mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
[MOVED FROM BAD 28/57] gst/flv/gstflvparse.c: Create pads from the pad templates, use fixed caps on them and only activate them after the ca...
Original commit message from CVS: * gst/flv/gstflvparse.c: (gst_flv_parse_tag_audio), (gst_flv_parse_tag_video): Create pads from the pad templates, use fixed caps on them and only activate them after the caps are set.
This commit is contained in:
parent
023e5ba09a
commit
549f97ea7b
1 changed files with 16 additions and 7 deletions
|
@ -548,16 +548,15 @@ gst_flv_parse_tag_audio (GstFLVDemux * demux, const guint8 * data,
|
||||||
/* If we don't have our audio pad created, then create it. */
|
/* If we don't have our audio pad created, then create it. */
|
||||||
if (G_UNLIKELY (!demux->audio_pad)) {
|
if (G_UNLIKELY (!demux->audio_pad)) {
|
||||||
|
|
||||||
demux->audio_pad = gst_pad_new ("audio", GST_PAD_SRC);
|
demux->audio_pad =
|
||||||
|
gst_pad_new_from_template (gst_element_class_get_pad_template
|
||||||
|
(GST_ELEMENT_GET_CLASS (demux), "audio"), "audio");
|
||||||
if (G_UNLIKELY (!demux->audio_pad)) {
|
if (G_UNLIKELY (!demux->audio_pad)) {
|
||||||
GST_WARNING_OBJECT (demux, "failed creating audio pad");
|
GST_WARNING_OBJECT (demux, "failed creating audio pad");
|
||||||
ret = GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make it active */
|
|
||||||
gst_pad_set_active (demux->audio_pad, TRUE);
|
|
||||||
|
|
||||||
/* Negotiate caps */
|
/* Negotiate caps */
|
||||||
if (!gst_flv_parse_audio_negotiate (demux, codec_tag, rate, channels,
|
if (!gst_flv_parse_audio_negotiate (demux, codec_tag, rate, channels,
|
||||||
width)) {
|
width)) {
|
||||||
|
@ -578,6 +577,11 @@ gst_flv_parse_tag_audio (GstFLVDemux * demux, const guint8 * data,
|
||||||
gst_pad_set_event_function (demux->audio_pad,
|
gst_pad_set_event_function (demux->audio_pad,
|
||||||
GST_DEBUG_FUNCPTR (gst_flv_demux_src_event));
|
GST_DEBUG_FUNCPTR (gst_flv_demux_src_event));
|
||||||
|
|
||||||
|
gst_pad_use_fixed_caps (demux->audio_pad);
|
||||||
|
|
||||||
|
/* Make it active */
|
||||||
|
gst_pad_set_active (demux->audio_pad, TRUE);
|
||||||
|
|
||||||
/* We need to set caps before adding */
|
/* We need to set caps before adding */
|
||||||
gst_element_add_pad (GST_ELEMENT (demux),
|
gst_element_add_pad (GST_ELEMENT (demux),
|
||||||
gst_object_ref (demux->audio_pad));
|
gst_object_ref (demux->audio_pad));
|
||||||
|
@ -823,14 +827,14 @@ gst_flv_parse_tag_video (GstFLVDemux * demux, const guint8 * data,
|
||||||
|
|
||||||
/* If we don't have our video pad created, then create it. */
|
/* If we don't have our video pad created, then create it. */
|
||||||
if (G_UNLIKELY (!demux->video_pad)) {
|
if (G_UNLIKELY (!demux->video_pad)) {
|
||||||
demux->video_pad = gst_pad_new ("video", GST_PAD_SRC);
|
demux->video_pad =
|
||||||
|
gst_pad_new_from_template (gst_element_class_get_pad_template
|
||||||
|
(GST_ELEMENT_GET_CLASS (demux), "video"), "video");
|
||||||
if (G_UNLIKELY (!demux->video_pad)) {
|
if (G_UNLIKELY (!demux->video_pad)) {
|
||||||
GST_WARNING_OBJECT (demux, "failed creating video pad");
|
GST_WARNING_OBJECT (demux, "failed creating video pad");
|
||||||
ret = GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
/* Make it active */
|
|
||||||
gst_pad_set_active (demux->video_pad, TRUE);
|
|
||||||
|
|
||||||
if (!gst_flv_parse_video_negotiate (demux, codec_tag)) {
|
if (!gst_flv_parse_video_negotiate (demux, codec_tag)) {
|
||||||
gst_object_unref (demux->video_pad);
|
gst_object_unref (demux->video_pad);
|
||||||
|
@ -854,6 +858,11 @@ gst_flv_parse_tag_video (GstFLVDemux * demux, const guint8 * data,
|
||||||
gst_pad_set_event_function (demux->video_pad,
|
gst_pad_set_event_function (demux->video_pad,
|
||||||
GST_DEBUG_FUNCPTR (gst_flv_demux_src_event));
|
GST_DEBUG_FUNCPTR (gst_flv_demux_src_event));
|
||||||
|
|
||||||
|
gst_pad_use_fixed_caps (demux->video_pad);
|
||||||
|
|
||||||
|
/* Make it active */
|
||||||
|
gst_pad_set_active (demux->video_pad, TRUE);
|
||||||
|
|
||||||
/* We need to set caps before adding */
|
/* We need to set caps before adding */
|
||||||
gst_element_add_pad (GST_ELEMENT (demux),
|
gst_element_add_pad (GST_ELEMENT (demux),
|
||||||
gst_object_ref (demux->video_pad));
|
gst_object_ref (demux->video_pad));
|
||||||
|
|
Loading…
Reference in a new issue