From 6cbaec75935b503f6dd2aaaac253fe10c6a0a6cc Mon Sep 17 00:00:00 2001 From: "suhwang.kim" Date: Tue, 8 Dec 2015 09:33:39 +0900 Subject: [PATCH] dashdemux: Suggestion for setting the framerate information. Dashdemux has set the width and height information from MPD manifest. Some embedded devices which are not insufficient H/W resources need more information such as framerate to assign H/W resources. So I suggested that dashdemux also needs to set the framerate information from MDP manifest. https://bugzilla.gnome.org/show_bug.cgi?id=758515 --- ext/dash/gstdashdemux.c | 9 +++++++++ ext/dash/gstmpdparser.c | 40 ++++++++++++++++++++++++++++++++++++++++ ext/dash/gstmpdparser.h | 1 + 3 files changed, 50 insertions(+) diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index ed699884de..27988f5d7a 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -866,6 +866,8 @@ gst_dash_demux_get_video_input_caps (GstDashDemux * demux, GstActiveStream * stream) { guint width = 0, height = 0; + gint fps_num = 0, fps_den = 1; + gboolean have_fps = FALSE; GstCaps *caps = NULL; if (stream == NULL) @@ -875,6 +877,8 @@ gst_dash_demux_get_video_input_caps (GstDashDemux * demux, if (!gst_mpd_client_get_bitstream_switching_flag (stream)) { width = gst_mpd_client_get_video_stream_width (stream); height = gst_mpd_client_get_video_stream_height (stream); + have_fps = + gst_mpd_client_get_video_stream_framerate (stream, &fps_num, &fps_den); } caps = gst_mpd_client_get_stream_caps (stream); if (caps == NULL) @@ -885,6 +889,11 @@ gst_dash_demux_get_video_input_caps (GstDashDemux * demux, G_TYPE_INT, height, NULL); } + if (have_fps) { + gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, fps_num, + fps_den, NULL); + } + return caps; } diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index 8b10340029..ca52ebf6c7 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -5635,6 +5635,46 @@ gst_mpd_client_get_video_stream_height (GstActiveStream * stream) return height; } +gboolean +gst_mpd_client_get_video_stream_framerate (GstActiveStream * stream, + gint * fps_num, gint * fps_den) +{ + if (stream == NULL) + return FALSE; + + if (stream->cur_adapt_set && + stream->cur_adapt_set->RepresentationBase->frameRate != NULL) { + *fps_num = stream->cur_adapt_set->RepresentationBase->frameRate->num; + *fps_den = stream->cur_adapt_set->RepresentationBase->frameRate->den; + return TRUE; + } + + if (stream->cur_adapt_set && + stream->cur_adapt_set->RepresentationBase->maxFrameRate != NULL) { + *fps_num = stream->cur_adapt_set->RepresentationBase->maxFrameRate->num; + *fps_den = stream->cur_adapt_set->RepresentationBase->maxFrameRate->den; + return TRUE; + } + + if (stream->cur_representation && + stream->cur_representation->RepresentationBase->frameRate != NULL) { + *fps_num = stream->cur_representation->RepresentationBase->frameRate->num; + *fps_den = stream->cur_representation->RepresentationBase->frameRate->den; + return TRUE; + } + + if (stream->cur_representation && + stream->cur_representation->RepresentationBase->maxFrameRate != NULL) { + *fps_num = + stream->cur_representation->RepresentationBase->maxFrameRate->num; + *fps_den = + stream->cur_representation->RepresentationBase->maxFrameRate->den; + return TRUE; + } + + return FALSE; +} + guint gst_mpd_client_get_audio_stream_rate (GstActiveStream * stream) { diff --git a/ext/dash/gstmpdparser.h b/ext/dash/gstmpdparser.h index aa8fe6c1cc..fcd3b69ad5 100644 --- a/ext/dash/gstmpdparser.h +++ b/ext/dash/gstmpdparser.h @@ -586,6 +586,7 @@ GstCaps * gst_mpd_client_get_stream_caps (GstActiveStream * stream); gboolean gst_mpd_client_get_bitstream_switching_flag (GstActiveStream * stream); guint gst_mpd_client_get_video_stream_width (GstActiveStream * stream); guint gst_mpd_client_get_video_stream_height (GstActiveStream * stream); +gboolean gst_mpd_client_get_video_stream_framerate (GstActiveStream * stream, gint * fps_num, gint * fps_den); guint gst_mpd_client_get_audio_stream_rate (GstActiveStream * stream); guint gst_mpd_client_get_audio_stream_num_channels (GstActiveStream * stream);