branch | RCL_3 |
changeset 29 | 567bb019e3e3 |
parent 0 | 0e761a78d257 |
child 30 | 7e817e7e631c |
child 34 | 1b8125c02661 |
6:9b2c3c7a1a9c | 29:567bb019e3e3 |
---|---|
27 #include "gststreamselector.h" |
27 #include "gststreamselector.h" |
28 #include "gstplay-marshal.h" |
28 #include "gstplay-marshal.h" |
29 |
29 |
30 #include <gst/pbutils/pbutils.h> |
30 #include <gst/pbutils/pbutils.h> |
31 |
31 |
32 #ifdef __SYMBIAN32__ |
|
33 #include <glib_global.h> |
|
34 #endif |
|
35 |
|
36 GST_DEBUG_CATEGORY_STATIC (gst_play_base_bin_debug); |
32 GST_DEBUG_CATEGORY_STATIC (gst_play_base_bin_debug); |
37 #define GST_CAT_DEFAULT gst_play_base_bin_debug |
33 #define GST_CAT_DEFAULT gst_play_base_bin_debug |
38 |
34 |
39 #define DEFAULT_QUEUE_SIZE (3 * GST_SECOND) |
35 #define DEFAULT_QUEUE_SIZE (3 * GST_SECOND) |
40 #define DEFAULT_QUEUE_MIN_THRESHOLD ((DEFAULT_QUEUE_SIZE * 30) / 100) |
36 #define DEFAULT_QUEUE_MIN_THRESHOLD ((DEFAULT_QUEUE_SIZE * 30) / 100) |
151 gobject_klass->set_property = gst_play_base_bin_set_property; |
147 gobject_klass->set_property = gst_play_base_bin_set_property; |
152 gobject_klass->get_property = gst_play_base_bin_get_property; |
148 gobject_klass->get_property = gst_play_base_bin_get_property; |
153 |
149 |
154 g_object_class_install_property (gobject_klass, ARG_URI, |
150 g_object_class_install_property (gobject_klass, ARG_URI, |
155 g_param_spec_string ("uri", "URI", "URI of the media to play", |
151 g_param_spec_string ("uri", "URI", "URI of the media to play", |
156 NULL, G_PARAM_READWRITE)); |
152 NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
157 g_object_class_install_property (gobject_klass, ARG_SUBURI, |
153 g_object_class_install_property (gobject_klass, ARG_SUBURI, |
158 g_param_spec_string ("suburi", ".sub-URI", "Optional URI of a subtitle", |
154 g_param_spec_string ("suburi", ".sub-URI", "Optional URI of a subtitle", |
159 NULL, G_PARAM_READWRITE)); |
155 NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
160 |
156 |
161 g_object_class_install_property (gobject_klass, ARG_QUEUE_SIZE, |
157 g_object_class_install_property (gobject_klass, ARG_QUEUE_SIZE, |
162 g_param_spec_uint64 ("queue-size", "Queue size", |
158 g_param_spec_uint64 ("queue-size", "Queue size", |
163 "Size of internal queues in nanoseconds", 0, G_MAXINT64, |
159 "Size of internal queues in nanoseconds", 0, G_MAXINT64, |
164 DEFAULT_QUEUE_SIZE, G_PARAM_READWRITE)); |
160 DEFAULT_QUEUE_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
165 g_object_class_install_property (gobject_klass, ARG_QUEUE_THRESHOLD, |
161 g_object_class_install_property (gobject_klass, ARG_QUEUE_THRESHOLD, |
166 g_param_spec_uint64 ("queue-threshold", "Queue threshold", |
162 g_param_spec_uint64 ("queue-threshold", "Queue threshold", |
167 "Buffering threshold of internal queues in nanoseconds", 0, |
163 "Buffering threshold of internal queues in nanoseconds", 0, |
168 G_MAXINT64, DEFAULT_QUEUE_THRESHOLD, G_PARAM_READWRITE)); |
164 G_MAXINT64, DEFAULT_QUEUE_THRESHOLD, |
165 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
|
169 g_object_class_install_property (gobject_klass, ARG_QUEUE_MIN_THRESHOLD, |
166 g_object_class_install_property (gobject_klass, ARG_QUEUE_MIN_THRESHOLD, |
170 g_param_spec_uint64 ("queue-min-threshold", "Queue min threshold", |
167 g_param_spec_uint64 ("queue-min-threshold", "Queue min threshold", |
171 "Buffering low threshold of internal queues in nanoseconds", 0, |
168 "Buffering low threshold of internal queues in nanoseconds", 0, |
172 G_MAXINT64, DEFAULT_QUEUE_MIN_THRESHOLD, G_PARAM_READWRITE)); |
169 G_MAXINT64, DEFAULT_QUEUE_MIN_THRESHOLD, |
170 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
|
173 |
171 |
174 g_object_class_install_property (gobject_klass, ARG_NSTREAMS, |
172 g_object_class_install_property (gobject_klass, ARG_NSTREAMS, |
175 g_param_spec_int ("nstreams", "NStreams", "number of streams", |
173 g_param_spec_int ("nstreams", "NStreams", "number of streams", |
176 0, G_MAXINT, 0, G_PARAM_READABLE)); |
174 0, G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); |
177 g_object_class_install_property (gobject_klass, ARG_STREAMINFO, |
175 g_object_class_install_property (gobject_klass, ARG_STREAMINFO, |
178 g_param_spec_pointer ("stream-info", "Stream info", "List of streaminfo", |
176 g_param_spec_pointer ("stream-info", "Stream info", "List of streaminfo", |
179 G_PARAM_READABLE)); |
177 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); |
180 g_object_class_install_property (gobject_klass, ARG_STREAMINFO_VALUES, |
178 g_object_class_install_property (gobject_klass, ARG_STREAMINFO_VALUES, |
181 g_param_spec_value_array ("stream-info-value-array", |
179 g_param_spec_value_array ("stream-info-value-array", |
182 "StreamInfo GValueArray", "value array of streaminfo", |
180 "StreamInfo GValueArray", "value array of streaminfo", |
183 g_param_spec_object ("streaminfo", "StreamInfo", "Streaminfo object", |
181 g_param_spec_object ("streaminfo", "StreamInfo", "Streaminfo object", |
184 GST_TYPE_STREAM_INFO, G_PARAM_READABLE), G_PARAM_READABLE)); |
182 GST_TYPE_STREAM_INFO, G_PARAM_READABLE), |
183 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); |
|
185 g_object_class_install_property (gobject_klass, ARG_SOURCE, |
184 g_object_class_install_property (gobject_klass, ARG_SOURCE, |
186 g_param_spec_object ("source", "Source", "Source element", |
185 g_param_spec_object ("source", "Source", "Source element", |
187 GST_TYPE_ELEMENT, G_PARAM_READABLE)); |
186 GST_TYPE_ELEMENT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); |
188 |
187 |
189 g_object_class_install_property (gobject_klass, ARG_VIDEO, |
188 g_object_class_install_property (gobject_klass, ARG_VIDEO, |
190 g_param_spec_int ("current-video", "Current video", |
189 g_param_spec_int ("current-video", "Current video", |
191 "Currently playing video stream (-1 = none)", |
190 "Currently playing video stream (-1 = none)", |
192 -1, G_MAXINT, -1, G_PARAM_READWRITE)); |
191 -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
193 g_object_class_install_property (gobject_klass, ARG_AUDIO, |
192 g_object_class_install_property (gobject_klass, ARG_AUDIO, |
194 g_param_spec_int ("current-audio", "Current audio", |
193 g_param_spec_int ("current-audio", "Current audio", |
195 "Currently playing audio stream (-1 = none)", |
194 "Currently playing audio stream (-1 = none)", |
196 -1, G_MAXINT, -1, G_PARAM_READWRITE)); |
195 -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
197 g_object_class_install_property (gobject_klass, ARG_TEXT, |
196 g_object_class_install_property (gobject_klass, ARG_TEXT, |
198 g_param_spec_int ("current-text", "Current text", |
197 g_param_spec_int ("current-text", "Current text", |
199 "Currently playing text stream (-1 = none)", |
198 "Currently playing text stream (-1 = none)", |
200 -1, G_MAXINT, -1, G_PARAM_READWRITE)); |
199 -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
201 g_object_class_install_property (gobject_klass, ARG_SUBTITLE_ENCODING, |
200 g_object_class_install_property (gobject_klass, ARG_SUBTITLE_ENCODING, |
202 g_param_spec_string ("subtitle-encoding", "subtitle encoding", |
201 g_param_spec_string ("subtitle-encoding", "subtitle encoding", |
203 "Encoding to assume if input subtitles are not in UTF-8 encoding. " |
202 "Encoding to assume if input subtitles are not in UTF-8 encoding. " |
204 "If not set, the GST_SUBTITLE_ENCODING environment variable will " |
203 "If not set, the GST_SUBTITLE_ENCODING environment variable will " |
205 "be checked for an encoding to use. If that is not set either, " |
204 "be checked for an encoding to use. If that is not set either, " |
206 "ISO-8859-15 will be assumed.", NULL, G_PARAM_READWRITE)); |
205 "ISO-8859-15 will be assumed.", NULL, |
206 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
|
207 /** |
207 /** |
208 * GstPlayBin::connection-speed |
208 * GstPlayBaseBin:connection-speed |
209 * |
209 * |
210 * Network connection speed in kbps (0 = unknown) |
210 * Network connection speed in kbps (0 = unknown) |
211 * <note><simpara> |
|
212 * Since version 0.10.10 in #GstPlayBin, at 0.10.15 moved to #GstPlayBaseBin |
|
213 * </simpara></note> |
|
211 * |
214 * |
212 * Since: 0.10.10 at gstplaybin.c, 0.10.15 moved to gstplaybasebin |
215 * Since: 0.10.10 |
213 **/ |
216 */ |
214 g_object_class_install_property (gobject_klass, ARG_CONNECTION_SPEED, |
217 g_object_class_install_property (gobject_klass, ARG_CONNECTION_SPEED, |
215 g_param_spec_uint ("connection-speed", "Connection Speed", |
218 g_param_spec_uint ("connection-speed", "Connection Speed", |
216 "Network connection speed in kbps (0 = unknown)", |
219 "Network connection speed in kbps (0 = unknown)", |
217 0, G_MAXUINT, DEFAULT_CONNECTION_SPEED, G_PARAM_READWRITE)); |
220 0, G_MAXUINT, DEFAULT_CONNECTION_SPEED, |
221 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
|
218 |
222 |
219 GST_DEBUG_CATEGORY_INIT (gst_play_base_bin_debug, "playbasebin", 0, |
223 GST_DEBUG_CATEGORY_INIT (gst_play_base_bin_debug, "playbasebin", 0, |
220 "playbasebin"); |
224 "playbasebin"); |
221 |
225 |
222 gobject_klass->dispose = GST_DEBUG_FUNCPTR (gst_play_base_bin_dispose); |
226 gobject_klass->dispose = GST_DEBUG_FUNCPTR (gst_play_base_bin_dispose); |
484 return; |
488 return; |
485 } |
489 } |
486 |
490 |
487 setup_substreams (play_base_bin); |
491 setup_substreams (play_base_bin); |
488 GST_DEBUG_OBJECT (play_base_bin, "Emitting signal"); |
492 GST_DEBUG_OBJECT (play_base_bin, "Emitting signal"); |
489 res = GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)-> |
493 res = |
490 setup_output_pads (play_base_bin, group); |
494 GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)->setup_output_pads |
495 (play_base_bin, group); |
|
491 GST_DEBUG_OBJECT (play_base_bin, "done"); |
496 GST_DEBUG_OBJECT (play_base_bin, "done"); |
492 |
497 |
493 GROUP_UNLOCK (play_base_bin); |
498 GROUP_UNLOCK (play_base_bin); |
494 |
499 |
495 g_object_notify (G_OBJECT (play_base_bin), "stream-info"); |
500 g_object_notify (G_OBJECT (play_base_bin), "stream-info"); |
629 { |
634 { |
630 gpointer data; |
635 gpointer data; |
631 GstPad *sinkpad; |
636 GstPad *sinkpad; |
632 |
637 |
633 data = g_object_get_data (G_OBJECT (queue), "probe"); |
638 data = g_object_get_data (G_OBJECT (queue), "probe"); |
634 sinkpad = gst_element_get_pad (queue, "sink"); |
639 sinkpad = gst_element_get_static_pad (queue, "sink"); |
635 |
640 |
636 if (data) { |
641 if (data) { |
637 GST_DEBUG_OBJECT (play_base_bin, |
642 GST_DEBUG_OBJECT (play_base_bin, |
638 "Removing buffer probe from pad %s:%s (%p)", |
643 "Removing buffer probe from pad %s:%s (%p)", |
639 GST_DEBUG_PAD_NAME (sinkpad), sinkpad); |
644 GST_DEBUG_PAD_NAME (sinkpad), sinkpad); |
753 * buffered and is posted in the BUFFERING message. */ |
758 * buffered and is posted in the BUFFERING message. */ |
754 if (!g_object_get_data (G_OBJECT (queue), "probe")) { |
759 if (!g_object_get_data (G_OBJECT (queue), "probe")) { |
755 GstPad *sinkpad; |
760 GstPad *sinkpad; |
756 guint id; |
761 guint id; |
757 |
762 |
758 sinkpad = gst_element_get_pad (queue, "sink"); |
763 sinkpad = gst_element_get_static_pad (queue, "sink"); |
759 id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), queue); |
764 id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), queue); |
760 g_object_set_data (G_OBJECT (queue), "probe", GINT_TO_POINTER (id)); |
765 g_object_set_data (G_OBJECT (queue), "probe", GINT_TO_POINTER (id)); |
761 GST_DEBUG_OBJECT (play_base_bin, |
766 GST_DEBUG_OBJECT (play_base_bin, |
762 "Re-attaching buffering probe to pad %s:%s %p", |
767 "Re-attaching buffering probe to pad %s:%s %p", |
763 GST_DEBUG_PAD_NAME (sinkpad), sinkpad); |
768 GST_DEBUG_PAD_NAME (sinkpad), sinkpad); |
792 prename = "video"; |
797 prename = "video"; |
793 else if (type == GST_STREAM_TYPE_TEXT) |
798 else if (type == GST_STREAM_TYPE_TEXT) |
794 prename = "text"; |
799 prename = "text"; |
795 else if (type == GST_STREAM_TYPE_AUDIO) |
800 else if (type == GST_STREAM_TYPE_AUDIO) |
796 prename = "audio"; |
801 prename = "audio"; |
802 else if (type == GST_STREAM_TYPE_SUBPICTURE) |
|
803 prename = "subpicture"; |
|
797 else |
804 else |
798 g_return_if_reached (); |
805 g_return_if_reached (); |
799 |
806 |
800 /* create stream selector */ |
807 /* create stream selector */ |
801 selector = g_object_new (GST_TYPE_STREAM_SELECTOR, NULL); |
808 selector = g_object_new (GST_TYPE_STREAM_SELECTOR, NULL); |
821 * we can then easily do time-based buffering. The better |
828 * we can then easily do time-based buffering. The better |
822 * solution would be to add a specific network queue right |
829 * solution would be to add a specific network queue right |
823 * after the source that measures the datarate and scales this |
830 * after the source that measures the datarate and scales this |
824 * queue of encoded data instead. |
831 * queue of encoded data instead. |
825 */ |
832 */ |
826 g_object_set (G_OBJECT (preroll), |
833 if (play_base_bin->raw_decoding_mode) { |
827 "max-size-buffers", 0, "max-size-bytes", |
834 if (type == GST_STREAM_TYPE_VIDEO) { |
828 ((type == GST_STREAM_TYPE_VIDEO) ? 25 : 2) * 1024 * 1024, |
835 g_object_set (G_OBJECT (preroll), |
829 "max-size-time", play_base_bin->queue_size, NULL); |
836 "max-size-buffers", 2, "max-size-bytes", 0, |
837 "max-size-time", (guint64) 0, NULL); |
|
838 } else { |
|
839 g_object_set (G_OBJECT (preroll), |
|
840 "max-size-buffers", 0, "max-size-bytes", |
|
841 2 * 1024 * 1024, "max-size-time", play_base_bin->queue_size, NULL); |
|
842 } |
|
843 } else { |
|
844 g_object_set (G_OBJECT (preroll), |
|
845 "max-size-buffers", 0, "max-size-bytes", |
|
846 ((type == GST_STREAM_TYPE_VIDEO) ? 25 : 2) * 1024 * 1024, |
|
847 "max-size-time", play_base_bin->queue_size, NULL); |
|
848 } |
|
830 |
849 |
831 /* the overrun signal is always attached and serves two purposes: |
850 /* the overrun signal is always attached and serves two purposes: |
832 * |
851 * |
833 * 1) when we are building a group and the overrun is called, we commit the |
852 * 1) when we are building a group and the overrun is called, we commit the |
834 * group. The reason being that if we fill the entire queue without a |
853 * group. The reason being that if we fill the entire queue without a |
864 |
883 |
865 /* attach pointer to playbasebin */ |
884 /* attach pointer to playbasebin */ |
866 g_object_set_data (G_OBJECT (preroll), "pbb", play_base_bin); |
885 g_object_set_data (G_OBJECT (preroll), "pbb", play_base_bin); |
867 |
886 |
868 /* give updates on queue size */ |
887 /* give updates on queue size */ |
869 sinkpad = gst_element_get_pad (preroll, "sink"); |
888 sinkpad = gst_element_get_static_pad (preroll, "sink"); |
870 id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), preroll); |
889 id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), preroll); |
871 GST_DEBUG_OBJECT (play_base_bin, "Attaching probe to pad %s:%s (%p)", |
890 GST_DEBUG_OBJECT (play_base_bin, "Attaching probe to pad %s:%s (%p)", |
872 GST_DEBUG_PAD_NAME (sinkpad), sinkpad); |
891 GST_DEBUG_PAD_NAME (sinkpad), sinkpad); |
873 gst_object_unref (sinkpad); |
|
874 g_object_set_data (G_OBJECT (preroll), "probe", GINT_TO_POINTER (id)); |
892 g_object_set_data (G_OBJECT (preroll), "probe", GINT_TO_POINTER (id)); |
875 |
893 |
876 /* catch eos and flush events so that we can ignore underruns */ |
894 /* catch eos and flush events so that we can ignore underruns */ |
877 id = gst_pad_add_event_probe (sinkpad, G_CALLBACK (check_queue_event), |
895 id = gst_pad_add_event_probe (sinkpad, G_CALLBACK (check_queue_event), |
878 preroll); |
896 preroll); |
879 g_object_set_data (G_OBJECT (preroll), "eos_probe", GINT_TO_POINTER (id)); |
897 g_object_set_data (G_OBJECT (preroll), "eos_probe", GINT_TO_POINTER (id)); |
898 |
|
899 gst_object_unref (sinkpad); |
|
880 |
900 |
881 /* When we connect this queue, it will start running and immediatly |
901 /* When we connect this queue, it will start running and immediatly |
882 * fire an underrun. */ |
902 * fire an underrun. */ |
883 g_signal_connect (G_OBJECT (preroll), "underrun", |
903 g_signal_connect (G_OBJECT (preroll), "underrun", |
884 G_CALLBACK (queue_out_of_data), play_base_bin); |
904 G_CALLBACK (queue_out_of_data), play_base_bin); |
885 /* configure threshold and callbacks */ |
905 /* configure threshold and callbacks */ |
886 queue_out_of_data (preroll, play_base_bin); |
906 queue_out_of_data (preroll, play_base_bin); |
887 } |
907 } |
888 |
908 |
889 /* listen for EOS so we can switch groups when one ended. */ |
909 /* listen for EOS so we can switch groups when one ended. */ |
890 preroll_pad = gst_element_get_pad (preroll, "src"); |
910 preroll_pad = gst_element_get_static_pad (preroll, "src"); |
891 gst_pad_add_event_probe (preroll_pad, G_CALLBACK (probe_triggered), info); |
911 gst_pad_add_event_probe (preroll_pad, G_CALLBACK (probe_triggered), info); |
892 gst_object_unref (preroll_pad); |
912 gst_object_unref (preroll_pad); |
893 |
913 |
894 /* add to group list */ |
914 /* add to group list */ |
895 group->type[type - 1].selector = selector; |
915 group->type[type - 1].selector = selector; |
1215 |
1235 |
1216 /* now activate the next one */ |
1236 /* now activate the next one */ |
1217 setup_substreams (play_base_bin); |
1237 setup_substreams (play_base_bin); |
1218 GST_DEBUG ("switching to next group %p - emitting signal", group); |
1238 GST_DEBUG ("switching to next group %p - emitting signal", group); |
1219 /* and signal the new group */ |
1239 /* and signal the new group */ |
1220 res = GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)-> |
1240 res = |
1221 setup_output_pads (play_base_bin, group); |
1241 GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)->setup_output_pads |
1242 (play_base_bin, group); |
|
1222 |
1243 |
1223 GROUP_UNLOCK (play_base_bin); |
1244 GROUP_UNLOCK (play_base_bin); |
1224 |
1245 |
1225 g_object_notify (G_OBJECT (play_base_bin), "stream-info"); |
1246 g_object_notify (G_OBJECT (play_base_bin), "stream-info"); |
1226 |
1247 |
1247 guint sig_id; |
1268 guint sig_id; |
1248 GstPad *srcpad; |
1269 GstPad *srcpad; |
1249 |
1270 |
1250 /* make a fakesrc that will just emit one EOS */ |
1271 /* make a fakesrc that will just emit one EOS */ |
1251 fakesrc = gst_element_factory_make ("fakesrc", NULL); |
1272 fakesrc = gst_element_factory_make ("fakesrc", NULL); |
1252 g_object_set (G_OBJECT (fakesrc), "num_buffers", 0, NULL); |
1273 g_object_set (G_OBJECT (fakesrc), "num-buffers", 0, NULL); |
1253 |
1274 |
1254 GST_DEBUG ("patching unlinked pad %s:%s", GST_DEBUG_PAD_NAME (pad)); |
1275 GST_DEBUG ("patching unlinked pad %s:%s", GST_DEBUG_PAD_NAME (pad)); |
1255 |
1276 |
1256 srcpad = gst_element_get_pad (fakesrc, "src"); |
1277 srcpad = gst_element_get_static_pad (fakesrc, "src"); |
1257 gst_bin_add (GST_BIN_CAST (play_base_bin), fakesrc); |
1278 gst_bin_add (GST_BIN_CAST (play_base_bin), fakesrc); |
1258 gst_pad_link (srcpad, pad); |
1279 gst_pad_link (srcpad, pad); |
1259 gst_object_unref (srcpad); |
1280 gst_object_unref (srcpad); |
1260 |
1281 |
1261 /* keep track of these patch elements */ |
1282 /* keep track of these patch elements */ |
1338 |
1359 |
1339 parent = gst_object_get_parent (GST_OBJECT_CAST (element)); |
1360 parent = gst_object_get_parent (GST_OBJECT_CAST (element)); |
1340 if (g_str_has_prefix (mimetype, "audio/") && |
1361 if (g_str_has_prefix (mimetype, "audio/") && |
1341 parent != GST_OBJECT_CAST (play_base_bin->subtitle)) { |
1362 parent != GST_OBJECT_CAST (play_base_bin->subtitle)) { |
1342 type = GST_STREAM_TYPE_AUDIO; |
1363 type = GST_STREAM_TYPE_AUDIO; |
1364 } else if (g_str_has_prefix (mimetype, "video/x-dvd-subpicture") && |
|
1365 parent != GST_OBJECT_CAST (play_base_bin->subtitle)) { |
|
1366 type = GST_STREAM_TYPE_SUBPICTURE; |
|
1343 } else if (g_str_has_prefix (mimetype, "video/") && |
1367 } else if (g_str_has_prefix (mimetype, "video/") && |
1344 parent != GST_OBJECT_CAST (play_base_bin->subtitle)) { |
1368 parent != GST_OBJECT_CAST (play_base_bin->subtitle)) { |
1345 type = GST_STREAM_TYPE_VIDEO; |
1369 type = GST_STREAM_TYPE_VIDEO; |
1346 } else if (g_str_has_prefix (mimetype, "text/")) { |
1370 } else if (g_str_has_prefix (mimetype, "text/")) { |
1347 type = GST_STREAM_TYPE_TEXT; |
1371 type = GST_STREAM_TYPE_TEXT; |
1570 "application/zip", "application/x-compress", NULL |
1594 "application/zip", "application/x-compress", NULL |
1571 }; |
1595 }; |
1572 |
1596 |
1573 /* mime types we consider raw media */ |
1597 /* mime types we consider raw media */ |
1574 static const gchar *raw_mimes[] = { |
1598 static const gchar *raw_mimes[] = { |
1575 "audio/x-raw", "video/x-raw", NULL |
1599 "audio/x-raw", "video/x-raw", "video/x-dvd-subpicture", NULL |
1576 }; |
1600 }; |
1577 |
1601 |
1578 #define IS_STREAM_URI(uri) (array_has_value (stream_uris, uri)) |
1602 #define IS_STREAM_URI(uri) (array_has_value (stream_uris, uri)) |
1579 #define IS_BLACKLISTED_URI(uri) (array_has_value (blacklisted_uris, uri)) |
1603 #define IS_BLACKLISTED_URI(uri) (array_has_value (blacklisted_uris, uri)) |
1580 #define IS_NO_MEDIA_MIME(mime) (array_has_value (no_media_mimes, mime)) |
1604 #define IS_NO_MEDIA_MIME(mime) (array_has_value (no_media_mimes, mime)) |
1688 GST_DEBUG_OBJECT (bin, "Found new pad %s.%s in source element %s", |
1712 GST_DEBUG_OBJECT (bin, "Found new pad %s.%s in source element %s", |
1689 GST_DEBUG_PAD_NAME (pad), GST_ELEMENT_NAME (element)); |
1713 GST_DEBUG_PAD_NAME (pad), GST_ELEMENT_NAME (element)); |
1690 |
1714 |
1691 /* if this is a pad with all raw caps, we can expose it */ |
1715 /* if this is a pad with all raw caps, we can expose it */ |
1692 if (has_all_raw_caps (pad, &is_raw) && is_raw) { |
1716 if (has_all_raw_caps (pad, &is_raw) && is_raw) { |
1717 bin->raw_decoding_mode = TRUE; |
|
1693 /* it's all raw, create output pads. */ |
1718 /* it's all raw, create output pads. */ |
1694 new_decoded_pad_full (element, pad, FALSE, bin, FALSE); |
1719 new_decoded_pad_full (element, pad, FALSE, bin, FALSE); |
1695 return; |
1720 return; |
1696 } |
1721 } |
1697 |
1722 |
1937 |
1962 |
1938 for (walk = bin->decoders; walk; walk = g_slist_next (walk)) { |
1963 for (walk = bin->decoders; walk; walk = g_slist_next (walk)) { |
1939 GstElement *decoder = GST_ELEMENT_CAST (walk->data); |
1964 GstElement *decoder = GST_ELEMENT_CAST (walk->data); |
1940 |
1965 |
1941 GST_DEBUG_OBJECT (bin, "removing old decoder element"); |
1966 GST_DEBUG_OBJECT (bin, "removing old decoder element"); |
1967 /* Disconnect all the signal handlers we attached to the decodebin before |
|
1968 * we dispose of it */ |
|
1969 g_signal_handlers_disconnect_by_func (decoder, |
|
1970 (gpointer) (decodebin_element_added_cb), bin); |
|
1971 g_signal_handlers_disconnect_by_func (decoder, |
|
1972 (gpointer) (decodebin_element_removed_cb), bin); |
|
1973 g_signal_handlers_disconnect_by_func (decoder, |
|
1974 (gpointer) (new_decoded_pad), bin); |
|
1975 g_signal_handlers_disconnect_by_func (decoder, |
|
1976 (gpointer) (no_more_pads), bin); |
|
1977 g_signal_handlers_disconnect_by_func (decoder, |
|
1978 (gpointer) (unknown_type), bin); |
|
1979 |
|
1942 gst_element_set_state (decoder, GST_STATE_NULL); |
1980 gst_element_set_state (decoder, GST_STATE_NULL); |
1943 gst_bin_remove (GST_BIN_CAST (bin), decoder); |
1981 gst_bin_remove (GST_BIN_CAST (bin), decoder); |
1944 } |
1982 } |
1945 g_slist_free (bin->decoders); |
1983 g_slist_free (bin->decoders); |
1946 bin->decoders = NULL; |
1984 bin->decoders = NULL; |
2043 GstElement *subbin = NULL; |
2081 GstElement *subbin = NULL; |
2044 gboolean is_raw, have_out, is_dynamic; |
2082 gboolean is_raw, have_out, is_dynamic; |
2045 |
2083 |
2046 if (!play_base_bin->need_rebuild) |
2084 if (!play_base_bin->need_rebuild) |
2047 return TRUE; |
2085 return TRUE; |
2086 play_base_bin->raw_decoding_mode = FALSE; |
|
2048 |
2087 |
2049 GST_DEBUG_OBJECT (play_base_bin, "setup source"); |
2088 GST_DEBUG_OBJECT (play_base_bin, "setup source"); |
2050 |
2089 |
2051 /* delete old src */ |
2090 /* delete old src */ |
2052 remove_source (play_base_bin); |
2091 remove_source (play_base_bin); |
2346 mute_group_type (GstPlayBaseGroup * group, GstStreamType type, gboolean mute) |
2385 mute_group_type (GstPlayBaseGroup * group, GstStreamType type, gboolean mute) |
2347 { |
2386 { |
2348 gboolean active = !mute; |
2387 gboolean active = !mute; |
2349 GstPad *pad; |
2388 GstPad *pad; |
2350 |
2389 |
2351 pad = gst_element_get_pad (group->type[type - 1].preroll, "src"); |
2390 pad = gst_element_get_static_pad (group->type[type - 1].preroll, "src"); |
2352 gst_pad_set_active (pad, active); |
2391 gst_pad_set_active (pad, active); |
2353 gst_object_unref (pad); |
2392 gst_object_unref (pad); |
2354 pad = gst_element_get_pad (group->type[type - 1].preroll, "sink"); |
2393 pad = gst_element_get_static_pad (group->type[type - 1].preroll, "sink"); |
2355 gst_pad_set_active (pad, active); |
2394 gst_pad_set_active (pad, active); |
2356 gst_object_unref (pad); |
2395 gst_object_unref (pad); |
2357 pad = gst_element_get_pad (group->type[type - 1].selector, "src"); |
2396 pad = gst_element_get_static_pad (group->type[type - 1].selector, "src"); |
2358 gst_pad_set_active (pad, active); |
2397 gst_pad_set_active (pad, active); |
2359 gst_object_unref (pad); |
2398 gst_object_unref (pad); |
2360 |
2399 |
2361 #if 0 |
2400 #if 0 |
2362 if (mute) { |
2401 if (mute) { |
2401 * textoverlay element, but playbin does */ |
2440 * textoverlay element, but playbin does */ |
2402 if (klass != NULL && klass->set_subtitles_visible != NULL) |
2441 if (klass != NULL && klass->set_subtitles_visible != NULL) |
2403 klass->set_subtitles_visible (play_base_bin, visible); |
2442 klass->set_subtitles_visible (play_base_bin, visible); |
2404 } |
2443 } |
2405 |
2444 |
2445 static void |
|
2446 set_audio_mute (GstPlayBaseBin * play_base_bin, gboolean mute) |
|
2447 { |
|
2448 GstPlayBaseBinClass *klass = GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin); |
|
2449 |
|
2450 /* we use a vfunc for this since we don't have a reference to the |
|
2451 * textoverlay element, but playbin does */ |
|
2452 if (klass != NULL && klass->set_audio_mute != NULL) |
|
2453 klass->set_audio_mute (play_base_bin, mute); |
|
2454 } |
|
2455 |
|
2406 /* |
2456 /* |
2407 * Caller has group-lock held. |
2457 * Caller has group-lock held. |
2408 */ |
2458 */ |
2409 |
2459 |
2410 static void |
2460 static void |
2432 if (type == GST_STREAM_TYPE_TEXT) { |
2482 if (type == GST_STREAM_TYPE_TEXT) { |
2433 gboolean visible = (source_num != -1); |
2483 gboolean visible = (source_num != -1); |
2434 |
2484 |
2435 set_subtitles_visible (play_base_bin, visible); |
2485 set_subtitles_visible (play_base_bin, visible); |
2436 if (!visible) |
2486 if (!visible) |
2487 return; |
|
2488 } else if (type == GST_STREAM_TYPE_AUDIO) { |
|
2489 gboolean mute = (source_num == -1); |
|
2490 |
|
2491 set_audio_mute (play_base_bin, mute); |
|
2492 |
|
2493 if (mute) |
|
2437 return; |
2494 return; |
2438 } |
2495 } |
2439 |
2496 |
2440 sel = group->type[type - 1].selector; |
2497 sel = group->type[type - 1].selector; |
2441 |
2498 |