This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
hello everybody:
I met some problems when I used IVA-HD's AM5728 module:
Here are my steps:
1. AM5728 connected to the keyboard, CTRL+BACKSPACE, CTRL+F2
2. gst-launch-1.0 filesrc location=/usr/share/ti/video/TearOfSteel-Short-1920x800.mov ! qtdemux name=demux demux.audio_0 ! queue ! decodebin ! fakesink demux.video_0 ! queue ! h264parse ! ducatih264dec ! kmssink scale=true
This command can be executed smoothly, you can see the board screen in the play video,
However,when I convert this command to the C language, the program can run, but the screen does not have a picture, the following is my code:
#include <stdio.h> #include <string.h> #include <gst/gst.h> #include <glib.h> GstElement *pipeline,*source,*demuxer, *Videoqueue,*h264par,*Videodecoder,*Videosink, *Audioqueue,*Audiodecoder,*Audiosink; 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("play ending!\n"); 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); } static void on_pad_added(GstElement *element,GstPad *pad,gpointer data){ char video[12]="video_0"; //char audio[9]="audio_00"; gchar *new_pad_name = GST_PAD_NAME(pad); g_print("recvfrom '%s' new pad' %s' \n",GST_ELEMENT_NAME (element), new_pad_name); GstPad *audio_sink_pad ,*video_sink_pad; video_sink_pad = gst_element_get_static_pad(Videoqueue,"sink"); audio_sink_pad = gst_element_get_static_pad(Audioqueue,"sink"); if(!strcmp(new_pad_name,video)){ g_print("link %s pad\n",new_pad_name); gst_pad_link(pad,video_sink_pad); }else{ g_print("link %s pad\n",new_pad_name); gst_pad_link(pad,audio_sink_pad); } gst_object_unref(video_sink_pad); gst_object_unref(audio_sink_pad); } int main(int argc,char *argv[]){ GMainLoop *loop; GstBus *bus; gst_init(&argc,&argv); loop = g_main_loop_new(NULL,FALSE); if (argc != 2) { g_printerr("You need file : %s <.moc filename>\n",argv[0]); return(-1); } //creating pipeline pipeline = gst_pipeline_new("test-pipeline"); if (!pipeline){ g_printerr("pipeline creat failure,quit!\n"); return(-1); } //creat filesrc element source = gst_element_factory_make("filesrc","file-source"); if (!source){ g_printerr("source creat failure,quit!\n"); return(-1); } //qtmuxer demuxer = gst_element_factory_make("qtdemux","demuxer"); if (!demuxer){ g_printerr("demuxer creat failure,quit!\n"); return(-1); } Videoqueue = gst_element_factory_make("queue","videoqueue"); if (!Videoqueue){ g_printerr("Videoqueue creat failure,quit!\n"); return(-1); } //h264parse h264par = gst_element_factory_make("h264parse","h264par"); if (!h264par){ g_printerr("h264par creat failure,quit!\n"); return(-1); } //video decode Videodecoder = gst_element_factory_make("ducatih264dec","video-decoder"); if (!Videodecoder){ g_printerr("Videodecoder creat failure,quit!\n"); return(-1); } //video sink Videosink = gst_element_factory_make("kmssink","video-output"); if (!Videosink){ g_printerr("Videosink creat failure,quit!\n"); return(-1); } Audioqueue = gst_element_factory_make("queue","audioqueue"); if (!Audioqueue){ g_printerr("Audioqueue creat failure,quit!\n"); return(-1); } Audiodecoder = gst_element_factory_make("decodebin","audio-decoder"); if (!Audiodecoder){ g_printerr("Audiodecoder creat failure,quit!\n"); return(-1); } Audiosink = gst_element_factory_make("fakesink","audio-output"); if (!Audiosink){ g_printerr("Audiosink creat failure,quit!\n"); return(-1); } //|| !h264par /* if (!pipeline || !source || !demuxer || !queue || !decoder || !textoverlay || !sink || !Audioqueue || !Audiodecoder || !Audiosink){ g_printerr("element creat failure,quit!\n"); return(-1); } */ //set source location g_object_set(G_OBJECT(source),"location",argv[1],NULL); //g_object_set(G_OBJECT(Videosink),"scale",1,NULL); //bus bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); gst_bus_add_watch(bus,bus_call,loop); //添加消息监视器 gst_object_unref(bus); //add_bin gst_bin_add_many(GST_BIN(pipeline), source,demuxer,Videoqueue,h264par,Videodecoder,Videosink, Audioqueue,Audiodecoder,Audiosink,NULL); //link element gst_element_link(source,demuxer); gst_element_link_many(Videoqueue,h264par,Videodecoder,Videosink,NULL); gst_element_link_many(Audioqueue,Audiodecoder,Audiosink,NULL); // sink pad g_signal_connect(demuxer,"pad-added",G_CALLBACK(on_pad_added),NULL); //playing g_print("start playing %s\n",argv[1]); gst_element_set_state(pipeline,GST_STATE_PLAYING); g_main_loop_run(loop); //stop gst_element_set_state(pipeline,GST_STATE_NULL); //free gst_object_unref(GST_OBJECT(pipeline)); return(0); }
Compile: /home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-gcc -pthread gst_mp4.c -o gst_mp4 -I/home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/targetNFS/usr/include/gstreamer-1.0/ -I/home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/targetNFS/usr/include/glib-2.0/ -I/home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/targetNFS/usr/lib/glib-2.0/include/ -I/home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/targetNFS/usr/include/glib-2.0/glib/ -L/home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/targetNFS/usr/lib -L/home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/targetNFS/lib -lgstreamer-1.0 -lgobject-2.0 -lgmodule-2.0 -lpthread -lxml2 -lglib-2.0
run: ./gst_mp4 /usr/share/ti/video/TearOfSteel-Short-1920x800.mov
Hello,
Could you try with command in the above post?
I will take a look into the code.
Could you add the full debug log ?
I would also recommend you first to try only the "video branch" after it runs without an issue you could add the "audio branch".
BR
Margarita