mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-09 05:38:58 +00:00
mpdparser/dashdemux: fixed get_width, get_height, get_audio_rate, get_num_audio_channels API functions
the actual values now can be extracted also from the AdaptationSet element; checking NULL structs for better robustness;
This commit is contained in:
parent
98a41f2c9e
commit
375634f669
3 changed files with 67 additions and 37 deletions
|
@ -1175,6 +1175,8 @@ gst_dash_demux_prepend_header (GstDashDemux * demux,
|
||||||
const gchar *
|
const gchar *
|
||||||
gst_mpd_mimetype_to_caps (const gchar * mimeType)
|
gst_mpd_mimetype_to_caps (const gchar * mimeType)
|
||||||
{
|
{
|
||||||
|
if (mimeType == NULL)
|
||||||
|
return NULL;
|
||||||
if (strcmp (mimeType, "video/mp2t") == 0) {
|
if (strcmp (mimeType, "video/mp2t") == 0) {
|
||||||
return "video/mpegts";
|
return "video/mpegts";
|
||||||
} else if (strcmp (mimeType, "video/mp4") == 0) {
|
} else if (strcmp (mimeType, "video/mp4") == 0) {
|
||||||
|
@ -1192,17 +1194,24 @@ gst_dash_demux_get_video_input_caps (GstDashDemux * demux,
|
||||||
guint width, height;
|
guint width, height;
|
||||||
const gchar *mimeType;
|
const gchar *mimeType;
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
|
GstRepresentationBaseType *RepresentationBase;
|
||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
width =
|
|
||||||
gst_mpd_client_get_width_of_video_current_stream (demux->client, stream);
|
if (stream->cur_representation->RepresentationBase) {
|
||||||
height =
|
RepresentationBase = stream->cur_representation->RepresentationBase;
|
||||||
gst_mpd_client_get_height_of_video_current_stream (demux->client, stream);
|
} else {
|
||||||
if (!stream->cur_representation->RepresentationBase->mimeType)
|
RepresentationBase = stream->cur_adapt_set->RepresentationBase;
|
||||||
|
}
|
||||||
|
if (RepresentationBase == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
width =
|
||||||
|
gst_mpd_client_get_width_of_video_current_stream (RepresentationBase);
|
||||||
|
height =
|
||||||
|
gst_mpd_client_get_height_of_video_current_stream (RepresentationBase);
|
||||||
mimeType =
|
mimeType =
|
||||||
gst_mpd_mimetype_to_caps (stream->cur_representation->
|
gst_mpd_mimetype_to_caps (RepresentationBase->mimeType);
|
||||||
RepresentationBase->mimeType);
|
|
||||||
caps =
|
caps =
|
||||||
gst_caps_new_simple (mimeType, "width", G_TYPE_INT, width, "height",
|
gst_caps_new_simple (mimeType, "width", G_TYPE_INT, width, "height",
|
||||||
G_TYPE_INT, height, NULL);
|
G_TYPE_INT, height, NULL);
|
||||||
|
@ -1216,14 +1225,24 @@ gst_dash_demux_get_audio_input_caps (GstDashDemux * demux,
|
||||||
guint rate, channels;
|
guint rate, channels;
|
||||||
const gchar *mimeType;
|
const gchar *mimeType;
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
|
GstRepresentationBaseType *RepresentationBase;
|
||||||
|
if (stream == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (stream->cur_representation->RepresentationBase) {
|
||||||
|
RepresentationBase = stream->cur_representation->RepresentationBase;
|
||||||
|
} else {
|
||||||
|
RepresentationBase = stream->cur_adapt_set->RepresentationBase;
|
||||||
|
}
|
||||||
|
if (RepresentationBase == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
channels =
|
channels =
|
||||||
gst_mpd_client_get_num_channels_of_audio_current_stream (demux->client,
|
gst_mpd_client_get_num_channels_of_audio_current_stream (RepresentationBase);
|
||||||
stream);
|
|
||||||
rate =
|
rate =
|
||||||
gst_mpd_client_get_rate_of_audio_current_stream (demux->client, stream);
|
gst_mpd_client_get_rate_of_audio_current_stream (RepresentationBase);
|
||||||
mimeType =
|
mimeType =
|
||||||
gst_mpd_mimetype_to_caps (stream->cur_representation->
|
gst_mpd_mimetype_to_caps (RepresentationBase->mimeType);
|
||||||
RepresentationBase->mimeType);
|
|
||||||
caps =
|
caps =
|
||||||
gst_caps_new_simple (mimeType, "channels", G_TYPE_INT, channels, "rate",
|
gst_caps_new_simple (mimeType, "channels", G_TYPE_INT, channels, "rate",
|
||||||
G_TYPE_INT, rate, NULL);
|
G_TYPE_INT, rate, NULL);
|
||||||
|
@ -1236,9 +1255,20 @@ gst_dash_demux_get_application_input_caps (GstDashDemux * demux,
|
||||||
{
|
{
|
||||||
const gchar *mimeType;
|
const gchar *mimeType;
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
|
GstRepresentationBaseType *RepresentationBase;
|
||||||
|
if (stream == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (stream->cur_representation->RepresentationBase) {
|
||||||
|
RepresentationBase = stream->cur_representation->RepresentationBase;
|
||||||
|
} else {
|
||||||
|
RepresentationBase = stream->cur_adapt_set->RepresentationBase;
|
||||||
|
}
|
||||||
|
if (RepresentationBase == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
mimeType =
|
mimeType =
|
||||||
gst_mpd_mimetype_to_caps (stream->cur_representation->
|
gst_mpd_mimetype_to_caps (RepresentationBase->mimeType);
|
||||||
RepresentationBase->mimeType);
|
|
||||||
caps = gst_caps_new_simple (mimeType, NULL);
|
caps = gst_caps_new_simple (mimeType, NULL);
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2884,43 +2884,43 @@ guint gst_mpdparser_get_nb_active_stream (GstMpdClient *client){
|
||||||
return g_list_length (client->active_streams);
|
return g_list_length (client->active_streams);
|
||||||
}
|
}
|
||||||
|
|
||||||
guint gst_mpdparser_get_nb_adaptationSet(GstMpdClient *client){
|
guint gst_mpdparser_get_nb_adaptationSet(GstMpdClient *client)
|
||||||
|
{
|
||||||
g_return_val_if_fail (client != NULL, FALSE);
|
g_return_val_if_fail (client != NULL, FALSE);
|
||||||
g_return_val_if_fail (client->cur_period != NULL, FALSE);
|
g_return_val_if_fail (client->cur_period != NULL, FALSE);
|
||||||
g_return_val_if_fail (client->cur_period->AdaptationSets != NULL, FALSE);
|
g_return_val_if_fail (client->cur_period->AdaptationSets != NULL, FALSE);
|
||||||
return g_list_length (client->cur_period->AdaptationSets);
|
return g_list_length (client->cur_period->AdaptationSets);
|
||||||
}
|
}
|
||||||
|
|
||||||
GstActiveStream *gst_mpdparser_get_active_stream_by_index (GstMpdClient *client, gint stream_idx){
|
GstActiveStream *gst_mpdparser_get_active_stream_by_index (GstMpdClient *client, gint stream_idx)
|
||||||
|
{
|
||||||
g_return_val_if_fail (client != NULL, FALSE);
|
g_return_val_if_fail (client != NULL, FALSE);
|
||||||
g_return_val_if_fail (client->active_streams != NULL, FALSE);
|
g_return_val_if_fail (client->active_streams != NULL, FALSE);
|
||||||
return g_list_nth_data (client->active_streams,
|
return g_list_nth_data (client->active_streams,
|
||||||
stream_idx);
|
stream_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
guint gst_mpd_client_get_width_of_video_current_stream (GstMpdClient *client, GstActiveStream *stream){
|
guint gst_mpd_client_get_width_of_video_current_stream (GstRepresentationBaseType *RepresentationBase)
|
||||||
|
{
|
||||||
g_return_val_if_fail (stream != NULL, FALSE);
|
g_return_val_if_fail (RepresentationBase != NULL, 0);
|
||||||
return stream->cur_representation->RepresentationBase->width;
|
return RepresentationBase->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint gst_mpd_client_get_height_of_video_current_stream (GstMpdClient *client, GstActiveStream *stream){
|
guint gst_mpd_client_get_height_of_video_current_stream (GstRepresentationBaseType *RepresentationBase)
|
||||||
|
{
|
||||||
g_return_val_if_fail (stream != NULL, FALSE);
|
g_return_val_if_fail (RepresentationBase != NULL, 0);
|
||||||
return stream->cur_representation->RepresentationBase->height;
|
return RepresentationBase->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint gst_mpd_client_get_rate_of_audio_current_stream (GstMpdClient *client, GstActiveStream *stream){
|
guint gst_mpd_client_get_rate_of_audio_current_stream (GstRepresentationBaseType *RepresentationBase)
|
||||||
|
{
|
||||||
g_return_val_if_fail (stream != NULL, FALSE);
|
g_return_val_if_fail (RepresentationBase != NULL, 0);
|
||||||
return (guint) stream->cur_representation->RepresentationBase->audioSamplingRate;
|
return (guint) RepresentationBase->audioSamplingRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint gst_mpd_client_get_num_channels_of_audio_current_stream (GstMpdClient *client, GstActiveStream *stream){
|
guint gst_mpd_client_get_num_channels_of_audio_current_stream (GstRepresentationBaseType *RepresentationBase)
|
||||||
|
{
|
||||||
g_return_val_if_fail (stream != NULL, FALSE);
|
g_return_val_if_fail (RepresentationBase != NULL, 0);
|
||||||
/* TODO*/
|
/* TODO*/
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -468,12 +468,12 @@ GstActiveStream *gst_mpdparser_get_active_stream_by_index (GstMpdClient *client,
|
||||||
guint gst_mpdparser_get_nb_adaptationSet(GstMpdClient *client);
|
guint gst_mpdparser_get_nb_adaptationSet(GstMpdClient *client);
|
||||||
|
|
||||||
/* Get With and high of video parameter by stream */
|
/* Get With and high of video parameter by stream */
|
||||||
guint gst_mpd_client_get_width_of_video_current_stream (GstMpdClient *client, GstActiveStream *stream);
|
guint gst_mpd_client_get_width_of_video_current_stream (GstRepresentationBaseType *RepresentationBase);
|
||||||
guint gst_mpd_client_get_height_of_video_current_stream (GstMpdClient *client, GstActiveStream *stream);
|
guint gst_mpd_client_get_height_of_video_current_stream (GstRepresentationBaseType *RepresentationBase);
|
||||||
|
|
||||||
/* Get channel and rate of audio parameter by stream */
|
/* Get channel and rate of audio parameter by stream */
|
||||||
guint gst_mpd_client_get_rate_of_audio_current_stream (GstMpdClient *client, GstActiveStream *stream);
|
guint gst_mpd_client_get_rate_of_audio_current_stream (GstRepresentationBaseType *RepresentationBase);
|
||||||
guint gst_mpd_client_get_num_channels_of_audio_current_stream (GstMpdClient *client, GstActiveStream *stream);
|
guint gst_mpd_client_get_num_channels_of_audio_current_stream (GstRepresentationBaseType *RepresentationBase);
|
||||||
|
|
||||||
/* Support multi language */
|
/* Support multi language */
|
||||||
guint gst_mpdparser_get_list_and_nb_of_audio_language(GList **lang, GList *AdaptationSets);
|
guint gst_mpdparser_get_list_and_nb_of_audio_language(GList **lang, GList *AdaptationSets);
|
||||||
|
|
Loading…
Reference in a new issue