return res;
}
-const gchar *
-gst_mpd_mimetype_to_caps (const gchar * mimeType)
-{
- if (mimeType == NULL)
- return NULL;
- if (strcmp (mimeType, "video/mp2t") == 0) {
- return "video/mpegts";
- } else if (strcmp (mimeType, "video/mp4") == 0) {
- return "video/quicktime";
- } else if (strcmp (mimeType, "audio/mp4") == 0) {
- return "audio/x-m4a";
- } else
- return mimeType;
-}
-
static GstCaps *
gst_dash_demux_get_video_input_caps (GstDashDemux * demux,
GstActiveStream * stream)
{
guint width, height;
- const gchar *mimeType;
+ const gchar *mimeType = 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)
+ width = gst_mpd_client_get_video_stream_width (stream);
+ height = gst_mpd_client_get_video_stream_height (stream);
+ mimeType = gst_mpd_client_get_stream_mimeType (stream);
+ if (mimeType == 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 = gst_mpd_mimetype_to_caps (RepresentationBase->mimeType);
- caps =
- gst_caps_new_simple (mimeType, "width", G_TYPE_INT, width, "height",
- G_TYPE_INT, height, NULL);
+ caps = gst_caps_new_simple (mimeType, NULL);
+ if (width > 0 && height > 0) {
+ gst_caps_set_simple (caps, "width", G_TYPE_INT, width, "height",
+ G_TYPE_INT, height, NULL);
+ }
+
return caps;
}
guint rate, channels;
const gchar *mimeType;
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)
+ channels = gst_mpd_client_get_audio_stream_num_channels (stream);
+ rate = gst_mpd_client_get_audio_stream_rate (stream);
+ mimeType = gst_mpd_client_get_stream_mimeType (stream);
+ if (mimeType == NULL)
return NULL;
- channels =
- gst_mpd_client_get_num_channels_of_audio_current_stream
- (RepresentationBase);
- rate = gst_mpd_client_get_rate_of_audio_current_stream (RepresentationBase);
- mimeType = gst_mpd_mimetype_to_caps (RepresentationBase->mimeType);
- caps =
- gst_caps_new_simple (mimeType, "channels", G_TYPE_INT, channels, "rate",
- G_TYPE_INT, rate, NULL);
+ caps = gst_caps_new_simple (mimeType, NULL);
+ if (rate > 0) {
+ gst_caps_set_simple (caps, "rate", G_TYPE_INT, rate, NULL);
+ }
+ if (channels > 0) {
+ gst_caps_set_simple (caps, "channels", G_TYPE_INT, channels, NULL);
+ }
+
return caps;
}
{
const gchar *mimeType;
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)
+ mimeType = gst_mpd_client_get_stream_mimeType (stream);
+ if (mimeType == NULL)
return NULL;
- mimeType = gst_mpd_mimetype_to_caps (RepresentationBase->mimeType);
caps = gst_caps_new_simple (mimeType, NULL);
+
return caps;
}
static gchar *gst_mpdparser_get_initializationURL (GstURLType *InitializationURL);
static gchar *gst_mpdparser_build_URL_from_template (const gchar *url_template, const gchar *id, guint number, guint bandwidth, guint time);
static gboolean gst_mpd_client_add_media_segment (GstActiveStream *stream, GstSegmentURLNode *url_node, guint number, guint start, GstClockTime start_time, GstClockTime duration);
+static const gchar *gst_mpdparser_mimetype_to_caps (const gchar * mimeType);
/* Period */
static GstPeriodNode *gst_mpdparser_get_next_period (GList *Periods, GstPeriodNode *prev_period);
gst_mpdparser_get_first_adapt_set_with_mimeType (client->
cur_period->AdaptationSets, "audio");
if (!adapt_set) {
- GST_INFO ("No audio adaptation set found, aborting...");
+ GST_INFO ("No audio adaptation set found");
return FALSE;
}
rep_list = adapt_set->Representations;
gst_mpdparser_get_first_adapt_set_with_mimeType (client->
cur_period->AdaptationSets, "application");
if (!adapt_set) {
- GST_INFO ("No application adaptation set found, aborting...");
+ GST_INFO ("No application adaptation set found");
return FALSE;
}
rep_list = adapt_set->Representations;
stream_idx);
}
-guint gst_mpd_client_get_width_of_video_current_stream (GstRepresentationBaseType *RepresentationBase)
+static const gchar *
+gst_mpdparser_mimetype_to_caps (const gchar * mimeType)
{
- g_return_val_if_fail (RepresentationBase != NULL, 0);
- return RepresentationBase->width;
+ if (mimeType == NULL)
+ return NULL;
+ if (strcmp (mimeType, "video/mp2t") == 0) {
+ return "video/mpegts";
+ } else if (strcmp (mimeType, "video/mp4") == 0) {
+ return "video/quicktime";
+ } else if (strcmp (mimeType, "audio/mp4") == 0) {
+ return "audio/x-m4a";
+ } else
+ return mimeType;
+}
+
+const gchar *gst_mpd_client_get_stream_mimeType (GstActiveStream * stream)
+{
+ const gchar *mimeType;
+
+ if (stream == NULL || stream->cur_adapt_set == NULL || stream->cur_representation == NULL)
+ return NULL;
+
+ mimeType = stream->cur_representation->RepresentationBase->mimeType;
+ if (mimeType == NULL) {
+ mimeType = stream->cur_adapt_set->RepresentationBase->mimeType;
+ }
+
+ return gst_mpdparser_mimetype_to_caps (mimeType);
+}
+
+guint gst_mpd_client_get_video_stream_width (GstActiveStream * stream)
+{
+ guint width;
+
+ if (stream == NULL || stream->cur_adapt_set == NULL || stream->cur_representation == NULL)
+ return 0;
+
+ width = stream->cur_representation->RepresentationBase->width;
+ if (width == 0) {
+ width = stream->cur_adapt_set->RepresentationBase->width;
+ }
+
+ return width;
}
-guint gst_mpd_client_get_height_of_video_current_stream (GstRepresentationBaseType *RepresentationBase)
+guint gst_mpd_client_get_video_stream_height (GstActiveStream * stream)
{
- g_return_val_if_fail (RepresentationBase != NULL, 0);
- return RepresentationBase->height;
+ guint height;
+
+ if (stream == NULL || stream->cur_adapt_set == NULL || stream->cur_representation == NULL)
+ return 0;
+
+ height = stream->cur_representation->RepresentationBase->height;
+ if (height == 0) {
+ height = stream->cur_adapt_set->RepresentationBase->height;
+ }
+
+ return height;
}
-guint gst_mpd_client_get_rate_of_audio_current_stream (GstRepresentationBaseType *RepresentationBase)
+guint gst_mpd_client_get_audio_stream_rate (GstActiveStream * stream)
{
- g_return_val_if_fail (RepresentationBase != NULL, 0);
- return (guint) RepresentationBase->audioSamplingRate;
+ const gchar *rate;
+
+ if (stream == NULL || stream->cur_adapt_set == NULL || stream->cur_representation == NULL)
+ return 0;
+
+ rate = stream->cur_representation->RepresentationBase->audioSamplingRate;
+ if (rate == NULL) {
+ rate = stream->cur_adapt_set->RepresentationBase->audioSamplingRate;
+ }
+
+ return rate ? atoi (rate) : 0;
}
-guint gst_mpd_client_get_num_channels_of_audio_current_stream (GstRepresentationBaseType *RepresentationBase)
+guint gst_mpd_client_get_audio_stream_num_channels (GstActiveStream * stream)
{
- g_return_val_if_fail (RepresentationBase != NULL, 0);
- /* TODO*/
- return 1;
+ if (stream == NULL || stream->cur_adapt_set == NULL || stream->cur_representation == NULL)
+ return 0;
+ /* TODO: here we have to parse the AudioChannelConfiguration descriptors */
+ return 0;
}
guint
/* AdaptationSet */
guint gst_mpdparser_get_nb_adaptationSet(GstMpdClient *client);
-/* Get With and high of video parameter by stream */
-guint gst_mpd_client_get_width_of_video_current_stream (GstRepresentationBaseType *RepresentationBase);
-guint gst_mpd_client_get_height_of_video_current_stream (GstRepresentationBaseType *RepresentationBase);
-
-/* Get channel and rate of audio parameter by stream */
-guint gst_mpd_client_get_rate_of_audio_current_stream (GstRepresentationBaseType *RepresentationBase);
-guint gst_mpd_client_get_num_channels_of_audio_current_stream (GstRepresentationBaseType *RepresentationBase);
+/* Get audio/video stream parameters (mimeType, width, height, rate, number of channels) */
+const gchar *gst_mpd_client_get_stream_mimeType (GstActiveStream * stream);
+guint gst_mpd_client_get_video_stream_width (GstActiveStream * stream);
+guint gst_mpd_client_get_video_stream_height (GstActiveStream * stream);
+guint gst_mpd_client_get_audio_stream_rate (GstActiveStream * stream);
+guint gst_mpd_client_get_audio_stream_num_channels (GstActiveStream * stream);
/* Support multi language */
guint gst_mpdparser_get_list_and_nb_of_audio_language(GList **lang, GList *AdaptationSets);