customized videosink in playbin with subtitles won't play
kastagir
kmikolaj at gmail.com
Mon Mar 24 08:15:11 PDT 2014
Hi
I wrote a player using gstreamer 0.10. Now I'm trying to port it to
gstreamer 1.0. Unfortunately I have encountered a problem. I used playbin2
element and customized videosink with timeoverlay and xvimagesink. After
setting uri and suburi properties I can see movie with subtitles and time in
left corner.
#include <gst/gst.h>
int main(int argc, char *argv[]) {
GstElement *pipeline, *bin, *time, *sink;
GstPad *pad, *ghost_pad;
GstBus *bus;
GstMessage *msg;
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Build the pipeline */
/* GST 0.10 */
/*pipeline = gst_parse_launch ("playbin2 uri=file:///home/kuba/test.avi",
NULL);*/ // THIS WORKS
/*pipeline = gst_parse_launch ("playbin2 uri=file:///home/kuba/test.avi
suburi=file:///home/kuba/test.txt", NULL);*/ // THIS WORKS TOO
/*GST 1.0 */
/*pipeline = gst_parse_launch ("playbin uri=file:///home/kuba/test.avi",
NULL);*/ // THIS WORKS
pipeline = gst_parse_launch ("playbin uri=file:///home/kuba/test.avi
suburi=file:///home/kuba/test.txt", NULL); // THIS WON'T PLAY
/* Create the elements inside the sink bin */
time = gst_element_factory_make ("timeoverlay", "over");
sink = gst_element_factory_make ("xvimagesink", "video_sink");
/* Create the sink bin, add the elements and link them */
bin = gst_bin_new ("bin");
gst_bin_add_many (GST_BIN (bin), time, sink, NULL);
gst_element_link (time, sink);
pad = gst_element_get_static_pad (time, "video_sink");
ghost_pad = gst_ghost_pad_new ("sink", pad);
gst_element_add_pad (bin, ghost_pad);
gst_object_unref (pad);
/* Set playbin2's audio sink to be our sink bin */
g_object_set (GST_OBJECT (pipeline), "video-sink", bin, NULL);
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
/* Free resources */
if (msg != NULL)
gst_message_unref (msg);
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
When I use this code with gstreamer 1.0 I see only black background. It
plays video only without setting subtitles or with default videosink.
I figured it may have something to do with gststreamsynchronizer, because I
got that from debug info:
0x1304f20 WARN streamsynchronizer
gststreamsynchronizer.c:389:gst_stream_synchronizer_sink_event:<streamsynchronizer0:sink_2>
Non-TIME segment: bytes
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/customized-videosink-in-playbin-with-subtitles-won-t-play-tp4666075.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list