qtmux: set src pads when starting file

... rather than at _init time, so they are also available following a
pad (de)activation cycle.

https://bugzilla.gnome.org/show_bug.cgi?id=639338
This commit is contained in:
Mark Nauwelaerts 2011-01-13 15:27:36 +01:00 committed by Tim-Philipp Müller
parent ae644937fc
commit 20e4bdee32

View file

@ -469,13 +469,9 @@ gst_qt_mux_init (GstQTMux * qtmux, GstQTMuxClass * qtmux_klass)
{ {
GstElementClass *klass = GST_ELEMENT_CLASS (qtmux_klass); GstElementClass *klass = GST_ELEMENT_CLASS (qtmux_klass);
GstPadTemplate *templ; GstPadTemplate *templ;
GstCaps *caps;
templ = gst_element_class_get_pad_template (klass, "src"); templ = gst_element_class_get_pad_template (klass, "src");
qtmux->srcpad = gst_pad_new_from_template (templ, "src"); qtmux->srcpad = gst_pad_new_from_template (templ, "src");
caps = gst_caps_copy (gst_pad_get_pad_template_caps (qtmux->srcpad));
gst_pad_set_caps (qtmux->srcpad, caps);
gst_caps_unref (caps);
gst_pad_use_fixed_caps (qtmux->srcpad); gst_pad_use_fixed_caps (qtmux->srcpad);
gst_element_add_pad (GST_ELEMENT (qtmux), qtmux->srcpad); gst_element_add_pad (GST_ELEMENT (qtmux), qtmux->srcpad);
@ -1578,9 +1574,14 @@ static GstFlowReturn
gst_qt_mux_start_file (GstQTMux * qtmux) gst_qt_mux_start_file (GstQTMux * qtmux)
{ {
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
GstCaps *caps;
GST_DEBUG_OBJECT (qtmux, "starting file"); GST_DEBUG_OBJECT (qtmux, "starting file");
caps = gst_caps_copy (gst_pad_get_pad_template_caps (qtmux->srcpad));
gst_pad_set_caps (qtmux->srcpad, caps);
gst_caps_unref (caps);
/* let downstream know we think in BYTES and expect to do seeking later on */ /* let downstream know we think in BYTES and expect to do seeking later on */
gst_pad_push_event (qtmux->srcpad, gst_pad_push_event (qtmux->srcpad,
gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0)); gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0));