Tool/software: TI C/C++ Compiler
Hello:
I will save a test.ts file locally and use the following gstream command to display it properly.
gst-launch-1.0 -v filesrc location=test.ts ! queue ! tsdemux ! h264parse ! ducatih264dec ! waylandsink
I try to use C language to write,The image is not displayed when compiling execution.
Here is my source code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
#include <gst/gst.h>
int main(int argc, char *argv[])
{
GstElement *pipeline, *filesrc, *queue, *tsdemux, *h264parse, *ducatih264dec, *waylandsink;
static GMainLoop *loop;
gst_init(&argc, &argv);
loop = g_main_loop_new(NULL, FALSE);
pipeline = gst_pipeline_new("pipeline");
if (!pipeline) {
g_printerr("%d gst_pipeline_new error \n", __LINE__);
return -1;
}
filesrc = gst_element_factory_make("filesrc", "filesrc0");
if (!filesrc) {
g_printerr("%d gst_element_factory_make error \n", __LINE__);
}
queue = gst_element_factory_make("queue", "queue0");
if (!queue) {
g_printerr("%d gst_element_factory_make error \n", __LINE__);
}
tsdemux = gst_element_factory_make("tsdemux", "tsdemux0");
if (!tsdemux) {
g_printerr("%d gst_element_factory_make error \n", __LINE__);
}
h264parse = gst_element_factory_make("h264parse", "h264parse0");
if (!h264parse) {
g_printerr("%d gst_element_factory_make error \n", __LINE__);
}
ducatih264dec = gst_element_factory_make("ducatih264dec", "ducatih264dec0");
if (!ducatih264dec) {
g_printerr("%d gst_element_factory_make error \n", __LINE__);
}
waylandsink = gst_element_factory_make("waylandsink", "waylandsink0");
if (!waylandsink) {
g_printerr("%d gst_element_factory_make error \n", __LINE__);
}
g_object_set(G_OBJECT(filesrc), "location", "test.ts", NULL);
gst_bin_add_many(GST_BIN(pipeline), filesrc, queue, tsdemux, h264parse, ducatih264dec, waylandsink, NULL);
gst_element_link_many(filesrc, queue, tsdemux, h264parse, ducatih264dec, waylandsink, NULL);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
g_main_loop_run(loop);
g_main_loop_unref(loop);
return 0;
}
I try to add the "--gst-debug = 4" parameter when executing, and the red section has an error message
GST_ELEMENT_PADS ../../gstreamer-1.2.3/gst/gstelement.c:894:gst_element_get_static_pad: no such pad 'sink' in element "filesrc0"
0:00:02.207006671 1091 0x13d8f0 INFO GST_EVENT ../../gstreamer-1.2.3/gst/gstevent.c:709:gst_event_new_segment: creating segment event bytes segment start=0, stop=-1, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0, base=0, position 0, duration 1875968
0:00:02.207197967 1091 0x13d8f0 INFO basesrc ../../../../gstreamer-1.2.3/libs/gst/base/gstbasesrc.c:2772:gst_base_src_loop:<filesrc0> marking pending DISCONT
0:00:02.207344855 1091 0x13d8c0 INFO mpegtspacketizer ../../../git/gst/mpegtsdemux/mpegtspacketizer.c:770:mpegts_try_discover_packet_size: have packetsize detected: 188 bytes
0:00:02.207464578 1091 0x13d8c0 INFO mpegtsbase ../../../git/gst/mpegtsdemux/mpegtsbase.c:726:mpegts_base_apply_pat:<tsdemux0> PAT
0:00:02.207720941 1091 0x13d8c0 INFO GST_ELEMENT_PADS ../../gstreamer-1.2.3/gst/gstelement.c:897:gst_element_get_static_pad: found pad tsdemux0:sink
0:00:02.207803413 1091 0x13d8c0 INFO GST_EVENT ../../gstreamer-1.2.3/gst/gstevent.c:628:gst_event_new_caps: creating caps event video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal
0:00:02.208967130 1091 0x13d8c0 INFO GST_ELEMENT_PADS ../../gstreamer-1.2.3/gst/gstelement.c:646:gst_element_add_pad:<tsdemux0> adding pad 'video_0041'
0:00:02.209020485 1091 0x13d8c0 INFO GST_EVENT ../../gstreamer-1.2.3/gst/gstevent.c:709:gst_event_new_segment: creating segment event time segment start=0:00:00.125000000, stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.125000000, base=0:00:00.000000000, position 0:00:00.125000000, duration 99:99:99.999999999
0:00:02.209187869 1091 0x13d8c0 INFO task ../../gstreamer-1.2.3/gst/gsttask.c:300:gst_task_func:<queue0:src> Task going to paused
0:00:02.209288559 1091 0x13d8f0 INFO basesrc ../../../../gstreamer-1.2.3/libs/gst/base/gstbasesrc.c:2785:gst_base_src_loop:<filesrc0> pausing after gst_pad_push() = not-linked
0:00:02.209340125 1091 0x13d8f0 WARN basesrc ../../../../gstreamer-1.2.3/libs/gst/base/gstbasesrc.c:2865:gst_base_src_loop:<filesrc0> error: Internal data flow error.
0:00:02.209373797 1091 0x13d8f0 WARN basesrc ../../../../gstreamer-1.2.3/libs/gst/base/gstbasesrc.c:2865:gst_base_src_loop:<filesrc0> error: streaming task paused, reason not-linked (-1)
0:00:02.209429266 1091 0x13d8f0 INFO GST_ERROR_SYSTEM ../../gstreamer-1.2.3/gst/gstelement.c:1835:gst_element_message_full:<filesrc0> posting message: Internal data flow error.
0:00:02.209511250 1091 0x13d8f0 INFO GST_ERROR_SYSTEM ../../gstreamer-1.2.3/gst/gstelement.c:1858:gst_element_message_full:<filesrc0> posted error message: Internal data flow error.
0:00:02.562908161 1091 0x13d8f0 INFO task ../../gstreamer-1.2.3/gst/gsttask.c:300:gst_task_func:<filesrc0:src> Task going to paused
Please help me where I am wrong?