From c28e7d928d6dd7ee26510b82631fbd0e499d1c53 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Cerveau?= Date: Fri, 24 May 2019 16:24:00 +0200 Subject: [PATCH] dash: move parser nodes/types to separated files Rename GstMpdClient to GstMPDClient and use GObject model. Move nodes to file from gstmpdparser.c: - GstMPDRootNode - GstMPDBaseURLNode - GstMPDUTCTimingNode - GstMPDMetricsNode - GstMPDMetricsRangeNode - GstMPDSNode - GstMPDSegmentTimelineNode - GstSegmentTemplateNode - GstMPDSegmentURLNode - GstMPDSegmentListNode - GstMPDPeriodNode - GstMPDRepresentationNode - GstMPDsubRepresentationNode - GstMPDAdaptationSetNode - GstMPDContentComponentNode - GstMPDSubsetNode - GstMPDProgramInformationNode Move types to gstmpdhelper from gstmpdparser.c: - GstURLType - GstDescriptorType - GstSegmentBaseType - GstMPDMultSegmentBaseType - GstMPDRepresentationBaseType Cleanup naming when possible. --- ext/dash/gstdashdemux.c | 56 +- ext/dash/gstdashdemux.h | 2 +- ext/dash/gstmpdadaptationsetnode.c | 127 ++++ ext/dash/gstmpdadaptationsetnode.h | 104 +++ ext/dash/gstmpdbaseurlnode.c | 66 ++ ext/dash/gstmpdbaseurlnode.h | 66 ++ ext/dash/gstmpdclient.c | 542 +++++++------- ext/dash/gstmpdclient.h | 103 ++- ext/dash/gstmpdcontentcomponentnode.c | 85 +++ ext/dash/gstmpdcontentcomponentnode.h | 74 ++ ext/dash/gstmpdhelper.c | 160 +++++ ext/dash/gstmpdhelper.h | 84 +++ ext/dash/gstmpdmetricsnode.c | 66 ++ ext/dash/gstmpdmetricsnode.h | 71 ++ ext/dash/gstmpdmetricsrangenode.c | 52 ++ ext/dash/gstmpdmetricsrangenode.h | 64 ++ ext/dash/gstmpdparser.c | 890 +++++------------------ ext/dash/gstmpdparser.h | 394 +---------- ext/dash/gstmpdperiodnode.c | 83 +++ ext/dash/gstmpdperiodnode.h | 84 +++ ext/dash/gstmpdprograminformationnode.c | 79 +++ ext/dash/gstmpdprograminformationnode.h | 68 ++ ext/dash/gstmpdrepresentationnode.c | 83 +++ ext/dash/gstmpdrepresentationnode.h | 81 +++ ext/dash/gstmpdrootnode.c | 108 +++ ext/dash/gstmpdrootnode.h | 89 +++ ext/dash/gstmpdsegmentlistnode.c | 81 +++ ext/dash/gstmpdsegmentlistnode.h | 72 ++ ext/dash/gstmpdsegmenttemplatenode.c | 78 ++ ext/dash/gstmpdsegmenttemplatenode.h | 68 ++ ext/dash/gstmpdsegmenttimelinenode.c | 88 +++ ext/dash/gstmpdsegmenttimelinenode.h | 66 ++ ext/dash/gstmpdsegmenturlnode.c | 87 +++ ext/dash/gstmpdsegmenturlnode.h | 68 ++ ext/dash/gstmpdsnode.c | 67 ++ ext/dash/gstmpdsnode.h | 67 ++ ext/dash/gstmpdsubrepresentationnode.c | 73 ++ ext/dash/gstmpdsubrepresentationnode.h | 69 ++ ext/dash/gstmpdsubsetnode.c | 64 ++ ext/dash/gstmpdsubsetnode.h | 64 ++ ext/dash/gstmpdutctimingnode.c | 68 ++ ext/dash/gstmpdutctimingnode.h | 78 ++ ext/dash/meson.build | 17 + tests/check/elements/dash_mpd.c | 1179 ++++++++++++++++--------------- 44 files changed, 4047 insertions(+), 1988 deletions(-) create mode 100644 ext/dash/gstmpdadaptationsetnode.c create mode 100644 ext/dash/gstmpdadaptationsetnode.h create mode 100644 ext/dash/gstmpdbaseurlnode.c create mode 100644 ext/dash/gstmpdbaseurlnode.h create mode 100644 ext/dash/gstmpdcontentcomponentnode.c create mode 100644 ext/dash/gstmpdcontentcomponentnode.h create mode 100644 ext/dash/gstmpdmetricsnode.c create mode 100644 ext/dash/gstmpdmetricsnode.h create mode 100644 ext/dash/gstmpdmetricsrangenode.c create mode 100644 ext/dash/gstmpdmetricsrangenode.h create mode 100644 ext/dash/gstmpdperiodnode.c create mode 100644 ext/dash/gstmpdperiodnode.h create mode 100644 ext/dash/gstmpdprograminformationnode.c create mode 100644 ext/dash/gstmpdprograminformationnode.h create mode 100644 ext/dash/gstmpdrepresentationnode.c create mode 100644 ext/dash/gstmpdrepresentationnode.h create mode 100644 ext/dash/gstmpdrootnode.c create mode 100644 ext/dash/gstmpdrootnode.h create mode 100644 ext/dash/gstmpdsegmentlistnode.c create mode 100644 ext/dash/gstmpdsegmentlistnode.h create mode 100644 ext/dash/gstmpdsegmenttemplatenode.c create mode 100644 ext/dash/gstmpdsegmenttemplatenode.h create mode 100644 ext/dash/gstmpdsegmenttimelinenode.c create mode 100644 ext/dash/gstmpdsegmenttimelinenode.h create mode 100644 ext/dash/gstmpdsegmenturlnode.c create mode 100644 ext/dash/gstmpdsegmenturlnode.h create mode 100644 ext/dash/gstmpdsnode.c create mode 100644 ext/dash/gstmpdsnode.h create mode 100644 ext/dash/gstmpdsubrepresentationnode.c create mode 100644 ext/dash/gstmpdsubrepresentationnode.h create mode 100644 ext/dash/gstmpdsubsetnode.c create mode 100644 ext/dash/gstmpdsubsetnode.h create mode 100644 ext/dash/gstmpdutctimingnode.c create mode 100644 ext/dash/gstmpdutctimingnode.h diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index 9b0fa26..05bb85b 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -475,14 +475,14 @@ gst_dash_demux_get_live_seek_range (GstAdaptiveDemux * demux, gint64 * start, GTimeSpan stream_now; GstClockTime seg_duration; - if (self->client->mpd_node->availabilityStartTime == NULL) + if (self->client->mpd_root_node->availabilityStartTime == NULL) return FALSE; seg_duration = gst_mpd_client_get_maximum_segment_duration (self->client); now = gst_dash_demux_get_server_now_utc (self); mstart = - gst_date_time_to_g_date_time (self->client-> - mpd_node->availabilityStartTime); + gst_date_time_to_g_date_time (self->client->mpd_root_node-> + availabilityStartTime); stream_now = g_date_time_difference (now, mstart); g_date_time_unref (now); g_date_time_unref (mstart); @@ -491,11 +491,13 @@ gst_dash_demux_get_live_seek_range (GstAdaptiveDemux * demux, gint64 * start, return FALSE; *stop = stream_now * GST_USECOND; - if (self->client->mpd_node->timeShiftBufferDepth == GST_MPD_DURATION_NONE) { + if (self->client->mpd_root_node->timeShiftBufferDepth == + GST_MPD_DURATION_NONE) { *start = 0; } else { *start = - *stop - (self->client->mpd_node->timeShiftBufferDepth * GST_MSECOND); + *stop - + (self->client->mpd_root_node->timeShiftBufferDepth * GST_MSECOND); if (*start < 0) *start = 0; } @@ -749,14 +751,14 @@ gst_dash_demux_get_property (GObject * object, guint prop_id, GValue * value, static gboolean gst_dash_demux_setup_mpdparser_streams (GstDashDemux * demux, - GstMpdClient * client) + GstMPDClient * client) { gboolean has_streams = FALSE; GList *adapt_sets, *iter; adapt_sets = gst_mpd_client_get_adaptation_sets (client); for (iter = adapt_sets; iter; iter = g_list_next (iter)) { - GstAdaptationSetNode *adapt_set_node = iter->data; + GstMPDAdaptationSetNode *adapt_set_node = iter->data; gst_mpd_client_setup_streaming (client, adapt_set_node); has_streams = TRUE; @@ -814,7 +816,7 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux) GST_LOG_OBJECT (demux, "Creating stream %d %" GST_PTR_FORMAT, i, caps); if (active_stream->cur_adapt_set) { - GstAdaptationSetNode *adp_set = active_stream->cur_adapt_set; + GstMPDAdaptationSetNode *adp_set = active_stream->cur_adapt_set; lang = adp_set->lang; /* Fallback to the language in ContentComponent node */ @@ -822,7 +824,7 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux) GList *it; for (it = adp_set->ContentComponents; it; it = it->next) { - GstContentComponentNode *cc_node = it->data; + GstMPDContentComponentNode *cc_node = it->data; if (cc_node->lang) { lang = cc_node->lang; break; @@ -864,9 +866,9 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux) active_stream->cur_adapt_set->RepresentationBase && active_stream->cur_adapt_set->RepresentationBase->ContentProtection) { GST_DEBUG_OBJECT (demux, "Adding ContentProtection events to source pad"); - g_list_foreach (active_stream->cur_adapt_set->RepresentationBase-> - ContentProtection, gst_dash_demux_send_content_protection_event, - stream); + g_list_foreach (active_stream->cur_adapt_set-> + RepresentationBase->ContentProtection, + gst_dash_demux_send_content_protection_event, stream); } gst_isoff_sidx_parser_init (&stream->sidx_parser); @@ -878,7 +880,7 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux) static void gst_dash_demux_send_content_protection_event (gpointer data, gpointer userdata) { - GstDescriptorType *cp = (GstDescriptorType *) data; + GstMPDDescriptorType *cp = (GstMPDDescriptorType *) data; GstDashDemuxStream *stream = (GstDashDemuxStream *) userdata; GstEvent *event; GstBuffer *pssi; @@ -939,7 +941,7 @@ gst_dash_demux_setup_streams (GstAdaptiveDemux * demux) period_idx = 0; if (gst_mpd_client_is_live (dashdemux->client)) { GDateTime *g_now; - if (dashdemux->client->mpd_node->availabilityStartTime == NULL) { + if (dashdemux->client->mpd_root_node->availabilityStartTime == NULL) { ret = FALSE; GST_ERROR_OBJECT (demux, "MPD does not have availabilityStartTime"); goto done; @@ -958,9 +960,9 @@ gst_dash_demux_setup_streams (GstAdaptiveDemux * demux) /* get period index for period encompassing the current time */ g_now = gst_dash_demux_get_server_now_utc (dashdemux); now = gst_date_time_new_from_g_date_time (g_now); - if (dashdemux->client->mpd_node->suggestedPresentationDelay != -1) { + if (dashdemux->client->mpd_root_node->suggestedPresentationDelay != -1) { GstDateTime *target = gst_mpd_client_add_time_difference (now, - dashdemux->client->mpd_node->suggestedPresentationDelay * -1000); + dashdemux->client->mpd_root_node->suggestedPresentationDelay * -1000); gst_date_time_unref (now); now = target; } else if (dashdemux->default_presentation_delay) { @@ -2215,7 +2217,7 @@ gst_dash_demux_stream_select_bitrate (GstAdaptiveDemuxStream * stream, new_index = gst_mpd_client_get_rep_idx_with_min_bandwidth (rep_list); if (new_index != active_stream->representation_idx) { - GstRepresentationNode *rep = g_list_nth_data (rep_list, new_index); + GstMPDRepresentationNode *rep = g_list_nth_data (rep_list, new_index); GST_INFO_OBJECT (demux, "Changing representation idx: %d %d %u", dashstream->index, new_index, rep->bandwidth); if (gst_mpd_client_setup_representation (demux->client, active_stream, rep)) { @@ -2384,7 +2386,7 @@ static gint64 gst_dash_demux_get_manifest_update_interval (GstAdaptiveDemux * demux) { GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux); - return MIN (dashdemux->client->mpd_node->minimumUpdatePeriod * 1000, + return MIN (dashdemux->client->mpd_root_node->minimumUpdatePeriod * 1000, SLOW_CLOCK_UPDATE_INTERVAL); } @@ -2393,7 +2395,7 @@ gst_dash_demux_update_manifest_data (GstAdaptiveDemux * demux, GstBuffer * buffer) { GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux); - GstMpdClient *new_client = NULL; + GstMPDClient *new_client = NULL; GstMapInfo mapinfo; GST_DEBUG_OBJECT (demux, "Updating manifest file from URL"); @@ -2956,8 +2958,8 @@ gst_dash_demux_parse_isobmff (GstAdaptiveDemux * demux, } } dash_stream->sidx_position = - SIDX (dash_stream)->entries[SIDX (dash_stream)-> - entry_index].pts; + SIDX (dash_stream)->entries[SIDX (dash_stream)->entry_index]. + pts; } } @@ -3104,8 +3106,8 @@ gst_dash_demux_find_sync_samples (GstAdaptiveDemux * demux, } else if ((trun->flags & GST_TRUN_FLAGS_FIRST_SAMPLE_FLAGS_PRESENT) && k == 0) { sample_flags = trun->first_sample_flags; - } else if (traf-> - tfhd.flags & GST_TFHD_FLAGS_DEFAULT_SAMPLE_FLAGS_PRESENT) { + } else if (traf->tfhd. + flags & GST_TFHD_FLAGS_DEFAULT_SAMPLE_FLAGS_PRESENT) { sample_flags = traf->tfhd.default_sample_flags; } else { trex_sample_flags = TRUE; @@ -3115,8 +3117,8 @@ gst_dash_demux_find_sync_samples (GstAdaptiveDemux * demux, #if 0 if (trun->flags & GST_TRUN_FLAGS_SAMPLE_DURATION_PRESENT) { sample_duration = sample->sample_duration; - } else if (traf-> - tfhd.flags & GST_TFHD_FLAGS_DEFAULT_SAMPLE_DURATION_PRESENT) { + } else if (traf->tfhd. + flags & GST_TFHD_FLAGS_DEFAULT_SAMPLE_DURATION_PRESENT) { sample_duration = traf->tfhd.default_sample_duration; } else { GST_FIXME_OBJECT (stream->pad, @@ -3129,8 +3131,8 @@ gst_dash_demux_find_sync_samples (GstAdaptiveDemux * demux, if (trun->flags & GST_TRUN_FLAGS_SAMPLE_SIZE_PRESENT) { prev_sample_end += sample->sample_size; - } else if (traf-> - tfhd.flags & GST_TFHD_FLAGS_DEFAULT_SAMPLE_SIZE_PRESENT) { + } else if (traf->tfhd. + flags & GST_TFHD_FLAGS_DEFAULT_SAMPLE_SIZE_PRESENT) { prev_sample_end += traf->tfhd.default_sample_size; } else { GST_FIXME_OBJECT (stream->pad, diff --git a/ext/dash/gstdashdemux.h b/ext/dash/gstdashdemux.h index ae22a19..43d0e83 100644 --- a/ext/dash/gstdashdemux.h +++ b/ext/dash/gstdashdemux.h @@ -125,7 +125,7 @@ struct _GstDashDemux GSList *next_periods; - GstMpdClient *client; /* MPD client */ + GstMPDClient *client; /* MPD client */ GMutex client_lock; GstDashDemuxClockDrift *clock_drift; diff --git a/ext/dash/gstmpdadaptationsetnode.c b/ext/dash/gstmpdadaptationsetnode.c new file mode 100644 index 0000000..a47bd91 --- /dev/null +++ b/ext/dash/gstmpdadaptationsetnode.c @@ -0,0 +1,127 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdadaptationsetnode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDAdaptationSetNode, gst_mpd_adaptation_set_node, + GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_adaptation_set_node_finalize (GObject * object) +{ + GstMPDAdaptationSetNode *self = GST_MPD_ADAPTATION_SET_NODE (object); + + if (self->lang) + xmlFree (self->lang); + if (self->contentType) + xmlFree (self->contentType); + g_slice_free (GstXMLRatio, self->par); + g_slice_free (GstXMLConditionalUintType, self->segmentAlignment); + g_slice_free (GstXMLConditionalUintType, self->subsegmentAlignment); + g_list_free_full (self->Accessibility, + (GDestroyNotify) gst_mpd_helper_descriptor_type_free); + g_list_free_full (self->Role, + (GDestroyNotify) gst_mpd_helper_descriptor_type_free); + g_list_free_full (self->Rating, + (GDestroyNotify) gst_mpd_helper_descriptor_type_free); + g_list_free_full (self->Viewpoint, + (GDestroyNotify) gst_mpd_helper_descriptor_type_free); + gst_mpd_helper_representation_base_type_free (self->RepresentationBase); + gst_mpd_helper_segment_base_type_free (self->SegmentBase); + gst_mpd_segment_list_node_free (self->SegmentList); + gst_mpd_segment_template_node_free (self->SegmentTemplate); + g_list_free_full (self->BaseURLs, (GDestroyNotify) gst_mpd_baseurl_node_free); + g_list_free_full (self->Representations, + (GDestroyNotify) gst_mpd_representation_node_free); + g_list_free_full (self->ContentComponents, + (GDestroyNotify) gst_mpd_content_component_node_free); + if (self->xlink_href) + xmlFree (self->xlink_href); + + G_OBJECT_CLASS (gst_mpd_adaptation_set_node_parent_class)->finalize (object); +} + +static void +gst_mpd_adaptation_set_node_class_init (GstMPDAdaptationSetNodeClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_adaptation_set_node_finalize; +} + +static void +gst_mpd_adaptation_set_node_init (GstMPDAdaptationSetNode * self) +{ + self->id = 0; + self->group = 0; + self->lang = NULL; /* LangVectorType RFC 5646 */ + self->contentType = NULL; + self->par = 0; + self->minBandwidth = 0; + self->maxBandwidth = 0; + self->minWidth = 0; + self->maxWidth = 0; + self->minHeight = 0; + self->maxHeight = 0; + self->segmentAlignment = NULL; + self->subsegmentAlignment = NULL; + self->subsegmentStartsWithSAP = GST_SAP_TYPE_0; + self->bitstreamSwitching = FALSE; + /* list of Accessibility DescriptorType nodes */ + self->Accessibility = NULL; + /* list of Role DescriptorType nodes */ + self->Role = NULL; + /* list of Rating DescriptorType nodes */ + self->Rating = NULL; + /* list of Viewpoint DescriptorType nodes */ + self->Viewpoint = NULL; + /* RepresentationBase extension */ + self->RepresentationBase = NULL; + /* SegmentBase node */ + self->SegmentBase = NULL; + /* SegmentList node */ + self->SegmentList = NULL; + /* SegmentTemplate node */ + self->SegmentTemplate = NULL; + /* list of BaseURL nodes */ + self->BaseURLs = NULL; + /* list of Representation nodes */ + self->Representations = NULL; + /* list of ContentComponent nodes */ + self->ContentComponents = NULL; + + self->xlink_href = NULL; + self->actuate = GST_MPD_XLINK_ACTUATE_ON_REQUEST; +} + +GstMPDAdaptationSetNode * +gst_mpd_adaptation_set_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_ADAPTATION_SET_NODE, NULL); +} + +void +gst_mpd_adaptation_set_node_free (GstMPDAdaptationSetNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdadaptationsetnode.h b/ext/dash/gstmpdadaptationsetnode.h new file mode 100644 index 0000000..1a0977f --- /dev/null +++ b/ext/dash/gstmpdadaptationsetnode.h @@ -0,0 +1,104 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDADAPTATIONSETNODE_H__ +#define __GSTMPDADAPTATIONSETNODE_H__ + +#include +#include "gstmpdhelper.h" +#include "gstmpdsegmentlistnode.h" +#include "gstmpdsegmenttemplatenode.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_ADAPTATION_SET_NODE gst_mpd_adaptation_set_node_get_type () +#define GST_MPD_ADAPTATION_SET_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_ADAPTATION_SET_NODE, GstMPDAdaptationSetNode)) +#define GST_MPD_ADAPTATION_SET_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_ADAPTATION_SET_NODE, GstMPDAdaptationSetNodeClass)) +#define GST_IS_MPD_ADAPTATION_SET_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_ADAPTATION_SET_NODE)) +#define GST_IS_MPD_ADAPTATION_SET_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_ADAPTATION_SET_NODE)) +#define GST_MPD_ADAPTATION_SET_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_ADAPTATION_SET_NODE, GstMPDAdaptationSetNodeClass)) + +typedef struct _GstMPDAdaptationSetNode GstMPDAdaptationSetNode; +typedef struct _GstMPDAdaptationSetNodeClass GstMPDAdaptationSetNodeClass; + + +struct _GstMPDAdaptationSetNode +{ + GstObject parent_instance; + guint id; + guint group; + gchar *lang; /* LangVectorType RFC 5646 */ + gchar *contentType; + GstXMLRatio *par; + guint minBandwidth; + guint maxBandwidth; + guint minWidth; + guint maxWidth; + guint minHeight; + guint maxHeight; + GstXMLConditionalUintType *segmentAlignment; + GstXMLConditionalUintType *subsegmentAlignment; + GstMPDSAPType subsegmentStartsWithSAP; + gboolean bitstreamSwitching; + /* list of Accessibility DescriptorType nodes */ + GList *Accessibility; + /* list of Role DescriptorType nodes */ + GList *Role; + /* list of Rating DescriptorType nodes */ + GList *Rating; + /* list of Viewpoint DescriptorType nodes */ + GList *Viewpoint; + /* RepresentationBase extension */ + GstMPDRepresentationBaseType *RepresentationBase; + /* SegmentBase node */ + GstMPDSegmentBaseType *SegmentBase; + /* SegmentList node */ + GstMPDSegmentListNode *SegmentList; + /* SegmentTemplate node */ + GstMPDSegmentTemplateNode *SegmentTemplate; + /* list of BaseURL nodes */ + GList *BaseURLs; + /* list of Representation nodes */ + GList *Representations; + /* list of ContentComponent nodes */ + GList *ContentComponents; + + gchar *xlink_href; + GstMPDXLinkActuate actuate; +}; + +struct _GstMPDAdaptationSetNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_adaptation_set_node_get_type (void); + +GstMPDAdaptationSetNode * gst_mpd_adaptation_set_node_new (void); +void gst_mpd_adaptation_set_node_free (GstMPDAdaptationSetNode* self); + +G_END_DECLS + +#endif /* __GSTMPDADAPTATIONSETNODE_H__ */ diff --git a/ext/dash/gstmpdbaseurlnode.c b/ext/dash/gstmpdbaseurlnode.c new file mode 100644 index 0000000..4e5f89e --- /dev/null +++ b/ext/dash/gstmpdbaseurlnode.c @@ -0,0 +1,66 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdbaseurlnode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDBaseURLNode, gst_mpd_baseurl_node, GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_baseurl_node_finalize (GObject * object) +{ + GstMPDBaseURLNode *self = GST_MPD_BASEURL_NODE (object); + + g_free (self->baseURL); + g_free (self->serviceLocation); + g_free (self->byteRange); + + G_OBJECT_CLASS (gst_mpd_baseurl_node_parent_class)->finalize (object); +} + +static void +gst_mpd_baseurl_node_class_init (GstMPDBaseURLNodeClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_baseurl_node_finalize; +} + +static void +gst_mpd_baseurl_node_init (GstMPDBaseURLNode * self) +{ + self->baseURL = NULL; + self->serviceLocation = NULL; + self->byteRange = NULL; +} + +GstMPDBaseURLNode * +gst_mpd_baseurl_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_BASEURL_NODE, NULL); +} + +void +gst_mpd_baseurl_node_free (GstMPDBaseURLNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdbaseurlnode.h b/ext/dash/gstmpdbaseurlnode.h new file mode 100644 index 0000000..be28dc8 --- /dev/null +++ b/ext/dash/gstmpdbaseurlnode.h @@ -0,0 +1,66 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDBASEURLNODE_H__ +#define __GSTMPDBASEURLNODE_H__ + +#include +#include "gstmpdhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_BASEURL_NODE gst_mpd_baseurl_node_get_type () +#define GST_MPD_BASEURL_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_BASEURL_NODE, GstMPDBaseURLNode)) +#define GST_MPD_BASEURL_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_BASEURL_NODE, GstMPDBaseURLNodeClass)) +#define GST_IS_MPD_BASEURL_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_BASEURL_NODE)) +#define GST_IS_MPD_BASEURL_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_BASEURL_NODE)) +#define GST_MPD_BASEURL_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_BASEURL_NODE, GstMPDBaseURLNodeClass)) + +typedef struct _GstMPDBaseURLNode GstMPDBaseURLNode; +typedef struct _GstMPDBaseURLNodeClass GstMPDBaseURLNodeClass; + + +struct _GstMPDBaseURLNode +{ + GstObject parent_instance; + gchar *baseURL; + gchar *serviceLocation; + gchar *byteRange; + /* TODO add missing fields such as weight etc.*/ +}; + +struct _GstMPDBaseURLNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_baseurl_node_get_type (void); + +GstMPDBaseURLNode * gst_mpd_baseurl_node_new (void); +void gst_mpd_baseurl_node_free (GstMPDBaseURLNode* self); + +G_END_DECLS + +#endif /* __GSTMPDBASEURLNODE_H__ */ diff --git a/ext/dash/gstmpdclient.c b/ext/dash/gstmpdclient.c index a4015d8..b2fdea9 100644 --- a/ext/dash/gstmpdclient.c +++ b/ext/dash/gstmpdclient.c @@ -26,40 +26,40 @@ GST_DEBUG_CATEGORY_STATIC (gst_dash_mpd_client_debug); #undef GST_CAT_DEFAULT #define GST_CAT_DEFAULT gst_dash_mpd_client_debug - -static GstSegmentBaseType *gst_mpd_client_get_segment_base (GstPeriodNode * - Period, GstAdaptationSetNode * AdaptationSet, - GstRepresentationNode * Representation); -static GstSegmentListNode *gst_mpd_client_get_segment_list (GstMpdClient * - client, GstPeriodNode * Period, GstAdaptationSetNode * AdaptationSet, - GstRepresentationNode * Representation); +G_DEFINE_TYPE (GstMPDClient, gst_mpd_client, GST_TYPE_OBJECT); + +static GstMPDSegmentBaseType *gst_mpd_client_get_segment_base (GstMPDPeriodNode + * Period, GstMPDAdaptationSetNode * AdaptationSet, + GstMPDRepresentationNode * Representation); +static GstMPDSegmentListNode *gst_mpd_client_get_segment_list (GstMPDClient * + client, GstMPDPeriodNode * Period, GstMPDAdaptationSetNode * AdaptationSet, + GstMPDRepresentationNode * Representation); /* Segments */ -static guint gst_mpd_client_get_segments_counts (GstMpdClient * client, +static guint gst_mpd_client_get_segments_counts (GstMPDClient * client, GstActiveStream * stream); -static GList *gst_mpd_client_fetch_external_periods (GstMpdClient * client, - GstPeriodNode * period_node); -static GList *gst_mpd_client_fetch_external_adaptation_set (GstMpdClient * - client, GstPeriodNode * period, GstAdaptationSetNode * adapt_set); +static GList *gst_mpd_client_fetch_external_periods (GstMPDClient * client, + GstMPDPeriodNode * period_node); +static GList *gst_mpd_client_fetch_external_adaptation_set (GstMPDClient * + client, GstMPDPeriodNode * period, GstMPDAdaptationSetNode * adapt_set); -static GstRepresentationNode *gst_mpd_client_get_lowest_representation (GList * - Representations); -static GstStreamPeriod *gst_mpd_client_get_stream_period (GstMpdClient * +static GstMPDRepresentationNode *gst_mpd_client_get_lowest_representation (GList + * Representations); +static GstStreamPeriod *gst_mpd_client_get_stream_period (GstMPDClient * client); - -static GstRepresentationNode * +static GstMPDRepresentationNode * gst_mpd_client_get_lowest_representation (GList * Representations) { GList *list = NULL; - GstRepresentationNode *rep = NULL; - GstRepresentationNode *lowest = NULL; + GstMPDRepresentationNode *rep = NULL; + GstMPDRepresentationNode *lowest = NULL; if (Representations == NULL) return NULL; for (list = g_list_first (Representations); list; list = g_list_next (list)) { - rep = (GstRepresentationNode *) list->data; + rep = (GstMPDRepresentationNode *) list->data; if (rep && (!lowest || rep->bandwidth < lowest->bandwidth)) { lowest = rep; } @@ -69,7 +69,7 @@ gst_mpd_client_get_lowest_representation (GList * Representations) } #if 0 -static GstRepresentationNode * +static GstMPDRepresentationNode * gst_mpdparser_get_highest_representation (GList * Representations) { GList *list = NULL; @@ -79,15 +79,15 @@ gst_mpdparser_get_highest_representation (GList * Representations) list = g_list_last (Representations); - return list ? (GstRepresentationNode *) list->data : NULL; + return list ? (GstMPDRepresentationNode *) list->data : NULL; } -static GstRepresentationNode * +static GstMPDRepresentationNode * gst_mpdparser_get_representation_with_max_bandwidth (GList * Representations, gint max_bandwidth) { GList *list = NULL; - GstRepresentationNode *representation, *best_rep = NULL; + GstMPDRepresentationNode *representation, *best_rep = NULL; if (Representations == NULL) return NULL; @@ -96,7 +96,7 @@ gst_mpdparser_get_representation_with_max_bandwidth (GList * Representations, return gst_mpdparser_get_highest_representation (Representations); for (list = g_list_first (Representations); list; list = g_list_next (list)) { - representation = (GstRepresentationNode *) list->data; + representation = (GstMPDRepresentationNode *) list->data; if (representation && representation->bandwidth <= max_bandwidth) { best_rep = representation; } @@ -106,12 +106,12 @@ gst_mpdparser_get_representation_with_max_bandwidth (GList * Representations, } #endif -static GstSegmentListNode * -gst_mpd_client_fetch_external_segment_list (GstMpdClient * client, - GstPeriodNode * Period, - GstAdaptationSetNode * AdaptationSet, - GstRepresentationNode * Representation, - GstSegmentListNode * parent, GstSegmentListNode * segment_list) +static GstMPDSegmentListNode * +gst_mpd_client_fetch_external_segment_list (GstMPDClient * client, + GstMPDPeriodNode * Period, + GstMPDAdaptationSetNode * AdaptationSet, + GstMPDRepresentationNode * Representation, + GstMPDSegmentListNode * parent, GstMPDSegmentListNode * segment_list) { GstFragment *download; GstBuffer *segment_list_buffer = NULL; @@ -121,7 +121,7 @@ gst_mpd_client_fetch_external_segment_list (GstMpdClient * client, GstUri *base_uri, *uri; gchar *query = NULL; gchar *uri_string; - GstSegmentListNode *new_segment_list = NULL; + GstMPDSegmentListNode *new_segment_list = NULL; /* ISO/IEC 23009-1:2014 5.5.3 4) * Remove nodes that resolve to nothing when resolving @@ -139,22 +139,29 @@ gst_mpd_client_fetch_external_segment_list (GstMpdClient * client, /* Get base URI at the MPD level */ base_uri = - gst_uri_from_string (client-> - mpd_base_uri ? client->mpd_base_uri : client->mpd_uri); + gst_uri_from_string (client->mpd_base_uri ? client-> + mpd_base_uri : client->mpd_uri); /* combine a BaseURL at the MPD level with the current base url */ - base_uri = combine_urls (base_uri, client->mpd_node->BaseURLs, &query, 0); + base_uri = + gst_mpd_helper_combine_urls (base_uri, client->mpd_root_node->BaseURLs, + &query, 0); /* combine a BaseURL at the Period level with the current base url */ - base_uri = combine_urls (base_uri, Period->BaseURLs, &query, 0); + base_uri = + gst_mpd_helper_combine_urls (base_uri, Period->BaseURLs, &query, 0); if (AdaptationSet) { /* combine a BaseURL at the AdaptationSet level with the current base url */ - base_uri = combine_urls (base_uri, AdaptationSet->BaseURLs, &query, 0); + base_uri = + gst_mpd_helper_combine_urls (base_uri, AdaptationSet->BaseURLs, &query, + 0); if (Representation) { /* combine a BaseURL at the Representation level with the current base url */ - base_uri = combine_urls (base_uri, Representation->BaseURLs, &query, 0); + base_uri = + gst_mpd_helper_combine_urls (base_uri, Representation->BaseURLs, + &query, 0); } } @@ -195,12 +202,12 @@ gst_mpd_client_fetch_external_segment_list (GstMpdClient * client, return new_segment_list; } -static GstSegmentBaseType * -gst_mpd_client_get_segment_base (GstPeriodNode * Period, - GstAdaptationSetNode * AdaptationSet, - GstRepresentationNode * Representation) +static GstMPDSegmentBaseType * +gst_mpd_client_get_segment_base (GstMPDPeriodNode * Period, + GstMPDAdaptationSetNode * AdaptationSet, + GstMPDRepresentationNode * Representation) { - GstSegmentBaseType *SegmentBase = NULL; + GstMPDSegmentBaseType *SegmentBase = NULL; if (Representation && Representation->SegmentBase) { SegmentBase = Representation->SegmentBase; @@ -229,13 +236,13 @@ gst_mpd_client_get_segment_base (GstPeriodNode * Period, return SegmentBase; } -static GstSegmentListNode * -gst_mpd_client_get_segment_list (GstMpdClient * client, GstPeriodNode * Period, - GstAdaptationSetNode * AdaptationSet, - GstRepresentationNode * Representation) +static GstMPDSegmentListNode * +gst_mpd_client_get_segment_list (GstMPDClient * client, + GstMPDPeriodNode * Period, GstMPDAdaptationSetNode * AdaptationSet, + GstMPDRepresentationNode * Representation) { - GstSegmentListNode **SegmentList; - GstSegmentListNode *ParentSegmentList = NULL; + GstMPDSegmentListNode **SegmentList; + GstMPDSegmentListNode *ParentSegmentList = NULL; if (Representation && Representation->SegmentList) { SegmentList = &Representation->SegmentList; @@ -252,7 +259,7 @@ gst_mpd_client_get_segment_list (GstMpdClient * client, GstPeriodNode * Period, /* Resolve external segment list here. */ if (*SegmentList && (*SegmentList)->xlink_href) { - GstSegmentListNode *new_segment_list; + GstMPDSegmentListNode *new_segment_list; /* TODO: Use SegmentList of parent if * - Parent has its own SegmentList @@ -262,7 +269,7 @@ gst_mpd_client_get_segment_list (GstMpdClient * client, GstPeriodNode * Period, gst_mpd_client_fetch_external_segment_list (client, Period, AdaptationSet, Representation, ParentSegmentList, *SegmentList); - gst_mpdparser_free_segment_list_node (*SegmentList); + gst_mpd_segment_list_node_free (*SegmentList); *SegmentList = new_segment_list; } @@ -270,11 +277,11 @@ gst_mpd_client_get_segment_list (GstMpdClient * client, GstPeriodNode * Period, } static GstClockTime -gst_mpd_client_get_segment_duration (GstMpdClient * client, +gst_mpd_client_get_segment_duration (GstMPDClient * client, GstActiveStream * stream, guint64 * scale_dur) { GstStreamPeriod *stream_period; - GstMultSegmentBaseType *base = NULL; + GstMPDMultSegmentBaseType *base = NULL; GstClockTime duration = 0; g_return_val_if_fail (stream != NULL, GST_CLOCK_TIME_NONE); @@ -303,20 +310,8 @@ gst_mpd_client_get_segment_duration (GstMpdClient * client, return duration; } - -GstMpdClient * -gst_mpd_client_new (void) -{ - GstMpdClient *client; - GST_DEBUG_CATEGORY_INIT (gst_dash_mpd_client_debug, "dashmpdclient", 0, - "DashmMpdClient"); - client = g_new0 (GstMpdClient, 1); - - return client; -} - void -gst_mpd_client_active_streams_free (GstMpdClient * client) +gst_mpd_client_active_streams_free (GstMPDClient * client) { if (client->active_streams) { g_list_foreach (client->active_streams, @@ -326,13 +321,13 @@ gst_mpd_client_active_streams_free (GstMpdClient * client) } } -void -gst_mpd_client_free (GstMpdClient * client) +static void +gst_mpd_client_finalize (GObject * object) { - g_return_if_fail (client != NULL); + GstMPDClient *client = GST_MPD_CLIENT (object); - if (client->mpd_node) - gst_mpdparser_free_mpd_node (client->mpd_node); + if (client->mpd_root_node) + gst_mpd_root_node_free (client->mpd_root_node); if (client->periods) { g_list_free_full (client->periods, @@ -350,16 +345,43 @@ gst_mpd_client_free (GstMpdClient * client) gst_object_unref (client->downloader); client->downloader = NULL; - g_free (client); + G_OBJECT_CLASS (gst_mpd_client_parent_class)->finalize (object); +} + +static void +gst_mpd_client_class_init (GstMPDClientClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_client_finalize; +} + +static void +gst_mpd_client_init (GstMPDClient * client) +{ +} + +GstMPDClient * +gst_mpd_client_new (void) +{ + GST_DEBUG_CATEGORY_INIT (gst_dash_mpd_client_debug, "dashmpdclient", 0, + "DashmMpdClient"); + return g_object_new (GST_TYPE_MPD_CLIENT, NULL); +} + +void +gst_mpd_client_free (GstMPDClient * client) +{ + if (client) + gst_object_unref (client); } gboolean -gst_mpd_client_parse (GstMpdClient * client, const gchar * data, gint size) +gst_mpd_client_parse (GstMPDClient * client, const gchar * data, gint size) { gboolean ret = FALSE; - ret = gst_mpdparser_get_mpd_node (&client->mpd_node, data, size); + ret = gst_mpdparser_get_mpd_root_node (&client->mpd_root_node, data, size); if (ret) { gst_mpd_client_check_profiles (client); @@ -370,21 +392,21 @@ gst_mpd_client_parse (GstMpdClient * client, const gchar * data, gint size) } GstDateTime * -gst_mpd_client_get_availability_start_time (GstMpdClient * client) +gst_mpd_client_get_availability_start_time (GstMPDClient * client) { GstDateTime *start_time; if (client == NULL) return (GstDateTime *) NULL; - start_time = client->mpd_node->availabilityStartTime; + start_time = client->mpd_root_node->availabilityStartTime; if (start_time) gst_date_time_ref (start_time); return start_time; } void -gst_mpd_client_set_uri_downloader (GstMpdClient * client, +gst_mpd_client_set_uri_downloader (GstMPDClient * client, GstUriDownloader * downloader) { if (client->downloader) @@ -393,15 +415,16 @@ gst_mpd_client_set_uri_downloader (GstMpdClient * client, } void -gst_mpd_client_check_profiles (GstMpdClient * client) +gst_mpd_client_check_profiles (GstMPDClient * client) { GST_DEBUG ("Profiles: %s", - client->mpd_node->profiles ? client->mpd_node->profiles : ""); + client->mpd_root_node->profiles ? client->mpd_root_node-> + profiles : ""); - if (!client->mpd_node->profiles) + if (!client->mpd_root_node->profiles) return; - if (g_strstr_len (client->mpd_node->profiles, -1, + if (g_strstr_len (client->mpd_root_node->profiles, -1, "urn:mpeg:dash:profile:isoff-on-demand:2011")) { client->profile_isoff_ondemand = TRUE; GST_DEBUG ("Found ISOFF on demand profile (2011)"); @@ -409,34 +432,34 @@ gst_mpd_client_check_profiles (GstMpdClient * client) } void -gst_mpd_client_fetch_on_load_external_resources (GstMpdClient * client) +gst_mpd_client_fetch_on_load_external_resources (GstMPDClient * client) { GList *l; - for (l = client->mpd_node->Periods; l; /* explicitly advanced below */ ) { - GstPeriodNode *period = l->data; + for (l = client->mpd_root_node->Periods; l; /* explicitly advanced below */ ) { + GstMPDPeriodNode *period = l->data; GList *m; - if (period->xlink_href && period->actuate == GST_XLINK_ACTUATE_ON_LOAD) { + if (period->xlink_href && period->actuate == GST_MPD_XLINK_ACTUATE_ON_LOAD) { GList *new_periods, *prev, *next; new_periods = gst_mpd_client_fetch_external_periods (client, period); prev = l->prev; - client->mpd_node->Periods = - g_list_delete_link (client->mpd_node->Periods, l); - gst_mpdparser_free_period_node (period); + client->mpd_root_node->Periods = + g_list_delete_link (client->mpd_root_node->Periods, l); + gst_mpd_period_node_free (period); period = NULL; /* Get new next node, we will insert before this */ if (prev) next = prev->next; else - next = client->mpd_node->Periods; + next = client->mpd_root_node->Periods; while (new_periods) { - client->mpd_node->Periods = - g_list_insert_before (client->mpd_node->Periods, next, + client->mpd_root_node->Periods = + g_list_insert_before (client->mpd_root_node->Periods, next, new_periods->data); new_periods = g_list_delete_link (new_periods, new_periods); } @@ -446,29 +469,29 @@ gst_mpd_client_fetch_on_load_external_resources (GstMpdClient * client) if (prev) l = prev->next; else - l = client->mpd_node->Periods; + l = client->mpd_root_node->Periods; continue; } if (period->SegmentList && period->SegmentList->xlink_href - && period->SegmentList->actuate == GST_XLINK_ACTUATE_ON_LOAD) { - GstSegmentListNode *new_segment_list; + && period->SegmentList->actuate == GST_MPD_XLINK_ACTUATE_ON_LOAD) { + GstMPDSegmentListNode *new_segment_list; new_segment_list = gst_mpd_client_fetch_external_segment_list (client, period, NULL, NULL, NULL, period->SegmentList); - gst_mpdparser_free_segment_list_node (period->SegmentList); + gst_mpd_segment_list_node_free (period->SegmentList); period->SegmentList = new_segment_list; } for (m = period->AdaptationSets; m; /* explicitly advanced below */ ) { - GstAdaptationSetNode *adapt_set = m->data; + GstMPDAdaptationSetNode *adapt_set = m->data; GList *n; if (adapt_set->xlink_href - && adapt_set->actuate == GST_XLINK_ACTUATE_ON_LOAD) { + && adapt_set->actuate == GST_MPD_XLINK_ACTUATE_ON_LOAD) { GList *new_adapt_sets, *prev, *next; new_adapt_sets = @@ -477,7 +500,7 @@ gst_mpd_client_fetch_on_load_external_resources (GstMpdClient * client) prev = m->prev; period->AdaptationSets = g_list_delete_link (period->AdaptationSets, m); - gst_mpdparser_free_adaptation_set_node (adapt_set); + gst_mpd_adaptation_set_node_free (adapt_set); adapt_set = NULL; /* Get new next node, we will insert before this */ @@ -504,33 +527,33 @@ gst_mpd_client_fetch_on_load_external_resources (GstMpdClient * client) } if (adapt_set->SegmentList && adapt_set->SegmentList->xlink_href - && adapt_set->SegmentList->actuate == GST_XLINK_ACTUATE_ON_LOAD) { - GstSegmentListNode *new_segment_list; + && adapt_set->SegmentList->actuate == GST_MPD_XLINK_ACTUATE_ON_LOAD) { + GstMPDSegmentListNode *new_segment_list; new_segment_list = gst_mpd_client_fetch_external_segment_list (client, period, adapt_set, NULL, period->SegmentList, adapt_set->SegmentList); - gst_mpdparser_free_segment_list_node (adapt_set->SegmentList); + gst_mpd_segment_list_node_free (adapt_set->SegmentList); adapt_set->SegmentList = new_segment_list; } for (n = adapt_set->Representations; n; n = n->next) { - GstRepresentationNode *representation = n->data; + GstMPDRepresentationNode *representation = n->data; if (representation->SegmentList && representation->SegmentList->xlink_href && representation->SegmentList->actuate == - GST_XLINK_ACTUATE_ON_LOAD) { + GST_MPD_XLINK_ACTUATE_ON_LOAD) { - GstSegmentListNode *new_segment_list; + GstMPDSegmentListNode *new_segment_list; new_segment_list = gst_mpd_client_fetch_external_segment_list (client, period, adapt_set, representation, adapt_set->SegmentList, representation->SegmentList); - gst_mpdparser_free_segment_list_node (representation->SegmentList); + gst_mpd_segment_list_node_free (representation->SegmentList); representation->SegmentList = new_segment_list; } @@ -545,7 +568,7 @@ gst_mpd_client_fetch_on_load_external_resources (GstMpdClient * client) static GstStreamPeriod * -gst_mpd_client_get_stream_period (GstMpdClient * client) +gst_mpd_client_get_stream_period (GstMPDClient * client) { g_return_val_if_fail (client != NULL, NULL); g_return_val_if_fail (client->periods != NULL, NULL); @@ -554,7 +577,7 @@ gst_mpd_client_get_stream_period (GstMpdClient * client) } const gchar * -gst_mpd_client_get_baseURL (GstMpdClient * client, guint indexStream) +gst_mpd_client_get_baseURL (GstMPDClient * client, guint indexStream) { GstActiveStream *stream; @@ -568,7 +591,7 @@ gst_mpd_client_get_baseURL (GstMpdClient * client, guint indexStream) /* select a stream and extract the baseURL (if present) */ gchar * -gst_mpd_client_parse_baseURL (GstMpdClient * client, GstActiveStream * stream, +gst_mpd_client_parse_baseURL (GstMPDClient * client, GstActiveStream * stream, gchar ** query) { GstStreamPeriod *stream_period; @@ -587,30 +610,30 @@ gst_mpd_client_parse_baseURL (GstMpdClient * client, GstActiveStream * stream, /* initialise base url */ abs_url = - gst_uri_from_string (client-> - mpd_base_uri ? client->mpd_base_uri : client->mpd_uri); + gst_uri_from_string (client->mpd_base_uri ? client-> + mpd_base_uri : client->mpd_uri); /* combine a BaseURL at the MPD level with the current base url */ abs_url = - combine_urls (abs_url, client->mpd_node->BaseURLs, query, - stream->baseURL_idx); + gst_mpd_helper_combine_urls (abs_url, client->mpd_root_node->BaseURLs, + query, stream->baseURL_idx); /* combine a BaseURL at the Period level with the current base url */ abs_url = - combine_urls (abs_url, stream_period->period->BaseURLs, query, - stream->baseURL_idx); + gst_mpd_helper_combine_urls (abs_url, stream_period->period->BaseURLs, + query, stream->baseURL_idx); GST_DEBUG ("Current adaptation set id %i (%s)", stream->cur_adapt_set->id, stream->cur_adapt_set->contentType); /* combine a BaseURL at the AdaptationSet level with the current base url */ abs_url = - combine_urls (abs_url, stream->cur_adapt_set->BaseURLs, query, - stream->baseURL_idx); + gst_mpd_helper_combine_urls (abs_url, stream->cur_adapt_set->BaseURLs, + query, stream->baseURL_idx); /* combine a BaseURL at the Representation level with the current base url */ abs_url = - combine_urls (abs_url, stream->cur_representation->BaseURLs, query, - stream->baseURL_idx); + gst_mpd_helper_combine_urls (abs_url, + stream->cur_representation->BaseURLs, query, stream->baseURL_idx); ret = gst_uri_to_string (abs_url); gst_uri_unref (abs_url); @@ -619,7 +642,7 @@ gst_mpd_client_parse_baseURL (GstMpdClient * client, GstActiveStream * stream, } static GstClockTime -gst_mpd_client_get_segment_end_time (GstMpdClient * client, +gst_mpd_client_get_segment_end_time (GstMPDClient * client, GPtrArray * segments, const GstMediaSegment * segment, gint index) { const GstStreamPeriod *stream_period; @@ -641,7 +664,7 @@ gst_mpd_client_get_segment_end_time (GstMpdClient * client, static gboolean gst_mpd_client_add_media_segment (GstActiveStream * stream, - GstSegmentURLNode * url_node, guint number, gint repeat, + GstMPDSegmentURLNode * url_node, guint number, gint repeat, guint64 scale_start, guint64 scale_duration, GstClockTime start, GstClockTime duration) { @@ -669,10 +692,10 @@ gst_mpd_client_add_media_segment (GstActiveStream * stream, } static void -gst_mpd_client_stream_update_presentation_time_offset (GstMpdClient * client, +gst_mpd_client_stream_update_presentation_time_offset (GstMPDClient * client, GstActiveStream * stream) { - GstSegmentBaseType *segbase = NULL; + GstMPDSegmentBaseType *segbase = NULL; /* Find the used segbase */ if (stream->cur_segment_list) { @@ -697,8 +720,8 @@ gst_mpd_client_stream_update_presentation_time_offset (GstMpdClient * client, } gboolean -gst_mpd_client_setup_representation (GstMpdClient * client, - GstActiveStream * stream, GstRepresentationNode * representation) +gst_mpd_client_setup_representation (GstMPDClient * client, + GstActiveStream * stream, GstMPDRepresentationNode * representation) { GstStreamPeriod *stream_period; GList *rep_list; @@ -775,11 +798,11 @@ gst_mpd_client_setup_representation (GstMpdClient * client, GST_LOG ("Building media segment list using a SegmentList node"); if (stream->cur_segment_list->MultSegBaseType->SegmentTimeline) { - GstSegmentTimelineNode *timeline; - GstSNode *S; + GstMPDSegmentTimelineNode *timeline; + GstMPDSNode *S; GList *list; GstClockTime presentationTimeOffset; - GstSegmentBaseType *segbase; + GstMPDSegmentBaseType *segbase; segbase = stream->cur_segment_list->MultSegBaseType->SegBaseType; presentationTimeOffset = @@ -793,7 +816,7 @@ gst_mpd_client_setup_representation (GstMpdClient * client, list = g_list_next (list)) { guint timescale; - S = (GstSNode *) list->data; + S = (GstMPDSNode *) list->data; GST_LOG ("Processing S node: d=%" G_GUINT64_FORMAT " r=%d t=%" G_GUINT64_FORMAT, S->d, S->r, S->t); timescale = @@ -861,7 +884,7 @@ gst_mpd_client_setup_representation (GstMpdClient * client, } } else { GstClockTime presentationTimeOffset; - GstMultSegmentBaseType *mult_seg = + GstMPDMultSegmentBaseType *mult_seg = stream->cur_seg_template->MultSegBaseType; presentationTimeOffset = gst_util_uint64_scale (mult_seg->SegBaseType->presentationTimeOffset, @@ -877,8 +900,8 @@ gst_mpd_client_setup_representation (GstMpdClient * client, stream->cur_seg_template->media); if (mult_seg->SegmentTimeline) { - GstSegmentTimelineNode *timeline; - GstSNode *S; + GstMPDSegmentTimelineNode *timeline; + GstMPDSNode *S; GList *list; timeline = mult_seg->SegmentTimeline; @@ -887,7 +910,7 @@ gst_mpd_client_setup_representation (GstMpdClient * client, list = g_list_next (list)) { guint timescale; - S = (GstSNode *) list->data; + S = (GstMPDSNode *) list->data; GST_LOG ("Processing S node: d=%" G_GUINT64_FORMAT " r=%u t=%" G_GUINT64_FORMAT, S->d, S->r, S->t); timescale = mult_seg->SegBaseType->timescale; @@ -973,8 +996,8 @@ gst_mpd_client_setup_representation (GstMpdClient * client, #define CUSTOM_WRAPPER_END "" static GList * -gst_mpd_client_fetch_external_periods (GstMpdClient * client, - GstPeriodNode * period_node) +gst_mpd_client_fetch_external_periods (GstMPDClient * client, + GstMPDPeriodNode * period_node) { GstFragment *download; GstAdapter *adapter; @@ -1003,11 +1026,13 @@ gst_mpd_client_fetch_external_periods (GstMpdClient * client, /* Get base URI at the MPD level */ base_uri = - gst_uri_from_string (client-> - mpd_base_uri ? client->mpd_base_uri : client->mpd_uri); + gst_uri_from_string (client->mpd_base_uri ? client-> + mpd_base_uri : client->mpd_uri); /* combine a BaseURL at the MPD level with the current base url */ - base_uri = combine_urls (base_uri, client->mpd_node->BaseURLs, &query, 0); + base_uri = + gst_mpd_helper_combine_urls (base_uri, client->mpd_root_node->BaseURLs, + &query, 0); uri = gst_uri_from_string_with_base (base_uri, period_node->xlink_href); if (query) gst_uri_set_query_string (uri, query); @@ -1061,7 +1086,7 @@ gst_mpd_client_fetch_external_periods (GstMpdClient * client, } gboolean -gst_mpd_client_setup_media_presentation (GstMpdClient * client, +gst_mpd_client_setup_media_presentation (GstMPDClient * client, GstClockTime time, gint period_idx, const gchar * period_id) { GstStreamPeriod *stream_period; @@ -1071,7 +1096,7 @@ gst_mpd_client_setup_media_presentation (GstMpdClient * client, gboolean ret = FALSE; g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (client->mpd_node != NULL, FALSE); + g_return_val_if_fail (client->mpd_root_node != NULL, FALSE); /* Check if we set up the media presentation far enough already */ for (list = client->periods; list; list = list->next) { @@ -1108,15 +1133,16 @@ gst_mpd_client_setup_media_presentation (GstMpdClient * client, start = 0; duration = GST_CLOCK_TIME_NONE; - if (client->mpd_node->mediaPresentationDuration <= 0 && - client->mpd_node->mediaPresentationDuration != -1) { + if (client->mpd_root_node->mediaPresentationDuration <= 0 && + client->mpd_root_node->mediaPresentationDuration != -1) { /* Invalid MPD file: MPD duration is negative or zero */ goto syntax_error; } - for (list = client->mpd_node->Periods; list; /* explicitly advanced below */ ) { - GstPeriodNode *period_node = list->data; - GstPeriodNode *next_period_node = NULL; + for (list = client->mpd_root_node->Periods; list; + /* explicitly advanced below */ ) { + GstMPDPeriodNode *period_node = list->data; + GstMPDPeriodNode *next_period_node = NULL; /* Download external period */ if (period_node->xlink_href) { @@ -1126,20 +1152,20 @@ gst_mpd_client_setup_media_presentation (GstMpdClient * client, new_periods = gst_mpd_client_fetch_external_periods (client, period_node); prev = list->prev; - client->mpd_node->Periods = - g_list_delete_link (client->mpd_node->Periods, list); - gst_mpdparser_free_period_node (period_node); + client->mpd_root_node->Periods = + g_list_delete_link (client->mpd_root_node->Periods, list); + gst_mpd_period_node_free (period_node); period_node = NULL; /* Get new next node, we will insert before this */ if (prev) next = prev->next; else - next = client->mpd_node->Periods; + next = client->mpd_root_node->Periods; while (new_periods) { - client->mpd_node->Periods = - g_list_insert_before (client->mpd_node->Periods, next, + client->mpd_root_node->Periods = + g_list_insert_before (client->mpd_root_node->Periods, next, new_periods->data); new_periods = g_list_delete_link (new_periods, new_periods); } @@ -1149,7 +1175,7 @@ gst_mpd_client_setup_media_presentation (GstMpdClient * client, if (prev) list = prev->next; else - list = client->mpd_node->Periods; + list = client->mpd_root_node->Periods; /* And try again */ continue; @@ -1158,7 +1184,7 @@ gst_mpd_client_setup_media_presentation (GstMpdClient * client, if (period_node->start != -1) { /* we have a regular period */ /* start cannot be smaller than previous start */ - if (list != g_list_first (client->mpd_node->Periods) + if (list != g_list_first (client->mpd_root_node->Periods) && start >= period_node->start * GST_MSECOND) { /* Invalid MPD file: duration would be negative or zero */ goto syntax_error; @@ -1167,10 +1193,11 @@ gst_mpd_client_setup_media_presentation (GstMpdClient * client, } else if (duration != GST_CLOCK_TIME_NONE) { /* start time inferred from previous period, this is still a regular period */ start += duration; - } else if (idx == 0 && client->mpd_node->type == GST_MPD_FILE_TYPE_STATIC) { + } else if (idx == 0 + && client->mpd_root_node->type == GST_MPD_FILE_TYPE_STATIC) { /* first period of a static MPD file, start time is 0 */ start = 0; - } else if (client->mpd_node->type == GST_MPD_FILE_TYPE_DYNAMIC) { + } else if (client->mpd_root_node->type == GST_MPD_FILE_TYPE_DYNAMIC) { /* this should be a live stream, let this pass */ } else { /* this is an 'Early Available Period' */ @@ -1197,15 +1224,15 @@ gst_mpd_client_setup_media_presentation (GstMpdClient * client, new_periods = gst_mpd_client_fetch_external_periods (client, next_period_node); - client->mpd_node->Periods = - g_list_delete_link (client->mpd_node->Periods, next); - gst_mpdparser_free_period_node (next_period_node); + client->mpd_root_node->Periods = + g_list_delete_link (client->mpd_root_node->Periods, next); + gst_mpd_period_node_free (next_period_node); next_period_node = NULL; /* Get new next node, we will insert before this */ next = g_list_next (list); while (new_periods) { - client->mpd_node->Periods = - g_list_insert_before (client->mpd_node->Periods, next, + client->mpd_root_node->Periods = + g_list_insert_before (client->mpd_root_node->Periods, next, new_periods->data); new_periods = g_list_delete_link (new_periods, new_periods); } @@ -1231,23 +1258,25 @@ gst_mpd_client_setup_media_presentation (GstMpdClient * client, goto syntax_error; } duration = period_node->duration * GST_MSECOND; - } else if (client->mpd_node->type == GST_MPD_FILE_TYPE_DYNAMIC) { + } else if (client->mpd_root_node->type == GST_MPD_FILE_TYPE_DYNAMIC) { /* might be a live file, ignore unspecified duration */ } else { /* Invalid MPD file! */ goto syntax_error; } - } else if (client->mpd_node->mediaPresentationDuration != -1) { + } else if (client->mpd_root_node->mediaPresentationDuration != -1) { /* last Period of the Media Presentation */ - if (client->mpd_node->mediaPresentationDuration * GST_MSECOND <= start) { + if (client->mpd_root_node->mediaPresentationDuration * GST_MSECOND <= + start) { /* Invalid MPD file: duration would be negative or zero */ goto syntax_error; } duration = - client->mpd_node->mediaPresentationDuration * GST_MSECOND - start; + client->mpd_root_node->mediaPresentationDuration * GST_MSECOND - + start; } else if (period_node->duration != -1) { duration = period_node->duration * GST_MSECOND; - } else if (client->mpd_node->type == GST_MPD_FILE_TYPE_DYNAMIC) { + } else if (client->mpd_root_node->type == GST_MPD_FILE_TYPE_DYNAMIC) { /* might be a live file, ignore unspecified duration */ } else { /* Invalid MPD file! */ @@ -1298,8 +1327,8 @@ syntax_error: } static GList * -gst_mpd_client_fetch_external_adaptation_set (GstMpdClient * client, - GstPeriodNode * period, GstAdaptationSetNode * adapt_set) +gst_mpd_client_fetch_external_adaptation_set (GstMPDClient * client, + GstMPDPeriodNode * period, GstMPDAdaptationSetNode * adapt_set) { GstFragment *download; GstBuffer *adapt_set_buffer; @@ -1325,14 +1354,17 @@ gst_mpd_client_fetch_external_adaptation_set (GstMpdClient * client, /* Get base URI at the MPD level */ base_uri = - gst_uri_from_string (client-> - mpd_base_uri ? client->mpd_base_uri : client->mpd_uri); + gst_uri_from_string (client->mpd_base_uri ? client-> + mpd_base_uri : client->mpd_uri); /* combine a BaseURL at the MPD level with the current base url */ - base_uri = combine_urls (base_uri, client->mpd_node->BaseURLs, &query, 0); + base_uri = + gst_mpd_helper_combine_urls (base_uri, client->mpd_root_node->BaseURLs, + &query, 0); /* combine a BaseURL at the Period level with the current base url */ - base_uri = combine_urls (base_uri, period->BaseURLs, &query, 0); + base_uri = + gst_mpd_helper_combine_urls (base_uri, period->BaseURLs, &query, 0); uri = gst_uri_from_string_with_base (base_uri, adapt_set->xlink_href); if (query) @@ -1370,7 +1402,7 @@ gst_mpd_client_fetch_external_adaptation_set (GstMpdClient * client, } static GList * -gst_mpd_client_get_adaptation_sets_for_period (GstMpdClient * client, +gst_mpd_client_get_adaptation_sets_for_period (GstMPDClient * client, GstStreamPeriod * period) { GList *list; @@ -1383,7 +1415,7 @@ gst_mpd_client_get_adaptation_sets_for_period (GstMpdClient * client, */ for (list = period->period->AdaptationSets; list; /* advanced explicitly below */ ) { - GstAdaptationSetNode *adapt_set = (GstAdaptationSetNode *) list->data; + GstMPDAdaptationSetNode *adapt_set = (GstMPDAdaptationSetNode *) list->data; GList *new_adapt_sets = NULL, *prev, *next; if (!adapt_set->xlink_href) { @@ -1398,7 +1430,7 @@ gst_mpd_client_get_adaptation_sets_for_period (GstMpdClient * client, prev = list->prev; period->period->AdaptationSets = g_list_delete_link (period->period->AdaptationSets, list); - gst_mpdparser_free_adaptation_set_node (adapt_set); + gst_mpd_adaptation_set_node_free (adapt_set); adapt_set = NULL; /* Get new next node, we will insert before this */ @@ -1425,7 +1457,7 @@ gst_mpd_client_get_adaptation_sets_for_period (GstMpdClient * client, } GList * -gst_mpd_client_get_adaptation_sets (GstMpdClient * client) +gst_mpd_client_get_adaptation_sets (GstMPDClient * client) { GstStreamPeriod *stream_period; @@ -1439,10 +1471,10 @@ gst_mpd_client_get_adaptation_sets (GstMpdClient * client) } gboolean -gst_mpd_client_setup_streaming (GstMpdClient * client, - GstAdaptationSetNode * adapt_set) +gst_mpd_client_setup_streaming (GstMPDClient * client, + GstMPDAdaptationSetNode * adapt_set) { - GstRepresentationNode *representation; + GstMPDRepresentationNode *representation; GList *rep_list = NULL; GstActiveStream *stream; @@ -1502,7 +1534,7 @@ gst_mpd_client_setup_streaming (GstMpdClient * client, } gboolean -gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream, +gst_mpd_client_stream_seek (GstMPDClient * client, GstActiveStream * stream, gboolean forward, GstSeekFlags flags, GstClockTime ts, GstClockTime * final_ts) { @@ -1593,8 +1625,8 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream, guint segments_count = gst_mpd_client_get_segments_counts (client, stream); GstClockTime index_time; - g_return_val_if_fail (stream->cur_seg_template-> - MultSegBaseType->SegmentTimeline == NULL, FALSE); + g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType-> + SegmentTimeline == NULL, FALSE); if (!GST_CLOCK_TIME_IS_VALID (duration)) { return FALSE; } @@ -1676,7 +1708,7 @@ gst_mpd_client_add_time_difference (GstDateTime * t1, gint64 usecs) } gboolean -gst_mpd_client_get_last_fragment_timestamp_end (GstMpdClient * client, +gst_mpd_client_get_last_fragment_timestamp_end (GstMPDClient * client, guint stream_idx, GstClockTime * ts) { GstActiveStream *stream; @@ -1718,7 +1750,7 @@ gst_mpd_client_get_last_fragment_timestamp_end (GstMpdClient * client, } gboolean -gst_mpd_client_get_next_fragment_timestamp (GstMpdClient * client, +gst_mpd_client_get_next_fragment_timestamp (GstMPDClient * client, guint stream_idx, GstClockTime * ts) { GstActiveStream *stream; @@ -1743,8 +1775,8 @@ gst_mpd_client_get_next_fragment_timestamp (GstMpdClient * client, gst_mpd_client_get_segment_duration (client, stream, NULL); guint segments_count = gst_mpd_client_get_segments_counts (client, stream); - g_return_val_if_fail (stream->cur_seg_template-> - MultSegBaseType->SegmentTimeline == NULL, FALSE); + g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType-> + SegmentTimeline == NULL, FALSE); if (!GST_CLOCK_TIME_IS_VALID (duration) || (segments_count > 0 && stream->segment_index >= segments_count)) { return FALSE; @@ -1756,7 +1788,7 @@ gst_mpd_client_get_next_fragment_timestamp (GstMpdClient * client, } GstClockTime -gst_mpd_client_get_stream_presentation_offset (GstMpdClient * client, +gst_mpd_client_get_stream_presentation_offset (GstMPDClient * client, guint stream_idx) { GstActiveStream *stream = NULL; @@ -1770,7 +1802,7 @@ gst_mpd_client_get_stream_presentation_offset (GstMpdClient * client, } GstClockTime -gst_mpd_client_get_period_start_time (GstMpdClient * client) +gst_mpd_client_get_period_start_time (GstMPDClient * client) { GstStreamPeriod *stream_period = NULL; @@ -1783,7 +1815,7 @@ gst_mpd_client_get_period_start_time (GstMpdClient * client) /** * gst_mpd_client_get_utc_timing_sources: - * @client: #GstMpdClient to check for UTCTiming elements + * @client: #GstMPDClient to check for UTCTiming elements * @methods: A bit mask of #GstMPDUTCTimingType that specifies the methods * to search for. * @selected_method: (nullable): The selected method @@ -1798,16 +1830,16 @@ gst_mpd_client_get_period_start_time (GstMpdClient * client) * Since: 1.6 */ gchar ** -gst_mpd_client_get_utc_timing_sources (GstMpdClient * client, +gst_mpd_client_get_utc_timing_sources (GstMPDClient * client, guint methods, GstMPDUTCTimingType * selected_method) { GList *list; g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (client->mpd_node != NULL, NULL); - for (list = g_list_first (client->mpd_node->UTCTiming); list; + g_return_val_if_fail (client->mpd_root_node != NULL, NULL); + for (list = g_list_first (client->mpd_root_node->UTCTimings); list; list = g_list_next (list)) { - const GstUTCTimingNode *node = (const GstUTCTimingNode *) list->data; + const GstMPDUTCTimingNode *node = (const GstMPDUTCTimingNode *) list->data; if (node->method & methods) { if (selected_method) { *selected_method = node->method; @@ -1820,7 +1852,7 @@ gst_mpd_client_get_utc_timing_sources (GstMpdClient * client, gboolean -gst_mpd_client_get_next_fragment (GstMpdClient * client, +gst_mpd_client_get_next_fragment (GstMPDClient * client, guint indexStream, GstMediaFragmentInfo * fragment) { GstActiveStream *stream = NULL; @@ -1846,8 +1878,8 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client, stream, NULL); guint segments_count = gst_mpd_client_get_segments_counts (client, stream); - g_return_val_if_fail (stream->cur_seg_template-> - MultSegBaseType->SegmentTimeline == NULL, FALSE); + g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType-> + SegmentTimeline == NULL, FALSE); if (!GST_CLOCK_TIME_IS_VALID (duration) || (segments_count > 0 && stream->segment_index >= segments_count)) { return FALSE; @@ -1874,16 +1906,16 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client, indexURL = g_strdup (currentChunk->SegmentURL->index); } else if (stream->cur_seg_template != NULL) { mediaURL = - gst_mpdparser_build_URL_from_template (stream-> - cur_seg_template->media, stream->cur_representation->id, + gst_mpdparser_build_URL_from_template (stream->cur_seg_template-> + media, stream->cur_representation->id, currentChunk->number + stream->segment_repeat_index, stream->cur_representation->bandwidth, currentChunk->scale_start + stream->segment_repeat_index * currentChunk->scale_duration); if (stream->cur_seg_template->index) { indexURL = - gst_mpdparser_build_URL_from_template (stream-> - cur_seg_template->index, stream->cur_representation->id, + gst_mpdparser_build_URL_from_template (stream->cur_seg_template-> + index, stream->cur_representation->id, currentChunk->number + stream->segment_repeat_index, stream->cur_representation->bandwidth, currentChunk->scale_start + @@ -1914,16 +1946,16 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client, } else { if (stream->cur_seg_template != NULL) { mediaURL = - gst_mpdparser_build_URL_from_template (stream-> - cur_seg_template->media, stream->cur_representation->id, + gst_mpdparser_build_URL_from_template (stream->cur_seg_template-> + media, stream->cur_representation->id, stream->segment_index + stream->cur_seg_template->MultSegBaseType->startNumber, stream->cur_representation->bandwidth, stream->segment_index * fragment->duration); if (stream->cur_seg_template->index) { indexURL = - gst_mpdparser_build_URL_from_template (stream-> - cur_seg_template->index, stream->cur_representation->id, + gst_mpdparser_build_URL_from_template (stream->cur_seg_template-> + index, stream->cur_representation->id, stream->segment_index + stream->cur_seg_template->MultSegBaseType->startNumber, stream->cur_representation->bandwidth, @@ -1978,7 +2010,7 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client, } gboolean -gst_mpd_client_has_next_segment (GstMpdClient * client, +gst_mpd_client_has_next_segment (GstMPDClient * client, GstActiveStream * stream, gboolean forward) { if (forward) { @@ -2005,7 +2037,7 @@ gst_mpd_client_has_next_segment (GstMpdClient * client, } GstFlowReturn -gst_mpd_client_advance_segment (GstMpdClient * client, GstActiveStream * stream, +gst_mpd_client_advance_segment (GstMPDClient * client, GstActiveStream * stream, gboolean forward) { GstMediaSegment *segment; @@ -2120,7 +2152,7 @@ done: } gboolean -gst_mpd_client_get_next_header (GstMpdClient * client, gchar ** uri, +gst_mpd_client_get_next_header (GstMPDClient * client, gchar ** uri, guint stream_idx, gint64 * range_start, gint64 * range_end) { GstActiveStream *stream; @@ -2159,8 +2191,8 @@ gst_mpd_client_get_next_header (GstMpdClient * client, gchar ** uri, } else if (stream->cur_seg_template && stream->cur_seg_template->initialization) { *uri = - gst_mpdparser_build_URL_from_template (stream-> - cur_seg_template->initialization, stream->cur_representation->id, 0, + gst_mpdparser_build_URL_from_template (stream->cur_seg_template-> + initialization, stream->cur_representation->id, 0, stream->cur_representation->bandwidth, 0); } @@ -2168,7 +2200,7 @@ gst_mpd_client_get_next_header (GstMpdClient * client, gchar ** uri, } gboolean -gst_mpd_client_get_next_header_index (GstMpdClient * client, gchar ** uri, +gst_mpd_client_get_next_header_index (GstMPDClient * client, gchar ** uri, guint stream_idx, gint64 * range_start, gint64 * range_end) { GstActiveStream *stream; @@ -2203,7 +2235,7 @@ gst_mpd_client_get_next_header_index (GstMpdClient * client, gchar ** uri, } GstClockTime -gst_mpd_client_get_next_fragment_duration (GstMpdClient * client, +gst_mpd_client_get_next_fragment_duration (GstMPDClient * client, GstActiveStream * stream) { GstMediaSegment *media_segment = NULL; @@ -2223,8 +2255,8 @@ gst_mpd_client_get_next_fragment_duration (GstMpdClient * client, gst_mpd_client_get_segment_duration (client, stream, NULL); guint segments_count = gst_mpd_client_get_segments_counts (client, stream); - g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType-> - SegmentTimeline == NULL, 0); + g_return_val_if_fail (stream->cur_seg_template-> + MultSegBaseType->SegmentTimeline == NULL, 0); if (!GST_CLOCK_TIME_IS_VALID (duration) || (segments_count > 0 && seg_idx >= segments_count)) { @@ -2235,14 +2267,14 @@ gst_mpd_client_get_next_fragment_duration (GstMpdClient * client, } GstClockTime -gst_mpd_client_get_media_presentation_duration (GstMpdClient * client) +gst_mpd_client_get_media_presentation_duration (GstMPDClient * client) { GstClockTime duration; g_return_val_if_fail (client != NULL, GST_CLOCK_TIME_NONE); - if (client->mpd_node->mediaPresentationDuration != -1) { - duration = client->mpd_node->mediaPresentationDuration * GST_MSECOND; + if (client->mpd_root_node->mediaPresentationDuration != -1) { + duration = client->mpd_root_node->mediaPresentationDuration * GST_MSECOND; } else { /* We can only get the duration for on-demand streams */ duration = GST_CLOCK_TIME_NONE; @@ -2252,7 +2284,7 @@ gst_mpd_client_get_media_presentation_duration (GstMpdClient * client) } gboolean -gst_mpd_client_set_period_id (GstMpdClient * client, const gchar * period_id) +gst_mpd_client_set_period_id (GstMPDClient * client, const gchar * period_id) { GstStreamPeriod *next_stream_period; gboolean ret = FALSE; @@ -2283,7 +2315,7 @@ gst_mpd_client_set_period_id (GstMpdClient * client, const gchar * period_id) } gboolean -gst_mpd_client_set_period_index (GstMpdClient * client, guint period_idx) +gst_mpd_client_set_period_index (GstMPDClient * client, guint period_idx) { GstStreamPeriod *next_stream_period; gboolean ret = FALSE; @@ -2304,7 +2336,7 @@ gst_mpd_client_set_period_index (GstMpdClient * client, guint period_idx) } guint -gst_mpd_client_get_period_index (GstMpdClient * client) +gst_mpd_client_get_period_index (GstMPDClient * client) { guint period_idx; @@ -2315,7 +2347,7 @@ gst_mpd_client_get_period_index (GstMpdClient * client) } const gchar * -gst_mpd_client_get_period_id (GstMpdClient * client) +gst_mpd_client_get_period_id (GstMPDClient * client) { GstStreamPeriod *period; gchar *period_id = NULL; @@ -2329,7 +2361,7 @@ gst_mpd_client_get_period_id (GstMpdClient * client) } gboolean -gst_mpd_client_has_next_period (GstMpdClient * client) +gst_mpd_client_has_next_period (GstMPDClient * client) { GList *next_stream_period; g_return_val_if_fail (client != NULL, FALSE); @@ -2345,7 +2377,7 @@ gst_mpd_client_has_next_period (GstMpdClient * client) } gboolean -gst_mpd_client_has_previous_period (GstMpdClient * client) +gst_mpd_client_has_previous_period (GstMPDClient * client) { GList *next_stream_period; g_return_val_if_fail (client != NULL, FALSE); @@ -2365,14 +2397,14 @@ gint gst_mpd_client_get_rep_idx_with_min_bandwidth (GList * Representations) { GList *list = NULL, *lowest = NULL; - GstRepresentationNode *rep = NULL; + GstMPDRepresentationNode *rep = NULL; gint lowest_bandwidth = -1; if (Representations == NULL) return -1; for (list = g_list_first (Representations); list; list = g_list_next (list)) { - rep = (GstRepresentationNode *) list->data; + rep = (GstMPDRepresentationNode *) list->data; if (rep && (!lowest || rep->bandwidth < lowest_bandwidth)) { lowest = list; lowest_bandwidth = rep->bandwidth; @@ -2388,7 +2420,7 @@ gst_mpd_client_get_rep_idx_with_max_bandwidth (GList * Representations, max_video_framerate_n, gint max_video_framerate_d) { GList *list = NULL, *best = NULL; - GstRepresentationNode *representation; + GstMPDRepresentationNode *representation; gint best_bandwidth = 0; GST_DEBUG ("max_bandwidth = %" G_GINT64_FORMAT, max_bandwidth); @@ -2402,7 +2434,7 @@ gst_mpd_client_get_rep_idx_with_max_bandwidth (GList * Representations, for (list = g_list_first (Representations); list; list = g_list_next (list)) { GstXMLFrameRate *framerate = NULL; - representation = (GstRepresentationNode *) list->data; + representation = (GstMPDRepresentationNode *) list->data; /* FIXME: Really? */ if (!representation) @@ -2436,7 +2468,7 @@ gst_mpd_client_get_rep_idx_with_max_bandwidth (GList * Representations, } void -gst_mpd_client_seek_to_first_segment (GstMpdClient * client) +gst_mpd_client_seek_to_first_segment (GstMPDClient * client) { GList *list; @@ -2454,7 +2486,7 @@ gst_mpd_client_seek_to_first_segment (GstMpdClient * client) } static guint -gst_mpd_client_get_segments_counts (GstMpdClient * client, +gst_mpd_client_get_segments_counts (GstMPDClient * client, GstActiveStream * stream) { GstStreamPeriod *stream_period; @@ -2463,8 +2495,8 @@ gst_mpd_client_get_segments_counts (GstMpdClient * client, if (stream->segments) return stream->segments->len; - g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType-> - SegmentTimeline == NULL, 0); + g_return_val_if_fail (stream->cur_seg_template-> + MultSegBaseType->SegmentTimeline == NULL, 0); stream_period = gst_mpd_client_get_stream_period (client); if (stream_period->duration != -1) @@ -2475,16 +2507,16 @@ gst_mpd_client_get_segments_counts (GstMpdClient * client, } gboolean -gst_mpd_client_is_live (GstMpdClient * client) +gst_mpd_client_is_live (GstMPDClient * client) { g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (client->mpd_node != NULL, FALSE); + g_return_val_if_fail (client->mpd_root_node != NULL, FALSE); - return client->mpd_node->type == GST_MPD_FILE_TYPE_DYNAMIC; + return client->mpd_root_node->type == GST_MPD_FILE_TYPE_DYNAMIC; } guint -gst_mpd_client_get_nb_active_stream (GstMpdClient * client) +gst_mpd_client_get_nb_active_stream (GstMPDClient * client) { g_return_val_if_fail (client != NULL, 0); @@ -2492,7 +2524,7 @@ gst_mpd_client_get_nb_active_stream (GstMpdClient * client) } guint -gst_mpd_client_get_nb_adaptationSet (GstMpdClient * client) +gst_mpd_client_get_nb_adaptationSet (GstMPDClient * client) { GstStreamPeriod *stream_period; @@ -2504,7 +2536,7 @@ gst_mpd_client_get_nb_adaptationSet (GstMpdClient * client) } GstActiveStream * -gst_mpd_client_get_active_stream_by_index (GstMpdClient * client, +gst_mpd_client_get_active_stream_by_index (GstMPDClient * client, guint stream_idx) { g_return_val_if_fail (client != NULL, NULL); @@ -2550,7 +2582,7 @@ gst_mpd_client_get_stream_caps (GstActiveStream * stream) mimeType = stream->cur_adapt_set->RepresentationBase->mimeType; } - caps_string = gst_mpdparser_mimetype_to_caps (mimeType); + caps_string = gst_mpd_helper_mimetype_to_caps (mimeType); if ((g_strcmp0 (caps_string, "application/mp4") == 0) && gst_mpd_client_active_stream_contains_subtitles (stream)) @@ -2673,11 +2705,11 @@ gst_mpd_client_get_audio_stream_num_channels (GstActiveStream * stream) } guint -gst_mpd_client_get_list_and_nb_of_audio_language (GstMpdClient * client, +gst_mpd_client_get_list_and_nb_of_audio_language (GstMPDClient * client, GList ** lang) { GstStreamPeriod *stream_period; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; GList *adaptation_sets, *list; const gchar *this_mimeType = "audio"; gchar *mimeType = NULL; @@ -2690,10 +2722,10 @@ gst_mpd_client_get_list_and_nb_of_audio_language (GstMpdClient * client, adaptation_sets = gst_mpd_client_get_adaptation_sets_for_period (client, stream_period); for (list = adaptation_sets; list; list = g_list_next (list)) { - adapt_set = (GstAdaptationSetNode *) list->data; + adapt_set = (GstMPDAdaptationSetNode *) list->data; if (adapt_set && adapt_set->lang) { gchar *this_lang = adapt_set->lang; - GstRepresentationNode *rep; + GstMPDRepresentationNode *rep; rep = gst_mpd_client_get_lowest_representation (adapt_set->Representations); mimeType = NULL; @@ -2703,7 +2735,7 @@ gst_mpd_client_get_list_and_nb_of_audio_language (GstMpdClient * client, mimeType = adapt_set->RepresentationBase->mimeType; } - if (strncmp_ext (mimeType, this_mimeType) == 0) { + if (gst_mpd_helper_strncmp_ext (mimeType, this_mimeType) == 0) { nb_adaptation_set++; *lang = g_list_append (*lang, this_lang); } @@ -2715,7 +2747,7 @@ gst_mpd_client_get_list_and_nb_of_audio_language (GstMpdClient * client, GstDateTime * -gst_mpd_client_get_next_segment_availability_start_time (GstMpdClient * client, +gst_mpd_client_get_next_segment_availability_start_time (GstMPDClient * client, GstActiveStream * stream) { GstDateTime *availability_start_time, *rv; @@ -2775,7 +2807,7 @@ gst_mpd_client_get_next_segment_availability_start_time (GstMpdClient * client, } gboolean -gst_mpd_client_seek_to_time (GstMpdClient * client, GDateTime * time) +gst_mpd_client_seek_to_time (GstMPDClient * client, GDateTime * time) { GDateTime *start; GTimeSpan ts_microseconds; @@ -2784,10 +2816,12 @@ gst_mpd_client_seek_to_time (GstMpdClient * client, GDateTime * time) GList *stream; g_return_val_if_fail (gst_mpd_client_is_live (client), FALSE); - g_return_val_if_fail (client->mpd_node->availabilityStartTime != NULL, FALSE); + g_return_val_if_fail (client->mpd_root_node->availabilityStartTime != NULL, + FALSE); start = - gst_date_time_to_g_date_time (client->mpd_node->availabilityStartTime); + gst_date_time_to_g_date_time (client->mpd_root_node-> + availabilityStartTime); ts_microseconds = g_date_time_difference (time, start); g_date_time_unref (start); @@ -2806,14 +2840,14 @@ gst_mpd_client_seek_to_time (GstMpdClient * client, GDateTime * time) } gboolean -gst_mpd_client_has_isoff_ondemand_profile (GstMpdClient * client) +gst_mpd_client_has_isoff_ondemand_profile (GstMPDClient * client) { return client->profile_isoff_ondemand; } /** * gst_mpd_client_parse_default_presentation_delay: - * @client: #GstMpdClient that has a parsed manifest + * @client: #GstMPDClient that has a parsed manifest * @default_presentation_delay: A string that specifies a time period * in fragments (e.g. "5 f"), seconds ("12 s") or milliseconds * ("12000 ms") @@ -2822,7 +2856,7 @@ gst_mpd_client_has_isoff_ondemand_profile (GstMpdClient * client) * Since: 1.6 */ gint64 -gst_mpd_client_parse_default_presentation_delay (GstMpdClient * client, +gst_mpd_client_parse_default_presentation_delay (GstMPDClient * client, const gchar * default_presentation_delay) { gint64 value; @@ -2840,8 +2874,8 @@ gst_mpd_client_parse_default_presentation_delay (GstMpdClient * client, value *= 1000; /* convert to ms */ } else if (*endptr == 'f' || *endptr == 'F') { gint64 segment_duration; - g_assert (client->mpd_node != NULL); - segment_duration = client->mpd_node->maxSegmentDuration; + g_assert (client->mpd_root_node != NULL); + segment_duration = client->mpd_root_node->maxSegmentDuration; value *= segment_duration; } else if (*endptr != 'm' && *endptr != 'M') { GST_ERROR ("Unable to parse default presentation delay: %s", @@ -2852,16 +2886,16 @@ gst_mpd_client_parse_default_presentation_delay (GstMpdClient * client, } GstClockTime -gst_mpd_client_get_maximum_segment_duration (GstMpdClient * client) +gst_mpd_client_get_maximum_segment_duration (GstMPDClient * client) { GstClockTime ret = GST_CLOCK_TIME_NONE, dur; GList *stream; g_return_val_if_fail (client != NULL, GST_CLOCK_TIME_NONE); - g_return_val_if_fail (client->mpd_node != NULL, GST_CLOCK_TIME_NONE); + g_return_val_if_fail (client->mpd_root_node != NULL, GST_CLOCK_TIME_NONE); - if (client->mpd_node->maxSegmentDuration != GST_MPD_DURATION_NONE) { - return client->mpd_node->maxSegmentDuration * GST_MSECOND; + if (client->mpd_root_node->maxSegmentDuration != GST_MPD_DURATION_NONE) { + return client->mpd_root_node->maxSegmentDuration * GST_MSECOND; } /* According to the DASH specification, if maxSegmentDuration is not present: @@ -2878,7 +2912,7 @@ gst_mpd_client_get_maximum_segment_duration (GstMpdClient * client) } guint -gst_mpd_client_get_period_index_at_time (GstMpdClient * client, +gst_mpd_client_get_period_index_at_time (GstMPDClient * client, GstDateTime * time) { GList *iter; diff --git a/ext/dash/gstmpdclient.h b/ext/dash/gstmpdclient.h index fbe287c..8d165a9 100644 --- a/ext/dash/gstmpdclient.h +++ b/ext/dash/gstmpdclient.h @@ -25,14 +25,13 @@ G_BEGIN_DECLS -#define GST_MPD_CLIENT_LOCK(c) g_mutex_lock (&c->lock); -#define GST_MPD_CLIENT_UNLOCK(c) g_mutex_unlock (&c->lock); +#define GST_TYPE_MPD_CLIENT gst_mpd_client_get_type () +G_DECLARE_FINAL_TYPE (GstMPDClient, gst_mpd_client, GST, MPD_CLIENT, GstObject) -typedef struct _GstMpdClient GstMpdClient; - -struct _GstMpdClient +struct _GstMPDClient { - GstMPDNode *mpd_node; /* active MPD manifest file */ + GstObject parent_instance; + GstMPDRootNode *mpd_root_node; /* mpd root node */ GList *periods; /* list of GstStreamPeriod */ guint period_idx; /* index of current Period */ @@ -51,71 +50,71 @@ struct _GstMpdClient }; /* Basic initialization/deinitialization functions */ -GstMpdClient *gst_mpd_client_new (void); -void gst_mpd_client_active_streams_free (GstMpdClient * client); -void gst_mpd_client_free (GstMpdClient * client); +GstMPDClient *gst_mpd_client_new (void); +void gst_mpd_client_active_streams_free (GstMPDClient * client); +void gst_mpd_client_free (GstMPDClient * client); /* main mpd parsing methods from xml data */ -gboolean gst_mpd_client_parse (GstMpdClient * client, const gchar * data, gint size); +gboolean gst_mpd_client_parse (GstMPDClient * client, const gchar * data, gint size); -void gst_mpd_client_set_uri_downloader (GstMpdClient * client, GstUriDownloader * download); -void gst_mpd_client_check_profiles (GstMpdClient * client); -void gst_mpd_client_fetch_on_load_external_resources (GstMpdClient * client); +void gst_mpd_client_set_uri_downloader (GstMPDClient * client, GstUriDownloader * download); +void gst_mpd_client_check_profiles (GstMPDClient * client); +void gst_mpd_client_fetch_on_load_external_resources (GstMPDClient * client); /* Streaming management */ -gboolean gst_mpd_client_setup_media_presentation (GstMpdClient *client, GstClockTime time, gint period_index, const gchar *period_id); -gboolean gst_mpd_client_setup_streaming (GstMpdClient * client, GstAdaptationSetNode * adapt_set); -gboolean gst_mpd_client_setup_representation (GstMpdClient *client, GstActiveStream *stream, GstRepresentationNode *representation); - -GstClockTime gst_mpd_client_get_next_fragment_duration (GstMpdClient * client, GstActiveStream * stream); -GstClockTime gst_mpd_client_get_media_presentation_duration (GstMpdClient *client); -GstClockTime gst_mpd_client_get_maximum_segment_duration (GstMpdClient * client); -gboolean gst_mpd_client_get_last_fragment_timestamp_end (GstMpdClient * client, guint stream_idx, GstClockTime * ts); -gboolean gst_mpd_client_get_next_fragment_timestamp (GstMpdClient * client, guint stream_idx, GstClockTime * ts); -gboolean gst_mpd_client_get_next_fragment (GstMpdClient *client, guint indexStream, GstMediaFragmentInfo * fragment); -gboolean gst_mpd_client_get_next_header (GstMpdClient *client, gchar **uri, guint stream_idx, gint64 * range_start, gint64 * range_end); -gboolean gst_mpd_client_get_next_header_index (GstMpdClient *client, gchar **uri, guint stream_idx, gint64 * range_start, gint64 * range_end); -gboolean gst_mpd_client_is_live (GstMpdClient * client); -gboolean gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream, gboolean forward, GstSeekFlags flags, GstClockTime ts, GstClockTime * final_ts); -gboolean gst_mpd_client_seek_to_time (GstMpdClient * client, GDateTime * time); -GstClockTime gst_mpd_client_get_stream_presentation_offset (GstMpdClient *client, guint stream_idx); -gchar** gst_mpd_client_get_utc_timing_sources (GstMpdClient *client, guint methods, GstMPDUTCTimingType *selected_method); -GstClockTime gst_mpd_client_get_period_start_time (GstMpdClient *client); +gboolean gst_mpd_client_setup_media_presentation (GstMPDClient *client, GstClockTime time, gint period_index, const gchar *period_id); +gboolean gst_mpd_client_setup_streaming (GstMPDClient * client, GstMPDAdaptationSetNode * adapt_set); +gboolean gst_mpd_client_setup_representation (GstMPDClient *client, GstActiveStream *stream, GstMPDRepresentationNode *representation); + +GstClockTime gst_mpd_client_get_next_fragment_duration (GstMPDClient * client, GstActiveStream * stream); +GstClockTime gst_mpd_client_get_media_presentation_duration (GstMPDClient *client); +GstClockTime gst_mpd_client_get_maximum_segment_duration (GstMPDClient * client); +gboolean gst_mpd_client_get_last_fragment_timestamp_end (GstMPDClient * client, guint stream_idx, GstClockTime * ts); +gboolean gst_mpd_client_get_next_fragment_timestamp (GstMPDClient * client, guint stream_idx, GstClockTime * ts); +gboolean gst_mpd_client_get_next_fragment (GstMPDClient *client, guint indexStream, GstMediaFragmentInfo * fragment); +gboolean gst_mpd_client_get_next_header (GstMPDClient *client, gchar **uri, guint stream_idx, gint64 * range_start, gint64 * range_end); +gboolean gst_mpd_client_get_next_header_index (GstMPDClient *client, gchar **uri, guint stream_idx, gint64 * range_start, gint64 * range_end); +gboolean gst_mpd_client_is_live (GstMPDClient * client); +gboolean gst_mpd_client_stream_seek (GstMPDClient * client, GstActiveStream * stream, gboolean forward, GstSeekFlags flags, GstClockTime ts, GstClockTime * final_ts); +gboolean gst_mpd_client_seek_to_time (GstMPDClient * client, GDateTime * time); +GstClockTime gst_mpd_client_get_stream_presentation_offset (GstMPDClient *client, guint stream_idx); +gchar** gst_mpd_client_get_utc_timing_sources (GstMPDClient *client, guint methods, GstMPDUTCTimingType *selected_method); +GstClockTime gst_mpd_client_get_period_start_time (GstMPDClient *client); /* Period selection */ -guint gst_mpd_client_get_period_index_at_time (GstMpdClient * client, GstDateTime * time); -gboolean gst_mpd_client_set_period_index (GstMpdClient *client, guint period_idx); -gboolean gst_mpd_client_set_period_id (GstMpdClient *client, const gchar * period_id); -guint gst_mpd_client_get_period_index (GstMpdClient *client); -const gchar *gst_mpd_client_get_period_id (GstMpdClient *client); -gboolean gst_mpd_client_has_next_period (GstMpdClient *client); -gboolean gst_mpd_client_has_previous_period (GstMpdClient * client); +guint gst_mpd_client_get_period_index_at_time (GstMPDClient * client, GstDateTime * time); +gboolean gst_mpd_client_set_period_index (GstMPDClient *client, guint period_idx); +gboolean gst_mpd_client_set_period_id (GstMPDClient *client, const gchar * period_id); +guint gst_mpd_client_get_period_index (GstMPDClient *client); +const gchar *gst_mpd_client_get_period_id (GstMPDClient *client); +gboolean gst_mpd_client_has_next_period (GstMPDClient *client); +gboolean gst_mpd_client_has_previous_period (GstMPDClient * client); /* Representation selection */ gint gst_mpd_client_get_rep_idx_with_max_bandwidth (GList *Representations, gint64 max_bandwidth, gint max_video_width, gint max_video_height, gint max_video_framerate_n, gint max_video_framerate_d); gint gst_mpd_client_get_rep_idx_with_min_bandwidth (GList * Representations); GstDateTime * -gst_mpd_client_get_availability_start_time (GstMpdClient * client); +gst_mpd_client_get_availability_start_time (GstMPDClient * client); /* URL management */ -const gchar *gst_mpd_client_get_baseURL (GstMpdClient *client, guint indexStream); -gchar *gst_mpd_client_parse_baseURL (GstMpdClient * client, GstActiveStream * stream, gchar ** query); +const gchar *gst_mpd_client_get_baseURL (GstMPDClient *client, guint indexStream); +gchar *gst_mpd_client_parse_baseURL (GstMPDClient * client, GstActiveStream * stream, gchar ** query); /* Active stream */ -guint gst_mpd_client_get_nb_active_stream (GstMpdClient *client); -GstActiveStream *gst_mpd_client_get_active_stream_by_index (GstMpdClient *client, guint stream_idx); +guint gst_mpd_client_get_nb_active_stream (GstMPDClient *client); +GstActiveStream *gst_mpd_client_get_active_stream_by_index (GstMPDClient *client, guint stream_idx); gboolean gst_mpd_client_active_stream_contains_subtitles (GstActiveStream * stream); /* AdaptationSet */ -guint gst_mpd_client_get_nb_adaptationSet (GstMpdClient *client); -GList * gst_mpd_client_get_adaptation_sets (GstMpdClient * client); +guint gst_mpd_client_get_nb_adaptationSet (GstMPDClient *client); +GList * gst_mpd_client_get_adaptation_sets (GstMPDClient * client); /* Segment */ -gboolean gst_mpd_client_has_next_segment (GstMpdClient * client, GstActiveStream * stream, gboolean forward); -GstFlowReturn gst_mpd_client_advance_segment (GstMpdClient * client, GstActiveStream * stream, gboolean forward); -void gst_mpd_client_seek_to_first_segment (GstMpdClient * client); -GstDateTime *gst_mpd_client_get_next_segment_availability_start_time (GstMpdClient * client, GstActiveStream * stream); +gboolean gst_mpd_client_has_next_segment (GstMPDClient * client, GstActiveStream * stream, gboolean forward); +GstFlowReturn gst_mpd_client_advance_segment (GstMPDClient * client, GstActiveStream * stream, gboolean forward); +void gst_mpd_client_seek_to_first_segment (GstMPDClient * client); +GstDateTime *gst_mpd_client_get_next_segment_availability_start_time (GstMPDClient * client, GstActiveStream * stream); /* Get audio/video stream parameters (caps, width, height, rate, number of channels) */ GstCaps * gst_mpd_client_get_stream_caps (GstActiveStream * stream); @@ -127,14 +126,14 @@ 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_mpd_client_get_list_and_nb_of_audio_language (GstMpdClient *client, GList **lang); +guint gst_mpd_client_get_list_and_nb_of_audio_language (GstMPDClient *client, GList **lang); gint64 gst_mpd_client_calculate_time_difference (const GstDateTime * t1, const GstDateTime * t2); GstDateTime *gst_mpd_client_add_time_difference (GstDateTime * t1, gint64 usecs); -gint64 gst_mpd_client_parse_default_presentation_delay(GstMpdClient * client, const gchar * default_presentation_delay); +gint64 gst_mpd_client_parse_default_presentation_delay(GstMPDClient * client, const gchar * default_presentation_delay); /* profiles */ -gboolean gst_mpd_client_has_isoff_ondemand_profile (GstMpdClient *client); +gboolean gst_mpd_client_has_isoff_ondemand_profile (GstMPDClient *client); G_END_DECLS diff --git a/ext/dash/gstmpdcontentcomponentnode.c b/ext/dash/gstmpdcontentcomponentnode.c new file mode 100644 index 0000000..e8983f7 --- /dev/null +++ b/ext/dash/gstmpdcontentcomponentnode.c @@ -0,0 +1,85 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdcontentcomponentnode.h" +#include "gstmpdparser.h" + + +G_DEFINE_TYPE (GstMPDContentComponentNode, gst_mpd_content_component_node, + GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_content_component_node_finalize (GObject * object) +{ + GstMPDContentComponentNode *self = GST_MPD_CONTENT_COMPONENT_NODE (object); + + if (self->lang) + xmlFree (self->lang); + if (self->contentType) + xmlFree (self->contentType); + g_slice_free (GstXMLRatio, self->par); + g_list_free_full (self->Accessibility, + (GDestroyNotify) gst_mpd_helper_descriptor_type_free); + g_list_free_full (self->Role, + (GDestroyNotify) gst_mpd_helper_descriptor_type_free); + g_list_free_full (self->Rating, + (GDestroyNotify) gst_mpd_helper_descriptor_type_free); + g_list_free_full (self->Viewpoint, + (GDestroyNotify) gst_mpd_helper_descriptor_type_free); + + G_OBJECT_CLASS (gst_mpd_content_component_node_parent_class)->finalize + (object); +} + +static void +gst_mpd_content_component_node_class_init (GstMPDContentComponentNodeClass * + klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_content_component_node_finalize; +} + +static void +gst_mpd_content_component_node_init (GstMPDContentComponentNode * self) +{ + self->id = 0; + self->lang = NULL; + self->contentType = NULL; + self->par = 0; + self->Accessibility = 0; + self->Role = NULL; + self->Rating = NULL; + self->Viewpoint = NULL; +} + +GstMPDContentComponentNode * +gst_mpd_content_component_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_CONTENT_COMPONENT_NODE, NULL); +} + +void +gst_mpd_content_component_node_free (GstMPDContentComponentNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdcontentcomponentnode.h b/ext/dash/gstmpdcontentcomponentnode.h new file mode 100644 index 0000000..9521100 --- /dev/null +++ b/ext/dash/gstmpdcontentcomponentnode.h @@ -0,0 +1,74 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDCONTENTCOMPONENTNODE_H__ +#define __GSTMPDCONTENTCOMPONENTNODE_H__ + +#include +#include "gstmpdhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_CONTENT_COMPONENT_NODE gst_mpd_content_component_node_get_type () +#define GST_MPD_CONTENT_COMPONENT_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_CONTENT_COMPONENT_NODE, GstMPDContentComponentNode)) +#define GST_MPD_CONTENT_COMPONENT_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_CONTENT_COMPONENT_NODE, GstMPDContentComponentNodeClass)) +#define GST_IS_MPD_CONTENT_COMPONENT_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_CONTENT_COMPONENT_NODE)) +#define GST_IS_MPD_CONTENT_COMPONENT_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_CONTENT_COMPONENT_NODE)) +#define GST_MPD_CONTENT_COMPONENT_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_CONTENT_COMPONENT_NODE, GstMPDContentComponentNodeClass)) + +typedef struct _GstMPDContentComponentNode GstMPDContentComponentNode; +typedef struct _GstMPDContentComponentNodeClass GstMPDContentComponentNodeClass; + + +struct _GstMPDContentComponentNode +{ + GstObject parent_instance; + guint id; + gchar *lang; /* LangVectorType RFC 5646 */ + gchar *contentType; + GstXMLRatio *par; + /* list of Accessibility DescriptorType nodes */ + GList *Accessibility; + /* list of Role DescriptorType nodes */ + GList *Role; + /* list of Rating DescriptorType nodes */ + GList *Rating; + /* list of Viewpoint DescriptorType nodes */ + GList *Viewpoint; +}; + +struct _GstMPDContentComponentNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_content_component_node_get_type (void); + +GstMPDContentComponentNode * gst_mpd_content_component_node_new (void); +void gst_mpd_content_component_node_free (GstMPDContentComponentNode* self); + +G_END_DECLS + +#endif /* __GSTMPDCONTENTCOMPONENTNODE_H__ */ diff --git a/ext/dash/gstmpdhelper.c b/ext/dash/gstmpdhelper.c index ed2cfca..7c10225 100644 --- a/ext/dash/gstmpdhelper.c +++ b/ext/dash/gstmpdhelper.c @@ -20,6 +20,7 @@ */ #include "gstmpdhelper.h" +#include "gstmpdbaseurlnode.h" gboolean gst_mpd_helper_get_mpd_type (xmlNode * a_node, @@ -76,3 +77,162 @@ gst_mpd_helper_get_SAP_type (xmlNode * a_node, return exists; } + +GstMPDURLType * +gst_mpd_helper_URLType_clone (GstMPDURLType * url) +{ + + GstMPDURLType *clone = NULL; + + if (url) { + clone = g_slice_new0 (GstMPDURLType); + if (url->sourceURL) { + clone->sourceURL = xmlMemStrdup (url->sourceURL); + } + clone->range = gst_xml_helper_clone_range (url->range); + } + + return clone; +} + +void +gst_mpd_helper_url_type_node_free (GstMPDURLType * url_type_node) +{ + if (url_type_node) { + if (url_type_node->sourceURL) + xmlFree (url_type_node->sourceURL); + g_slice_free (GstXMLRange, url_type_node->range); + g_slice_free (GstMPDURLType, url_type_node); + } +} + +void +gst_mpd_helper_descriptor_type_free (GstMPDDescriptorType * descriptor_type) +{ + if (descriptor_type) { + if (descriptor_type->schemeIdUri) + xmlFree (descriptor_type->schemeIdUri); + if (descriptor_type->value) + xmlFree (descriptor_type->value); + g_slice_free (GstMPDDescriptorType, descriptor_type); + } +} + +void +gst_mpd_helper_segment_base_type_free (GstMPDSegmentBaseType * seg_base_type) +{ + if (seg_base_type) { + if (seg_base_type->indexRange) + g_slice_free (GstXMLRange, seg_base_type->indexRange); + gst_mpd_helper_url_type_node_free (seg_base_type->Initialization); + gst_mpd_helper_url_type_node_free (seg_base_type->RepresentationIndex); + g_slice_free (GstMPDSegmentBaseType, seg_base_type); + } +} + +void +gst_mpd_helper_mult_seg_base_type_free (GstMPDMultSegmentBaseType * + mult_seg_base_type) +{ + if (mult_seg_base_type) { + /* SegmentBaseType extension */ + gst_mpd_helper_segment_base_type_free (mult_seg_base_type->SegBaseType); + gst_mpd_segment_timeline_node_free (mult_seg_base_type->SegmentTimeline); + gst_mpd_helper_url_type_node_free (mult_seg_base_type->BitstreamSwitching); + g_slice_free (GstMPDMultSegmentBaseType, mult_seg_base_type); + } +} + +void +gst_mpd_helper_representation_base_type_free (GstMPDRepresentationBaseType * + representation_base) +{ + if (representation_base) { + if (representation_base->profiles) + xmlFree (representation_base->profiles); + g_slice_free (GstXMLRatio, representation_base->sar); + g_slice_free (GstXMLFrameRate, representation_base->frameRate); + g_slice_free (GstXMLFrameRate, representation_base->minFrameRate); + g_slice_free (GstXMLFrameRate, representation_base->maxFrameRate); + if (representation_base->audioSamplingRate) + xmlFree (representation_base->audioSamplingRate); + if (representation_base->mimeType) + xmlFree (representation_base->mimeType); + if (representation_base->segmentProfiles) + xmlFree (representation_base->segmentProfiles); + if (representation_base->codecs) + xmlFree (representation_base->codecs); + if (representation_base->scanType) + xmlFree (representation_base->scanType); + g_list_free_full (representation_base->FramePacking, + (GDestroyNotify) gst_mpd_helper_descriptor_type_free); + g_list_free_full (representation_base->AudioChannelConfiguration, + (GDestroyNotify) gst_mpd_helper_descriptor_type_free); + g_list_free_full (representation_base->ContentProtection, + (GDestroyNotify) gst_mpd_helper_descriptor_type_free); + g_slice_free (GstMPDRepresentationBaseType, representation_base); + } +} + +const gchar * +gst_mpd_helper_mimetype_to_caps (const gchar * mimeType) +{ + if (mimeType == NULL) + return NULL; + if (strcmp (mimeType, "video/mp2t") == 0) { + return "video/mpegts, systemstream=(bool) true"; + } else if (strcmp (mimeType, "video/mp4") == 0) { + return "video/quicktime"; + } else if (strcmp (mimeType, "audio/mp4") == 0) { + return "audio/x-m4a"; + } else if (strcmp (mimeType, "text/vtt") == 0) { + return "application/x-subtitle-vtt"; + } else + return mimeType; +} + +/* + * Combine a base url with the current stream base url from the list of + * baseURLs. Takes ownership of base and returns a new base. + */ +GstUri * +gst_mpd_helper_combine_urls (GstUri * base, GList * list, gchar ** query, + guint idx) +{ + GstMPDBaseURLNode *baseURL; + GstUri *ret = base; + + if (list != NULL) { + baseURL = g_list_nth_data (list, idx); + if (!baseURL) { + baseURL = list->data; + } + + ret = gst_uri_from_string_with_base (base, baseURL->baseURL); + gst_uri_unref (base); + + if (ret && query) { + g_free (*query); + *query = gst_uri_get_query_string (ret); + if (*query) { + ret = gst_uri_make_writable (ret); + gst_uri_set_query_table (ret, NULL); + } + } + } + + return ret; +} + +/* comparison functions */ +int +gst_mpd_helper_strncmp_ext (const char *s1, const char *s2) +{ + if (s1 == NULL && s2 == NULL) + return 0; + if (s1 == NULL && s2 != NULL) + return 1; + if (s2 == NULL && s1 != NULL) + return 1; + return strncmp (s1, s2, strlen (s2)); +} diff --git a/ext/dash/gstmpdhelper.h b/ext/dash/gstmpdhelper.h index 3da5df4..5bf35b6 100644 --- a/ext/dash/gstmpdhelper.h +++ b/ext/dash/gstmpdhelper.h @@ -22,6 +22,7 @@ #define __GST_MPDHELPER_H__ #include "gstxmlhelper.h" +#include "gstmpdsegmenttimelinenode.h" G_BEGIN_DECLS @@ -42,8 +43,91 @@ typedef enum GST_SAP_TYPE_6 } GstMPDSAPType; +typedef enum +{ + GST_MPD_XLINK_ACTUATE_ON_REQUEST, + GST_MPD_XLINK_ACTUATE_ON_LOAD +} GstMPDXLinkActuate; + +typedef struct _GstMPDURLType +{ + gchar *sourceURL; + GstXMLRange *range; +} GstMPDURLType; + +typedef struct _GstMPDDescriptorType +{ + gchar *schemeIdUri; + gchar *value; +} GstMPDDescriptorType; + +typedef struct _GstMPDSegmentBaseType +{ + guint timescale; + guint64 presentationTimeOffset; + GstXMLRange *indexRange; + gboolean indexRangeExact; + /* Initialization node */ + GstMPDURLType *Initialization; + /* RepresentationIndex node */ + GstMPDURLType *RepresentationIndex; +} GstMPDSegmentBaseType; + +typedef struct _GstMPDMultSegmentBaseType +{ + guint duration; /* in seconds */ + guint startNumber; + /* SegmentBaseType extension */ + GstMPDSegmentBaseType *SegBaseType; + /* SegmentTimeline node */ + GstMPDSegmentTimelineNode *SegmentTimeline; + /* BitstreamSwitching node */ + GstMPDURLType *BitstreamSwitching; +} GstMPDMultSegmentBaseType; + +typedef struct _GstMPDRepresentationBaseType +{ + gchar *profiles; + guint width; + guint height; + GstXMLRatio *sar; + GstXMLFrameRate *minFrameRate; + GstXMLFrameRate *maxFrameRate; + GstXMLFrameRate *frameRate; + gchar *audioSamplingRate; + gchar *mimeType; + gchar *segmentProfiles; + gchar *codecs; + gdouble maximumSAPPeriod; + GstMPDSAPType startWithSAP; + gdouble maxPlayoutRate; + gboolean codingDependency; + gchar *scanType; + /* list of FramePacking DescriptorType nodes */ + GList *FramePacking; + /* list of AudioChannelConfiguration DescriptorType nodes */ + GList *AudioChannelConfiguration; + /* list of ContentProtection DescriptorType nodes */ + GList *ContentProtection; +} GstMPDRepresentationBaseType; gboolean gst_mpd_helper_get_mpd_type (xmlNode * a_node, const gchar * property_name, GstMPDFileType * property_value); gboolean gst_mpd_helper_get_SAP_type (xmlNode * a_node, const gchar * property_name, GstMPDSAPType * property_value); + +GstMPDURLType *gst_mpd_helper_URLType_clone (GstMPDURLType * url); +void gst_mpd_helper_url_type_node_free (GstMPDURLType * url_type_node); +void gst_mpd_helper_descriptor_type_free (GstMPDDescriptorType * + descriptor_type); +void gst_mpd_helper_segment_base_type_free (GstMPDSegmentBaseType * seg_base_type); +void gst_mpd_helper_mult_seg_base_type_free (GstMPDMultSegmentBaseType * + mult_seg_base_type); +void +gst_mpd_helper_representation_base_type_free (GstMPDRepresentationBaseType * + representation_base); + +const gchar * gst_mpd_helper_mimetype_to_caps (const gchar * mimeType); +GstUri *gst_mpd_helper_combine_urls (GstUri * base, GList * list, gchar ** query, guint idx); +int gst_mpd_helper_strncmp_ext (const char *s1, const char *s2); + G_END_DECLS #endif /* __GST_MPDHELPER_H__ */ diff --git a/ext/dash/gstmpdmetricsnode.c b/ext/dash/gstmpdmetricsnode.c new file mode 100644 index 0000000..1c1d5e4 --- /dev/null +++ b/ext/dash/gstmpdmetricsnode.c @@ -0,0 +1,66 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdmetricsnode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDMetricsNode, gst_mpd_metrics_node, GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_metrics_node_finalize (GObject * object) +{ + GstMPDMetricsNode *self = GST_MPD_METRICS_NODE (object); + + g_free (self->metrics); + g_list_free_full (self->MetricsRanges, + (GDestroyNotify) gst_mpd_metrics_range_node_free); + + G_OBJECT_CLASS (gst_mpd_metrics_node_parent_class)->finalize (object); +} + +static void +gst_mpd_metrics_node_class_init (GstMPDMetricsNodeClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_metrics_node_finalize; +} + +static void +gst_mpd_metrics_node_init (GstMPDMetricsNode * self) +{ + self->metrics = NULL; + self->MetricsRanges = NULL; + self->Reportings = NULL; +} + +GstMPDMetricsNode * +gst_mpd_metrics_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_METRICS_NODE, NULL); +} + +void +gst_mpd_metrics_node_free (GstMPDMetricsNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdmetricsnode.h b/ext/dash/gstmpdmetricsnode.h new file mode 100644 index 0000000..ef3ec2b --- /dev/null +++ b/ext/dash/gstmpdmetricsnode.h @@ -0,0 +1,71 @@ +/* + * No description. + * + * gstmpdmetricsnode.h + * + * Copyright (C) 2019 Collabora inc. + * Authors: + * Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDMETRICSNODE_H__ +#define __GSTMPDMETRICSNODE_H__ + +#include +#include "gstmpdhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_METRICS_NODE gst_mpd_metrics_node_get_type () +#define GST_MPD_METRICS_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_METRICS_NODE, GstMPDMetricsNode)) +#define GST_MPD_METRICS_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_METRICS_NODE, GstMPDMetricsNodeClass)) +#define GST_IS_MPD_METRICS_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_METRICS_NODE)) +#define GST_IS_MPD_METRICS_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_METRICS_NODE)) +#define GST_MPD_METRICS_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_METRICS_NODE, GstMPDMetricsNodeClass)) + +typedef struct _GstMPDMetricsNode GstMPDMetricsNode; +typedef struct _GstMPDMetricsNodeClass GstMPDMetricsNodeClass; + + +struct _GstMPDMetricsNode +{ + GstObject parent_instance; + gchar *metrics; + /* list of Metrics Range nodes */ + GList *MetricsRanges; + /* list of Reporting nodes */ + GList *Reportings; +}; + +struct _GstMPDMetricsNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_metrics_node_get_type (void); + +GstMPDMetricsNode * gst_mpd_metrics_node_new (void); +void gst_mpd_metrics_node_free (GstMPDMetricsNode* self); + +G_END_DECLS + +#endif /* __GSTMPDMETRICSNODE_H__ */ diff --git a/ext/dash/gstmpdmetricsrangenode.c b/ext/dash/gstmpdmetricsrangenode.c new file mode 100644 index 0000000..1b8a9bd --- /dev/null +++ b/ext/dash/gstmpdmetricsrangenode.c @@ -0,0 +1,52 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdmetricsrangenode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDMetricsRangeNode, gst_mpd_metrics_range_node, + GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_metrics_range_node_class_init (GstMPDMetricsRangeNodeClass * klass) +{ +} + +static void +gst_mpd_metrics_range_node_init (GstMPDMetricsRangeNode * self) +{ + self->starttime = 0; /* [ms] */ + self->duration = 0; /* [ms] */ +} + +GstMPDMetricsRangeNode * +gst_mpd_metrics_range_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_METRICS_RANGE_NODE, NULL); +} + +void +gst_mpd_metrics_range_node_free (GstMPDMetricsRangeNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdmetricsrangenode.h b/ext/dash/gstmpdmetricsrangenode.h new file mode 100644 index 0000000..90709f9 --- /dev/null +++ b/ext/dash/gstmpdmetricsrangenode.h @@ -0,0 +1,64 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDMETRICSRANGENODE_H__ +#define __GSTMPDMETRICSRANGENODE_H__ + +#include +#include "gstmpdhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_METRICS_RANGE_NODE gst_mpd_metrics_range_node_get_type () +#define GST_MPD_METRICS_RANGE_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_METRICS_RANGE_NODE, GstMPDMetricsRangeNode)) +#define GST_MPD_METRICS_RANGE_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_METRICS_RANGE_NODE, GstMPDMetricsRangeNodeClass)) +#define GST_IS_MPD_METRICS_RANGE_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_METRICS_RANGE_NODE)) +#define GST_IS_MPD_METRICS_RANGE_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_METRICS_RANGE_NODE)) +#define GST_MPD_METRICS_RANGE_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_METRICS_RANGE_NODE, GstMPDMetricsRangeNodeClass)) + +typedef struct _GstMPDMetricsRangeNode GstMPDMetricsRangeNode; +typedef struct _GstMPDMetricsRangeNodeClass GstMPDMetricsRangeNodeClass; + + +struct _GstMPDMetricsRangeNode +{ + GstObject parent_instance; + guint64 starttime; /* [ms] */ + guint64 duration; /* [ms] */ +}; + +struct _GstMPDMetricsRangeNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_metrics_range_node_get_type (void); + +GstMPDMetricsRangeNode * gst_mpd_metrics_range_node_new (void); +void gst_mpd_metrics_range_node_free (GstMPDMetricsRangeNode* self); + +G_END_DECLS + +#endif /* __GSTMPDMETRICSRANGENODE_H__ */ diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index a924678..9dcc3bb 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -34,7 +34,7 @@ /* XML node parsing */ static void gst_mpdparser_parse_baseURL_node (GList ** list, xmlNode * a_node); -static void gst_mpdparser_parse_descriptor_type_node (GList ** list, +static void gst_mpdparser_parse_descriptor_type (GList ** list, xmlNode * a_node); static void gst_mpdparser_parse_content_component_node (GList ** list, xmlNode * a_node); @@ -43,30 +43,30 @@ static void gst_mpdparser_parse_subrepresentation_node (GList ** list, xmlNode * a_node); static void gst_mpdparser_parse_segment_url_node (GList ** list, xmlNode * a_node); -static void gst_mpdparser_parse_url_type_node (GstURLType ** pointer, +static void gst_mpdparser_parse_url_type_node (GstMPDURLType ** pointer, xmlNode * a_node); -static void gst_mpdparser_parse_seg_base_type_ext (GstSegmentBaseType ** - pointer, xmlNode * a_node, GstSegmentBaseType * parent); +static void gst_mpdparser_parse_seg_base_type_ext (GstMPDSegmentBaseType ** + pointer, xmlNode * a_node, GstMPDSegmentBaseType * parent); static void gst_mpdparser_parse_s_node (GQueue * queue, xmlNode * a_node); -static void gst_mpdparser_parse_segment_timeline_node (GstSegmentTimelineNode ** - pointer, xmlNode * a_node); +static void gst_mpdparser_parse_segment_timeline_node (GstMPDSegmentTimelineNode + ** pointer, xmlNode * a_node); static gboolean -gst_mpdparser_parse_mult_seg_base_type_ext (GstMultSegmentBaseType ** pointer, - xmlNode * a_node, GstMultSegmentBaseType * parent); -static gboolean gst_mpdparser_parse_segment_list_node (GstSegmentListNode ** - pointer, xmlNode * a_node, GstSegmentListNode * parent); +gst_mpdparser_parse_mult_seg_base_type_ext (GstMPDMultSegmentBaseType ** + pointer, xmlNode * a_node, GstMPDMultSegmentBaseType * parent); +static gboolean gst_mpdparser_parse_segment_list_node (GstMPDSegmentListNode ** + pointer, xmlNode * a_node, GstMPDSegmentListNode * parent); static void -gst_mpdparser_parse_representation_base_type (GstRepresentationBaseType ** +gst_mpdparser_parse_representation_base_type (GstMPDRepresentationBaseType ** pointer, xmlNode * a_node); static gboolean gst_mpdparser_parse_representation_node (GList ** list, - xmlNode * a_node, GstAdaptationSetNode * parent, - GstPeriodNode * period_node); + xmlNode * a_node, GstMPDAdaptationSetNode * parent, + GstMPDPeriodNode * period_node); static gboolean gst_mpdparser_parse_adaptation_set_node (GList ** list, - xmlNode * a_node, GstPeriodNode * parent); + xmlNode * a_node, GstMPDPeriodNode * parent); static void gst_mpdparser_parse_subset_node (GList ** list, xmlNode * a_node); static gboolean -gst_mpdparser_parse_segment_template_node (GstSegmentTemplateNode ** pointer, - xmlNode * a_node, GstSegmentTemplateNode * parent); +gst_mpdparser_parse_segment_template_node (GstMPDSegmentTemplateNode ** pointer, + xmlNode * a_node, GstMPDSegmentTemplateNode * parent); static gboolean gst_mpdparser_parse_period_node (GList ** list, xmlNode * a_node); static void gst_mpdparser_parse_program_info_node (GList ** list, @@ -74,51 +74,12 @@ static void gst_mpdparser_parse_program_info_node (GList ** list, static void gst_mpdparser_parse_metrics_range_node (GList ** list, xmlNode * a_node); static void gst_mpdparser_parse_metrics_node (GList ** list, xmlNode * a_node); -static gboolean gst_mpdparser_parse_root_node (GstMPDNode ** pointer, +static gboolean gst_mpdparser_parse_root_node (GstMPDRootNode ** pointer, xmlNode * a_node); static void gst_mpdparser_parse_utctiming_node (GList ** list, xmlNode * a_node); -static GstSNode *gst_mpdparser_clone_s_node (GstSNode * pointer); -static GstSegmentTimelineNode - * gst_mpdparser_clone_segment_timeline (GstSegmentTimelineNode * pointer); - -static GstURLType *gst_mpdparser_clone_URL (GstURLType * url); -static GstSegmentURLNode *gst_mpdparser_clone_segment_url (GstSegmentURLNode * - seg_url); - /* Memory management */ -static GstSegmentTimelineNode *gst_mpdparser_segment_timeline_node_new (void); -static void gst_mpdparser_free_prog_info_node (GstProgramInformationNode * - prog_info_node); -static void gst_mpdparser_free_metrics_node (GstMetricsNode * metrics_node); -static void gst_mpdparser_free_metrics_range_node (GstMetricsRangeNode * - metrics_range_node); -static void gst_mpdparser_free_subset_node (GstSubsetNode * subset_node); -static void gst_mpdparser_free_segment_template_node (GstSegmentTemplateNode * - segment_template_node); -static void -gst_mpdparser_free_representation_base_type (GstRepresentationBaseType * - representation_base); -static void gst_mpdparser_free_representation_node (GstRepresentationNode * - representation_node); -static void gst_mpdparser_free_subrepresentation_node (GstSubRepresentationNode - * subrep_node); -static void gst_mpdparser_free_s_node (GstSNode * s_node); -static void gst_mpdparser_free_segment_timeline_node (GstSegmentTimelineNode * - seg_timeline); -static void gst_mpdparser_free_url_type_node (GstURLType * url_type_node); -static void gst_mpdparser_free_seg_base_type_ext (GstSegmentBaseType * - seg_base_type); -static void gst_mpdparser_free_mult_seg_base_type_ext (GstMultSegmentBaseType * - mult_seg_base_type); -static void gst_mpdparser_free_segment_url_node (GstSegmentURLNode * - segment_url); -static void gst_mpdparser_free_descriptor_type_node (GstDescriptorType * - descriptor_type); -static void gst_mpdparser_free_content_component_node (GstContentComponentNode * - content_component_node); -static void gst_mpdparser_free_utctiming_node (GstUTCTimingNode * timing_type); struct GstMpdParserUtcTimingMethod { @@ -177,9 +138,9 @@ static const struct GstMpdParserUtcTimingMethod static void gst_mpdparser_parse_baseURL_node (GList ** list, xmlNode * a_node) { - GstBaseURL *new_base_url; + GstMPDBaseURLNode *new_base_url; - new_base_url = g_slice_new0 (GstBaseURL); + new_base_url = gst_mpd_baseurl_node_new (); *list = g_list_append (*list, new_base_url); GST_LOG ("content of BaseURL node:"); @@ -193,11 +154,11 @@ gst_mpdparser_parse_baseURL_node (GList ** list, xmlNode * a_node) } static void -gst_mpdparser_parse_descriptor_type_node (GList ** list, xmlNode * a_node) +gst_mpdparser_parse_descriptor_type (GList ** list, xmlNode * a_node) { - GstDescriptorType *new_descriptor; + GstMPDDescriptorType *new_descriptor; - new_descriptor = g_slice_new0 (GstDescriptorType); + new_descriptor = g_slice_new0 (GstMPDDescriptorType); *list = g_list_append (*list, new_descriptor); GST_LOG ("attributes of %s node:", a_node->name); @@ -213,9 +174,9 @@ static void gst_mpdparser_parse_content_component_node (GList ** list, xmlNode * a_node) { xmlNode *cur_node; - GstContentComponentNode *new_content_component; + GstMPDContentComponentNode *new_content_component; - new_content_component = g_slice_new0 (GstContentComponentNode); + new_content_component = gst_mpd_content_component_node_new (); *list = g_list_append (*list, new_content_component); GST_LOG ("attributes of ContentComponent node:"); @@ -230,16 +191,16 @@ gst_mpdparser_parse_content_component_node (GList ** list, xmlNode * a_node) for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { if (xmlStrcmp (cur_node->name, (xmlChar *) "Accessibility") == 0) { - gst_mpdparser_parse_descriptor_type_node + gst_mpdparser_parse_descriptor_type (&new_content_component->Accessibility, cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Role") == 0) { - gst_mpdparser_parse_descriptor_type_node (&new_content_component->Role, + gst_mpdparser_parse_descriptor_type (&new_content_component->Role, cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Rating") == 0) { - gst_mpdparser_parse_descriptor_type_node + gst_mpdparser_parse_descriptor_type (&new_content_component->Rating, cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Viewpoint") == 0) { - gst_mpdparser_parse_descriptor_type_node + gst_mpdparser_parse_descriptor_type (&new_content_component->Viewpoint, cur_node); } } @@ -259,9 +220,9 @@ gst_mpdparser_parse_location_node (GList ** list, xmlNode * a_node) static void gst_mpdparser_parse_subrepresentation_node (GList ** list, xmlNode * a_node) { - GstSubRepresentationNode *new_subrep; + GstMPDSubRepresentationNode *new_subrep; - new_subrep = g_slice_new0 (GstSubRepresentationNode); + new_subrep = gst_mpd_sub_representation_node_new (); *list = g_list_append (*list, new_subrep); GST_LOG ("attributes of SubRepresentation node:"); @@ -279,28 +240,14 @@ gst_mpdparser_parse_subrepresentation_node (GList ** list, xmlNode * a_node) a_node); } -static GstSegmentURLNode * -gst_mpdparser_clone_segment_url (GstSegmentURLNode * seg_url) -{ - GstSegmentURLNode *clone = NULL; - - if (seg_url) { - clone = g_slice_new0 (GstSegmentURLNode); - clone->media = xmlMemStrdup (seg_url->media); - clone->mediaRange = gst_xml_helper_clone_range (seg_url->mediaRange); - clone->index = xmlMemStrdup (seg_url->index); - clone->indexRange = gst_xml_helper_clone_range (seg_url->indexRange); - } - return clone; -} static void gst_mpdparser_parse_segment_url_node (GList ** list, xmlNode * a_node) { - GstSegmentURLNode *new_segment_url; + GstMPDSegmentURLNode *new_segment_url; - new_segment_url = g_slice_new0 (GstSegmentURLNode); + new_segment_url = gst_mpd_segment_url_node_new (); *list = g_list_append (*list, new_segment_url); GST_LOG ("attributes of SegmentURL node:"); @@ -313,12 +260,12 @@ gst_mpdparser_parse_segment_url_node (GList ** list, xmlNode * a_node) } static void -gst_mpdparser_parse_url_type_node (GstURLType ** pointer, xmlNode * a_node) +gst_mpdparser_parse_url_type_node (GstMPDURLType ** pointer, xmlNode * a_node) { - GstURLType *new_url_type; + GstMPDURLType *new_url_type; - gst_mpdparser_free_url_type_node (*pointer); - *pointer = new_url_type = g_slice_new0 (GstURLType); + gst_mpd_helper_url_type_node_free (*pointer); + *pointer = new_url_type = g_slice_new0 (GstMPDURLType); GST_LOG ("attributes of URLType node:"); gst_xml_helper_get_prop_string (a_node, "sourceURL", @@ -327,18 +274,18 @@ gst_mpdparser_parse_url_type_node (GstURLType ** pointer, xmlNode * a_node) } static void -gst_mpdparser_parse_seg_base_type_ext (GstSegmentBaseType ** pointer, - xmlNode * a_node, GstSegmentBaseType * parent) +gst_mpdparser_parse_seg_base_type_ext (GstMPDSegmentBaseType ** pointer, + xmlNode * a_node, GstMPDSegmentBaseType * parent) { xmlNode *cur_node; - GstSegmentBaseType *seg_base_type; + GstMPDSegmentBaseType *seg_base_type; guint intval; guint64 int64val; gboolean boolval; GstXMLRange *rangeval; - gst_mpdparser_free_seg_base_type_ext (*pointer); - *pointer = seg_base_type = g_slice_new0 (GstSegmentBaseType); + gst_mpd_helper_segment_base_type_free (*pointer); + *pointer = seg_base_type = g_slice_new0 (GstMPDSegmentBaseType); /* Initialize values that have defaults */ seg_base_type->indexRangeExact = FALSE; @@ -351,9 +298,9 @@ gst_mpdparser_parse_seg_base_type_ext (GstSegmentBaseType ** pointer, seg_base_type->indexRange = gst_xml_helper_clone_range (parent->indexRange); seg_base_type->indexRangeExact = parent->indexRangeExact; seg_base_type->Initialization = - gst_mpdparser_clone_URL (parent->Initialization); + gst_mpd_helper_URLType_clone (parent->Initialization); seg_base_type->RepresentationIndex = - gst_mpdparser_clone_URL (parent->RepresentationIndex); + gst_mpd_helper_URLType_clone (parent->RepresentationIndex); } /* We must retrieve each value first to see if it exists. If it does not @@ -396,27 +343,14 @@ gst_mpdparser_parse_seg_base_type_ext (GstSegmentBaseType ** pointer, } } -static GstSNode * -gst_mpdparser_clone_s_node (GstSNode * pointer) -{ - GstSNode *clone = NULL; - if (pointer) { - clone = g_slice_new0 (GstSNode); - clone->t = pointer->t; - clone->d = pointer->d; - clone->r = pointer->r; - } - - return clone; -} static void gst_mpdparser_parse_s_node (GQueue * queue, xmlNode * a_node) { - GstSNode *new_s_node; + GstMPDSNode *new_s_node; - new_s_node = g_slice_new0 (GstSNode); + new_s_node = gst_mpd_s_node_new (); g_queue_push_tail (queue, new_s_node); GST_LOG ("attributes of S node:"); @@ -425,40 +359,17 @@ gst_mpdparser_parse_s_node (GQueue * queue, xmlNode * a_node) gst_xml_helper_get_prop_signed_integer (a_node, "r", 0, &new_s_node->r); } -static GstSegmentTimelineNode * -gst_mpdparser_clone_segment_timeline (GstSegmentTimelineNode * pointer) -{ - GstSegmentTimelineNode *clone = NULL; - - if (pointer) { - clone = gst_mpdparser_segment_timeline_node_new (); - if (clone) { - GList *list; - for (list = g_queue_peek_head_link (&pointer->S); list; - list = g_list_next (list)) { - GstSNode *s_node; - s_node = (GstSNode *) list->data; - if (s_node) { - g_queue_push_tail (&clone->S, gst_mpdparser_clone_s_node (s_node)); - } - } - } else { - GST_WARNING ("Allocation of SegmentTimeline node failed!"); - } - } - return clone; -} static void -gst_mpdparser_parse_segment_timeline_node (GstSegmentTimelineNode ** pointer, +gst_mpdparser_parse_segment_timeline_node (GstMPDSegmentTimelineNode ** pointer, xmlNode * a_node) { xmlNode *cur_node; - GstSegmentTimelineNode *new_seg_timeline; + GstMPDSegmentTimelineNode *new_seg_timeline; - gst_mpdparser_free_segment_timeline_node (*pointer); - *pointer = new_seg_timeline = gst_mpdparser_segment_timeline_node_new (); + gst_mpd_segment_timeline_node_free (*pointer); + *pointer = new_seg_timeline = gst_mpd_segment_timeline_node_new (); if (new_seg_timeline == NULL) { GST_WARNING ("Allocation of SegmentTimeline node failed!"); return; @@ -475,16 +386,16 @@ gst_mpdparser_parse_segment_timeline_node (GstSegmentTimelineNode ** pointer, } static gboolean -gst_mpdparser_parse_mult_seg_base_type_ext (GstMultSegmentBaseType ** pointer, - xmlNode * a_node, GstMultSegmentBaseType * parent) +gst_mpdparser_parse_mult_seg_base_type_ext (GstMPDMultSegmentBaseType ** + pointer, xmlNode * a_node, GstMPDMultSegmentBaseType * parent) { xmlNode *cur_node; - GstMultSegmentBaseType *mult_seg_base_type; + GstMPDMultSegmentBaseType *mult_seg_base_type; guint intval; gboolean has_timeline = FALSE, has_duration = FALSE; - gst_mpdparser_free_mult_seg_base_type_ext (*pointer); - mult_seg_base_type = g_slice_new0 (GstMultSegmentBaseType); + gst_mpd_helper_mult_seg_base_type_free (*pointer); + mult_seg_base_type = g_slice_new0 (GstMPDMultSegmentBaseType); mult_seg_base_type->duration = 0; mult_seg_base_type->startNumber = 1; @@ -494,9 +405,9 @@ gst_mpdparser_parse_mult_seg_base_type_ext (GstMultSegmentBaseType ** pointer, mult_seg_base_type->duration = parent->duration; mult_seg_base_type->startNumber = parent->startNumber; mult_seg_base_type->SegmentTimeline = - gst_mpdparser_clone_segment_timeline (parent->SegmentTimeline); + gst_mpd_segment_timeline_node_clone (parent->SegmentTimeline); mult_seg_base_type->BitstreamSwitching = - gst_mpdparser_clone_URL (parent->BitstreamSwitching); + gst_mpd_helper_URLType_clone (parent->BitstreamSwitching); } GST_LOG ("attributes of MultipleSegmentBaseType extension:"); @@ -546,43 +457,43 @@ gst_mpdparser_parse_mult_seg_base_type_ext (GstMultSegmentBaseType ** pointer, return TRUE; error: - gst_mpdparser_free_mult_seg_base_type_ext (mult_seg_base_type); + gst_mpd_helper_mult_seg_base_type_free (mult_seg_base_type); return FALSE; } static gboolean -gst_mpdparser_parse_segment_list_node (GstSegmentListNode ** pointer, - xmlNode * a_node, GstSegmentListNode * parent) +gst_mpdparser_parse_segment_list_node (GstMPDSegmentListNode ** pointer, + xmlNode * a_node, GstMPDSegmentListNode * parent) { xmlNode *cur_node; - GstSegmentListNode *new_segment_list; + GstMPDSegmentListNode *new_segment_list; gchar *actuate; gboolean segment_urls_inherited_from_parent = FALSE; - gst_mpdparser_free_segment_list_node (*pointer); - new_segment_list = g_slice_new0 (GstSegmentListNode); + gst_mpd_segment_list_node_free (*pointer); + new_segment_list = gst_mpd_segment_list_node_new (); /* Inherit attribute values from parent */ if (parent) { GList *list; - GstSegmentURLNode *seg_url; + GstMPDSegmentURLNode *seg_url; for (list = g_list_first (parent->SegmentURL); list; list = g_list_next (list)) { - seg_url = (GstSegmentURLNode *) list->data; + seg_url = (GstMPDSegmentURLNode *) list->data; new_segment_list->SegmentURL = g_list_append (new_segment_list->SegmentURL, - gst_mpdparser_clone_segment_url (seg_url)); + gst_mpd_segment_url_node_clone (seg_url)); segment_urls_inherited_from_parent = TRUE; } } - new_segment_list->actuate = GST_XLINK_ACTUATE_ON_REQUEST; + new_segment_list->actuate = GST_MPD_XLINK_ACTUATE_ON_REQUEST; if (gst_xml_helper_get_ns_prop_string (a_node, "http://www.w3.org/1999/xlink", "href", &new_segment_list->xlink_href) && gst_xml_helper_get_ns_prop_string (a_node, "http://www.w3.org/1999/xlink", "actuate", &actuate)) { if (strcmp (actuate, "onLoad") == 0) - new_segment_list->actuate = GST_XLINK_ACTUATE_ON_LOAD; + new_segment_list->actuate = GST_MPD_XLINK_ACTUATE_ON_LOAD; xmlFree (actuate); } @@ -607,7 +518,7 @@ gst_mpdparser_parse_segment_list_node (GstSegmentListNode ** pointer, /* Clear the list of inherited segment URLs */ g_list_free_full (new_segment_list->SegmentURL, - (GDestroyNotify) gst_mpdparser_free_segment_url_node); + (GDestroyNotify) gst_mpd_segment_url_node_free); new_segment_list->SegmentURL = NULL; /* mark the fact that we cleared the list, so that it is not tried again */ @@ -623,7 +534,7 @@ gst_mpdparser_parse_segment_list_node (GstSegmentListNode ** pointer, return TRUE; error: - gst_mpdparser_free_segment_list_node (new_segment_list); + gst_mpd_segment_list_node_free (new_segment_list); return FALSE; } @@ -637,8 +548,8 @@ gst_mpdparser_parse_content_protection_node (GList ** list, xmlNode * a_node) for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { if (xmlStrcmp (cur_node->name, (xmlChar *) "pro") == 0) { - GstDescriptorType *new_descriptor; - new_descriptor = g_slice_new0 (GstDescriptorType); + GstMPDDescriptorType *new_descriptor; + new_descriptor = g_slice_new0 (GstMPDDescriptorType); *list = g_list_append (*list, new_descriptor); gst_xml_helper_get_prop_string_stripped (a_node, "schemeIdUri", @@ -650,10 +561,10 @@ gst_mpdparser_parse_content_protection_node (GList ** list, xmlNode * a_node) } } } else { - gst_mpdparser_parse_descriptor_type_node (list, a_node); + gst_mpdparser_parse_descriptor_type (list, a_node); } } else { - gst_mpdparser_parse_descriptor_type_node (list, a_node); + gst_mpdparser_parse_descriptor_type (list, a_node); } beach: if (value) @@ -661,14 +572,14 @@ beach: } static void -gst_mpdparser_parse_representation_base_type (GstRepresentationBaseType ** +gst_mpdparser_parse_representation_base_type (GstMPDRepresentationBaseType ** pointer, xmlNode * a_node) { xmlNode *cur_node; - GstRepresentationBaseType *representation_base; + GstMPDRepresentationBaseType *representation_base; - gst_mpdparser_free_representation_base_type (*pointer); - *pointer = representation_base = g_slice_new0 (GstRepresentationBaseType); + gst_mpd_helper_representation_base_type_free (*pointer); + *pointer = representation_base = g_slice_new0 (GstMPDRepresentationBaseType); GST_LOG ("attributes of RepresentationBaseType extension:"); gst_xml_helper_get_prop_string (a_node, "profiles", @@ -707,11 +618,11 @@ gst_mpdparser_parse_representation_base_type (GstRepresentationBaseType ** for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { if (xmlStrcmp (cur_node->name, (xmlChar *) "FramePacking") == 0) { - gst_mpdparser_parse_descriptor_type_node + gst_mpdparser_parse_descriptor_type (&representation_base->FramePacking, cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "AudioChannelConfiguration") == 0) { - gst_mpdparser_parse_descriptor_type_node + gst_mpdparser_parse_descriptor_type (&representation_base->AudioChannelConfiguration, cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "ContentProtection") == 0) { @@ -724,12 +635,12 @@ gst_mpdparser_parse_representation_base_type (GstRepresentationBaseType ** static gboolean gst_mpdparser_parse_representation_node (GList ** list, xmlNode * a_node, - GstAdaptationSetNode * parent, GstPeriodNode * period_node) + GstMPDAdaptationSetNode * parent, GstMPDPeriodNode * period_node) { xmlNode *cur_node; - GstRepresentationNode *new_representation; + GstMPDRepresentationNode *new_representation; - new_representation = g_slice_new0 (GstRepresentationNode); + new_representation = gst_mpd_representation_node_new (); GST_LOG ("attributes of Representation node:"); if (!gst_xml_helper_get_prop_string_no_whitespace (a_node, "id", @@ -769,8 +680,8 @@ gst_mpdparser_parse_representation_node (GList ** list, xmlNode * a_node, } else if (xmlStrcmp (cur_node->name, (xmlChar *) "SegmentList") == 0) { if (!gst_mpdparser_parse_segment_list_node (&new_representation->SegmentList, cur_node, - parent->SegmentList ? parent-> - SegmentList : period_node->SegmentList)) + parent->SegmentList ? parent->SegmentList : period_node-> + SegmentList)) goto error; } else if (xmlStrcmp (cur_node->name, (xmlChar *) "BaseURL") == 0) { gst_mpdparser_parse_baseURL_node (&new_representation->BaseURLs, @@ -789,29 +700,29 @@ gst_mpdparser_parse_representation_node (GList ** list, xmlNode * a_node, return TRUE; error: - gst_mpdparser_free_representation_node (new_representation); + gst_mpd_representation_node_free (new_representation); return FALSE; } static gboolean gst_mpdparser_parse_adaptation_set_node (GList ** list, xmlNode * a_node, - GstPeriodNode * parent) + GstMPDPeriodNode * parent) { xmlNode *cur_node; - GstAdaptationSetNode *new_adap_set; + GstMPDAdaptationSetNode *new_adap_set; gchar *actuate; - new_adap_set = g_slice_new0 (GstAdaptationSetNode); + new_adap_set = gst_mpd_adaptation_set_node_new (); GST_LOG ("attributes of AdaptationSet node:"); - new_adap_set->actuate = GST_XLINK_ACTUATE_ON_REQUEST; + new_adap_set->actuate = GST_MPD_XLINK_ACTUATE_ON_REQUEST; if (gst_xml_helper_get_ns_prop_string (a_node, "http://www.w3.org/1999/xlink", "href", &new_adap_set->xlink_href) && gst_xml_helper_get_ns_prop_string (a_node, "http://www.w3.org/1999/xlink", "actuate", &actuate)) { if (strcmp (actuate, "onLoad") == 0) - new_adap_set->actuate = GST_XLINK_ACTUATE_ON_LOAD; + new_adap_set->actuate = GST_MPD_XLINK_ACTUATE_ON_LOAD; xmlFree (actuate); } @@ -860,16 +771,14 @@ gst_mpdparser_parse_adaptation_set_node (GList ** list, xmlNode * a_node, for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { if (xmlStrcmp (cur_node->name, (xmlChar *) "Accessibility") == 0) { - gst_mpdparser_parse_descriptor_type_node (&new_adap_set->Accessibility, + gst_mpdparser_parse_descriptor_type (&new_adap_set->Accessibility, cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Role") == 0) { - gst_mpdparser_parse_descriptor_type_node (&new_adap_set->Role, - cur_node); + gst_mpdparser_parse_descriptor_type (&new_adap_set->Role, cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Rating") == 0) { - gst_mpdparser_parse_descriptor_type_node (&new_adap_set->Rating, - cur_node); + gst_mpdparser_parse_descriptor_type (&new_adap_set->Rating, cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Viewpoint") == 0) { - gst_mpdparser_parse_descriptor_type_node (&new_adap_set->Viewpoint, + gst_mpdparser_parse_descriptor_type (&new_adap_set->Viewpoint, cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "BaseURL") == 0) { gst_mpdparser_parse_baseURL_node (&new_adap_set->BaseURLs, cur_node); @@ -910,16 +819,16 @@ gst_mpdparser_parse_adaptation_set_node (GList ** list, xmlNode * a_node, return TRUE; error: - gst_mpdparser_free_adaptation_set_node (new_adap_set); + gst_mpd_adaptation_set_node_free (new_adap_set); return FALSE; } static void gst_mpdparser_parse_subset_node (GList ** list, xmlNode * a_node) { - GstSubsetNode *new_subset; + GstMPDSubsetNode *new_subset; - new_subset = g_slice_new0 (GstSubsetNode); + new_subset = gst_mpd_subset_node_new (); *list = g_list_append (*list, new_subset); GST_LOG ("attributes of Subset node:"); @@ -928,14 +837,14 @@ gst_mpdparser_parse_subset_node (GList ** list, xmlNode * a_node) } static gboolean -gst_mpdparser_parse_segment_template_node (GstSegmentTemplateNode ** pointer, - xmlNode * a_node, GstSegmentTemplateNode * parent) +gst_mpdparser_parse_segment_template_node (GstMPDSegmentTemplateNode ** pointer, + xmlNode * a_node, GstMPDSegmentTemplateNode * parent) { - GstSegmentTemplateNode *new_segment_template; + GstMPDSegmentTemplateNode *new_segment_template; gchar *strval; - gst_mpdparser_free_segment_template_node (*pointer); - new_segment_template = g_slice_new0 (GstSegmentTemplateNode); + gst_mpd_segment_template_node_free (*pointer); + new_segment_template = gst_mpd_segment_template_node_new (); GST_LOG ("extension of SegmentTemplate node:"); if (!gst_mpdparser_parse_mult_seg_base_type_ext @@ -975,7 +884,7 @@ gst_mpdparser_parse_segment_template_node (GstSegmentTemplateNode ** pointer, return TRUE; error: - gst_mpdparser_free_segment_template_node (new_segment_template); + gst_mpd_segment_template_node_free (new_segment_template); return FALSE; } @@ -983,20 +892,20 @@ static gboolean gst_mpdparser_parse_period_node (GList ** list, xmlNode * a_node) { xmlNode *cur_node; - GstPeriodNode *new_period; + GstMPDPeriodNode *new_period; gchar *actuate; - new_period = g_slice_new0 (GstPeriodNode); + new_period = gst_mpd_period_node_new (); GST_LOG ("attributes of Period node:"); - new_period->actuate = GST_XLINK_ACTUATE_ON_REQUEST; + new_period->actuate = GST_MPD_XLINK_ACTUATE_ON_REQUEST; if (gst_xml_helper_get_ns_prop_string (a_node, "http://www.w3.org/1999/xlink", "href", &new_period->xlink_href) && gst_xml_helper_get_ns_prop_string (a_node, "http://www.w3.org/1999/xlink", "actuate", &actuate)) { if (strcmp (actuate, "onLoad") == 0) - new_period->actuate = GST_XLINK_ACTUATE_ON_LOAD; + new_period->actuate = GST_MPD_XLINK_ACTUATE_ON_LOAD; xmlFree (actuate); } @@ -1048,7 +957,7 @@ gst_mpdparser_parse_period_node (GList ** list, xmlNode * a_node) return TRUE; error: - gst_mpdparser_free_period_node (new_period); + gst_mpd_period_node_free (new_period); return FALSE; } @@ -1056,9 +965,9 @@ static void gst_mpdparser_parse_program_info_node (GList ** list, xmlNode * a_node) { xmlNode *cur_node; - GstProgramInformationNode *new_prog_info; + GstMPDProgramInformationNode *new_prog_info; - new_prog_info = g_slice_new0 (GstProgramInformationNode); + new_prog_info = gst_mpd_program_information_node_new (); *list = g_list_append (*list, new_prog_info); GST_LOG ("attributes of ProgramInformation node:"); @@ -1084,9 +993,9 @@ gst_mpdparser_parse_program_info_node (GList ** list, xmlNode * a_node) static void gst_mpdparser_parse_metrics_range_node (GList ** list, xmlNode * a_node) { - GstMetricsRangeNode *new_metrics_range; + GstMPDMetricsRangeNode *new_metrics_range; - new_metrics_range = g_slice_new0 (GstMetricsRangeNode); + new_metrics_range = gst_mpd_metrics_range_node_new (); *list = g_list_append (*list, new_metrics_range); GST_LOG ("attributes of Metrics Range node:"); @@ -1100,9 +1009,9 @@ static void gst_mpdparser_parse_metrics_node (GList ** list, xmlNode * a_node) { xmlNode *cur_node; - GstMetricsNode *new_metrics; + GstMPDMetricsNode *new_metrics; - new_metrics = g_slice_new0 (GstMetricsNode); + new_metrics = gst_mpd_metrics_node_new (); *list = g_list_append (*list, new_metrics); GST_LOG ("attributes of Metrics node:"); @@ -1131,11 +1040,11 @@ gst_mpdparser_parse_metrics_node (GList ** list, xmlNode * a_node) static void gst_mpdparser_parse_utctiming_node (GList ** list, xmlNode * a_node) { - GstUTCTimingNode *new_timing; + GstMPDUTCTimingNode *new_timing; gchar *method = NULL; gchar *value = NULL; - new_timing = g_slice_new0 (GstUTCTimingNode); + new_timing = gst_mpd_utctiming_node_new (); GST_LOG ("attributes of UTCTiming node:"); if (gst_xml_helper_get_prop_string (a_node, "schemeIdUri", &method)) { @@ -1168,338 +1077,85 @@ gst_mpdparser_parse_utctiming_node (GList ** list, xmlNode * a_node) g_strv_length (new_timing->urls) != 0) { *list = g_list_append (*list, new_timing); } else { - gst_mpdparser_free_utctiming_node (new_timing); + gst_mpd_utctiming_node_free (new_timing); } } static gboolean -gst_mpdparser_parse_root_node (GstMPDNode ** pointer, xmlNode * a_node) +gst_mpdparser_parse_root_node (GstMPDRootNode ** pointer, xmlNode * a_node) { xmlNode *cur_node; - GstMPDNode *new_mpd; + GstMPDRootNode *new_mpd_root; - gst_mpdparser_free_mpd_node (*pointer); + gst_mpd_root_node_free (*pointer); *pointer = NULL; - new_mpd = g_slice_new0 (GstMPDNode); + new_mpd_root = gst_mpd_root_node_new (); GST_LOG ("namespaces of root MPD node:"); - new_mpd->default_namespace = gst_xml_helper_get_node_namespace (a_node, NULL); - new_mpd->namespace_xsi = gst_xml_helper_get_node_namespace (a_node, "xsi"); - new_mpd->namespace_ext = gst_xml_helper_get_node_namespace (a_node, "ext"); + new_mpd_root->default_namespace = + gst_xml_helper_get_node_namespace (a_node, NULL); + new_mpd_root->namespace_xsi = + gst_xml_helper_get_node_namespace (a_node, "xsi"); + new_mpd_root->namespace_ext = + gst_xml_helper_get_node_namespace (a_node, "ext"); GST_LOG ("attributes of root MPD node:"); gst_xml_helper_get_prop_string (a_node, "schemaLocation", - &new_mpd->schemaLocation); - gst_xml_helper_get_prop_string (a_node, "id", &new_mpd->id); - gst_xml_helper_get_prop_string (a_node, "profiles", &new_mpd->profiles); - gst_mpd_helper_get_mpd_type (a_node, "type", &new_mpd->type); + &new_mpd_root->schemaLocation); + gst_xml_helper_get_prop_string (a_node, "id", &new_mpd_root->id); + gst_xml_helper_get_prop_string (a_node, "profiles", &new_mpd_root->profiles); + gst_mpd_helper_get_mpd_type (a_node, "type", &new_mpd_root->type); gst_xml_helper_get_prop_dateTime (a_node, "availabilityStartTime", - &new_mpd->availabilityStartTime); + &new_mpd_root->availabilityStartTime); gst_xml_helper_get_prop_dateTime (a_node, "availabilityEndTime", - &new_mpd->availabilityEndTime); + &new_mpd_root->availabilityEndTime); gst_xml_helper_get_prop_duration (a_node, "mediaPresentationDuration", - GST_MPD_DURATION_NONE, &new_mpd->mediaPresentationDuration); + GST_MPD_DURATION_NONE, &new_mpd_root->mediaPresentationDuration); gst_xml_helper_get_prop_duration (a_node, "minimumUpdatePeriod", - GST_MPD_DURATION_NONE, &new_mpd->minimumUpdatePeriod); + GST_MPD_DURATION_NONE, &new_mpd_root->minimumUpdatePeriod); gst_xml_helper_get_prop_duration (a_node, "minBufferTime", - GST_MPD_DURATION_NONE, &new_mpd->minBufferTime); + GST_MPD_DURATION_NONE, &new_mpd_root->minBufferTime); gst_xml_helper_get_prop_duration (a_node, "timeShiftBufferDepth", - GST_MPD_DURATION_NONE, &new_mpd->timeShiftBufferDepth); + GST_MPD_DURATION_NONE, &new_mpd_root->timeShiftBufferDepth); gst_xml_helper_get_prop_duration (a_node, "suggestedPresentationDelay", - GST_MPD_DURATION_NONE, &new_mpd->suggestedPresentationDelay); + GST_MPD_DURATION_NONE, &new_mpd_root->suggestedPresentationDelay); gst_xml_helper_get_prop_duration (a_node, "maxSegmentDuration", - GST_MPD_DURATION_NONE, &new_mpd->maxSegmentDuration); + GST_MPD_DURATION_NONE, &new_mpd_root->maxSegmentDuration); gst_xml_helper_get_prop_duration (a_node, "maxSubsegmentDuration", - GST_MPD_DURATION_NONE, &new_mpd->maxSubsegmentDuration); + GST_MPD_DURATION_NONE, &new_mpd_root->maxSubsegmentDuration); /* explore children Period nodes */ for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { if (xmlStrcmp (cur_node->name, (xmlChar *) "Period") == 0) { - if (!gst_mpdparser_parse_period_node (&new_mpd->Periods, cur_node)) + if (!gst_mpdparser_parse_period_node (&new_mpd_root->Periods, cur_node)) goto error; } else if (xmlStrcmp (cur_node->name, (xmlChar *) "ProgramInformation") == 0) { - gst_mpdparser_parse_program_info_node (&new_mpd->ProgramInfo, cur_node); + gst_mpdparser_parse_program_info_node (&new_mpd_root->ProgramInfos, + cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "BaseURL") == 0) { - gst_mpdparser_parse_baseURL_node (&new_mpd->BaseURLs, cur_node); + gst_mpdparser_parse_baseURL_node (&new_mpd_root->BaseURLs, cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Location") == 0) { - gst_mpdparser_parse_location_node (&new_mpd->Locations, cur_node); + gst_mpdparser_parse_location_node (&new_mpd_root->Locations, cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Metrics") == 0) { - gst_mpdparser_parse_metrics_node (&new_mpd->Metrics, cur_node); + gst_mpdparser_parse_metrics_node (&new_mpd_root->Metrics, cur_node); } else if (xmlStrcmp (cur_node->name, (xmlChar *) "UTCTiming") == 0) { - gst_mpdparser_parse_utctiming_node (&new_mpd->UTCTiming, cur_node); + gst_mpdparser_parse_utctiming_node (&new_mpd_root->UTCTimings, + cur_node); } } } - *pointer = new_mpd; + *pointer = new_mpd_root; return TRUE; error: - gst_mpdparser_free_mpd_node (new_mpd); + gst_mpd_root_node_free (new_mpd_root); return FALSE; } /* internal memory management functions */ -static void -gst_mpdparser_free_prog_info_node (GstProgramInformationNode * prog_info_node) -{ - if (prog_info_node) { - if (prog_info_node->lang) - xmlFree (prog_info_node->lang); - if (prog_info_node->moreInformationURL) - xmlFree (prog_info_node->moreInformationURL); - if (prog_info_node->Title) - xmlFree (prog_info_node->Title); - if (prog_info_node->Source) - xmlFree (prog_info_node->Source); - if (prog_info_node->Copyright) - xmlFree (prog_info_node->Copyright); - g_slice_free (GstProgramInformationNode, prog_info_node); - } -} - -static void -gst_mpdparser_free_metrics_node (GstMetricsNode * metrics_node) -{ - if (metrics_node) { - if (metrics_node->metrics) - xmlFree (metrics_node->metrics); - g_list_free_full (metrics_node->MetricsRanges, - (GDestroyNotify) gst_mpdparser_free_metrics_range_node); - g_slice_free (GstMetricsNode, metrics_node); - } -} - -static void -gst_mpdparser_free_metrics_range_node (GstMetricsRangeNode * metrics_range_node) -{ - if (metrics_range_node) { - g_slice_free (GstMetricsRangeNode, metrics_range_node); - } -} - -static void -gst_mpdparser_free_subset_node (GstSubsetNode * subset_node) -{ - if (subset_node) { - if (subset_node->contains) - xmlFree (subset_node->contains); - g_slice_free (GstSubsetNode, subset_node); - } -} - -static void -gst_mpdparser_free_segment_template_node (GstSegmentTemplateNode * - segment_template_node) -{ - if (segment_template_node) { - if (segment_template_node->media) - xmlFree (segment_template_node->media); - if (segment_template_node->index) - xmlFree (segment_template_node->index); - if (segment_template_node->initialization) - xmlFree (segment_template_node->initialization); - if (segment_template_node->bitstreamSwitching) - xmlFree (segment_template_node->bitstreamSwitching); - /* MultipleSegmentBaseType extension */ - gst_mpdparser_free_mult_seg_base_type_ext - (segment_template_node->MultSegBaseType); - g_slice_free (GstSegmentTemplateNode, segment_template_node); - } -} - -static void -gst_mpdparser_free_representation_base_type (GstRepresentationBaseType * - representation_base) -{ - if (representation_base) { - if (representation_base->profiles) - xmlFree (representation_base->profiles); - g_slice_free (GstXMLRatio, representation_base->sar); - g_slice_free (GstXMLFrameRate, representation_base->frameRate); - g_slice_free (GstXMLFrameRate, representation_base->minFrameRate); - g_slice_free (GstXMLFrameRate, representation_base->maxFrameRate); - if (representation_base->audioSamplingRate) - xmlFree (representation_base->audioSamplingRate); - if (representation_base->mimeType) - xmlFree (representation_base->mimeType); - if (representation_base->segmentProfiles) - xmlFree (representation_base->segmentProfiles); - if (representation_base->codecs) - xmlFree (representation_base->codecs); - if (representation_base->scanType) - xmlFree (representation_base->scanType); - g_list_free_full (representation_base->FramePacking, - (GDestroyNotify) gst_mpdparser_free_descriptor_type_node); - g_list_free_full (representation_base->AudioChannelConfiguration, - (GDestroyNotify) gst_mpdparser_free_descriptor_type_node); - g_list_free_full (representation_base->ContentProtection, - (GDestroyNotify) gst_mpdparser_free_descriptor_type_node); - g_slice_free (GstRepresentationBaseType, representation_base); - } -} - -static void -gst_mpdparser_free_representation_node (GstRepresentationNode * - representation_node) -{ - if (representation_node) { - if (representation_node->id) - xmlFree (representation_node->id); - g_strfreev (representation_node->dependencyId); - g_strfreev (representation_node->mediaStreamStructureId); - gst_mpdparser_free_representation_base_type - (representation_node->RepresentationBase); - g_list_free_full (representation_node->SubRepresentations, - (GDestroyNotify) gst_mpdparser_free_subrepresentation_node); - gst_mpdparser_free_seg_base_type_ext (representation_node->SegmentBase); - gst_mpdparser_free_segment_template_node - (representation_node->SegmentTemplate); - gst_mpdparser_free_segment_list_node (representation_node->SegmentList); - g_list_free_full (representation_node->BaseURLs, - (GDestroyNotify) gst_mpdparser_free_base_url_node); - g_slice_free (GstRepresentationNode, representation_node); - } -} - -static void -gst_mpdparser_free_subrepresentation_node (GstSubRepresentationNode * - subrep_node) -{ - if (subrep_node) { - gst_mpdparser_free_representation_base_type - (subrep_node->RepresentationBase); - if (subrep_node->dependencyLevel) - xmlFree (subrep_node->dependencyLevel); - g_strfreev (subrep_node->contentComponent); - g_slice_free (GstSubRepresentationNode, subrep_node); - } -} - -static void -gst_mpdparser_free_s_node (GstSNode * s_node) -{ - if (s_node) { - g_slice_free (GstSNode, s_node); - } -} - -static GstSegmentTimelineNode * -gst_mpdparser_segment_timeline_node_new (void) -{ - GstSegmentTimelineNode *node = g_slice_new0 (GstSegmentTimelineNode); - - g_queue_init (&node->S); - - return node; -} - -static void -gst_mpdparser_free_segment_timeline_node (GstSegmentTimelineNode * seg_timeline) -{ - if (seg_timeline) { - g_queue_foreach (&seg_timeline->S, (GFunc) gst_mpdparser_free_s_node, NULL); - g_queue_clear (&seg_timeline->S); - g_slice_free (GstSegmentTimelineNode, seg_timeline); - } -} - -static void -gst_mpdparser_free_url_type_node (GstURLType * url_type_node) -{ - if (url_type_node) { - if (url_type_node->sourceURL) - xmlFree (url_type_node->sourceURL); - g_slice_free (GstXMLRange, url_type_node->range); - g_slice_free (GstURLType, url_type_node); - } -} - -static void -gst_mpdparser_free_seg_base_type_ext (GstSegmentBaseType * seg_base_type) -{ - if (seg_base_type) { - if (seg_base_type->indexRange) - g_slice_free (GstXMLRange, seg_base_type->indexRange); - gst_mpdparser_free_url_type_node (seg_base_type->Initialization); - gst_mpdparser_free_url_type_node (seg_base_type->RepresentationIndex); - g_slice_free (GstSegmentBaseType, seg_base_type); - } -} - -static void -gst_mpdparser_free_mult_seg_base_type_ext (GstMultSegmentBaseType * - mult_seg_base_type) -{ - if (mult_seg_base_type) { - /* SegmentBaseType extension */ - gst_mpdparser_free_seg_base_type_ext (mult_seg_base_type->SegBaseType); - gst_mpdparser_free_segment_timeline_node - (mult_seg_base_type->SegmentTimeline); - gst_mpdparser_free_url_type_node (mult_seg_base_type->BitstreamSwitching); - g_slice_free (GstMultSegmentBaseType, mult_seg_base_type); - } -} - -static void -gst_mpdparser_free_segment_url_node (GstSegmentURLNode * segment_url) -{ - if (segment_url) { - if (segment_url->media) - xmlFree (segment_url->media); - g_slice_free (GstXMLRange, segment_url->mediaRange); - if (segment_url->index) - xmlFree (segment_url->index); - g_slice_free (GstXMLRange, segment_url->indexRange); - g_slice_free (GstSegmentURLNode, segment_url); - } -} - -static void -gst_mpdparser_free_descriptor_type_node (GstDescriptorType * descriptor_type) -{ - if (descriptor_type) { - if (descriptor_type->schemeIdUri) - xmlFree (descriptor_type->schemeIdUri); - if (descriptor_type->value) - xmlFree (descriptor_type->value); - g_slice_free (GstDescriptorType, descriptor_type); - } -} - -static void -gst_mpdparser_free_content_component_node (GstContentComponentNode * - content_component_node) -{ - if (content_component_node) { - if (content_component_node->lang) - xmlFree (content_component_node->lang); - if (content_component_node->contentType) - xmlFree (content_component_node->contentType); - g_slice_free (GstXMLRatio, content_component_node->par); - g_list_free_full (content_component_node->Accessibility, - (GDestroyNotify) gst_mpdparser_free_descriptor_type_node); - g_list_free_full (content_component_node->Role, - (GDestroyNotify) gst_mpdparser_free_descriptor_type_node); - g_list_free_full (content_component_node->Rating, - (GDestroyNotify) gst_mpdparser_free_descriptor_type_node); - g_list_free_full (content_component_node->Viewpoint, - (GDestroyNotify) gst_mpdparser_free_descriptor_type_node); - g_slice_free (GstContentComponentNode, content_component_node); - } -} - -static void -gst_mpdparser_free_utctiming_node (GstUTCTimingNode * timing_type) -{ - if (timing_type) { - if (timing_type->urls) - g_strfreev (timing_type->urls); - g_slice_free (GstUTCTimingNode, timing_type); - } -} /* ISO/IEC 23009-1:2004 5.3.9.4.4 */ static gboolean @@ -1592,27 +1248,8 @@ gst_mpdparser_validate_rfc1738_url (const char *s) return TRUE; } - - -static GstURLType * -gst_mpdparser_clone_URL (GstURLType * url) -{ - - GstURLType *clone = NULL; - - if (url) { - clone = g_slice_new0 (GstURLType); - if (url->sourceURL) { - clone->sourceURL = xmlMemStrdup (url->sourceURL); - } - clone->range = gst_xml_helper_clone_range (url->range); - } - - return clone; -} - -static void -gst_media_fragment_info_clear (GstMediaFragmentInfo * fragment) +void +gst_mpdparser_media_fragment_info_clear (GstMediaFragmentInfo * fragment) { g_free (fragment->uri); g_free (fragment->index_uri); @@ -1620,8 +1257,8 @@ gst_media_fragment_info_clear (GstMediaFragmentInfo * fragment) /* API */ gboolean -gst_mpdparser_get_mpd_node (GstMPDNode ** mpd_node, const gchar * data, - gint size) +gst_mpdparser_get_mpd_root_node (GstMPDRootNode ** mpd_root_node, + const gchar * data, gint size) { gboolean ret = FALSE; @@ -1655,7 +1292,7 @@ gst_mpdparser_get_mpd_node (GstMPDNode ** mpd_node, const gchar * data, ret = FALSE; /* used to return TRUE before, but this seems wrong */ } else { /* now we can parse the MPD root node and all children nodes, recursively */ - ret = gst_mpdparser_parse_root_node (mpd_node, root_element); + ret = gst_mpdparser_parse_root_node (mpd_root_node, root_element); } /* free the document */ xmlFreeDoc (doc); @@ -1665,12 +1302,12 @@ gst_mpdparser_get_mpd_node (GstMPDNode ** mpd_node, const gchar * data, return ret; } -GstSegmentListNode * +GstMPDSegmentListNode * gst_mpdparser_get_external_segment_list (const gchar * data, gint size, - GstSegmentListNode * parent) + GstMPDSegmentListNode * parent) { xmlDocPtr doc = NULL; - GstSegmentListNode *new_segment_list = NULL; + GstMPDSegmentListNode *new_segment_list = NULL; doc = xmlReadMemory (data, size, "noname.xml", NULL, XML_PARSE_NONET); @@ -1729,8 +1366,7 @@ error: GST_ERROR ("Failed to parse period node XML"); if (new_periods) { - g_list_free_full (new_periods, - (GDestroyNotify) gst_mpdparser_free_period_node); + g_list_free_full (new_periods, (GDestroyNotify) gst_mpd_period_node_free); new_periods = NULL; } goto done; @@ -1738,7 +1374,7 @@ error: GList * gst_mpdparser_get_external_adaptation_sets (const gchar * data, gint size, - GstPeriodNode * period) + GstMPDPeriodNode * period) { xmlDocPtr doc = NULL; GList *new_adaptation_sets = NULL; @@ -1763,131 +1399,6 @@ gst_mpdparser_get_external_adaptation_sets (const gchar * data, gint size, } void -gst_mpdparser_free_mpd_node (GstMPDNode * mpd_node) -{ - if (mpd_node) { - if (mpd_node->default_namespace) - xmlFree (mpd_node->default_namespace); - if (mpd_node->namespace_xsi) - xmlFree (mpd_node->namespace_xsi); - if (mpd_node->namespace_ext) - xmlFree (mpd_node->namespace_ext); - if (mpd_node->schemaLocation) - xmlFree (mpd_node->schemaLocation); - if (mpd_node->id) - xmlFree (mpd_node->id); - if (mpd_node->profiles) - xmlFree (mpd_node->profiles); - if (mpd_node->availabilityStartTime) - gst_date_time_unref (mpd_node->availabilityStartTime); - if (mpd_node->availabilityEndTime) - gst_date_time_unref (mpd_node->availabilityEndTime); - g_list_free_full (mpd_node->ProgramInfo, - (GDestroyNotify) gst_mpdparser_free_prog_info_node); - g_list_free_full (mpd_node->BaseURLs, - (GDestroyNotify) gst_mpdparser_free_base_url_node); - g_list_free_full (mpd_node->Locations, (GDestroyNotify) xmlFree); - g_list_free_full (mpd_node->Periods, - (GDestroyNotify) gst_mpdparser_free_period_node); - g_list_free_full (mpd_node->Metrics, - (GDestroyNotify) gst_mpdparser_free_metrics_node); - g_list_free_full (mpd_node->UTCTiming, - (GDestroyNotify) gst_mpdparser_free_utctiming_node); - g_slice_free (GstMPDNode, mpd_node); - } -} - -void -gst_mpdparser_free_period_node (GstPeriodNode * period_node) -{ - if (period_node) { - if (period_node->id) - xmlFree (period_node->id); - gst_mpdparser_free_seg_base_type_ext (period_node->SegmentBase); - gst_mpdparser_free_segment_list_node (period_node->SegmentList); - gst_mpdparser_free_segment_template_node (period_node->SegmentTemplate); - g_list_free_full (period_node->AdaptationSets, - (GDestroyNotify) gst_mpdparser_free_adaptation_set_node); - g_list_free_full (period_node->Subsets, - (GDestroyNotify) gst_mpdparser_free_subset_node); - g_list_free_full (period_node->BaseURLs, - (GDestroyNotify) gst_mpdparser_free_base_url_node); - if (period_node->xlink_href) - xmlFree (period_node->xlink_href); - g_slice_free (GstPeriodNode, period_node); - } -} - -void -gst_mpdparser_free_adaptation_set_node (GstAdaptationSetNode * - adaptation_set_node) -{ - if (adaptation_set_node) { - if (adaptation_set_node->lang) - xmlFree (adaptation_set_node->lang); - if (adaptation_set_node->contentType) - xmlFree (adaptation_set_node->contentType); - g_slice_free (GstXMLRatio, adaptation_set_node->par); - g_slice_free (GstXMLConditionalUintType, - adaptation_set_node->segmentAlignment); - g_slice_free (GstXMLConditionalUintType, - adaptation_set_node->subsegmentAlignment); - g_list_free_full (adaptation_set_node->Accessibility, - (GDestroyNotify) gst_mpdparser_free_descriptor_type_node); - g_list_free_full (adaptation_set_node->Role, - (GDestroyNotify) gst_mpdparser_free_descriptor_type_node); - g_list_free_full (adaptation_set_node->Rating, - (GDestroyNotify) gst_mpdparser_free_descriptor_type_node); - g_list_free_full (adaptation_set_node->Viewpoint, - (GDestroyNotify) gst_mpdparser_free_descriptor_type_node); - gst_mpdparser_free_representation_base_type - (adaptation_set_node->RepresentationBase); - gst_mpdparser_free_seg_base_type_ext (adaptation_set_node->SegmentBase); - gst_mpdparser_free_segment_list_node (adaptation_set_node->SegmentList); - gst_mpdparser_free_segment_template_node - (adaptation_set_node->SegmentTemplate); - g_list_free_full (adaptation_set_node->BaseURLs, - (GDestroyNotify) gst_mpdparser_free_base_url_node); - g_list_free_full (adaptation_set_node->Representations, - (GDestroyNotify) gst_mpdparser_free_representation_node); - g_list_free_full (adaptation_set_node->ContentComponents, - (GDestroyNotify) gst_mpdparser_free_content_component_node); - if (adaptation_set_node->xlink_href) - xmlFree (adaptation_set_node->xlink_href); - g_slice_free (GstAdaptationSetNode, adaptation_set_node); - } -} - -void -gst_mpdparser_free_segment_list_node (GstSegmentListNode * segment_list_node) -{ - if (segment_list_node) { - g_list_free_full (segment_list_node->SegmentURL, - (GDestroyNotify) gst_mpdparser_free_segment_url_node); - /* MultipleSegmentBaseType extension */ - gst_mpdparser_free_mult_seg_base_type_ext - (segment_list_node->MultSegBaseType); - if (segment_list_node->xlink_href) - xmlFree (segment_list_node->xlink_href); - g_slice_free (GstSegmentListNode, segment_list_node); - } -} - -void -gst_mpdparser_free_base_url_node (GstBaseURL * base_url_node) -{ - if (base_url_node) { - if (base_url_node->baseURL) - xmlFree (base_url_node->baseURL); - if (base_url_node->serviceLocation) - xmlFree (base_url_node->serviceLocation); - if (base_url_node->byteRange) - xmlFree (base_url_node->byteRange); - g_slice_free (GstBaseURL, base_url_node); - } -} - -void gst_mpdparser_free_stream_period (GstStreamPeriod * stream_period) { if (stream_period) { @@ -1928,22 +1439,22 @@ gst_mpdparser_free_active_stream (GstActiveStream * active_stream) const gchar * gst_mpdparser_get_initializationURL (GstActiveStream * stream, - GstURLType * InitializationURL) + GstMPDURLType * InitializationURL) { const gchar *url_prefix; g_return_val_if_fail (stream != NULL, NULL); url_prefix = (InitializationURL - && InitializationURL->sourceURL) ? InitializationURL-> - sourceURL : stream->baseURL; + && InitializationURL->sourceURL) ? InitializationURL->sourceURL : stream-> + baseURL; return url_prefix; } gchar * gst_mpdparser_get_mediaURL (GstActiveStream * stream, - GstSegmentURLNode * segmentURL) + GstMPDSegmentURLNode * segmentURL) { const gchar *url_prefix; @@ -1958,8 +1469,8 @@ gst_mpdparser_get_mediaURL (GstActiveStream * stream, /* navigation functions */ GstStreamMimeType -gst_mpdparser_representation_get_mimetype (GstAdaptationSetNode * adapt_set, - GstRepresentationNode * rep) +gst_mpdparser_representation_get_mimetype (GstMPDAdaptationSetNode * adapt_set, + GstMPDRepresentationNode * rep) { gchar *mime = NULL; if (rep->RepresentationBase) @@ -1968,11 +1479,12 @@ gst_mpdparser_representation_get_mimetype (GstAdaptationSetNode * adapt_set, mime = adapt_set->RepresentationBase->mimeType; } - if (strncmp_ext (mime, "audio") == 0) + if (gst_mpd_helper_strncmp_ext (mime, "audio") == 0) return GST_STREAM_AUDIO; - if (strncmp_ext (mime, "video") == 0) + if (gst_mpd_helper_strncmp_ext (mime, "video") == 0) return GST_STREAM_VIDEO; - if (strncmp_ext (mime, "application") == 0 || strncmp_ext (mime, "text") == 0) + if (gst_mpd_helper_strncmp_ext (mime, "application") == 0 + || gst_mpd_helper_strncmp_ext (mime, "text") == 0) return GST_STREAM_APPLICATION; return GST_STREAM_UNKNOWN; @@ -2095,65 +1607,3 @@ invalid_representation_id: return NULL; } } - -const gchar * -gst_mpdparser_mimetype_to_caps (const gchar * mimeType) -{ - if (mimeType == NULL) - return NULL; - if (strcmp (mimeType, "video/mp2t") == 0) { - return "video/mpegts, systemstream=(bool) true"; - } else if (strcmp (mimeType, "video/mp4") == 0) { - return "video/quicktime"; - } else if (strcmp (mimeType, "audio/mp4") == 0) { - return "audio/x-m4a"; - } else if (strcmp (mimeType, "text/vtt") == 0) { - return "application/x-subtitle-vtt"; - } else - return mimeType; -} - -/* - * Combine a base url with the current stream base url from the list of - * baseURLs. Takes ownership of base and returns a new base. - */ -GstUri * -combine_urls (GstUri * base, GList * list, gchar ** query, guint idx) -{ - GstBaseURL *baseURL; - GstUri *ret = base; - - if (list != NULL) { - baseURL = g_list_nth_data (list, idx); - if (!baseURL) { - baseURL = list->data; - } - - ret = gst_uri_from_string_with_base (base, baseURL->baseURL); - gst_uri_unref (base); - - if (ret && query) { - g_free (*query); - *query = gst_uri_get_query_string (ret); - if (*query) { - ret = gst_uri_make_writable (ret); - gst_uri_set_query_table (ret, NULL); - } - } - } - - return ret; -} - -/* comparison functions */ -int -strncmp_ext (const char *s1, const char *s2) -{ - if (s1 == NULL && s2 == NULL) - return 0; - if (s1 == NULL && s2 != NULL) - return 1; - if (s2 == NULL && s1 != NULL) - return 1; - return strncmp (s1, s2, strlen (s2)); -} diff --git a/ext/dash/gstmpdparser.h b/ext/dash/gstmpdparser.h index fb55704..653003f 100644 --- a/ext/dash/gstmpdparser.h +++ b/ext/dash/gstmpdparser.h @@ -31,6 +31,24 @@ #include #include #include "gstmpdhelper.h" +#include "gstxmlhelper.h" +#include "gstmpdrootnode.h" +#include "gstmpdbaseurlnode.h" +#include "gstmpdutctimingnode.h" +#include "gstmpdmetricsnode.h" +#include "gstmpdmetricsrangenode.h" +#include "gstmpdsnode.h" +#include "gstmpdsegmenttimelinenode.h" +#include "gstmpdsegmenttemplatenode.h" +#include "gstmpdsegmenturlnode.h" +#include "gstmpdsegmentlistnode.h" +#include "gstmpdperiodnode.h" +#include "gstmpdrepresentationnode.h" +#include "gstmpdsubrepresentationnode.h" +#include "gstmpdcontentcomponentnode.h" +#include "gstmpdadaptationsetnode.h" +#include "gstmpdsubsetnode.h" +#include "gstmpdprograminformationnode.h" G_BEGIN_DECLS @@ -38,29 +56,6 @@ typedef struct _GstActiveStream GstActiveStream; typedef struct _GstStreamPeriod GstStreamPeriod; typedef struct _GstMediaFragmentInfo GstMediaFragmentInfo; typedef struct _GstMediaSegment GstMediaSegment; -typedef struct _GstMPDNode GstMPDNode; -typedef struct _GstPeriodNode GstPeriodNode; -typedef struct _GstRepresentationBaseType GstRepresentationBaseType; -typedef struct _GstDescriptorType GstDescriptorType; -typedef struct _GstContentComponentNode GstContentComponentNode; -typedef struct _GstAdaptationSetNode GstAdaptationSetNode; -typedef struct _GstRepresentationNode GstRepresentationNode; -typedef struct _GstSubRepresentationNode GstSubRepresentationNode; -typedef struct _GstSegmentListNode GstSegmentListNode; -typedef struct _GstSegmentTemplateNode GstSegmentTemplateNode; -typedef struct _GstSegmentURLNode GstSegmentURLNode; -typedef struct _GstBaseURL GstBaseURL; - -typedef struct _GstSubsetNode GstSubsetNode; -typedef struct _GstProgramInformationNode GstProgramInformationNode; -typedef struct _GstMetricsRangeNode GstMetricsRangeNode; -typedef struct _GstMetricsNode GstMetricsNode; -typedef struct _GstUTCTimingNode GstUTCTimingNode; -typedef struct _GstSNode GstSNode; -typedef struct _GstSegmentTimelineNode GstSegmentTimelineNode; -typedef struct _GstSegmentBaseType GstSegmentBaseType; -typedef struct _GstURLType GstURLType; -typedef struct _GstMultSegmentBaseType GstMultSegmentBaseType; #define GST_MPD_DURATION_NONE ((guint64)-1) @@ -73,320 +68,6 @@ typedef enum GST_STREAM_APPLICATION /* application stream (optional): for timed text/subtitles */ } GstStreamMimeType; - -typedef enum -{ - GST_XLINK_ACTUATE_ON_REQUEST, - GST_XLINK_ACTUATE_ON_LOAD -} GstXLinkActuate; - -typedef enum -{ - GST_MPD_UTCTIMING_TYPE_UNKNOWN = 0x00, - GST_MPD_UTCTIMING_TYPE_NTP = 0x01, - GST_MPD_UTCTIMING_TYPE_SNTP = 0x02, - GST_MPD_UTCTIMING_TYPE_HTTP_HEAD = 0x04, - GST_MPD_UTCTIMING_TYPE_HTTP_XSDATE = 0x08, - GST_MPD_UTCTIMING_TYPE_HTTP_ISO = 0x10, - GST_MPD_UTCTIMING_TYPE_HTTP_NTP = 0x20, - GST_MPD_UTCTIMING_TYPE_DIRECT = 0x40 -} GstMPDUTCTimingType; - -struct _GstBaseURL -{ - gchar *baseURL; - gchar *serviceLocation; - gchar *byteRange; -}; - -struct _GstSNode -{ - guint64 t; - guint64 d; - gint r; -}; - -struct _GstSegmentTimelineNode -{ - /* list of S nodes */ - GQueue S; -}; - -struct _GstURLType -{ - gchar *sourceURL; - GstXMLRange *range; -}; - -struct _GstSegmentBaseType -{ - guint timescale; - guint64 presentationTimeOffset; - GstXMLRange *indexRange; - gboolean indexRangeExact; - /* Initialization node */ - GstURLType *Initialization; - /* RepresentationIndex node */ - GstURLType *RepresentationIndex; -}; - -struct _GstMultSegmentBaseType -{ - guint duration; /* in seconds */ - guint startNumber; - /* SegmentBaseType extension */ - GstSegmentBaseType *SegBaseType; - /* SegmentTimeline node */ - GstSegmentTimelineNode *SegmentTimeline; - /* BitstreamSwitching node */ - GstURLType *BitstreamSwitching; -}; - -struct _GstSegmentListNode -{ - /* extension */ - GstMultSegmentBaseType *MultSegBaseType; - /* list of SegmentURL nodes */ - GList *SegmentURL; - - gchar *xlink_href; - GstXLinkActuate actuate; -}; - -struct _GstSegmentTemplateNode -{ - /* extension */ - GstMultSegmentBaseType *MultSegBaseType; - gchar *media; - gchar *index; - gchar *initialization; - gchar *bitstreamSwitching; -}; - -struct _GstSegmentURLNode -{ - gchar *media; - GstXMLRange *mediaRange; - gchar *index; - GstXMLRange *indexRange; -}; - -struct _GstRepresentationBaseType -{ - gchar *profiles; - guint width; - guint height; - GstXMLRatio *sar; - GstXMLFrameRate *minFrameRate; - GstXMLFrameRate *maxFrameRate; - GstXMLFrameRate *frameRate; - gchar *audioSamplingRate; - gchar *mimeType; - gchar *segmentProfiles; - gchar *codecs; - gdouble maximumSAPPeriod; - GstMPDSAPType startWithSAP; - gdouble maxPlayoutRate; - gboolean codingDependency; - gchar *scanType; - /* list of FramePacking DescriptorType nodes */ - GList *FramePacking; - /* list of AudioChannelConfiguration DescriptorType nodes */ - GList *AudioChannelConfiguration; - /* list of ContentProtection DescriptorType nodes */ - GList *ContentProtection; -}; - -struct _GstSubRepresentationNode -{ - /* RepresentationBase extension */ - GstRepresentationBaseType *RepresentationBase; - guint level; - guint *dependencyLevel; /* UIntVectorType */ - guint size; /* size of "dependencyLevel" array */ - guint bandwidth; - gchar **contentComponent; /* StringVectorType */ -}; - -struct _GstRepresentationNode -{ - gchar *id; - guint bandwidth; - guint qualityRanking; - gchar **dependencyId; /* StringVectorType */ - gchar **mediaStreamStructureId; /* StringVectorType */ - /* RepresentationBase extension */ - GstRepresentationBaseType *RepresentationBase; - /* list of BaseURL nodes */ - GList *BaseURLs; - /* list of SubRepresentation nodes */ - GList *SubRepresentations; - /* SegmentBase node */ - GstSegmentBaseType *SegmentBase; - /* SegmentTemplate node */ - GstSegmentTemplateNode *SegmentTemplate; - /* SegmentList node */ - GstSegmentListNode *SegmentList; -}; - -struct _GstDescriptorType -{ - gchar *schemeIdUri; - gchar *value; -}; - -struct _GstContentComponentNode -{ - guint id; - gchar *lang; /* LangVectorType RFC 5646 */ - gchar *contentType; - GstXMLRatio *par; - /* list of Accessibility DescriptorType nodes */ - GList *Accessibility; - /* list of Role DescriptorType nodes */ - GList *Role; - /* list of Rating DescriptorType nodes */ - GList *Rating; - /* list of Viewpoint DescriptorType nodes */ - GList *Viewpoint; -}; - -struct _GstAdaptationSetNode -{ - guint id; - guint group; - gchar *lang; /* LangVectorType RFC 5646 */ - gchar *contentType; - GstXMLRatio *par; - guint minBandwidth; - guint maxBandwidth; - guint minWidth; - guint maxWidth; - guint minHeight; - guint maxHeight; - GstXMLConditionalUintType *segmentAlignment; - GstXMLConditionalUintType *subsegmentAlignment; - GstMPDSAPType subsegmentStartsWithSAP; - gboolean bitstreamSwitching; - /* list of Accessibility DescriptorType nodes */ - GList *Accessibility; - /* list of Role DescriptorType nodes */ - GList *Role; - /* list of Rating DescriptorType nodes */ - GList *Rating; - /* list of Viewpoint DescriptorType nodes */ - GList *Viewpoint; - /* RepresentationBase extension */ - GstRepresentationBaseType *RepresentationBase; - /* SegmentBase node */ - GstSegmentBaseType *SegmentBase; - /* SegmentList node */ - GstSegmentListNode *SegmentList; - /* SegmentTemplate node */ - GstSegmentTemplateNode *SegmentTemplate; - /* list of BaseURL nodes */ - GList *BaseURLs; - /* list of Representation nodes */ - GList *Representations; - /* list of ContentComponent nodes */ - GList *ContentComponents; - - gchar *xlink_href; - GstXLinkActuate actuate; -}; - -struct _GstSubsetNode -{ - guint *contains; /* UIntVectorType */ - guint size; /* size of the "contains" array */ -}; - -struct _GstPeriodNode -{ - gchar *id; - guint64 start; /* [ms] */ - guint64 duration; /* [ms] */ - gboolean bitstreamSwitching; - /* SegmentBase node */ - GstSegmentBaseType *SegmentBase; - /* SegmentList node */ - GstSegmentListNode *SegmentList; - /* SegmentTemplate node */ - GstSegmentTemplateNode *SegmentTemplate; - /* list of Adaptation Set nodes */ - GList *AdaptationSets; - /* list of Representation nodes */ - GList *Subsets; - /* list of BaseURL nodes */ - GList *BaseURLs; - - gchar *xlink_href; - GstXLinkActuate actuate; -}; - -struct _GstProgramInformationNode -{ - gchar *lang; /* LangVectorType RFC 5646 */ - gchar *moreInformationURL; - /* children nodes */ - gchar *Title; - gchar *Source; - gchar *Copyright; -}; - -struct _GstMetricsRangeNode -{ - guint64 starttime; /* [ms] */ - guint64 duration; /* [ms] */ -}; - -struct _GstMetricsNode -{ - gchar *metrics; - /* list of Metrics Range nodes */ - GList *MetricsRanges; - /* list of Reporting nodes */ - GList *Reportings; -}; - -struct _GstUTCTimingNode { - GstMPDUTCTimingType method; - /* NULL terminated array of strings */ - gchar **urls; -}; - -struct _GstMPDNode -{ - gchar *default_namespace; - gchar *namespace_xsi; - gchar *namespace_ext; - gchar *schemaLocation; - gchar *id; - gchar *profiles; - GstMPDFileType type; - GstDateTime *availabilityStartTime; - GstDateTime *availabilityEndTime; - guint64 mediaPresentationDuration; /* [ms] */ - guint64 minimumUpdatePeriod; /* [ms] */ - guint64 minBufferTime; /* [ms] */ - guint64 timeShiftBufferDepth; /* [ms] */ - guint64 suggestedPresentationDelay; /* [ms] */ - guint64 maxSegmentDuration; /* [ms] */ - guint64 maxSubsegmentDuration; /* [ms] */ - /* list of BaseURL nodes */ - GList *BaseURLs; - /* list of Location nodes */ - GList *Locations; - /* List of ProgramInformation nodes */ - GList *ProgramInfo; - /* list of Periods nodes */ - GList *Periods; - /* list of Metrics nodes */ - GList *Metrics; - /* list of GstUTCTimingNode nodes */ - GList *UTCTiming; -}; - /** * GstStreamPeriod: * @@ -394,7 +75,7 @@ struct _GstMPDNode */ struct _GstStreamPeriod { - GstPeriodNode *period; /* Stream period */ + GstMPDPeriodNode *period; /* Stream period */ guint number; /* Period number */ GstClockTime start; /* Period start time */ GstClockTime duration; /* Period duration */ @@ -407,7 +88,7 @@ struct _GstStreamPeriod */ struct _GstMediaSegment { - GstSegmentURLNode *SegmentURL; /* this is NULL when using a SegmentTemplate */ + GstMPDSegmentURLNode *SegmentURL; /* this is NULL when using a SegmentTemplate */ guint number; /* segment number */ gint repeat; /* number of extra repetitions (0 = played only once) */ guint64 scale_start; /* start time in timescale units */ @@ -445,12 +126,12 @@ struct _GstActiveStream gchar *queryURL; /* active queryURL used for last request */ guint max_bandwidth; /* max bandwidth allowed for this mimeType */ - GstAdaptationSetNode *cur_adapt_set; /* active adaptation set */ + GstMPDAdaptationSetNode *cur_adapt_set; /* active adaptation set */ gint representation_idx; /* index of current representation */ - GstRepresentationNode *cur_representation; /* active representation */ - GstSegmentBaseType *cur_segment_base; /* active segment base */ - GstSegmentListNode *cur_segment_list; /* active segment list */ - GstSegmentTemplateNode *cur_seg_template; /* active segment template */ + GstMPDRepresentationNode *cur_representation; /* active representation */ + GstMPDSegmentBaseType *cur_segment_base; /* active segment base */ + GstMPDSegmentListNode *cur_segment_list; /* active segment list */ + GstMPDSegmentTemplateNode *cur_seg_template; /* active segment template */ gint segment_index; /* index of next sequence chunk */ guint segment_repeat_index; /* index of the repeat count of a segment */ GPtrArray *segments; /* array of GstMediaSegment */ @@ -458,34 +139,25 @@ struct _GstActiveStream }; /* MPD file parsing */ -gboolean gst_mpdparser_get_mpd_node (GstMPDNode ** mpd_node, const gchar * data, gint size); -GstSegmentListNode * gst_mpdparser_get_external_segment_list (const gchar * data, gint size, GstSegmentListNode * parent); +gboolean gst_mpdparser_get_mpd_root_node (GstMPDRootNode ** mpd_root_node, const gchar * data, gint size); +GstMPDSegmentListNode * gst_mpdparser_get_external_segment_list (const gchar * data, gint size, GstMPDSegmentListNode * parent); GList * gst_mpdparser_get_external_periods (const gchar * data, gint size); -GList * gst_mpdparser_get_external_adaptation_sets (const gchar * data, gint size, GstPeriodNode* period); +GList * gst_mpdparser_get_external_adaptation_sets (const gchar * data, gint size, GstMPDPeriodNode* period); /* navigation functions */ -GstStreamMimeType gst_mpdparser_representation_get_mimetype (GstAdaptationSetNode * adapt_set, GstRepresentationNode * rep); +GstStreamMimeType gst_mpdparser_representation_get_mimetype (GstMPDAdaptationSetNode * adapt_set, GstMPDRepresentationNode * rep); /* Memory management */ -void gst_mpdparser_free_mpd_node (GstMPDNode * mpd_node); -void gst_mpdparser_free_period_node (GstPeriodNode * period_node); -void gst_mpdparser_free_adaptation_set_node (GstAdaptationSetNode * adaptation_set_node); -void gst_mpdparser_free_segment_list_node (GstSegmentListNode * segment_list_node); void gst_mpdparser_free_stream_period (GstStreamPeriod * stream_period); void gst_mpdparser_free_media_segment (GstMediaSegment * media_segment); void gst_mpdparser_free_active_stream (GstActiveStream * active_stream); -void gst_mpdparser_free_base_url_node (GstBaseURL * base_url_node); - +void gst_mpdparser_media_fragment_info_clear (GstMediaFragmentInfo * fragment); /* Active stream methods*/ void gst_mpdparser_init_active_stream_segments (GstActiveStream * stream); -gchar *gst_mpdparser_get_mediaURL (GstActiveStream * stream, GstSegmentURLNode * segmentURL); -const gchar *gst_mpdparser_get_initializationURL (GstActiveStream * stream, GstURLType * InitializationURL); - -/*Helper methods */ +gchar *gst_mpdparser_get_mediaURL (GstActiveStream * stream, GstMPDSegmentURLNode * segmentURL); +const gchar *gst_mpdparser_get_initializationURL (GstActiveStream * stream, GstMPDURLType * InitializationURL); gchar *gst_mpdparser_build_URL_from_template (const gchar * url_template, const gchar * id, guint number, guint bandwidth, guint64 time); -const gchar *gst_mpdparser_mimetype_to_caps (const gchar * mimeType); -GstUri *combine_urls (GstUri * base, GList * list, gchar ** query, guint idx); -int strncmp_ext (const char *s1, const char *s2); + G_END_DECLS #endif /* __GST_MPDPARSER_H__ */ diff --git a/ext/dash/gstmpdperiodnode.c b/ext/dash/gstmpdperiodnode.c new file mode 100644 index 0000000..8dea50c --- /dev/null +++ b/ext/dash/gstmpdperiodnode.c @@ -0,0 +1,83 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdperiodnode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDPeriodNode, gst_mpd_period_node, GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_period_node_finalize (GObject * object) +{ + GstMPDPeriodNode *self = GST_MPD_PERIOD_NODE (object); + + if (self->id) + xmlFree (self->id); + gst_mpd_helper_segment_base_type_free (self->SegmentBase); + gst_mpd_segment_list_node_free (self->SegmentList); + gst_mpd_segment_template_node_free (self->SegmentTemplate); + g_list_free_full (self->AdaptationSets, + (GDestroyNotify) gst_mpd_adaptation_set_node_free); + g_list_free_full (self->Subsets, (GDestroyNotify) gst_mpd_subset_node_free); + g_list_free_full (self->BaseURLs, (GDestroyNotify) gst_mpd_baseurl_node_free); + if (self->xlink_href) + xmlFree (self->xlink_href); + + G_OBJECT_CLASS (gst_mpd_period_node_parent_class)->finalize (object); +} + +static void +gst_mpd_period_node_class_init (GstMPDPeriodNodeClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_period_node_finalize; +} + +static void +gst_mpd_period_node_init (GstMPDPeriodNode * self) +{ + self->id = NULL; + self->start = 0; /* [ms] */ + self->duration = 0; /* [ms] */ + self->bitstreamSwitching = 0; + self->SegmentBase = NULL; + self->SegmentList = NULL; + self->SegmentTemplate = NULL; + self->AdaptationSets = NULL; + self->Subsets = NULL; + self->BaseURLs = NULL; + self->xlink_href = NULL; + self->actuate = 0; +} + +GstMPDPeriodNode * +gst_mpd_period_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_PERIOD_NODE, NULL); +} + +void +gst_mpd_period_node_free (GstMPDPeriodNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdperiodnode.h b/ext/dash/gstmpdperiodnode.h new file mode 100644 index 0000000..7e327a9 --- /dev/null +++ b/ext/dash/gstmpdperiodnode.h @@ -0,0 +1,84 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDPERIODNODE_H__ +#define __GSTMPDPERIODNODE_H__ + +#include +#include "gstmpdhelper.h" +#include "gstmpdsegmentlistnode.h" +#include "gstmpdsegmenttemplatenode.h" + +G_BEGIN_DECLS + +struct _GstSegmentTemplateNode; + +#define GST_TYPE_MPD_PERIOD_NODE gst_mpd_period_node_get_type () +#define GST_MPD_PERIOD_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_PERIOD_NODE, GstMPDPeriodNode)) +#define GST_MPD_PERIOD_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_PERIOD_NODE, GstMPDPeriodNodeClass)) +#define GST_IS_MPD_PERIOD_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_PERIOD_NODE)) +#define GST_IS_MPD_PERIOD_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_PERIOD_NODE)) +#define GST_MPD_PERIOD_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_PERIOD_NODE, GstMPDPeriodNodeClass)) + +typedef struct _GstMPDPeriodNode GstMPDPeriodNode; +typedef struct _GstMPDPeriodNodeClass GstMPDPeriodNodeClass; + +struct _GstMPDPeriodNode +{ + GstObject parent_instance; + gchar *id; + guint64 start; /* [ms] */ + guint64 duration; /* [ms] */ + gboolean bitstreamSwitching; + /* SegmentBase node */ + GstMPDSegmentBaseType *SegmentBase; + /* SegmentList node */ + GstMPDSegmentListNode *SegmentList; + /* SegmentTemplate node */ + GstMPDSegmentTemplateNode *SegmentTemplate; + /* list of Adaptation Set nodes */ + GList *AdaptationSets; + /* list of Representation nodes */ + GList *Subsets; + /* list of BaseURL nodes */ + GList *BaseURLs; + + gchar *xlink_href; + int actuate; +}; + +struct _GstMPDPeriodNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_period_node_get_type (void); + +GstMPDPeriodNode * gst_mpd_period_node_new (void); +void gst_mpd_period_node_free (GstMPDPeriodNode* self); + +G_END_DECLS + +#endif /* __GSTMPDPERIODNODE_H__ */ diff --git a/ext/dash/gstmpdprograminformationnode.c b/ext/dash/gstmpdprograminformationnode.c new file mode 100644 index 0000000..14daa5d --- /dev/null +++ b/ext/dash/gstmpdprograminformationnode.c @@ -0,0 +1,79 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdprograminformationnode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDProgramInformationNode, gst_mpd_program_information_node, + GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_program_information_node_finalize (GObject * object) +{ + GstMPDProgramInformationNode *self = + GST_MPD_PROGRAM_INFORMATION_NODE (object); + + if (self->lang) + xmlFree (self->lang); + if (self->moreInformationURL) + xmlFree (self->moreInformationURL); + if (self->Title) + xmlFree (self->Title); + if (self->Source) + xmlFree (self->Source); + if (self->Copyright) + xmlFree (self->Copyright); + + G_OBJECT_CLASS (gst_mpd_program_information_node_parent_class)->finalize + (object); +} + +static void +gst_mpd_program_information_node_class_init (GstMPDProgramInformationNodeClass * + klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_program_information_node_finalize; +} + +static void +gst_mpd_program_information_node_init (GstMPDProgramInformationNode * self) +{ + self->lang = NULL; + self->moreInformationURL = NULL; + self->Title = NULL; + self->Source = NULL; + self->Copyright = NULL; +} + +GstMPDProgramInformationNode * +gst_mpd_program_information_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_PROGRAM_INFORMATION_NODE, NULL); +} + +void +gst_mpd_program_information_node_free (GstMPDProgramInformationNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdprograminformationnode.h b/ext/dash/gstmpdprograminformationnode.h new file mode 100644 index 0000000..9d3a5a8 --- /dev/null +++ b/ext/dash/gstmpdprograminformationnode.h @@ -0,0 +1,68 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDPROGRAMINFORMATIONNODE_H__ +#define __GSTMPDPROGRAMINFORMATIONNODE_H__ + +#include +#include "gstmpdhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_PROGRAM_INFORMATION_NODE gst_mpd_program_information_node_get_type () +#define GST_MPD_PROGRAM_INFORMATION_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_PROGRAM_INFORMATION_NODE, GstMPDProgramInformationNode)) +#define GST_MPD_PROGRAM_INFORMATION_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_PROGRAM_INFORMATION_NODE, GstMPDProgramInformationNodeClass)) +#define GST_IS_MPD_PROGRAM_INFORMATION_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_PROGRAM_INFORMATION_NODE)) +#define GST_IS_MPD_PROGRAM_INFORMATION_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_PROGRAM_INFORMATION_NODE)) +#define GST_MPD_PROGRAM_INFORMATION_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_PROGRAM_INFORMATION_NODE, GstMPDProgramInformationNodeClass)) + +typedef struct _GstMPDProgramInformationNode GstMPDProgramInformationNode; +typedef struct _GstMPDProgramInformationNodeClass GstMPDProgramInformationNodeClass; + + +struct _GstMPDProgramInformationNode +{ + GstObject parent_instance; + gchar *lang; /* LangVectorType RFC 5646 */ + gchar *moreInformationURL; + /* children nodes */ + gchar *Title; + gchar *Source; + gchar *Copyright; +}; + +struct _GstMPDProgramInformationNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_program_information_node_get_type (void); + +GstMPDProgramInformationNode * gst_mpd_program_information_node_new (void); +void gst_mpd_program_information_node_free (GstMPDProgramInformationNode* self); + +G_END_DECLS + +#endif /* __GSTMPDPROGRAMINFORMATIONNODE_H__ */ diff --git a/ext/dash/gstmpdrepresentationnode.c b/ext/dash/gstmpdrepresentationnode.c new file mode 100644 index 0000000..3179a4a --- /dev/null +++ b/ext/dash/gstmpdrepresentationnode.c @@ -0,0 +1,83 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdrepresentationnode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDRepresentationNode, gst_mpd_representation_node, + GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_representation_node_finalize (GObject * object) +{ + GstMPDRepresentationNode *self = GST_MPD_REPRESENTATION_NODE (object); + + if (self->id) + xmlFree (self->id); + g_strfreev (self->dependencyId); + g_strfreev (self->mediaStreamStructureId); + gst_mpd_helper_representation_base_type_free (self->RepresentationBase); + g_list_free_full (self->SubRepresentations, + (GDestroyNotify) gst_mpd_sub_representation_node_free); + gst_mpd_helper_segment_base_type_free (self->SegmentBase); + gst_mpd_segment_template_node_free (self->SegmentTemplate); + gst_mpd_segment_list_node_free (self->SegmentList); + g_list_free_full (self->BaseURLs, (GDestroyNotify) gst_mpd_baseurl_node_free); + + G_OBJECT_CLASS (gst_mpd_representation_node_parent_class)->finalize (object); +} + +static void +gst_mpd_representation_node_class_init (GstMPDRepresentationNodeClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_representation_node_finalize; +} + +static void +gst_mpd_representation_node_init (GstMPDRepresentationNode * self) +{ + self->id = NULL; + self->bandwidth = 0; + self->qualityRanking = 0; + self->dependencyId = NULL; + self->mediaStreamStructureId = NULL; + self->RepresentationBase = NULL; + self->BaseURLs = NULL; + self->SubRepresentations = NULL; + self->SegmentBase = NULL; + self->SegmentTemplate = NULL; + self->SegmentList = NULL; +} + +GstMPDRepresentationNode * +gst_mpd_representation_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_REPRESENTATION_NODE, NULL); +} + +void +gst_mpd_representation_node_free (GstMPDRepresentationNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdrepresentationnode.h b/ext/dash/gstmpdrepresentationnode.h new file mode 100644 index 0000000..2b0352c --- /dev/null +++ b/ext/dash/gstmpdrepresentationnode.h @@ -0,0 +1,81 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDREPRESENTATIONNODE_H__ +#define __GSTMPDREPRESENTATIONNODE_H__ + +#include +#include "gstmpdhelper.h" +#include "gstmpdsegmentlistnode.h" +#include "gstmpdsegmenttemplatenode.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_REPRESENTATION_NODE gst_mpd_representation_node_get_type () +#define GST_MPD_REPRESENTATION_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_REPRESENTATION_NODE, GstMPDRepresentationNode)) +#define GST_MPD_REPRESENTATION_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_REPRESENTATION_NODE, GstMPDRepresentationNodeClass)) +#define GST_IS_MPD_REPRESENTATION_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_REPRESENTATION_NODE)) +#define GST_IS_MPD_REPRESENTATION_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_REPRESENTATION_NODE)) +#define GST_MPD_REPRESENTATION_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_REPRESENTATION_NODE, GstMPDRepresentationNodeClass)) + +typedef struct _GstMPDRepresentationNode GstMPDRepresentationNode; +typedef struct _GstMPDRepresentationNodeClass GstMPDRepresentationNodeClass; + + +struct _GstMPDRepresentationNode +{ + GstObject parent_instance; + gchar *id; + guint bandwidth; + guint qualityRanking; + gchar **dependencyId; /* StringVectorType */ + gchar **mediaStreamStructureId; /* StringVectorType */ + /* RepresentationBase extension */ + GstMPDRepresentationBaseType *RepresentationBase; + /* list of BaseURL nodes */ + GList *BaseURLs; + /* list of SubRepresentation nodes */ + GList *SubRepresentations; + /* SegmentBase node */ + GstMPDSegmentBaseType *SegmentBase; + /* SegmentTemplate node */ + GstMPDSegmentTemplateNode *SegmentTemplate; + /* SegmentList node */ + GstMPDSegmentListNode *SegmentList; +}; + +struct _GstMPDRepresentationNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_representation_node_get_type (void); + +GstMPDRepresentationNode * gst_mpd_representation_node_new (void); +void gst_mpd_representation_node_free (GstMPDRepresentationNode* self); + +G_END_DECLS + +#endif /* __GSTMPDREPRESENTATIONNODE_H__ */ diff --git a/ext/dash/gstmpdrootnode.c b/ext/dash/gstmpdrootnode.c new file mode 100644 index 0000000..d2e954f --- /dev/null +++ b/ext/dash/gstmpdrootnode.c @@ -0,0 +1,108 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdrootnode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDRootNode, gst_mpd_root_node, GST_TYPE_OBJECT); +/* GObject VMethods */ + +static void +gst_mpd_root_node_finalize (GObject * object) +{ + GstMPDRootNode *self = GST_MPD_ROOT_NODE (object); + + g_free (self->default_namespace); + g_free (self->namespace_xsi); + g_free (self->namespace_ext); + g_free (self->schemaLocation); + g_free (self->id); + g_free (self->profiles); + + if (self->availabilityStartTime) + gst_date_time_unref (self->availabilityStartTime); + if (self->availabilityEndTime) + gst_date_time_unref (self->availabilityEndTime); + + g_list_free_full (self->ProgramInfos, + (GDestroyNotify) gst_mpd_program_information_node_free); + g_list_free_full (self->BaseURLs, (GDestroyNotify) gst_mpd_baseurl_node_free); + g_list_free_full (self->Locations, (GDestroyNotify) g_free); + g_list_free_full (self->Periods, (GDestroyNotify) gst_mpd_period_node_free); + g_list_free_full (self->Metrics, (GDestroyNotify) gst_mpd_metrics_node_free); + g_list_free_full (self->UTCTimings, + (GDestroyNotify) gst_mpd_utctiming_node_free); + + + G_OBJECT_CLASS (gst_mpd_root_node_parent_class)->finalize (object); +} + +static void +gst_mpd_root_node_class_init (GstMPDRootNodeClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_root_node_finalize; +} + +static void +gst_mpd_root_node_init (GstMPDRootNode * self) +{ + self->default_namespace = NULL; + self->namespace_xsi = NULL; + self->namespace_ext = NULL; + self->schemaLocation = NULL; + self->id = NULL; + self->profiles = NULL; + self->type = GST_MPD_FILE_TYPE_STATIC; + self->availabilityStartTime = NULL; + self->availabilityEndTime = NULL; + self->mediaPresentationDuration = 0; /* [ms] */ + self->minimumUpdatePeriod = 0; /* [ms] */ + self->minBufferTime = 2000; /* [ms] */ + self->timeShiftBufferDepth = 0; /* [ms] */ + self->suggestedPresentationDelay = 0; /* [ms] */ + self->maxSegmentDuration = 0; /* [ms] */ + self->maxSubsegmentDuration = 0; /* [ms] */ + /* list of BaseURL nodes */ + self->BaseURLs = NULL; + /* list of Location nodes */ + self->Locations = NULL; + /* List of ProgramInformation nodes */ + self->ProgramInfos = NULL; + /* list of Periods nodes */ + self->Periods = NULL; + /* list of Metrics nodes */ + self->Metrics = NULL; + /* list of GstUTCTimingNode nodes */ + self->UTCTimings = NULL; +} + +GstMPDRootNode * +gst_mpd_root_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_ROOT_NODE, NULL); +} + +void +gst_mpd_root_node_free (GstMPDRootNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdrootnode.h b/ext/dash/gstmpdrootnode.h new file mode 100644 index 0000000..bf463e0 --- /dev/null +++ b/ext/dash/gstmpdrootnode.h @@ -0,0 +1,89 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDROOTNODE_H__ +#define __GSTMPDROOTNODE_H__ + +#include +#include "gstmpdhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_ROOT_NODE gst_mpd_root_node_get_type () +#define GST_MPD_ROOT_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_ROOT_NODE, GstMPDRootNode)) +#define GST_MPD_ROOT_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_ROOT_NODE, GstMPDRootNodeClass)) +#define GST_IS_MPD_ROOT_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_ROOT_NODE)) +#define GST_IS_MPD_ROOT_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_ROOT_NODE)) +#define GST_MPD_ROOT_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_ROOT_NODE, GstMPDRootNodeClass)) + +typedef struct _GstMPDRootNode GstMPDRootNode; +typedef struct _GstMPDRootNodeClass GstMPDRootNodeClass; + + +struct _GstMPDRootNode +{ + GstObject parent_instance; + gchar *default_namespace; + gchar *namespace_xsi; + gchar *namespace_ext; + gchar *schemaLocation; + gchar *id; + gchar *profiles; + GstMPDFileType type; + GstDateTime *availabilityStartTime; + GstDateTime *availabilityEndTime; + guint64 mediaPresentationDuration; /* [ms] */ + guint64 minimumUpdatePeriod; /* [ms] */ + guint64 minBufferTime; /* [ms] */ + guint64 timeShiftBufferDepth; /* [ms] */ + guint64 suggestedPresentationDelay; /* [ms] */ + guint64 maxSegmentDuration; /* [ms] */ + guint64 maxSubsegmentDuration; /* [ms] */ + /* list of BaseURL nodes */ + GList *BaseURLs; + /* list of Location nodes */ + GList *Locations; + /* List of ProgramInformation nodes */ + GList *ProgramInfos; + /* list of Periods nodes */ + GList *Periods; + /* list of Metrics nodes */ + GList *Metrics; + /* list of GstUTCTimingNode nodes */ + GList *UTCTimings; +}; + +struct _GstMPDRootNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_root_node_get_type (void); + +GstMPDRootNode * gst_mpd_root_node_new (void); +void gst_mpd_root_node_free (GstMPDRootNode* self); + +G_END_DECLS +#endif /* __GSTMPDROOTNODE_H__ */ diff --git a/ext/dash/gstmpdsegmentlistnode.c b/ext/dash/gstmpdsegmentlistnode.c new file mode 100644 index 0000000..01c6d9a --- /dev/null +++ b/ext/dash/gstmpdsegmentlistnode.c @@ -0,0 +1,81 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdsegmentlistnode.h" +#include "gstmpdparser.h" +#include "gstmpdhelper.h" + +G_DEFINE_TYPE (GstMPDSegmentListNode, gst_mpd_segment_list_node, + GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_segment_list_node_finalize (GObject * object) +{ + GstMPDSegmentListNode *self = GST_MPD_SEGMENT_LIST_NODE (object); + + g_list_free_full (self->SegmentURL, + (GDestroyNotify) gst_mpd_segment_url_node_free); + /* MultipleSegmentBaseType extension */ + gst_mpd_helper_mult_seg_base_type_free (self->MultSegBaseType); + if (self->xlink_href) + xmlFree (self->xlink_href); + + G_OBJECT_CLASS (gst_mpd_segment_list_node_parent_class)->finalize (object); +} + +static void +gst_mpd_segment_list_node_class_init (GstMPDSegmentListNodeClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_segment_list_node_finalize; +} + +static void +gst_mpd_segment_list_node_init (GstMPDSegmentListNode * self) +{ + self->MultSegBaseType = NULL; + self->SegmentURL = NULL; + self->xlink_href = NULL; + self->actuate = GST_MPD_XLINK_ACTUATE_ON_REQUEST; +} + +GstMPDSegmentListNode * +gst_mpd_segment_list_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_SEGMENT_LIST_NODE, NULL); +} + +void +gst_mpd_segment_list_node_free (GstMPDSegmentListNode * self) +{ + if (self) + gst_object_unref (self); +} + +void +gst_mpd_segment_list_node_add_segment (GstMPDSegmentListNode * self, + GstMPDSegmentURLNode * segment_url) +{ + g_return_if_fail (self != NULL); + + self->SegmentURL = g_list_append (self->SegmentURL, segment_url); +} diff --git a/ext/dash/gstmpdsegmentlistnode.h b/ext/dash/gstmpdsegmentlistnode.h new file mode 100644 index 0000000..715e702 --- /dev/null +++ b/ext/dash/gstmpdsegmentlistnode.h @@ -0,0 +1,72 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDSEGMENTLISTNODE_H__ +#define __GSTMPDSEGMENTLISTNODE_H__ + +#include +#include "gstmpdhelper.h" +#include "gstmpdsegmenturlnode.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_SEGMENT_LIST_NODE gst_mpd_segment_list_node_get_type () +#define GST_MPD_SEGMENT_LIST_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_SEGMENT_LIST_NODE, GstMPDSegmentListNode)) +#define GST_MPD_SEGMENT_LIST_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_SEGMENT_LIST_NODE, GstMPDSegmentListNodeClass)) +#define GST_IS_MPD_SEGMENT_LIST_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_SEGMENT_LIST_NODE)) +#define GST_IS_MPD_SEGMENT_LIST_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_SEGMENT_LIST_NODE)) +#define GST_MPD_SEGMENT_LIST_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_SEGMENT_LIST_NODE, GstMPDSegmentListNodeClass)) + +typedef struct _GstMPDSegmentListNode GstMPDSegmentListNode; +typedef struct _GstMPDSegmentListNodeClass GstMPDSegmentListNodeClass; + + +struct _GstMPDSegmentListNode +{ + GstObject parent_instance; + /* extension */ + GstMPDMultSegmentBaseType *MultSegBaseType; + /* list of SegmentURL nodes */ + GList *SegmentURL; + + gchar *xlink_href; + GstMPDXLinkActuate actuate; +}; + +struct _GstMPDSegmentListNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_segment_list_node_get_type (void); + +GstMPDSegmentListNode * gst_mpd_segment_list_node_new (void); +void gst_mpd_segment_list_node_free (GstMPDSegmentListNode* self); + +void gst_mpd_segment_list_node_add_segment(GstMPDSegmentListNode * self, GstMPDSegmentURLNode * segment_url); + +G_END_DECLS + +#endif /* __GSTMPDSEGMENTLISTNODE_H__ */ diff --git a/ext/dash/gstmpdsegmenttemplatenode.c b/ext/dash/gstmpdsegmenttemplatenode.c new file mode 100644 index 0000000..3fc898a --- /dev/null +++ b/ext/dash/gstmpdsegmenttemplatenode.c @@ -0,0 +1,78 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdsegmenttemplatenode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDSegmentTemplateNode, gst_mpd_segment_template_node, + GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_segment_template_node_finalize (GObject * object) +{ + GstMPDSegmentTemplateNode *self = GST_MPD_SEGMENT_TEMPLATE_NODE (object); + + if (self->media) + xmlFree (self->media); + if (self->index) + xmlFree (self->index); + if (self->initialization) + xmlFree (self->initialization); + if (self->bitstreamSwitching) + xmlFree (self->bitstreamSwitching); + /* MultipleSegmentBaseType extension */ + gst_mpd_helper_mult_seg_base_type_free (self->MultSegBaseType); + + G_OBJECT_CLASS (gst_mpd_segment_template_node_parent_class)->finalize + (object); +} + +static void +gst_mpd_segment_template_node_class_init (GstMPDSegmentTemplateNodeClass * + klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_segment_template_node_finalize; +} + +static void +gst_mpd_segment_template_node_init (GstMPDSegmentTemplateNode * self) +{ + self->MultSegBaseType = NULL; + self->media = NULL; + self->index = NULL; + self->initialization = NULL; + self->bitstreamSwitching = NULL; +} + +GstMPDSegmentTemplateNode * +gst_mpd_segment_template_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_SEGMENT_TEMPLATE_NODE, NULL); +} + +void +gst_mpd_segment_template_node_free (GstMPDSegmentTemplateNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdsegmenttemplatenode.h b/ext/dash/gstmpdsegmenttemplatenode.h new file mode 100644 index 0000000..b882f55 --- /dev/null +++ b/ext/dash/gstmpdsegmenttemplatenode.h @@ -0,0 +1,68 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDSEGMENTTEMPLATENODE_H__ +#define __GSTMPDSEGMENTTEMPLATENODE_H__ + +#include +#include "gstmpdhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_SEGMENT_TEMPLATE_NODE gst_mpd_segment_template_node_get_type () +#define GST_MPD_SEGMENT_TEMPLATE_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_SEGMENT_TEMPLATE_NODE, GstMPDSegmentTemplateNode)) +#define GST_MPD_SEGMENT_TEMPLATE_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_SEGMENT_TEMPLATE_NODE, GstMPDSegmentTemplateNodeClass)) +#define GST_IS_MPD_SEGMENT_TEMPLATE_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_SEGMENT_TEMPLATE_NODE)) +#define GST_IS_MPD_SEGMENT_TEMPLATE_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_SEGMENT_TEMPLATE_NODE)) +#define GST_MPD_SEGMENT_TEMPLATE_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_SEGMENT_TEMPLATE_NODE, GstMPDSegmentTemplateNodeClass)) + +typedef struct _GstMPDSegmentTemplateNode GstMPDSegmentTemplateNode; +typedef struct _GstMPDSegmentTemplateNodeClass GstMPDSegmentTemplateNodeClass; + + +struct _GstMPDSegmentTemplateNode +{ + GstObject parent_instance; + /* extension */ + GstMPDMultSegmentBaseType *MultSegBaseType; + gchar *media; + gchar *index; + gchar *initialization; + gchar *bitstreamSwitching; +}; + +struct _GstMPDSegmentTemplateNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_segment_template_node_get_type (void); + +GstMPDSegmentTemplateNode * gst_mpd_segment_template_node_new (void); +void gst_mpd_segment_template_node_free (GstMPDSegmentTemplateNode* self); + +G_END_DECLS + +#endif /* __GSTMPDSEGMENTTEMPLATENODE_H__ */ diff --git a/ext/dash/gstmpdsegmenttimelinenode.c b/ext/dash/gstmpdsegmenttimelinenode.c new file mode 100644 index 0000000..c6e449a --- /dev/null +++ b/ext/dash/gstmpdsegmenttimelinenode.c @@ -0,0 +1,88 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdsegmenttimelinenode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDSegmentTimelineNode, gst_mpd_segment_timeline_node, + GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_segment_timeline_node_finalize (GObject * object) +{ + GstMPDSegmentTimelineNode *self = GST_MPD_SEGMENT_TIMELINE_NODE (object); + + g_queue_foreach (&self->S, (GFunc) gst_mpd_s_node_free, NULL); + g_queue_clear (&self->S); + + G_OBJECT_CLASS (gst_mpd_segment_timeline_node_parent_class)->finalize + (object); +} + +static void +gst_mpd_segment_timeline_node_class_init (GstMPDSegmentTimelineNodeClass * + klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_segment_timeline_node_finalize; +} + +static void +gst_mpd_segment_timeline_node_init (GstMPDSegmentTimelineNode * self) +{ + g_queue_init (&self->S); +} + +GstMPDSegmentTimelineNode * +gst_mpd_segment_timeline_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_SEGMENT_TIMELINE_NODE, NULL); +} + +void +gst_mpd_segment_timeline_node_free (GstMPDSegmentTimelineNode * self) +{ + if (self) + gst_object_unref (self); +} + +GstMPDSegmentTimelineNode * +gst_mpd_segment_timeline_node_clone (GstMPDSegmentTimelineNode * + segment_timeline) +{ + GstMPDSegmentTimelineNode *clone = NULL; + GList *list; + + if (segment_timeline) { + clone = gst_mpd_segment_timeline_node_new (); + for (list = g_queue_peek_head_link (&segment_timeline->S); list; + list = g_list_next (list)) { + GstMPDSNode *s_node; + s_node = (GstMPDSNode *) list->data; + if (s_node) { + g_queue_push_tail (&clone->S, gst_mpd_s_node_clone (s_node)); + } + } + } + + return clone; +} diff --git a/ext/dash/gstmpdsegmenttimelinenode.h b/ext/dash/gstmpdsegmenttimelinenode.h new file mode 100644 index 0000000..b275696 --- /dev/null +++ b/ext/dash/gstmpdsegmenttimelinenode.h @@ -0,0 +1,66 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDSEGMENTTIMELINENODE_H__ +#define __GSTMPDSEGMENTTIMELINENODE_H__ + +#include +#include "gstxmlhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_SEGMENT_TIMELINE_NODE gst_mpd_segment_timeline_node_get_type () +#define GST_MPD_SEGMENT_TIMELINE_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_SEGMENT_TIMELINE_NODE, GstMPDSegmentTimelineNode)) +#define GST_MPD_SEGMENT_TIMELINE_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_SEGMENT_TIMELINE_NODE, GstMPDSegmentTimelineNodeClass)) +#define GST_IS_MPD_SEGMENT_TIMELINE_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_SEGMENT_TIMELINE_NODE)) +#define GST_IS_MPD_SEGMENT_TIMELINE_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_SEGMENT_TIMELINE_NODE)) +#define GST_MPD_SEGMENT_TIMELINE_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_SEGMENT_TIMELINE_NODE, GstMPDSegmentTimelineNodeClass)) + +typedef struct _GstMPDSegmentTimelineNode GstMPDSegmentTimelineNode; +typedef struct _GstMPDSegmentTimelineNodeClass GstMPDSegmentTimelineNodeClass; + + +struct _GstMPDSegmentTimelineNode +{ + GstObject parent_instance; + /* list of S nodes */ + GQueue S; +}; + +struct _GstMPDSegmentTimelineNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_segment_timeline_node_get_type (void); + +GstMPDSegmentTimelineNode * gst_mpd_segment_timeline_node_new (void); +void gst_mpd_segment_timeline_node_free (GstMPDSegmentTimelineNode* self); + +GstMPDSegmentTimelineNode *gst_mpd_segment_timeline_node_clone (GstMPDSegmentTimelineNode * pointer); + +G_END_DECLS + +#endif /* __GSTMPDSEGMENTTIMELINENODE_H__ */ diff --git a/ext/dash/gstmpdsegmenturlnode.c b/ext/dash/gstmpdsegmenturlnode.c new file mode 100644 index 0000000..b8f23bf --- /dev/null +++ b/ext/dash/gstmpdsegmenturlnode.c @@ -0,0 +1,87 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdsegmenturlnode.h" +#include "gstmpdparser.h" +#include "gstmpdhelper.h" + +G_DEFINE_TYPE (GstMPDSegmentURLNode, gst_mpd_segment_url_node, GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_segment_url_node_finalize (GObject * object) +{ + GstMPDSegmentURLNode *self = GST_MPD_SEGMENT_URL_NODE (object); + + if (self->media) + xmlFree (self->media); + g_slice_free (GstXMLRange, self->mediaRange); + if (self->index) + xmlFree (self->index); + g_slice_free (GstXMLRange, self->indexRange); + + G_OBJECT_CLASS (gst_mpd_segment_url_node_parent_class)->finalize (object); +} + +static void +gst_mpd_segment_url_node_class_init (GstMPDSegmentURLNodeClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_segment_url_node_finalize; +} + +static void +gst_mpd_segment_url_node_init (GstMPDSegmentURLNode * self) +{ + self->media = NULL; + self->mediaRange = NULL; + self->index = NULL; + self->indexRange = NULL; +} + +GstMPDSegmentURLNode * +gst_mpd_segment_url_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_SEGMENT_URL_NODE, NULL); +} + +void +gst_mpd_segment_url_node_free (GstMPDSegmentURLNode * self) +{ + if (self) + gst_object_unref (self); +} + +GstMPDSegmentURLNode * +gst_mpd_segment_url_node_clone (GstMPDSegmentURLNode * seg_url) +{ + GstMPDSegmentURLNode *clone = NULL; + + if (seg_url) { + clone = gst_mpd_segment_url_node_new (); + clone->media = xmlMemStrdup (seg_url->media); + clone->mediaRange = gst_xml_helper_clone_range (seg_url->mediaRange); + clone->index = xmlMemStrdup (seg_url->index); + clone->indexRange = gst_xml_helper_clone_range (seg_url->indexRange); + } + + return clone; +} diff --git a/ext/dash/gstmpdsegmenturlnode.h b/ext/dash/gstmpdsegmenturlnode.h new file mode 100644 index 0000000..5523ec5 --- /dev/null +++ b/ext/dash/gstmpdsegmenturlnode.h @@ -0,0 +1,68 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDSEGMENTURLNODE_H__ +#define __GSTMPDSEGMENTURLNODE_H__ + +#include +#include "gstmpdhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_SEGMENT_URL_NODE gst_mpd_segment_url_node_get_type () +#define GST_MPD_SEGMENT_URL_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_SEGMENT_URL_NODE, GstMPDSegmentURLNode)) +#define GST_MPD_SEGMENT_URL_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_SEGMENT_URL_NODE, GstMPDSegmentURLNodeClass)) +#define GST_IS_MPD_SEGMENT_URL_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_SEGMENT_URL_NODE)) +#define GST_IS_MPD_SEGMENT_URL_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_SEGMENT_URL_NODE)) +#define GST_MPD_SEGMENT_URL_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_SEGMENT_URL_NODE, GstMPDSegmentURLNodeClass)) + +typedef struct _GstMPDSegmentURLNode GstMPDSegmentURLNode; +typedef struct _GstMPDSegmentURLNodeClass GstMPDSegmentURLNodeClass; + + +struct _GstMPDSegmentURLNode +{ + GstObject parent_instance; + gchar *media; + GstXMLRange *mediaRange; + gchar *index; + GstXMLRange *indexRange; +}; + +struct _GstMPDSegmentURLNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_segment_url_node_get_type (void); + +GstMPDSegmentURLNode * gst_mpd_segment_url_node_new (void); +void gst_mpd_segment_url_node_free (GstMPDSegmentURLNode* self); + +GstMPDSegmentURLNode *gst_mpd_segment_url_node_clone (GstMPDSegmentURLNode * seg_url); + +G_END_DECLS + +#endif /* __GSTMPDSEGMENTURLNODE_H__ */ diff --git a/ext/dash/gstmpdsnode.c b/ext/dash/gstmpdsnode.c new file mode 100644 index 0000000..63fd06e --- /dev/null +++ b/ext/dash/gstmpdsnode.c @@ -0,0 +1,67 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdsnode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDSNode, gst_mpd_s_node, GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_s_node_class_init (GstMPDSNodeClass * klass) +{ +} + +static void +gst_mpd_s_node_init (GstMPDSNode * self) +{ + self->t = 0; + self->d = 0; + self->r = 0; +} + +GstMPDSNode * +gst_mpd_s_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_S_NODE, NULL); +} + +void +gst_mpd_s_node_free (GstMPDSNode * self) +{ + if (self) + gst_object_unref (self); +} + +GstMPDSNode * +gst_mpd_s_node_clone (GstMPDSNode * s_node) +{ + GstMPDSNode *clone = NULL; + + if (s_node) { + clone = gst_mpd_s_node_new (); + clone->t = s_node->t; + clone->d = s_node->d; + clone->r = s_node->r; + } + + return clone; +} diff --git a/ext/dash/gstmpdsnode.h b/ext/dash/gstmpdsnode.h new file mode 100644 index 0000000..ded0235 --- /dev/null +++ b/ext/dash/gstmpdsnode.h @@ -0,0 +1,67 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDSNODE_H__ +#define __GSTMPDSNODE_H__ + +#include +#include "gstmpdhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_S_NODE gst_mpd_s_node_get_type () +#define GST_MPD_S_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_S_NODE, GstMPDSNode)) +#define GST_MPD_S_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_S_NODE, GstMPDSNodeClass)) +#define GST_IS_MPD_S_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_S_NODE)) +#define GST_IS_MPD_S_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_S_NODE)) +#define GST_MPD_S_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_S_NODE, GstMPDSNodeClass)) + +typedef struct _GstMPDSNode GstMPDSNode; +typedef struct _GstMPDSNodeClass GstMPDSNodeClass; + + +struct _GstMPDSNode +{ + GstObject parent_instance; + guint64 t; + guint64 d; + gint r; +}; + +struct _GstMPDSNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_s_node_get_type (void); + +GstMPDSNode * gst_mpd_s_node_new (void); +void gst_mpd_s_node_free (GstMPDSNode* self); + +GstMPDSNode *gst_mpd_s_node_clone (GstMPDSNode * pointer); + +G_END_DECLS + +#endif /* __GSTMPDSNODE_H__ */ diff --git a/ext/dash/gstmpdsubrepresentationnode.c b/ext/dash/gstmpdsubrepresentationnode.c new file mode 100644 index 0000000..55b9a47 --- /dev/null +++ b/ext/dash/gstmpdsubrepresentationnode.c @@ -0,0 +1,73 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdsubrepresentationnode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDSubRepresentationNode, gst_mpd_sub_representation_node, + GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_sub_representation_node_finalize (GObject * object) +{ + GstMPDSubRepresentationNode *self = GST_MPD_SUB_REPRESENTATION_NODE (object); + + gst_mpd_helper_representation_base_type_free (self->RepresentationBase); + if (self->dependencyLevel) + xmlFree (self->dependencyLevel); + g_strfreev (self->contentComponent); + + G_OBJECT_CLASS (gst_mpd_sub_representation_node_parent_class)->finalize + (object); +} + +static void +gst_mpd_sub_representation_node_class_init (GstMPDSubRepresentationNodeClass * + klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_sub_representation_node_finalize; +} + +static void +gst_mpd_sub_representation_node_init (GstMPDSubRepresentationNode * self) +{ + self->RepresentationBase = NULL; + self->level = 0; + self->dependencyLevel = NULL; + self->size = 0; + self->bandwidth = 0; + self->contentComponent = NULL; +} + +GstMPDSubRepresentationNode * +gst_mpd_sub_representation_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_SUB_REPRESENTATION_NODE, NULL); +} + +void +gst_mpd_sub_representation_node_free (GstMPDSubRepresentationNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdsubrepresentationnode.h b/ext/dash/gstmpdsubrepresentationnode.h new file mode 100644 index 0000000..40c4db3 --- /dev/null +++ b/ext/dash/gstmpdsubrepresentationnode.h @@ -0,0 +1,69 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDSUBREPRESENTATIONNODE_H__ +#define __GSTMPDSUBREPRESENTATIONNODE_H__ + +#include +#include "gstmpdhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_SUB_REPRESENTATION_NODE gst_mpd_sub_representation_node_get_type () +#define GST_MPD_SUB_REPRESENTATION_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_SUB_REPRESENTATION_NODE, GstMPDSubRepresentationNode)) +#define GST_MPD_SUB_REPRESENTATION_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_SUB_REPRESENTATION_NODE, GstMPDSubRepresentationNodeClass)) +#define GST_IS_MPD_SUB_REPRESENTATION_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_SUB_REPRESENTATION_NODE)) +#define GST_IS_MPD_SUB_REPRESENTATION_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_SUB_REPRESENTATION_NODE)) +#define GST_MPD_SUB_REPRESENTATION_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_SUB_REPRESENTATION_NODE, GstMPDSubRepresentationNodeClass)) + +typedef struct _GstMPDSubRepresentationNode GstMPDSubRepresentationNode; +typedef struct _GstMPDSubRepresentationNodeClass GstMPDSubRepresentationNodeClass; + + +struct _GstMPDSubRepresentationNode +{ + GstObject parent_instance; + /* RepresentationBase extension */ + GstMPDRepresentationBaseType *RepresentationBase; + guint level; + guint *dependencyLevel; /* UIntVectorType */ + guint size; /* size of "dependencyLevel" array */ + guint bandwidth; + gchar **contentComponent; /* StringVectorType */ +}; + +struct _GstMPDSubRepresentationNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_sub_representation_node_get_type (void); + +GstMPDSubRepresentationNode * gst_mpd_sub_representation_node_new (void); +void gst_mpd_sub_representation_node_free (GstMPDSubRepresentationNode* self); + +G_END_DECLS + +#endif /* __GSTMPDSUBREPRESENTATIONNODE_H__ */ diff --git a/ext/dash/gstmpdsubsetnode.c b/ext/dash/gstmpdsubsetnode.c new file mode 100644 index 0000000..8a8cd6a --- /dev/null +++ b/ext/dash/gstmpdsubsetnode.c @@ -0,0 +1,64 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdsubsetnode.h" +#include "gstmpdparser.h" + +G_DEFINE_TYPE (GstMPDSubsetNode, gst_mpd_subset_node, GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_subset_node_finalize (GObject * object) +{ + GstMPDSubsetNode *self = GST_MPD_SUBSET_NODE (object); + + if (self->contains) + xmlFree (self->contains); + + G_OBJECT_CLASS (gst_mpd_subset_node_parent_class)->finalize (object); +} + +static void +gst_mpd_subset_node_class_init (GstMPDSubsetNodeClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_subset_node_finalize; +} + +static void +gst_mpd_subset_node_init (GstMPDSubsetNode * self) +{ + self->size = 0; + self->contains = NULL; +} + +GstMPDSubsetNode * +gst_mpd_subset_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_SUBSET_NODE, NULL); +} + +void +gst_mpd_subset_node_free (GstMPDSubsetNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdsubsetnode.h b/ext/dash/gstmpdsubsetnode.h new file mode 100644 index 0000000..d307245 --- /dev/null +++ b/ext/dash/gstmpdsubsetnode.h @@ -0,0 +1,64 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDSUBSETNODE_H__ +#define __GSTMPDSUBSETNODE_H__ + +#include +#include "gstmpdhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_SUBSET_NODE gst_mpd_subset_node_get_type () +#define GST_MPD_SUBSET_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_SUBSET_NODE, GstMPDSubsetNode)) +#define GST_MPD_SUBSET_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_SUBSET_NODE, GstMPDSubsetNodeClass)) +#define GST_IS_MPD_SUBSET_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_SUBSET_NODE)) +#define GST_IS_MPD_SUBSET_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_SUBSET_NODE)) +#define GST_MPD_SUBSET_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_SUBSET_NODE, GstMPDSubsetNodeClass)) + +typedef struct _GstMPDSubsetNode GstMPDSubsetNode; +typedef struct _GstMPDSubsetNodeClass GstMPDSubsetNodeClass; + + +struct _GstMPDSubsetNode +{ + GstObject parent_instance; + guint *contains; /* UIntVectorType */ + guint size; /* size of the "contains" array */ +}; + +struct _GstMPDSubsetNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_subset_node_get_type (void); + +GstMPDSubsetNode * gst_mpd_subset_node_new (void); +void gst_mpd_subset_node_free (GstMPDSubsetNode* self); + +G_END_DECLS + +#endif /* __GSTMPDSUBSETNODE_H__ */ diff --git a/ext/dash/gstmpdutctimingnode.c b/ext/dash/gstmpdutctimingnode.c new file mode 100644 index 0000000..ca9c7bb --- /dev/null +++ b/ext/dash/gstmpdutctimingnode.c @@ -0,0 +1,68 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "gstmpdutctimingnode.h" +#include "gstmpdparser.h" + +enum +{ + PROP_MPD_UTCTIMING_0, +}; + +G_DEFINE_TYPE (GstMPDUTCTimingNode, gst_mpd_utctiming_node, GST_TYPE_OBJECT); + +/* GObject VMethods */ + +static void +gst_mpd_utctiming_node_finalize (GObject * object) +{ + GstMPDUTCTimingNode *self = GST_MPD_UTCTIMING_NODE (object); + + g_strfreev (self->urls); + + G_OBJECT_CLASS (gst_mpd_utctiming_node_parent_class)->finalize (object); +} + +static void +gst_mpd_utctiming_node_class_init (GstMPDUTCTimingNodeClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gst_mpd_utctiming_node_finalize; +} + +static void +gst_mpd_utctiming_node_init (GstMPDUTCTimingNode * self) +{ + self->method = 0; + self->urls = NULL; +} + +GstMPDUTCTimingNode * +gst_mpd_utctiming_node_new (void) +{ + return g_object_new (GST_TYPE_MPD_UTCTIMING_NODE, NULL); +} + +void +gst_mpd_utctiming_node_free (GstMPDUTCTimingNode * self) +{ + if (self) + gst_object_unref (self); +} diff --git a/ext/dash/gstmpdutctimingnode.h b/ext/dash/gstmpdutctimingnode.h new file mode 100644 index 0000000..42b5fec --- /dev/null +++ b/ext/dash/gstmpdutctimingnode.h @@ -0,0 +1,78 @@ +/* GStreamer + * + * Copyright (C) 2019 Collabora Ltd. + * Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library (COPYING); if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __GSTMPDUTCTIMINGNODE_H__ +#define __GSTMPDUTCTIMINGNODE_H__ + +#include +#include "gstxmlhelper.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPD_UTCTIMING_NODE gst_mpd_utctiming_node_get_type () +#define GST_MPD_UTCTIMING_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPD_UTCTIMING_NODE, GstMPDUTCTimingNode)) +#define GST_MPD_UTCTIMING_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPD_UTCTIMING_NODE, GstMPDUTCTimingNodeClass)) +#define GST_IS_MPD_UTCTIMING_NODE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPD_UTCTIMING_NODE)) +#define GST_IS_MPD_UTCTIMING_NODE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPD_UTCTIMING_NODE)) +#define GST_MPD_UTCTIMING_NODE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MPD_UTCTIMING_NODE, GstMPDUTCTimingNodeClass)) + +typedef struct _GstMPDUTCTimingNode GstMPDUTCTimingNode; +typedef struct _GstMPDUTCTimingNodeClass GstMPDUTCTimingNodeClass; + + +typedef enum +{ + GST_MPD_UTCTIMING_TYPE_UNKNOWN = 0x00, + GST_MPD_UTCTIMING_TYPE_NTP = 0x01, + GST_MPD_UTCTIMING_TYPE_SNTP = 0x02, + GST_MPD_UTCTIMING_TYPE_HTTP_HEAD = 0x04, + GST_MPD_UTCTIMING_TYPE_HTTP_XSDATE = 0x08, + GST_MPD_UTCTIMING_TYPE_HTTP_ISO = 0x10, + GST_MPD_UTCTIMING_TYPE_HTTP_NTP = 0x20, + GST_MPD_UTCTIMING_TYPE_DIRECT = 0x40 +} GstMPDUTCTimingType; + +struct _GstMPDUTCTimingNode +{ + GstObject parent_instance; + GstMPDUTCTimingType method; + /* NULL terminated array of strings */ + gchar **urls; + /* TODO add missing fields such as weight etc.*/ +}; + +struct _GstMPDUTCTimingNodeClass { + GstObjectClass parent_class; +}; + + +G_GNUC_INTERNAL GType gst_mpd_utctiming_node_get_type (void); + +GstMPDUTCTimingNode * gst_mpd_utctiming_node_new (void); +void gst_mpd_utctiming_node_free (GstMPDUTCTimingNode* self); + +G_END_DECLS + +#endif /* __GSTMPDUTCTIMINGNODE_H__ */ diff --git a/ext/dash/meson.build b/ext/dash/meson.build index c3e1f09..67779b2 100644 --- a/ext/dash/meson.build +++ b/ext/dash/meson.build @@ -1,5 +1,22 @@ dash_sources = [ 'gstdashdemux.c', + 'gstmpdrootnode.c', + 'gstmpdbaseurlnode.c', + 'gstmpdutctimingnode.c', + 'gstmpdmetricsnode.c', + 'gstmpdmetricsrangenode.c', + 'gstmpdsnode.c', + 'gstmpdsegmenttimelinenode.c', + 'gstmpdsegmenttemplatenode.c', + 'gstmpdsegmenturlnode.c', + 'gstmpdsegmentlistnode.c', + 'gstmpdperiodnode.c', + 'gstmpdrepresentationnode.c', + 'gstmpdsubrepresentationnode.c', + 'gstmpdcontentcomponentnode.c', + 'gstmpdadaptationsetnode.c', + 'gstmpdsubsetnode.c', + 'gstmpdprograminformationnode.c', 'gstxmlhelper.c', 'gstmpdhelper.c', 'gstmpdparser.c', diff --git a/tests/check/elements/dash_mpd.c b/tests/check/elements/dash_mpd.c index c6c9697..8098013 100644 --- a/tests/check/elements/dash_mpd.c +++ b/tests/check/elements/dash_mpd.c @@ -21,6 +21,23 @@ #include "../../ext/dash/gstmpdparser.c" #include "../../ext/dash/gstxmlhelper.c" #include "../../ext/dash/gstmpdhelper.c" +#include "../../ext/dash/gstmpdrootnode.c" +#include "../../ext/dash/gstmpdbaseurlnode.c" +#include "../../ext/dash/gstmpdutctimingnode.c" +#include "../../ext/dash/gstmpdmetricsnode.c" +#include "../../ext/dash/gstmpdmetricsrangenode.c" +#include "../../ext/dash/gstmpdsnode.c" +#include "../../ext/dash/gstmpdsegmenttimelinenode.c" +#include "../../ext/dash/gstmpdsegmenttemplatenode.c" +#include "../../ext/dash/gstmpdsegmenturlnode.c" +#include "../../ext/dash/gstmpdsegmentlistnode.c" +#include "../../ext/dash/gstmpdperiodnode.c" +#include "../../ext/dash/gstmpdsubrepresentationnode.c" +#include "../../ext/dash/gstmpdrepresentationnode.c" +#include "../../ext/dash/gstmpdcontentcomponentnode.c" +#include "../../ext/dash/gstmpdadaptationsetnode.c" +#include "../../ext/dash/gstmpdsubsetnode.c" +#include "../../ext/dash/gstmpdprograminformationnode.c" #include "../../ext/dash/gstmpdclient.c" #undef GST_CAT_DEFAULT @@ -67,13 +84,13 @@ GST_START_TEST (dash_mpdparser_validsimplempd) " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\"> "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); /* check that unset elements with default values are properly configured */ - assert_equals_int (mpdclient->mpd_node->type, GST_MPD_FILE_TYPE_STATIC); + assert_equals_int (mpdclient->mpd_root_node->type, GST_MPD_FILE_TYPE_STATIC); gst_mpd_client_free (mpdclient); } @@ -108,22 +125,24 @@ GST_START_TEST (dash_mpdparser_mpd) " maxSubsegmentDuration=\"P0Y1M2DT12H10M20.5S\">"; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - assert_equals_string (mpdclient->mpd_node->default_namespace, + assert_equals_string (mpdclient->mpd_root_node->default_namespace, "urn:mpeg:dash:schema:mpd:2011"); - assert_equals_string (mpdclient->mpd_node->namespace_xsi, "TestNamespaceXSI"); - assert_equals_string (mpdclient->mpd_node->namespace_ext, "TestNamespaceEXT"); - assert_equals_string (mpdclient->mpd_node->schemaLocation, + assert_equals_string (mpdclient->mpd_root_node->namespace_xsi, + "TestNamespaceXSI"); + assert_equals_string (mpdclient->mpd_root_node->namespace_ext, + "TestNamespaceEXT"); + assert_equals_string (mpdclient->mpd_root_node->schemaLocation, "TestSchemaLocation"); - assert_equals_string (mpdclient->mpd_node->id, "testId"); + assert_equals_string (mpdclient->mpd_root_node->id, "testId"); - assert_equals_int (mpdclient->mpd_node->type, GST_MPD_FILE_TYPE_STATIC); + assert_equals_int (mpdclient->mpd_root_node->type, GST_MPD_FILE_TYPE_STATIC); - availabilityStartTime = mpdclient->mpd_node->availabilityStartTime; + availabilityStartTime = mpdclient->mpd_root_node->availabilityStartTime; assert_equals_int (gst_date_time_get_year (availabilityStartTime), 2015); assert_equals_int (gst_date_time_get_month (availabilityStartTime), 3); assert_equals_int (gst_date_time_get_day (availabilityStartTime), 24); @@ -132,7 +151,7 @@ GST_START_TEST (dash_mpdparser_mpd) assert_equals_int (gst_date_time_get_second (availabilityStartTime), 50); assert_equals_int (gst_date_time_get_microsecond (availabilityStartTime), 0); - availabilityEndTime = mpdclient->mpd_node->availabilityEndTime; + availabilityEndTime = mpdclient->mpd_root_node->availabilityEndTime; assert_equals_int (gst_date_time_get_year (availabilityEndTime), 2015); assert_equals_int (gst_date_time_get_month (availabilityEndTime), 3); assert_equals_int (gst_date_time_get_day (availabilityEndTime), 24); @@ -142,25 +161,25 @@ GST_START_TEST (dash_mpdparser_mpd) assert_equals_int (gst_date_time_get_microsecond (availabilityEndTime), 123456); - assert_equals_uint64 (mpdclient->mpd_node->mediaPresentationDuration, + assert_equals_uint64 (mpdclient->mpd_root_node->mediaPresentationDuration, duration_to_ms (0, 1, 2, 12, 10, 20, 500)); - assert_equals_uint64 (mpdclient->mpd_node->minimumUpdatePeriod, + assert_equals_uint64 (mpdclient->mpd_root_node->minimumUpdatePeriod, duration_to_ms (0, 1, 2, 12, 10, 20, 500)); - assert_equals_uint64 (mpdclient->mpd_node->minBufferTime, + assert_equals_uint64 (mpdclient->mpd_root_node->minBufferTime, duration_to_ms (0, 1, 2, 12, 10, 20, 500)); - assert_equals_uint64 (mpdclient->mpd_node->timeShiftBufferDepth, + assert_equals_uint64 (mpdclient->mpd_root_node->timeShiftBufferDepth, duration_to_ms (0, 1, 2, 12, 10, 20, 500)); - assert_equals_uint64 (mpdclient->mpd_node->suggestedPresentationDelay, + assert_equals_uint64 (mpdclient->mpd_root_node->suggestedPresentationDelay, duration_to_ms (0, 1, 2, 12, 10, 20, 500)); - assert_equals_uint64 (mpdclient->mpd_node->maxSegmentDuration, + assert_equals_uint64 (mpdclient->mpd_root_node->maxSegmentDuration, duration_to_ms (0, 1, 2, 12, 10, 20, 500)); - assert_equals_uint64 (mpdclient->mpd_node->maxSubsegmentDuration, + assert_equals_uint64 (mpdclient->mpd_root_node->maxSubsegmentDuration, duration_to_ms (0, 1, 2, 12, 10, 20, 500)); gst_mpd_client_free (mpdclient); @@ -174,7 +193,7 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_programInformation) { - GstProgramInformationNode *program; + GstMPDProgramInformationNode *program; const gchar *xml = "" " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); program = - (GstProgramInformationNode *) mpdclient->mpd_node->ProgramInfo->data; + (GstMPDProgramInformationNode *) mpdclient->mpd_root_node-> + ProgramInfos->data; assert_equals_string (program->lang, "en"); assert_equals_string (program->moreInformationURL, "TestMoreInformationUrl"); assert_equals_string (program->Title, "TestTitle"); @@ -211,7 +231,7 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_baseURL) { - GstBaseURL *baseURL; + GstMPDBaseURLNode *baseURL; const gchar *xml = "" "TestBaseURL"; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - baseURL = (GstBaseURL *) mpdclient->mpd_node->BaseURLs->data; + baseURL = (GstMPDBaseURLNode *) mpdclient->mpd_root_node->BaseURLs->data; assert_equals_string (baseURL->baseURL, "TestBaseURL"); assert_equals_string (baseURL->serviceLocation, "TestServiceLocation"); assert_equals_string (baseURL->byteRange, "TestByteRange"); @@ -249,12 +269,12 @@ GST_START_TEST (dash_mpdparser_location) " TestLocation"; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - location = (gchar *) mpdclient->mpd_node->Locations->data; + location = (gchar *) mpdclient->mpd_root_node->Locations->data; assert_equals_string (location, "TestLocation"); gst_mpd_client_free (mpdclient); @@ -268,7 +288,7 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_metrics) { - GstMetricsNode *metricsNode; + GstMPDMetricsNode *metricsNode; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - metricsNode = (GstMetricsNode *) mpdclient->mpd_node->Metrics->data; + metricsNode = (GstMPDMetricsNode *) mpdclient->mpd_root_node->Metrics->data; assert_equals_string (metricsNode->metrics, "TestMetric"); gst_mpd_client_free (mpdclient); @@ -295,8 +315,8 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_metrics_range) { - GstMetricsNode *metricsNode; - GstMetricsRangeNode *metricsRangeNode; + GstMPDMetricsNode *metricsNode; + GstMPDMetricsRangeNode *metricsRangeNode; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - metricsNode = (GstMetricsNode *) mpdclient->mpd_node->Metrics->data; + metricsNode = (GstMPDMetricsNode *) mpdclient->mpd_root_node->Metrics->data; assert_equals_pointer (metricsNode->metrics, NULL); - metricsRangeNode = (GstMetricsRangeNode *) metricsNode->MetricsRanges->data; - assert_equals_uint64 (metricsRangeNode->starttime, - duration_to_ms (0, 1, 2, 12, 10, 20, 500)); - assert_equals_uint64 (metricsRangeNode->duration, - duration_to_ms (0, 1, 2, 12, 10, 20, 123)); + metricsRangeNode = + (GstMPDMetricsRangeNode *) metricsNode->MetricsRanges->data; + assert_equals_uint64 (metricsRangeNode->starttime, duration_to_ms (0, 1, 2, + 12, 10, 20, 500)); + assert_equals_uint64 (metricsRangeNode->duration, duration_to_ms (0, 1, 2, 12, + 10, 20, 123)); gst_mpd_client_free (mpdclient); } @@ -331,7 +352,7 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_metrics_reporting) { - GstMetricsNode *metricsNode; + GstMPDMetricsNode *metricsNode; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - metricsNode = (GstMetricsNode *) mpdclient->mpd_node->Metrics->data; + metricsNode = (GstMPDMetricsNode *) mpdclient->mpd_root_node->Metrics->data; assert_equals_pointer (metricsNode->metrics, NULL); gst_mpd_client_free (mpdclient); @@ -358,7 +379,7 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period) { - GstPeriodNode *periodNode; + GstMPDPeriodNode *periodNode; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; assert_equals_string (periodNode->id, "TestId"); assert_equals_uint64 (periodNode->start, duration_to_ms (0, 1, 2, 12, 10, 20, 123)); @@ -393,8 +414,8 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_baseURL) { - GstPeriodNode *periodNode; - GstBaseURL *baseURL; + GstMPDPeriodNode *periodNode; + GstMPDBaseURLNode *baseURL; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - baseURL = (GstBaseURL *) periodNode->BaseURLs->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + baseURL = (GstMPDBaseURLNode *) periodNode->BaseURLs->data; assert_equals_string (baseURL->baseURL, "TestBaseURL"); assert_equals_string (baseURL->serviceLocation, "TestServiceLocation"); assert_equals_string (baseURL->byteRange, "TestByteRange"); @@ -427,8 +448,8 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_segmentBase) { - GstPeriodNode *periodNode; - GstSegmentBaseType *segmentBase; + GstMPDPeriodNode *periodNode; + GstMPDSegmentBaseType *segmentBase; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentBase = periodNode->SegmentBase; assert_equals_uint64 (segmentBase->timescale, 123456); assert_equals_uint64 (segmentBase->presentationTimeOffset, 123456789); @@ -465,9 +486,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_segmentBase_initialization) { - GstPeriodNode *periodNode; - GstSegmentBaseType *segmentBase; - GstURLType *initialization; + GstMPDPeriodNode *periodNode; + GstMPDSegmentBaseType *segmentBase; + GstMPDURLType *initialization; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentBase = periodNode->SegmentBase; initialization = segmentBase->Initialization; assert_equals_string (initialization->sourceURL, "TestSourceURL"); @@ -502,9 +523,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_segmentBase_representationIndex) { - GstPeriodNode *periodNode; - GstSegmentBaseType *segmentBase; - GstURLType *representationIndex; + GstMPDPeriodNode *periodNode; + GstMPDSegmentBaseType *segmentBase; + GstMPDURLType *representationIndex; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentBase = periodNode->SegmentBase; representationIndex = segmentBase->RepresentationIndex; assert_equals_string (representationIndex->sourceURL, "TestSourceURL"); @@ -539,8 +560,8 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_segmentList) { - GstPeriodNode *periodNode; - GstSegmentListNode *segmentList; + GstMPDPeriodNode *periodNode; + GstMPDSegmentListNode *segmentList; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentList = periodNode->SegmentList; fail_if (segmentList == NULL); @@ -568,9 +589,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_segmentList_multipleSegmentBaseType) { - GstPeriodNode *periodNode; - GstSegmentListNode *segmentList; - GstMultSegmentBaseType *multSegBaseType; + GstMPDPeriodNode *periodNode; + GstMPDSegmentListNode *segmentList; + GstMPDMultSegmentBaseType *multSegBaseType; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentList = periodNode->SegmentList; multSegBaseType = segmentList->MultSegBaseType; assert_equals_uint64 (multSegBaseType->duration, 10); @@ -604,10 +625,10 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_period_segmentList_multipleSegmentBaseType_segmentBaseType) { - GstPeriodNode *periodNode; - GstSegmentListNode *segmentList; - GstMultSegmentBaseType *multSegBaseType; - GstSegmentBaseType *segBaseType; + GstMPDPeriodNode *periodNode; + GstMPDSegmentListNode *segmentList; + GstMPDMultSegmentBaseType *multSegBaseType; + GstMPDSegmentBaseType *segBaseType; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentList = periodNode->SegmentList; multSegBaseType = segmentList->MultSegBaseType; segBaseType = multSegBaseType->SegBaseType; @@ -648,10 +669,10 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_period_segmentList_multipleSegmentBaseType_segmentTimeline) { - GstPeriodNode *periodNode; - GstSegmentListNode *segmentList; - GstMultSegmentBaseType *multSegBaseType; - GstSegmentTimelineNode *segmentTimeline; + GstMPDPeriodNode *periodNode; + GstMPDSegmentListNode *segmentList; + GstMPDMultSegmentBaseType *multSegBaseType; + GstMPDSegmentTimelineNode *segmentTimeline; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentList = periodNode->SegmentList; multSegBaseType = segmentList->MultSegBaseType; segmentTimeline = multSegBaseType->SegmentTimeline; @@ -685,11 +706,11 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_period_segmentList_multipleSegmentBaseType_segmentTimeline_s) { - GstPeriodNode *periodNode; - GstSegmentListNode *segmentList; - GstMultSegmentBaseType *multSegBaseType; - GstSegmentTimelineNode *segmentTimeline; - GstSNode *sNode; + GstMPDPeriodNode *periodNode; + GstMPDSegmentListNode *segmentList; + GstMPDMultSegmentBaseType *multSegBaseType; + GstMPDSegmentTimelineNode *segmentTimeline; + GstMPDSNode *sNode; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentList = periodNode->SegmentList; multSegBaseType = segmentList->MultSegBaseType; segmentTimeline = multSegBaseType->SegmentTimeline; - sNode = (GstSNode *) g_queue_peek_head (&segmentTimeline->S); + sNode = (GstMPDSNode *) g_queue_peek_head (&segmentTimeline->S); assert_equals_uint64 (sNode->t, 1); assert_equals_uint64 (sNode->d, 2); assert_equals_uint64 (sNode->r, 3); @@ -727,10 +748,10 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_period_segmentList_multipleSegmentBaseType_bitstreamSwitching) { - GstPeriodNode *periodNode; - GstSegmentListNode *segmentList; - GstMultSegmentBaseType *multSegBaseType; - GstURLType *bitstreamSwitching; + GstMPDPeriodNode *periodNode; + GstMPDSegmentListNode *segmentList; + GstMPDMultSegmentBaseType *multSegBaseType; + GstMPDURLType *bitstreamSwitching; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentList = periodNode->SegmentList; multSegBaseType = segmentList->MultSegBaseType; bitstreamSwitching = multSegBaseType->BitstreamSwitching; @@ -766,9 +787,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_segmentList_segmentURL) { - GstPeriodNode *periodNode; - GstSegmentListNode *segmentList; - GstSegmentURLNode *segmentURL; + GstMPDPeriodNode *periodNode; + GstMPDSegmentListNode *segmentList; + GstMPDSegmentURLNode *segmentURL; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentList = periodNode->SegmentList; - segmentURL = (GstSegmentURLNode *) segmentList->SegmentURL->data; + segmentURL = (GstMPDSegmentURLNode *) segmentList->SegmentURL->data; assert_equals_string (segmentURL->media, "TestMedia"); assert_equals_uint64 (segmentURL->mediaRange->first_byte_pos, 100); assert_equals_uint64 (segmentURL->mediaRange->last_byte_pos, 200); @@ -808,8 +829,8 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_segmentTemplate) { - GstPeriodNode *periodNode; - GstSegmentTemplateNode *segmentTemplate; + GstMPDPeriodNode *periodNode; + GstMPDSegmentTemplateNode *segmentTemplate; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentTemplate = periodNode->SegmentTemplate; assert_equals_string (segmentTemplate->media, "TestMedia"); assert_equals_string (segmentTemplate->index, "TestIndex"); @@ -871,14 +892,14 @@ GST_START_TEST (dash_mpdparser_period_segmentTemplateWithPresentationTimeOffset) gboolean ret; GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; GstActiveStream *activeStream; GstMediaFragmentInfo fragment; GstClockTime expectedDuration; GstClockTime expectedTimestamp; - GstMpdClient *mpdclient; - GstPeriodNode *periodNode; - GstSegmentTemplateNode *segmentTemplate; + GstMPDClient *mpdclient; + GstMPDPeriodNode *periodNode; + GstMPDSegmentTemplateNode *segmentTemplate; mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); @@ -890,7 +911,8 @@ GST_START_TEST (dash_mpdparser_period_segmentTemplateWithPresentationTimeOffset) assert_equals_int (ret, TRUE); periodNode = - (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 0); + (GstMPDPeriodNode *) g_list_nth_data (mpdclient->mpd_root_node->Periods, + 0); fail_if (periodNode == NULL); /* get the list of adaptation sets of the first period */ @@ -898,7 +920,7 @@ GST_START_TEST (dash_mpdparser_period_segmentTemplateWithPresentationTimeOffset) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -925,7 +947,7 @@ GST_START_TEST (dash_mpdparser_period_segmentTemplateWithPresentationTimeOffset) /* the $Time$ expansion uses the @t value, without including Period@start or presentationTimeOffset */ assert_equals_string (fragment.uri, "/vrep/TestMedia-100.mp4"); - gst_media_fragment_info_clear (&fragment); + gst_mpdparser_media_fragment_info_clear (&fragment); gst_mpd_client_free (mpdclient); } @@ -938,9 +960,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_segmentTemplate_multipleSegmentBaseType) { - GstPeriodNode *periodNode; - GstSegmentTemplateNode *segmentTemplate; - GstMultSegmentBaseType *multSegBaseType; + GstMPDPeriodNode *periodNode; + GstMPDSegmentTemplateNode *segmentTemplate; + GstMPDMultSegmentBaseType *multSegBaseType; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentTemplate = periodNode->SegmentTemplate; multSegBaseType = segmentTemplate->MultSegBaseType; assert_equals_uint64 (multSegBaseType->duration, 10); @@ -974,10 +996,10 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_period_segmentTemplate_multipleSegmentBaseType_segmentBaseType) { - GstPeriodNode *periodNode; - GstSegmentTemplateNode *segmentTemplate; - GstMultSegmentBaseType *multSegBaseType; - GstSegmentBaseType *segBaseType; + GstMPDPeriodNode *periodNode; + GstMPDSegmentTemplateNode *segmentTemplate; + GstMPDMultSegmentBaseType *multSegBaseType; + GstMPDSegmentBaseType *segBaseType; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentTemplate = periodNode->SegmentTemplate; multSegBaseType = segmentTemplate->MultSegBaseType; segBaseType = multSegBaseType->SegBaseType; @@ -1018,10 +1040,10 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_period_segmentTemplate_multipleSegmentBaseType_segmentTimeline) { - GstPeriodNode *periodNode; - GstSegmentTemplateNode *segmentTemplate; - GstMultSegmentBaseType *multSegBaseType; - GstSegmentTimelineNode *segmentTimeline; + GstMPDPeriodNode *periodNode; + GstMPDSegmentTemplateNode *segmentTemplate; + GstMPDMultSegmentBaseType *multSegBaseType; + GstMPDSegmentTimelineNode *segmentTimeline; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentTemplate = periodNode->SegmentTemplate; multSegBaseType = segmentTemplate->MultSegBaseType; - segmentTimeline = (GstSegmentTimelineNode *) multSegBaseType->SegmentTimeline; + segmentTimeline = + (GstMPDSegmentTimelineNode *) multSegBaseType->SegmentTimeline; fail_if (segmentTimeline == NULL); gst_mpd_client_free (mpdclient); @@ -1055,11 +1078,11 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_period_segmentTemplate_multipleSegmentBaseType_segmentTimeline_s) { - GstPeriodNode *periodNode; - GstSegmentTemplateNode *segmentTemplate; - GstMultSegmentBaseType *multSegBaseType; - GstSegmentTimelineNode *segmentTimeline; - GstSNode *sNode; + GstMPDPeriodNode *periodNode; + GstMPDSegmentTemplateNode *segmentTemplate; + GstMPDMultSegmentBaseType *multSegBaseType; + GstMPDSegmentTimelineNode *segmentTimeline; + GstMPDSNode *sNode; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentTemplate = periodNode->SegmentTemplate; multSegBaseType = segmentTemplate->MultSegBaseType; - segmentTimeline = (GstSegmentTimelineNode *) multSegBaseType->SegmentTimeline; - sNode = (GstSNode *) g_queue_peek_head (&segmentTimeline->S); + segmentTimeline = + (GstMPDSegmentTimelineNode *) multSegBaseType->SegmentTimeline; + sNode = (GstMPDSNode *) g_queue_peek_head (&segmentTimeline->S); assert_equals_uint64 (sNode->t, 1); assert_equals_uint64 (sNode->d, 2); assert_equals_uint64 (sNode->r, 3); @@ -1097,10 +1121,10 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_period_segmentTemplate_multipleSegmentBaseType_bitstreamSwitching) { - GstPeriodNode *periodNode; - GstSegmentTemplateNode *segmentTemplate; - GstMultSegmentBaseType *multSegBaseType; - GstURLType *bitstreamSwitching; + GstMPDPeriodNode *periodNode; + GstMPDSegmentTemplateNode *segmentTemplate; + GstMPDMultSegmentBaseType *multSegBaseType; + GstMPDURLType *bitstreamSwitching; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentTemplate = periodNode->SegmentTemplate; multSegBaseType = segmentTemplate->MultSegBaseType; bitstreamSwitching = multSegBaseType->BitstreamSwitching; @@ -1136,8 +1160,8 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; assert_equals_uint64 (adaptationSet->id, 7); assert_equals_uint64 (adaptationSet->group, 8); assert_equals_string (adaptationSet->lang, "en"); @@ -1208,9 +1232,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_representationBase) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationBaseType *representationBase; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationBaseType *representationBase; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; representationBase = adaptationSet->RepresentationBase; assert_equals_string (representationBase->profiles, "TestProfiles"); assert_equals_uint64 (representationBase->width, 100); @@ -1271,10 +1295,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_representationBase_framePacking) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationBaseType *representationBase; - GstDescriptorType *framePacking; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationBaseType *representationBase; + GstMPDDescriptorType *framePacking; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; representationBase = adaptationSet->RepresentationBase; - framePacking = (GstDescriptorType *) representationBase->FramePacking->data; + framePacking = + (GstMPDDescriptorType *) representationBase->FramePacking->data; assert_equals_string (framePacking->schemeIdUri, "TestSchemeIdUri"); assert_equals_string (framePacking->value, "TestValue"); @@ -1310,10 +1335,10 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_period_adaptationSet_representationBase_audioChannelConfiguration) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationBaseType *representationBase; - GstDescriptorType *audioChannelConfiguration; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationBaseType *representationBase; + GstMPDDescriptorType *audioChannelConfiguration; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; representationBase = adaptationSet->RepresentationBase; audioChannelConfiguration = - (GstDescriptorType *) representationBase->AudioChannelConfiguration->data; + (GstMPDDescriptorType *) representationBase-> + AudioChannelConfiguration->data; assert_equals_string (audioChannelConfiguration->schemeIdUri, "TestSchemeIdUri"); assert_equals_string (audioChannelConfiguration->value, "TestValue"); @@ -1350,10 +1376,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_representationBase_contentProtection) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationBaseType *representationBase; - GstDescriptorType *contentProtection; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationBaseType *representationBase; + GstMPDDescriptorType *contentProtection; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; representationBase = adaptationSet->RepresentationBase; contentProtection = - (GstDescriptorType *) representationBase->ContentProtection->data; + (GstMPDDescriptorType *) representationBase->ContentProtection->data; assert_equals_string (contentProtection->schemeIdUri, "TestSchemeIdUri"); assert_equals_string (contentProtection->value, "TestValue"); @@ -1388,10 +1414,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_contentProtection_no_value) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationBaseType *representationBase; - GstDescriptorType *contentProtection; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationBaseType *representationBase; + GstMPDDescriptorType *contentProtection; const gchar *xml = "" "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); gchar *str; ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; representationBase = adaptationSet->RepresentationBase; assert_equals_int (g_list_length (representationBase->ContentProtection), 3); - contentProtection = - (GstDescriptorType *) g_list_nth (representationBase->ContentProtection, - 1)->data; + contentProtection = (GstMPDDescriptorType *) + g_list_nth (representationBase->ContentProtection, 1)->data; assert_equals_string (contentProtection->schemeIdUri, "urn:uuid:5e629af5-38da-4063-8977-97ffbd9902d4"); fail_if (contentProtection->value == NULL); @@ -1452,10 +1477,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_contentProtection_no_value_no_encoding) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationBaseType *representationBase; - GstDescriptorType *contentProtection; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationBaseType *representationBase; + GstMPDDescriptorType *contentProtection; const gchar *xml = "" "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; representationBase = adaptationSet->RepresentationBase; assert_equals_int (g_list_length (representationBase->ContentProtection), 2); - contentProtection = - (GstDescriptorType *) g_list_nth (representationBase->ContentProtection, - 1)->data; + contentProtection = (GstMPDDescriptorType *) + g_list_nth (representationBase->ContentProtection, 1)->data; assert_equals_string (contentProtection->schemeIdUri, "urn:uuid:5e629af5-38da-4063-8977-97ffbd9902d4"); fail_if (contentProtection->value == NULL); @@ -1496,9 +1520,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_accessibility) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstDescriptorType *accessibility; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDDescriptorType *accessibility; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - accessibility = (GstDescriptorType *) adaptationSet->Accessibility->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + accessibility = (GstMPDDescriptorType *) adaptationSet->Accessibility->data; assert_equals_string (accessibility->schemeIdUri, "TestSchemeIdUri"); assert_equals_string (accessibility->value, "TestValue"); @@ -1532,9 +1556,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_role) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstDescriptorType *role; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDDescriptorType *role; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - role = (GstDescriptorType *) adaptationSet->Role->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + role = (GstMPDDescriptorType *) adaptationSet->Role->data; assert_equals_string (role->schemeIdUri, "TestSchemeIdUri"); assert_equals_string (role->value, "TestValue"); @@ -1568,9 +1592,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_rating) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstDescriptorType *rating; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDDescriptorType *rating; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - rating = (GstDescriptorType *) adaptationSet->Rating->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + rating = (GstMPDDescriptorType *) adaptationSet->Rating->data; assert_equals_string (rating->schemeIdUri, "TestSchemeIdUri"); assert_equals_string (rating->value, "TestValue"); @@ -1604,9 +1628,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_viewpoint) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstDescriptorType *viewpoint; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDDescriptorType *viewpoint; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - viewpoint = (GstDescriptorType *) adaptationSet->Viewpoint->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + viewpoint = (GstMPDDescriptorType *) adaptationSet->Viewpoint->data; assert_equals_string (viewpoint->schemeIdUri, "TestSchemeIdUri"); assert_equals_string (viewpoint->value, "TestValue"); @@ -1640,9 +1664,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_contentComponent) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstContentComponentNode *contentComponent; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDContentComponentNode *contentComponent; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - contentComponent = (GstContentComponentNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + contentComponent = (GstMPDContentComponentNode *) adaptationSet->ContentComponents->data; assert_equals_uint64 (contentComponent->id, 1); assert_equals_string (contentComponent->lang, "en"); @@ -1682,10 +1706,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_contentComponent_accessibility) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstContentComponentNode *contentComponent; - GstDescriptorType *accessibility; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDContentComponentNode *contentComponent; + GstMPDDescriptorType *accessibility; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - contentComponent = (GstContentComponentNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + contentComponent = (GstMPDContentComponentNode *) adaptationSet->ContentComponents->data; - accessibility = (GstDescriptorType *) contentComponent->Accessibility->data; + accessibility = + (GstMPDDescriptorType *) contentComponent->Accessibility->data; assert_equals_string (accessibility->schemeIdUri, "TestSchemeIdUri"); assert_equals_string (accessibility->value, "TestValue"); @@ -1723,10 +1748,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_contentComponent_role) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstContentComponentNode *contentComponent; - GstDescriptorType *role; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDContentComponentNode *contentComponent; + GstMPDDescriptorType *role; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - contentComponent = (GstContentComponentNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + contentComponent = (GstMPDContentComponentNode *) adaptationSet->ContentComponents->data; - role = (GstDescriptorType *) contentComponent->Role->data; + role = (GstMPDDescriptorType *) contentComponent->Role->data; assert_equals_string (role->schemeIdUri, "TestSchemeIdUri"); assert_equals_string (role->value, "TestValue"); @@ -1763,10 +1788,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_contentComponent_rating) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstContentComponentNode *contentComponent; - GstDescriptorType *rating; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDContentComponentNode *contentComponent; + GstMPDDescriptorType *rating; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - contentComponent = (GstContentComponentNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + contentComponent = (GstMPDContentComponentNode *) adaptationSet->ContentComponents->data; - rating = (GstDescriptorType *) contentComponent->Rating->data; + rating = (GstMPDDescriptorType *) contentComponent->Rating->data; assert_equals_string (rating->schemeIdUri, "TestSchemeIdUri"); assert_equals_string (rating->value, "TestValue"); @@ -1804,10 +1829,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_contentComponent_viewpoint) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstContentComponentNode *contentComponent; - GstDescriptorType *viewpoint; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDContentComponentNode *contentComponent; + GstMPDDescriptorType *viewpoint; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - contentComponent = (GstContentComponentNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + contentComponent = (GstMPDContentComponentNode *) adaptationSet->ContentComponents->data; - viewpoint = (GstDescriptorType *) contentComponent->Viewpoint->data; + viewpoint = (GstMPDDescriptorType *) contentComponent->Viewpoint->data; assert_equals_string (viewpoint->schemeIdUri, "TestSchemeIdUri"); assert_equals_string (viewpoint->value, "TestValue"); @@ -1845,9 +1870,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_baseURL) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstBaseURL *baseURL; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDBaseURLNode *baseURL; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - baseURL = (GstBaseURL *) adaptationSet->BaseURLs->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + baseURL = (GstMPDBaseURLNode *) adaptationSet->BaseURLs->data; assert_equals_string (baseURL->baseURL, "TestBaseURL"); assert_equals_string (baseURL->serviceLocation, "TestServiceLocation"); assert_equals_string (baseURL->byteRange, "TestByteRange"); @@ -1882,9 +1907,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_segmentBase) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstSegmentBaseType *segmentBase; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDSegmentBaseType *segmentBase; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; segmentBase = adaptationSet->SegmentBase; assert_equals_uint64 (segmentBase->timescale, 123456); assert_equals_uint64 (segmentBase->presentationTimeOffset, 123456789); @@ -1923,10 +1948,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_segmentBase_initialization) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstSegmentBaseType *segmentBase; - GstURLType *initialization; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDSegmentBaseType *segmentBase; + GstMPDURLType *initialization; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; segmentBase = adaptationSet->SegmentBase; initialization = segmentBase->Initialization; assert_equals_string (initialization->sourceURL, "TestSourceURL"); @@ -1963,10 +1988,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_segmentBase_representationIndex) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstSegmentBaseType *segmentBase; - GstURLType *representationIndex; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDSegmentBaseType *segmentBase; + GstMPDURLType *representationIndex; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; segmentBase = adaptationSet->SegmentBase; representationIndex = segmentBase->RepresentationIndex; assert_equals_string (representationIndex->sourceURL, "TestSourceURL"); @@ -2004,9 +2029,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_segmentList) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstSegmentListNode *segmentList; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDSegmentListNode *segmentList; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; segmentList = adaptationSet->SegmentList; fail_if (segmentList == NULL); @@ -2037,9 +2062,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_segmentTemplate) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstSegmentTemplateNode *segmentTemplate; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDSegmentTemplateNode *segmentTemplate; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; segmentTemplate = adaptationSet->SegmentTemplate; assert_equals_string (segmentTemplate->media, "TestMedia"); assert_equals_string (segmentTemplate->index, "TestIndex"); @@ -2077,10 +2102,10 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_period_adaptationSet_representation_segmentTemplate_inherit) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; - GstSegmentTemplateNode *segmentTemplate; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; + GstMPDSegmentTemplateNode *segmentTemplate; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; representation = - (GstRepresentationNode *) adaptationSet->Representations->data; + (GstMPDRepresentationNode *) adaptationSet->Representations->data; segmentTemplate = representation->SegmentTemplate; assert_equals_string (segmentTemplate->media, "TestMedia"); assert_equals_string (segmentTemplate->index, "TestIndex"); @@ -2121,10 +2146,10 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_period_adaptationSet_representation_segmentBase_inherit) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; - GstSegmentBaseType *segmentBase; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; + GstMPDSegmentBaseType *segmentBase; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; representation = - (GstRepresentationNode *) adaptationSet->Representations->data; + (GstMPDRepresentationNode *) adaptationSet->Representations->data; segmentBase = representation->SegmentBase; assert_equals_int (segmentBase->timescale, 123456); @@ -2166,12 +2191,12 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_adapt_repr_segmentTemplate_inherit) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstSegmentTemplateNode *segmentTemplate; - GstRepresentationNode *representation; - GstMultSegmentBaseType *multSegBaseType; - GstSegmentBaseType *segBaseType; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDSegmentTemplateNode *segmentTemplate; + GstMPDRepresentationNode *representation; + GstMPDMultSegmentBaseType *multSegBaseType; + GstMPDSegmentBaseType *segBaseType; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - representation = (GstRepresentationNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + representation = (GstMPDRepresentationNode *) adaptationSet->Representations->data; segmentTemplate = representation->SegmentTemplate; fail_if (segmentTemplate == NULL); @@ -2215,9 +2240,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_segmentTemplate_inherit) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstSegmentTemplateNode *segmentTemplate; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDSegmentTemplateNode *segmentTemplate; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; segmentTemplate = adaptationSet->SegmentTemplate; assert_equals_string (segmentTemplate->media, "TestMedia"); assert_equals_string (segmentTemplate->index, "TestIndex"); @@ -2260,9 +2285,9 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_representation) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - representation = (GstRepresentationNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + representation = (GstMPDRepresentationNode *) adaptationSet->Representations->data; assert_equals_string (representation->id, "Test_Id"); assert_equals_uint64 (representation->bandwidth, 100); @@ -2306,10 +2331,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_representation_representationBase) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; - GstRepresentationBaseType *representationBase; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; + GstMPDRepresentationBaseType *representationBase; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - representation = (GstRepresentationNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + representation = (GstMPDRepresentationNode *) adaptationSet->Representations->data; - representationBase = (GstRepresentationBaseType *) + representationBase = (GstMPDRepresentationBaseType *) representation->RepresentationBase; fail_if (representationBase == NULL); @@ -2344,10 +2369,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_representation_baseURL) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; - GstBaseURL *baseURL; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; + GstMPDBaseURLNode *baseURL; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - representation = (GstRepresentationNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + representation = (GstMPDRepresentationNode *) adaptationSet->Representations->data; - baseURL = (GstBaseURL *) representation->BaseURLs->data; + baseURL = (GstMPDBaseURLNode *) representation->BaseURLs->data; assert_equals_string (baseURL->baseURL, "TestBaseURL"); assert_equals_string (baseURL->serviceLocation, "TestServiceLocation"); assert_equals_string (baseURL->byteRange, "TestByteRange"); @@ -2385,10 +2410,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_representation_subRepresentation) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; - GstSubRepresentationNode *subRepresentation; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; + GstMPDSubRepresentationNode *subRepresentation; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - representation = (GstRepresentationNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + representation = (GstMPDRepresentationNode *) adaptationSet->Representations->data; - subRepresentation = (GstSubRepresentationNode *) + subRepresentation = (GstMPDSubRepresentationNode *) representation->SubRepresentations->data; assert_equals_uint64 (subRepresentation->level, 100); assert_equals_uint64 (subRepresentation->size, 3); @@ -2437,11 +2462,11 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_period_adaptationSet_representation_subRepresentation_representationBase) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; - GstSubRepresentationNode *subRepresentation; - GstRepresentationBaseType *representationBase; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; + GstMPDSubRepresentationNode *subRepresentation; + GstMPDRepresentationBaseType *representationBase; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - representation = (GstRepresentationNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + representation = (GstMPDRepresentationNode *) adaptationSet->Representations->data; - subRepresentation = (GstSubRepresentationNode *) + subRepresentation = (GstMPDSubRepresentationNode *) representation->SubRepresentations->data; - representationBase = (GstRepresentationBaseType *) + representationBase = (GstMPDRepresentationBaseType *) subRepresentation->RepresentationBase; fail_if (representationBase == NULL); @@ -2480,10 +2505,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_representation_segmentBase) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; - GstSegmentBaseType *segmentBase; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; + GstMPDSegmentBaseType *segmentBase; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - representation = (GstRepresentationNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + representation = (GstMPDRepresentationNode *) adaptationSet->Representations->data; segmentBase = representation->SegmentBase; fail_if (segmentBase == NULL); @@ -2519,10 +2544,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_representation_segmentList) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; - GstSegmentListNode *segmentList; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; + GstMPDSegmentListNode *segmentList; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - representation = (GstRepresentationNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + representation = (GstMPDRepresentationNode *) adaptationSet->Representations->data; segmentList = representation->SegmentList; fail_if (segmentList == NULL); @@ -2558,10 +2583,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_adaptationSet_representation_segmentTemplate) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; - GstSegmentTemplateNode *segmentTemplate; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; + GstMPDSegmentTemplateNode *segmentTemplate; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - representation = (GstRepresentationNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + representation = (GstMPDRepresentationNode *) adaptationSet->Representations->data; segmentTemplate = representation->SegmentTemplate; fail_if (segmentTemplate == NULL); @@ -2597,8 +2622,8 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_period_subset) { - GstPeriodNode *periodNode; - GstSubsetNode *subset; + GstMPDPeriodNode *periodNode; + GstMPDSubsetNode *subset; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - subset = (GstSubsetNode *) periodNode->Subsets->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + subset = (GstMPDSubsetNode *) periodNode->Subsets->data; assert_equals_uint64 (subset->size, 3); assert_equals_uint64 (subset->contains[0], 1); assert_equals_uint64 (subset->contains[1], 2); @@ -2638,16 +2663,16 @@ GST_START_TEST (dash_mpdparser_utctiming) "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); GstMPDUTCTimingType selected_method; gchar **urls; ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - fail_if (mpdclient->mpd_node == NULL); - fail_if (mpdclient->mpd_node->UTCTiming == NULL); - assert_equals_int (g_list_length (mpdclient->mpd_node->UTCTiming), 3); + fail_if (mpdclient->mpd_root_node == NULL); + fail_if (mpdclient->mpd_root_node->UTCTimings == NULL); + assert_equals_int (g_list_length (mpdclient->mpd_root_node->UTCTimings), 3); urls = gst_mpd_client_get_utc_timing_sources (mpdclient, GST_MPD_UTCTIMING_TYPE_HTTP_XSDATE, &selected_method); @@ -2709,13 +2734,13 @@ GST_START_TEST (dash_mpdparser_utctiming_invalid_value) "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - fail_if (mpdclient->mpd_node == NULL); - fail_if (mpdclient->mpd_node->UTCTiming != NULL); + fail_if (mpdclient->mpd_root_node == NULL); + fail_if (mpdclient->mpd_root_node->UTCTimings != NULL); gst_mpd_client_free (mpdclient); } @@ -2735,7 +2760,7 @@ GST_START_TEST (dash_mpdparser_type_dynamic) " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\"> "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -2828,7 +2853,7 @@ GST_START_TEST (dash_mpdparser_isoff_ondemand_profile) " profiles=\"urn:mpeg:dash:profile:isoff-on-demand:2011\">"; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -2890,7 +2915,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_bitstreamSwitching_inheritance) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; guint activeStreams; GstActiveStream *activeStream; GstCaps *caps; @@ -2916,7 +2941,7 @@ GST_START_TEST (dash_mpdparser_bitstreamSwitching_inheritance) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -2931,13 +2956,13 @@ GST_START_TEST (dash_mpdparser_bitstreamSwitching_inheritance) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); /* setup streaming from the second adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 1); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 1); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -2990,7 +3015,7 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_various_duration_formats) { - GstPeriodNode *periodNode; + GstMPDPeriodNode *periodNode; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -3018,49 +3043,57 @@ GST_START_TEST (dash_mpdparser_various_duration_formats) assert_equals_int (ret, TRUE); periodNode = - (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 0); + (GstMPDPeriodNode *) g_list_nth_data (mpdclient->mpd_root_node->Periods, + 0); assert_equals_string (periodNode->id, "Period0"); assert_equals_uint64 (periodNode->start, duration_to_ms (0, 0, 0, 0, 0, 1, 0)); periodNode = - (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 1); + (GstMPDPeriodNode *) g_list_nth_data (mpdclient->mpd_root_node->Periods, + 1); assert_equals_string (periodNode->id, "Period1"); assert_equals_uint64 (periodNode->start, duration_to_ms (0, 0, 0, 0, 0, 1, 500)); periodNode = - (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 2); + (GstMPDPeriodNode *) g_list_nth_data (mpdclient->mpd_root_node->Periods, + 2); assert_equals_string (periodNode->id, "Period2"); assert_equals_uint64 (periodNode->start, duration_to_ms (0, 0, 0, 0, 0, 1, 700)); periodNode = - (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 3); + (GstMPDPeriodNode *) g_list_nth_data (mpdclient->mpd_root_node->Periods, + 3); assert_equals_string (periodNode->id, "Period3"); assert_equals_uint64 (periodNode->start, duration_to_ms (0, 0, 0, 0, 1, 0, 0)); periodNode = - (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 4); + (GstMPDPeriodNode *) g_list_nth_data (mpdclient->mpd_root_node->Periods, + 4); assert_equals_string (periodNode->id, "Period4"); assert_equals_uint64 (periodNode->start, duration_to_ms (0, 0, 0, 1, 0, 0, 0)); periodNode = - (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 5); + (GstMPDPeriodNode *) g_list_nth_data (mpdclient->mpd_root_node->Periods, + 5); assert_equals_string (periodNode->id, "Period5"); assert_equals_uint64 (periodNode->start, duration_to_ms (0, 0, 1, 0, 0, 0, 0)); periodNode = - (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 6); + (GstMPDPeriodNode *) g_list_nth_data (mpdclient->mpd_root_node->Periods, + 6); assert_equals_string (periodNode->id, "Period6"); assert_equals_uint64 (periodNode->start, duration_to_ms (0, 1, 0, 0, 0, 0, 0)); periodNode = - (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 7); + (GstMPDPeriodNode *) g_list_nth_data (mpdclient->mpd_root_node->Periods, + 7); assert_equals_string (periodNode->id, "Period7"); assert_equals_uint64 (periodNode->start, duration_to_ms (1, 0, 0, 0, 0, 0, 0)); @@ -3084,7 +3117,7 @@ GST_START_TEST (dash_mpdparser_setup_media_presentation) " duration=\"P0Y0M1DT1H1M1S\">"; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -3107,7 +3140,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_setup_streaming) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; const gchar *xml = "" @@ -3121,7 +3154,7 @@ GST_START_TEST (dash_mpdparser_setup_streaming) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -3135,7 +3168,7 @@ GST_START_TEST (dash_mpdparser_setup_streaming) /* get the first adaptation set of the first period */ adaptationSets = gst_mpd_client_get_adaptation_sets (mpdclient); fail_if (adaptationSets == NULL); - adapt_set = (GstAdaptationSetNode *) adaptationSets->data; + adapt_set = (GstMPDAdaptationSetNode *) adaptationSets->data; fail_if (adapt_set == NULL); /* setup streaming from the adaptation set */ @@ -3166,7 +3199,7 @@ GST_START_TEST (dash_mpdparser_period_selection) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -3238,7 +3271,7 @@ GST_START_TEST (dash_mpdparser_get_period_at_time) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -3307,7 +3340,7 @@ GST_START_TEST (dash_mpdparser_adaptationSet_handling) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -3336,8 +3369,8 @@ GST_START_TEST (dash_mpdparser_adaptationSet_handling) fail_if (adaptationSets == NULL); for (it = adaptationSets; it; it = g_list_next (it)) { - GstAdaptationSetNode *adapt_set; - adapt_set = (GstAdaptationSetNode *) it->data; + GstMPDAdaptationSetNode *adapt_set; + adapt_set = (GstMPDAdaptationSetNode *) it->data; fail_if (adapt_set == NULL); assert_equals_int (adapt_set->id, 10 + count); @@ -3356,7 +3389,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_representation_selection) { GList *adaptationSets; - GstAdaptationSetNode *adaptationSetNode; + GstMPDAdaptationSetNode *adaptationSetNode; GList *representations; gint represendationIndex; @@ -3371,7 +3404,7 @@ GST_START_TEST (dash_mpdparser_representation_selection) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -3428,7 +3461,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_activeStream_selection) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; guint activeStreams; GstActiveStream *activeStream; @@ -3450,7 +3483,7 @@ GST_START_TEST (dash_mpdparser_activeStream_selection) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -3470,7 +3503,7 @@ GST_START_TEST (dash_mpdparser_activeStream_selection) assert_equals_int (activeStreams, 0); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -3480,7 +3513,7 @@ GST_START_TEST (dash_mpdparser_activeStream_selection) assert_equals_int (activeStreams, 1); /* setup streaming from the second adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 1); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 1); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -3490,7 +3523,7 @@ GST_START_TEST (dash_mpdparser_activeStream_selection) assert_equals_int (activeStreams, 2); /* setup streaming from the third adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 2); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 2); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -3526,7 +3559,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_activeStream_parameters) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; guint activeStreams; GstActiveStream *activeStream; GstCaps *caps; @@ -3553,7 +3586,7 @@ GST_START_TEST (dash_mpdparser_activeStream_parameters) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -3569,7 +3602,7 @@ GST_START_TEST (dash_mpdparser_activeStream_parameters) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -3618,7 +3651,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_get_audio_languages) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; guint activeStreams; guint adaptationSetsCount; GList *languages = NULL; @@ -3642,7 +3675,7 @@ GST_START_TEST (dash_mpdparser_get_audio_languages) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); gint i; ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); @@ -3661,7 +3694,7 @@ GST_START_TEST (dash_mpdparser_get_audio_languages) /* setup streaming from all adaptation sets */ adaptationSetsCount = gst_mpd_client_get_nb_adaptationSet (mpdclient); for (i = 0; i < adaptationSetsCount; i++) { - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, i); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, i); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -3686,15 +3719,15 @@ GST_END_TEST; * Tests getting the base URL * */ -static GstMpdClient * +static GstMPDClient * setup_mpd_client (const gchar * xml) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; guint activeStreams; guint adaptationSetsCount; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); gint i; ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); @@ -3713,7 +3746,7 @@ setup_mpd_client (const gchar * xml) /* setup streaming from all adaptation sets */ adaptationSetsCount = gst_mpd_client_get_nb_adaptationSet (mpdclient); for (i = 0; i < adaptationSetsCount; i++) { - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, i); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, i); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -3737,7 +3770,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL1) " " " "; - GstMpdClient *mpdclient = setup_mpd_client (xml); + GstMPDClient *mpdclient = setup_mpd_client (xml); baseURL = gst_mpd_client_get_baseURL (mpdclient, 0); fail_if (baseURL == NULL); @@ -3765,7 +3798,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL2) " representation_base_url" " "; - GstMpdClient *mpdclient = setup_mpd_client (xml); + GstMPDClient *mpdclient = setup_mpd_client (xml); /* test baseURL. Its value should be computed like this: * - start with xml url (null) @@ -3807,7 +3840,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL3) " /representation_base_url" " "; - GstMpdClient *mpdclient = setup_mpd_client (xml); + GstMPDClient *mpdclient = setup_mpd_client (xml); /* test baseURL. Its value should be computed like this: * - start with xml url (null) @@ -3847,7 +3880,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL4) " representation_base_url/" " "; - GstMpdClient *mpdclient = setup_mpd_client (xml); + GstMPDClient *mpdclient = setup_mpd_client (xml); /* test baseURL. Its value should be computed like this: * - start with xml url (null) @@ -3874,11 +3907,11 @@ GST_END_TEST; /* test multiple BaseUrl entries per section */ GST_START_TEST (dash_mpdparser_get_baseURL5) { - GstPeriodNode *periodNode; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; + GstMPDPeriodNode *periodNode; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; const gchar *baseURL; - GstBaseURL *gstBaseURL; + GstMPDBaseURLNode *gstBaseURL; const gchar *xml = "" @@ -3903,15 +3936,15 @@ GST_START_TEST (dash_mpdparser_get_baseURL5) " representation_base_url5/" " "; - GstMpdClient *mpdclient = setup_mpd_client (xml); + GstMPDClient *mpdclient = setup_mpd_client (xml); - assert_equals_int (g_list_length (mpdclient->mpd_node->BaseURLs), 2); - gstBaseURL = g_list_nth_data (mpdclient->mpd_node->BaseURLs, 0); + assert_equals_int (g_list_length (mpdclient->mpd_root_node->BaseURLs), 2); + gstBaseURL = g_list_nth_data (mpdclient->mpd_root_node->BaseURLs, 0); assert_equals_string (gstBaseURL->baseURL, "/mpd_base_url1/"); - gstBaseURL = g_list_nth_data (mpdclient->mpd_node->BaseURLs, 1); + gstBaseURL = g_list_nth_data (mpdclient->mpd_root_node->BaseURLs, 1); assert_equals_string (gstBaseURL->baseURL, "/mpd_base_url2/"); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; assert_equals_int (g_list_length (periodNode->BaseURLs), 3); gstBaseURL = g_list_nth_data (periodNode->BaseURLs, 0); assert_equals_string (gstBaseURL->baseURL, " period_base_url1/"); @@ -3920,7 +3953,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL5) gstBaseURL = g_list_nth_data (periodNode->BaseURLs, 2); assert_equals_string (gstBaseURL->baseURL, " period_base_url3/"); - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; assert_equals_int (g_list_length (adaptationSet->BaseURLs), 4); gstBaseURL = g_list_nth_data (adaptationSet->BaseURLs, 0); assert_equals_string (gstBaseURL->baseURL, "adaptation_base_url1/"); @@ -3931,7 +3964,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL5) gstBaseURL = g_list_nth_data (adaptationSet->BaseURLs, 3); assert_equals_string (gstBaseURL->baseURL, "adaptation_base_url4/"); - representation = (GstRepresentationNode *) + representation = (GstMPDRepresentationNode *) adaptationSet->Representations->data; assert_equals_int (g_list_length (representation->BaseURLs), 5); gstBaseURL = g_list_nth_data (representation->BaseURLs, 0); @@ -3980,7 +4013,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL6) " " " "; - GstMpdClient *mpdclient = setup_mpd_client (xml); + GstMPDClient *mpdclient = setup_mpd_client (xml); baseURL = gst_mpd_client_get_baseURL (mpdclient, 0); fail_if (baseURL == NULL); @@ -4005,7 +4038,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL7) " " " "; - GstMpdClient *mpdclient; + GstMPDClient *mpdclient; mpdclient = setup_mpd_client (xml); @@ -4033,7 +4066,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL8) " " " "; - GstMpdClient *mpdclient = setup_mpd_client (xml); + GstMPDClient *mpdclient = setup_mpd_client (xml); baseURL = gst_mpd_client_get_baseURL (mpdclient, 0); fail_if (baseURL == NULL); @@ -4059,7 +4092,7 @@ GST_START_TEST (dash_mpdparser_get_mediaPresentationDuration) " mediaPresentationDuration=\"P0Y0M0DT0H0M3S\">"; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -4080,7 +4113,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_get_streamPresentationOffset) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; GstClockTime offset; const gchar *xml = "" @@ -4095,7 +4128,7 @@ GST_START_TEST (dash_mpdparser_get_streamPresentationOffset) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -4111,7 +4144,7 @@ GST_START_TEST (dash_mpdparser_get_streamPresentationOffset) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -4133,7 +4166,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_segments) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; gboolean hasNextSegment; GstActiveStream *activeStream; GstFlowReturn flow; @@ -4166,7 +4199,7 @@ GST_START_TEST (dash_mpdparser_segments) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -4182,7 +4215,7 @@ GST_START_TEST (dash_mpdparser_segments) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -4276,7 +4309,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_headers) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; gchar *uri; gint64 range_start; gint64 range_end; @@ -4301,7 +4334,7 @@ GST_START_TEST (dash_mpdparser_headers) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -4317,7 +4350,7 @@ GST_START_TEST (dash_mpdparser_headers) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -4354,7 +4387,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_fragments) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; GstMediaFragmentInfo fragment; GstActiveStream *activeStream; GstClockTime nextFragmentDuration; @@ -4377,7 +4410,7 @@ GST_START_TEST (dash_mpdparser_fragments) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -4393,7 +4426,7 @@ GST_START_TEST (dash_mpdparser_fragments) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -4412,7 +4445,7 @@ GST_START_TEST (dash_mpdparser_fragments) assert_equals_int64 (fragment.range_end, -1); assert_equals_uint64 (fragment.duration, expectedDuration * GST_MSECOND); assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND); - gst_media_fragment_info_clear (&fragment); + gst_mpdparser_media_fragment_info_clear (&fragment); periodStartTime = gst_mpd_client_get_period_start_time (mpdclient); assert_equals_uint64 (periodStartTime, 10 * GST_SECOND); @@ -4445,10 +4478,10 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_inherited_segmentBase) { - GstPeriodNode *periodNode; - GstSegmentBaseType *segmentBase; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; + GstMPDPeriodNode *periodNode; + GstMPDSegmentBaseType *segmentBase; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; const gchar *xml = "" ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - representation = (GstRepresentationNode *) + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + representation = (GstMPDRepresentationNode *) adaptationSet->Representations->data; /* test segment base from adaptation set */ @@ -4493,7 +4526,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_inherited_segmentURL) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; GstActiveStream *activeStream; GstMediaFragmentInfo fragment; GstClockTime expectedDuration; @@ -4526,7 +4559,7 @@ GST_START_TEST (dash_mpdparser_inherited_segmentURL) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -4542,7 +4575,7 @@ GST_START_TEST (dash_mpdparser_inherited_segmentURL) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -4570,7 +4603,7 @@ GST_START_TEST (dash_mpdparser_inherited_segmentURL) assert_equals_int64 (fragment.index_range_end, 400); assert_equals_uint64 (fragment.duration, expectedDuration * GST_MSECOND); assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND); - gst_media_fragment_info_clear (&fragment); + gst_mpdparser_media_fragment_info_clear (&fragment); /* try to advance to next segment. Should fail */ flow = gst_mpd_client_advance_segment (mpdclient, activeStream, TRUE); @@ -4588,7 +4621,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_segment_list) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; GstActiveStream *activeStream; GstMediaFragmentInfo fragment; GstClockTime expectedDuration; @@ -4612,7 +4645,7 @@ GST_START_TEST (dash_mpdparser_segment_list) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -4628,7 +4661,7 @@ GST_START_TEST (dash_mpdparser_segment_list) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -4654,7 +4687,7 @@ GST_START_TEST (dash_mpdparser_segment_list) assert_equals_uint64 (fragment.duration, expectedDuration * GST_MSECOND); assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND); - gst_media_fragment_info_clear (&fragment); + gst_mpdparser_media_fragment_info_clear (&fragment); gst_mpd_client_free (mpdclient); } @@ -4668,7 +4701,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_segment_template) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; GstActiveStream *activeStream; GstMediaFragmentInfo fragment; GstClockTime expectedDuration; @@ -4693,7 +4726,7 @@ GST_START_TEST (dash_mpdparser_segment_template) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -4709,7 +4742,7 @@ GST_START_TEST (dash_mpdparser_segment_template) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -4749,7 +4782,7 @@ GST_START_TEST (dash_mpdparser_segment_template) offset = gst_mpd_client_get_stream_presentation_offset (mpdclient, 0); assert_equals_uint64 (offset, 15 * GST_SECOND); - gst_media_fragment_info_clear (&fragment); + gst_mpdparser_media_fragment_info_clear (&fragment); /* * Period starts at 10s. @@ -4774,7 +4807,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_segment_timeline) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; GstActiveStream *activeStream; GstMediaFragmentInfo fragment; GstClockTime expectedDuration; @@ -4811,7 +4844,7 @@ GST_START_TEST (dash_mpdparser_segment_timeline) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -4827,7 +4860,7 @@ GST_START_TEST (dash_mpdparser_segment_timeline) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -4845,7 +4878,7 @@ GST_START_TEST (dash_mpdparser_segment_timeline) assert_equals_string (fragment.index_uri, "/TestIndex0"); assert_equals_uint64 (fragment.duration, expectedDuration * GST_MSECOND); assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND); - gst_media_fragment_info_clear (&fragment); + gst_mpdparser_media_fragment_info_clear (&fragment); /* first segment starts at 3s and has a duration of 2s. * We also add period start time (10s) so we expect a segment availability @@ -4879,7 +4912,7 @@ GST_START_TEST (dash_mpdparser_segment_timeline) assert_equals_string (fragment.index_uri, "/TestIndex0"); assert_equals_uint64 (fragment.duration, expectedDuration * GST_MSECOND); assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND); - gst_media_fragment_info_clear (&fragment); + gst_mpdparser_media_fragment_info_clear (&fragment); /* first segment starts at 3s and has a duration of 2s. * Second segment starts when the first ends (5s) and has a duration of 2s, @@ -4914,7 +4947,7 @@ GST_START_TEST (dash_mpdparser_segment_timeline) assert_equals_string (fragment.index_uri, "/TestIndex1"); assert_equals_uint64 (fragment.duration, expectedDuration * GST_MSECOND); assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND); - gst_media_fragment_info_clear (&fragment); + gst_mpdparser_media_fragment_info_clear (&fragment); /* Third segment starts at 10s and has a duration of 3s so it ends at 13s. * We also add period start time (10s) so we expect a segment availability @@ -4944,7 +4977,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_multiple_inherited_segmentURL) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; GstActiveStream *activeStream; GstMediaFragmentInfo fragment; GstClockTime expectedDuration; @@ -4996,7 +5029,7 @@ GST_START_TEST (dash_mpdparser_multiple_inherited_segmentURL) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -5011,7 +5044,7 @@ GST_START_TEST (dash_mpdparser_multiple_inherited_segmentURL) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -5038,7 +5071,7 @@ GST_START_TEST (dash_mpdparser_multiple_inherited_segmentURL) assert_equals_int64 (fragment.index_range_end, 400); assert_equals_uint64 (fragment.duration, expectedDuration * GST_MSECOND); assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND); - gst_media_fragment_info_clear (&fragment); + gst_mpdparser_media_fragment_info_clear (&fragment); /* advance to next segment */ flow = gst_mpd_client_advance_segment (mpdclient, activeStream, TRUE); @@ -5058,7 +5091,7 @@ GST_START_TEST (dash_mpdparser_multiple_inherited_segmentURL) assert_equals_int64 (fragment.index_range_end, 500); assert_equals_uint64 (fragment.duration, expectedDuration * GST_MSECOND); assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND); - gst_media_fragment_info_clear (&fragment); + gst_mpdparser_media_fragment_info_clear (&fragment); /* try to advance to the next segment. There isn't any, so it should fail */ flow = gst_mpd_client_advance_segment (mpdclient, activeStream, TRUE); @@ -5076,7 +5109,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_multipleSegmentURL) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; GstActiveStream *activeStream; GstMediaFragmentInfo fragment; GstClockTime expectedDuration; @@ -5113,7 +5146,7 @@ GST_START_TEST (dash_mpdparser_multipleSegmentURL) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -5129,7 +5162,7 @@ GST_START_TEST (dash_mpdparser_multipleSegmentURL) fail_if (adaptationSets == NULL); /* setup streaming from the first adaptation set */ - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set); assert_equals_int (ret, TRUE); @@ -5155,7 +5188,7 @@ GST_START_TEST (dash_mpdparser_multipleSegmentURL) assert_equals_int64 (fragment.index_range_end, 200); assert_equals_uint64 (fragment.duration, expectedDuration * GST_MSECOND); assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND); - gst_media_fragment_info_clear (&fragment); + gst_mpdparser_media_fragment_info_clear (&fragment); /* advance to next segment */ flow = gst_mpd_client_advance_segment (mpdclient, activeStream, TRUE); @@ -5175,7 +5208,7 @@ GST_START_TEST (dash_mpdparser_missing_xml) const gchar *xml = ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, FALSE); @@ -5194,7 +5227,7 @@ GST_START_TEST (dash_mpdparser_missing_mpd) const gchar *xml = ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, FALSE); @@ -5215,7 +5248,7 @@ GST_START_TEST (dash_mpdparser_no_end_tag) " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\"> "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, FALSE); @@ -5235,7 +5268,7 @@ GST_START_TEST (dash_mpdparser_no_default_namespace) ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, strlen (xml)); assert_equals_int (ret, TRUE); @@ -5264,7 +5297,7 @@ GST_START_TEST (dash_mpdparser_wrong_period_duration_inferred_from_next_period) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -5309,7 +5342,7 @@ GST_START_TEST " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -5389,7 +5422,7 @@ GST_START_TEST (dash_mpdparser_negative_period_duration) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -5412,11 +5445,11 @@ GST_END_TEST; */ GST_START_TEST (dash_mpdparser_read_unsigned_from_negative_values) { - GstPeriodNode *periodNode; - GstSegmentBaseType *segmentBase; - GstAdaptationSetNode *adaptationSet; - GstRepresentationNode *representation; - GstSubRepresentationNode *subRepresentation; + GstMPDPeriodNode *periodNode; + GstMPDSegmentBaseType *segmentBase; + GstMPDAdaptationSetNode *adaptationSet; + GstMPDRepresentationNode *representation; + GstMPDSubRepresentationNode *subRepresentation; const gchar *xml = "" @@ -5437,21 +5470,21 @@ GST_START_TEST (dash_mpdparser_read_unsigned_from_negative_values) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + periodNode = (GstMPDPeriodNode *) mpdclient->mpd_root_node->Periods->data; segmentBase = periodNode->SegmentBase; - adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; - representation = (GstRepresentationNode *) + adaptationSet = (GstMPDAdaptationSetNode *) periodNode->AdaptationSets->data; + representation = (GstMPDRepresentationNode *) adaptationSet->Representations->data; - subRepresentation = (GstSubRepresentationNode *) + subRepresentation = (GstMPDSubRepresentationNode *) representation->SubRepresentations->data; /* availabilityStartTime parsing should fail */ - fail_if (mpdclient->mpd_node->availabilityStartTime != NULL); + fail_if (mpdclient->mpd_root_node->availabilityStartTime != NULL); /* Period start parsing should fail */ assert_equals_int64 (periodNode->start, -1); @@ -5495,7 +5528,7 @@ GST_START_TEST (dash_mpdparser_negative_mediaPresentationDuration) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -5522,7 +5555,7 @@ GST_START_TEST (dash_mpdparser_no_profiles) ""; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, strlen (xml)); @@ -5540,7 +5573,7 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_unmatched_segmentTimeline_segmentURL) { GList *adaptationSets; - GstAdaptationSetNode *adapt_set; + GstMPDAdaptationSetNode *adapt_set; const gchar *xml = "" @@ -5563,7 +5596,7 @@ GST_START_TEST (dash_mpdparser_unmatched_segmentTimeline_segmentURL) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); @@ -5577,7 +5610,7 @@ GST_START_TEST (dash_mpdparser_unmatched_segmentTimeline_segmentURL) adaptationSets = gst_mpd_client_get_adaptation_sets (mpdclient); fail_if (adaptationSets == NULL); - adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); + adapt_set = (GstMPDAdaptationSetNode *) g_list_nth_data (adaptationSets, 0); fail_if (adapt_set == NULL); /* setup streaming from the first adaptation set. @@ -5605,7 +5638,7 @@ GST_START_TEST (dash_mpdparser_default_presentation_delay) " "; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); gint64 value; ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); @@ -5717,7 +5750,7 @@ GST_START_TEST (dash_mpdparser_maximum_segment_duration) " " " " " " " "; gboolean ret; - GstMpdClient *mpdclient; + GstMPDClient *mpdclient; gchar *xml; GstClockTime dur; GList *adapt_sets, *iter; @@ -5728,7 +5761,7 @@ GST_START_TEST (dash_mpdparser_maximum_segment_duration) g_free (xml); assert_equals_int (ret, TRUE); - assert_equals_uint64 (mpdclient->mpd_node->maxSegmentDuration, + assert_equals_uint64 (mpdclient->mpd_root_node->maxSegmentDuration, duration_to_ms (0, 0, 0, 0, 0, 4, 500)); dur = gst_mpd_client_get_maximum_segment_duration (mpdclient); assert_equals_uint64 (dur, duration_to_clocktime (0, 0, 0, 0, 0, 4, 500)); @@ -5749,7 +5782,7 @@ GST_START_TEST (dash_mpdparser_maximum_segment_duration) assert_equals_int (ret, TRUE); adapt_sets = gst_mpd_client_get_adaptation_sets (mpdclient); for (iter = adapt_sets; iter; iter = g_list_next (iter)) { - GstAdaptationSetNode *adapt_set_node = iter->data; + GstMPDAdaptationSetNode *adapt_set_node = iter->data; ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set_node); assert_equals_int (ret, TRUE); @@ -5773,9 +5806,9 @@ GST_END_TEST; GST_START_TEST (dash_mpdparser_xlink_period) { - GstPeriodNode *periodNode; + GstMPDPeriodNode *periodNode; GstUriDownloader *downloader; - GstMpdClient *mpdclient; + GstMPDClient *mpdclient; GList *period_list, *iter; gboolean ret; gchar *xml_joined, *file_uri_single_period, *file_uri_double_period; @@ -5828,7 +5861,7 @@ GST_START_TEST (dash_mpdparser_xlink_period) gst_mpd_client_parse (mpdclient, xml_joined, (gint) strlen (xml_joined)); assert_equals_int (ret, TRUE); - period_list = mpdclient->mpd_node->Periods; + period_list = mpdclient->mpd_root_node->Periods; /* only count periods on initial mpd (external xml does not parsed yet) */ assert_equals_int (g_list_length (period_list), 4); @@ -5837,23 +5870,23 @@ GST_START_TEST (dash_mpdparser_xlink_period) -1, NULL); assert_equals_int (ret, TRUE); - period_list = mpdclient->mpd_node->Periods; + period_list = mpdclient->mpd_root_node->Periods; assert_equals_int (g_list_length (period_list), 4); iter = period_list; - periodNode = (GstPeriodNode *) iter->data; + periodNode = (GstMPDPeriodNode *) iter->data; assert_equals_string (periodNode->id, "Period0"); iter = iter->next; - periodNode = (GstPeriodNode *) iter->data; + periodNode = (GstMPDPeriodNode *) iter->data; assert_equals_string (periodNode->id, "xlink-single-period-Period1"); iter = iter->next; - periodNode = (GstPeriodNode *) iter->data; + periodNode = (GstMPDPeriodNode *) iter->data; assert_equals_string (periodNode->id, "xlink-double-period-Period1"); iter = iter->next; - periodNode = (GstPeriodNode *) iter->data; + periodNode = (GstMPDPeriodNode *) iter->data; assert_equals_string (periodNode->id, "xlink-double-period-Period2"); gst_mpd_client_free (mpdclient); @@ -5894,12 +5927,12 @@ GST_START_TEST (dash_mpdparser_datetime_with_tz_offset) " maxSubsegmentDuration=\"P0Y1M2DT12H10M20.5S\">"; gboolean ret; - GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDClient *mpdclient = gst_mpd_client_new (); ret = gst_mpd_client_parse (mpdclient, xml, (gint) strlen (xml)); assert_equals_int (ret, TRUE); - availabilityStartTime = mpdclient->mpd_node->availabilityStartTime; + availabilityStartTime = mpdclient->mpd_root_node->availabilityStartTime; assert_equals_int (gst_date_time_get_year (availabilityStartTime), 2015); assert_equals_int (gst_date_time_get_month (availabilityStartTime), 3); assert_equals_int (gst_date_time_get_day (availabilityStartTime), 24); @@ -5910,7 +5943,7 @@ GST_START_TEST (dash_mpdparser_datetime_with_tz_offset) assert_equals_float (gst_date_time_get_time_zone_offset (availabilityStartTime), 8.0); - availabilityEndTime = mpdclient->mpd_node->availabilityEndTime; + availabilityEndTime = mpdclient->mpd_root_node->availabilityEndTime; assert_equals_int (gst_date_time_get_year (availabilityEndTime), 2015); assert_equals_int (gst_date_time_get_month (availabilityEndTime), 3); assert_equals_int (gst_date_time_get_day (availabilityEndTime), 24); -- 2.7.4