1.播放mp4文件。
extern "C"
{
#include <gst/gst.h>
}
gint main(int argc, char *argv[])
{
gst_init(&argc, &argv);
GstElement * pipeline0 = gst_parse_launch("filesrc location = e:/silent_sheep.mp4 ! qtdemux ! queue ! decodebin ! autovideosink", NULL);
gst_element_set_state(pipeline0, GST_STATE_PLAYING);
g_main_loop_run(g_main_loop_new(NULL, FALSE));
return 0;
}
2.播放h264文件,只需将以下行替换上面对应行即可。
pipeline0 = gst_parse_launch(“filesrc location = e:/OK.mp4 ! h264parse ! avdec_h264 ! autovideosink”, NULL);