mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
dvdemux: post container-format tag
Also merge the two almost identical _add_*_pad() functions into one.
This commit is contained in:
parent
42936a73e6
commit
d0056049d3
1 changed files with 28 additions and 44 deletions
|
@ -287,58 +287,42 @@ gst_dvdemux_reset (GstDVDemux * dvdemux)
|
||||||
gst_segment_init (&dvdemux->time_segment, GST_FORMAT_TIME);
|
gst_segment_init (&dvdemux->time_segment, GST_FORMAT_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstPad *
|
||||||
gst_dvdemux_add_video_pad (GstDVDemux * dvdemux)
|
gst_dvdemux_add_pad (GstDVDemux * dvdemux, GstStaticPadTemplate * template)
|
||||||
{
|
{
|
||||||
if (dvdemux->videosrcpad)
|
gboolean no_more_pads;
|
||||||
return;
|
GstPad *pad;
|
||||||
|
|
||||||
dvdemux->videosrcpad =
|
pad = gst_pad_new_from_static_template (template, template->name_template);
|
||||||
gst_pad_new_from_static_template (&video_src_temp, "video");
|
|
||||||
gst_pad_set_query_function (dvdemux->videosrcpad,
|
gst_pad_set_query_function (pad, GST_DEBUG_FUNCPTR (gst_dvdemux_src_query));
|
||||||
GST_DEBUG_FUNCPTR (gst_dvdemux_src_query));
|
|
||||||
gst_pad_set_query_type_function (dvdemux->videosrcpad,
|
gst_pad_set_query_type_function (pad,
|
||||||
GST_DEBUG_FUNCPTR (gst_dvdemux_get_src_query_types));
|
GST_DEBUG_FUNCPTR (gst_dvdemux_get_src_query_types));
|
||||||
gst_pad_set_event_function (dvdemux->videosrcpad,
|
gst_pad_set_event_function (pad,
|
||||||
GST_DEBUG_FUNCPTR (gst_dvdemux_handle_src_event));
|
GST_DEBUG_FUNCPTR (gst_dvdemux_handle_src_event));
|
||||||
gst_pad_use_fixed_caps (dvdemux->videosrcpad);
|
gst_pad_use_fixed_caps (pad);
|
||||||
gst_pad_set_active (dvdemux->videosrcpad, TRUE);
|
gst_pad_set_active (pad, TRUE);
|
||||||
gst_element_add_pad (GST_ELEMENT (dvdemux), dvdemux->videosrcpad);
|
gst_element_add_pad (GST_ELEMENT (dvdemux), pad);
|
||||||
|
|
||||||
if (dvdemux->videosrcpad && dvdemux->audiosrcpad)
|
no_more_pads =
|
||||||
|
(dvdemux->videosrcpad != NULL && template == &audio_src_temp) ||
|
||||||
|
(dvdemux->audiosrcpad != NULL && template == &video_src_temp);
|
||||||
|
|
||||||
|
if (no_more_pads)
|
||||||
gst_element_no_more_pads (GST_ELEMENT (dvdemux));
|
gst_element_no_more_pads (GST_ELEMENT (dvdemux));
|
||||||
|
|
||||||
gst_pad_push_event (dvdemux->videosrcpad, gst_event_new_new_segment (FALSE,
|
gst_pad_push_event (pad, gst_event_new_new_segment (FALSE,
|
||||||
dvdemux->byte_segment.rate, GST_FORMAT_TIME,
|
dvdemux->byte_segment.rate, GST_FORMAT_TIME,
|
||||||
dvdemux->time_segment.start, dvdemux->time_segment.stop,
|
dvdemux->time_segment.start, dvdemux->time_segment.stop,
|
||||||
dvdemux->time_segment.start));
|
dvdemux->time_segment.start));
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
if (no_more_pads) {
|
||||||
gst_dvdemux_add_audio_pad (GstDVDemux * dvdemux)
|
gst_element_found_tags (GST_ELEMENT (dvdemux),
|
||||||
{
|
gst_tag_list_new_full (GST_TAG_CONTAINER_FORMAT, "DV", NULL));
|
||||||
if (dvdemux->audiosrcpad)
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
dvdemux->audiosrcpad =
|
return pad;
|
||||||
gst_pad_new_from_static_template (&audio_src_temp, "audio");
|
|
||||||
gst_pad_set_query_function (dvdemux->audiosrcpad,
|
|
||||||
GST_DEBUG_FUNCPTR (gst_dvdemux_src_query));
|
|
||||||
gst_pad_set_query_type_function (dvdemux->audiosrcpad,
|
|
||||||
GST_DEBUG_FUNCPTR (gst_dvdemux_get_src_query_types));
|
|
||||||
gst_pad_set_event_function (dvdemux->audiosrcpad,
|
|
||||||
GST_DEBUG_FUNCPTR (gst_dvdemux_handle_src_event));
|
|
||||||
gst_pad_use_fixed_caps (dvdemux->audiosrcpad);
|
|
||||||
gst_pad_set_active (dvdemux->audiosrcpad, TRUE);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (dvdemux), dvdemux->audiosrcpad);
|
|
||||||
|
|
||||||
if (dvdemux->videosrcpad && dvdemux->audiosrcpad)
|
|
||||||
gst_element_no_more_pads (GST_ELEMENT (dvdemux));
|
|
||||||
|
|
||||||
gst_pad_push_event (dvdemux->audiosrcpad, gst_event_new_new_segment (FALSE,
|
|
||||||
dvdemux->byte_segment.rate, GST_FORMAT_TIME,
|
|
||||||
dvdemux->time_segment.start, dvdemux->time_segment.stop,
|
|
||||||
dvdemux->time_segment.start));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1235,8 +1219,8 @@ gst_dvdemux_demux_audio (GstDVDemux * dvdemux, GstBuffer * buffer,
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
gint frequency, channels;
|
gint frequency, channels;
|
||||||
|
|
||||||
if (!dvdemux->audiosrcpad)
|
if (dvdemux->audiosrcpad == NULL)
|
||||||
gst_dvdemux_add_audio_pad (dvdemux);
|
dvdemux->audiosrcpad = gst_dvdemux_add_pad (dvdemux, &audio_src_temp);
|
||||||
|
|
||||||
/* get initial format or check if format changed */
|
/* get initial format or check if format changed */
|
||||||
frequency = dv_get_frequency (dvdemux->decoder);
|
frequency = dv_get_frequency (dvdemux->decoder);
|
||||||
|
@ -1301,8 +1285,8 @@ gst_dvdemux_demux_video (GstDVDemux * dvdemux, GstBuffer * buffer,
|
||||||
gboolean wide;
|
gboolean wide;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
if (!dvdemux->videosrcpad)
|
if (dvdemux->videosrcpad == NULL)
|
||||||
gst_dvdemux_add_video_pad (dvdemux);
|
dvdemux->videosrcpad = gst_dvdemux_add_pad (dvdemux, &video_src_temp);
|
||||||
|
|
||||||
/* get params */
|
/* get params */
|
||||||
/* framerate is already up-to-date */
|
/* framerate is already up-to-date */
|
||||||
|
|
Loading…
Reference in a new issue