gst-launch-1.0 --gst-debug-level = 3 dvbsr c модуляция = частота 'QAM 256' = 147000000! имя декодера = demux demux. ! очередь ! аудиосэмпл! аудиоконвертировать! voaacen c! Мультиплексор. mpegtsmux name = mux! udpsink host = 127.0.0.0 port = 22 demux. ! очередь ! видеоконверт! видеомасштаб x264en c битрейт = 1240 мелодия = нулевая задержка! video / x-h264, stream-format = байтовый поток, профиль = высокий, ширина = 540, высота = 380, key-int-max = 15! mux.
Я хочу перевести в c то же самое.
Я пытаюсь -:
#include <gst/gst.h>
#include <glib.h>
static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data)
{
GMainLoop *loop = (GMainLoop *) data;
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_EOS:
g_print ("End of stream\n");
g_main_loop_quit (loop);
break;
case GST_MESSAGE_ERROR: {
gchar *debug;
GError *error;
gst_message_parse_error (msg, &error, &debug);
g_free (debug);
g_printerr ("Error: %s\n", error->message);
g_error_free (error);
g_main_loop_quit (loop);
break;
}
default:
break;
}
return TRUE;
}
int main (gint argc, gchar *argv[])
{
GMainLoop *loop;
GstElement *pipeline, *source, *demuxer,*dec,*vdqueue,*adqueue, *conv, *sink;
GstBus *bus;
/* init GStreamer */
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
/* setup */
pipeline = gst_pipeline_new ("pipeline");
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
gst_bus_add_watch (bus, bus_call, loop);
gst_object_unref (bus);
source = gst_element_factory_make ("filesrc", "filesource");
g_object_set (G_OBJECT (source), "location", argv[1], NULL);
g_printerr ("source is: %s \n",argv[1]);
//demuxer = gst_element_factory_make ("avidemux", "avi-demuxer");
demuxer = gst_element_factory_make ("oggdemux", "ogg-demuxer");
vdqueue = gst_element_factory_make ("queue", "video-queue");
adqueue = gst_element_factory_make ("queue", "audio-queue");
dec = gst_element_factory_make ("vorbisdec", "vorbis-decoder");
conv = gst_element_factory_make ("audioconvert", "converter");
sink = gst_element_factory_make ("autoaudiosink", "audio-output");
/* g_object_set (pipeline->mux,"max-delay", (guint64)0,NULL);
g_object_set (pipeline->mux,"max-page-delay",(guint64)0,NULL);
*/
g_object_set (G_OBJECT (source), "caps",
gst_caps_new_simple ("video/x-raw",
"format", G_TYPE_STRING, "RGB16",
"width", G_TYPE_INT, 640,
"height", G_TYPE_INT, 480,
"framerate", GST_TYPE_FRACTION, 0, 1,
NULL), NULL);
gst_bin_add_many (GST_BIN (pipeline),source,demuxer,vdqueue,adqueue,dec,conv,sink, NULL);
gst_element_link (source, demuxer);
gst_element_link (demuxer, vdqueue);
gst_element_link (vdqueue, adqueue);
gst_element_link (adqueue, dec);
gst_element_link (dec, conv);
gst_element_link (conv, sink);
/* run */
// g_printerr ("pipeline is: %s \n",pipeline);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_main_loop_run (loop);
/* cleanup */
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (pipeline));
return 0;
}