mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 06:26:23 +00:00
dashdemux: use audio_%02u and video_%02u names for pads
Instead of using the default ghostpad%u naming. The audio_/video_ names are more common in demuxers
This commit is contained in:
parent
c6d5c4c2e1
commit
85bb450a44
2 changed files with 37 additions and 7 deletions
|
@ -152,7 +152,14 @@
|
||||||
#include "gstdashdemux.h"
|
#include "gstdashdemux.h"
|
||||||
#include "gstdash_debug.h"
|
#include "gstdash_debug.h"
|
||||||
|
|
||||||
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src_%u",
|
static GstStaticPadTemplate gst_dash_demux_videosrc_template =
|
||||||
|
GST_STATIC_PAD_TEMPLATE ("video_%02u",
|
||||||
|
GST_PAD_SRC,
|
||||||
|
GST_PAD_SOMETIMES,
|
||||||
|
GST_STATIC_CAPS_ANY);
|
||||||
|
|
||||||
|
static GstStaticPadTemplate gst_dash_demux_audiosrc_template =
|
||||||
|
GST_STATIC_PAD_TEMPLATE ("audio_%02u",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_SOMETIMES,
|
GST_PAD_SOMETIMES,
|
||||||
GST_STATIC_CAPS_ANY);
|
GST_STATIC_CAPS_ANY);
|
||||||
|
@ -225,7 +232,8 @@ static void gst_dash_demux_stream_free (GstAdaptiveDemuxStream * stream);
|
||||||
|
|
||||||
static GstCaps *gst_dash_demux_get_input_caps (GstDashDemux * demux,
|
static GstCaps *gst_dash_demux_get_input_caps (GstDashDemux * demux,
|
||||||
GstActiveStream * stream);
|
GstActiveStream * stream);
|
||||||
static GstPad *gst_dash_demux_create_pad (GstDashDemux * demux);
|
static GstPad *gst_dash_demux_create_pad (GstDashDemux * demux,
|
||||||
|
GstActiveStream * stream);
|
||||||
|
|
||||||
#define SIDX(s) (&(s)->sidx_parser.sidx)
|
#define SIDX(s) (&(s)->sidx_parser.sidx)
|
||||||
#define SIDX_ENTRY(s,i) (&(SIDX(s)->entries[(i)]))
|
#define SIDX_ENTRY(s,i) (&(SIDX(s)->entries[(i)]))
|
||||||
|
@ -292,7 +300,9 @@ gst_dash_demux_class_init (GstDashDemuxClass * klass)
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
gst_element_class_add_pad_template (gstelement_class,
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
gst_static_pad_template_get (&srctemplate));
|
gst_static_pad_template_get (&gst_dash_demux_audiosrc_template));
|
||||||
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
gst_static_pad_template_get (&gst_dash_demux_videosrc_template));
|
||||||
|
|
||||||
gst_element_class_add_pad_template (gstelement_class,
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
gst_static_pad_template_get (&sinktemplate));
|
gst_static_pad_template_get (&sinktemplate));
|
||||||
|
@ -438,7 +448,7 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux)
|
||||||
if (active_stream == NULL)
|
if (active_stream == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
srcpad = gst_dash_demux_create_pad (demux);
|
srcpad = gst_dash_demux_create_pad (demux, active_stream);
|
||||||
caps = gst_dash_demux_get_input_caps (demux, active_stream);
|
caps = gst_dash_demux_get_input_caps (demux, active_stream);
|
||||||
GST_LOG_OBJECT (demux, "Creating stream %d %" GST_PTR_FORMAT, i, caps);
|
GST_LOG_OBJECT (demux, "Creating stream %d %" GST_PTR_FORMAT, i, caps);
|
||||||
|
|
||||||
|
@ -626,15 +636,29 @@ gst_dash_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstPad *
|
static GstPad *
|
||||||
gst_dash_demux_create_pad (GstDashDemux * demux)
|
gst_dash_demux_create_pad (GstDashDemux * demux, GstActiveStream * stream)
|
||||||
{
|
{
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
GstPadTemplate *tmpl;
|
GstPadTemplate *tmpl;
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
tmpl = gst_static_pad_template_get (&srctemplate);
|
switch (stream->mimeType) {
|
||||||
|
case GST_STREAM_AUDIO:
|
||||||
|
name = g_strdup_printf ("audio_%02u", demux->n_audio_streams++);
|
||||||
|
tmpl = gst_static_pad_template_get (&gst_dash_demux_audiosrc_template);
|
||||||
|
break;
|
||||||
|
case GST_STREAM_VIDEO:
|
||||||
|
name = g_strdup_printf ("video_%02u", demux->n_video_streams++);
|
||||||
|
tmpl = gst_static_pad_template_get (&gst_dash_demux_videosrc_template);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create and activate new pads */
|
/* Create and activate new pads */
|
||||||
pad = gst_ghost_pad_new_no_target_from_template (NULL, tmpl);
|
pad = gst_ghost_pad_new_no_target_from_template (name, tmpl);
|
||||||
|
g_free (name);
|
||||||
gst_object_unref (tmpl);
|
gst_object_unref (tmpl);
|
||||||
|
|
||||||
gst_pad_set_active (pad, TRUE);
|
gst_pad_set_active (pad, TRUE);
|
||||||
|
@ -657,6 +681,9 @@ gst_dash_demux_reset (GstAdaptiveDemux * ademux)
|
||||||
demux->client = NULL;
|
demux->client = NULL;
|
||||||
}
|
}
|
||||||
demux->client = gst_mpd_client_new ();
|
demux->client = gst_mpd_client_new ();
|
||||||
|
|
||||||
|
demux->n_audio_streams = 0;
|
||||||
|
demux->n_video_streams = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
|
|
|
@ -94,6 +94,9 @@ struct _GstDashDemux
|
||||||
GstClockTime max_buffering_time; /* Maximum buffering time accumulated during playback */
|
GstClockTime max_buffering_time; /* Maximum buffering time accumulated during playback */
|
||||||
gfloat bandwidth_usage; /* Percentage of the available bandwidth to use */
|
gfloat bandwidth_usage; /* Percentage of the available bandwidth to use */
|
||||||
guint64 max_bitrate; /* max of bitrate supported by target decoder */
|
guint64 max_bitrate; /* max of bitrate supported by target decoder */
|
||||||
|
|
||||||
|
gint n_audio_streams;
|
||||||
|
gint n_video_streams;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstDashDemuxClass
|
struct _GstDashDemuxClass
|
||||||
|
|
Loading…
Reference in a new issue