mpdparser: Store an URI downloader in the parser for downloading additional MPD resources if needed

https://bugzilla.gnome.org/show_bug.cgi?id=752230
This commit is contained in:
Sebastian Dröge 2015-08-21 12:06:07 +03:00
parent 07ee57228b
commit 572e54574b
4 changed files with 24 additions and 2 deletions

View file

@ -724,6 +724,7 @@ gst_dash_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
if (dashdemux->client) if (dashdemux->client)
gst_mpd_client_free (dashdemux->client); gst_mpd_client_free (dashdemux->client);
dashdemux->client = gst_mpd_client_new (); dashdemux->client = gst_mpd_client_new ();
gst_mpd_client_set_uri_downloader (dashdemux->client, demux->downloader);
dashdemux->client->mpd_uri = g_strdup (demux->manifest_uri); dashdemux->client->mpd_uri = g_strdup (demux->manifest_uri);
dashdemux->client->mpd_base_uri = g_strdup (demux->manifest_base_uri); dashdemux->client->mpd_base_uri = g_strdup (demux->manifest_base_uri);
@ -801,6 +802,7 @@ gst_dash_demux_reset (GstAdaptiveDemux * ademux)
gst_dash_demux_clock_drift_free (demux->clock_drift); gst_dash_demux_clock_drift_free (demux->clock_drift);
demux->clock_drift = NULL; demux->clock_drift = NULL;
demux->client = gst_mpd_client_new (); demux->client = gst_mpd_client_new ();
gst_mpd_client_set_uri_downloader (demux->client, ademux->downloader);
demux->n_audio_streams = 0; demux->n_audio_streams = 0;
demux->n_video_streams = 0; demux->n_video_streams = 0;
@ -1273,6 +1275,7 @@ gst_dash_demux_update_manifest_data (GstAdaptiveDemux * demux,
/* parse the manifest file */ /* parse the manifest file */
new_client = gst_mpd_client_new (); new_client = gst_mpd_client_new ();
gst_mpd_client_set_uri_downloader (new_client, demux->downloader);
new_client->mpd_uri = g_strdup (demux->manifest_uri); new_client->mpd_uri = g_strdup (demux->manifest_uri);
new_client->mpd_base_uri = g_strdup (demux->manifest_base_uri); new_client->mpd_base_uri = g_strdup (demux->manifest_base_uri);
gst_buffer_map (buffer, &mapinfo, GST_MAP_READ); gst_buffer_map (buffer, &mapinfo, GST_MAP_READ);

View file

@ -3051,9 +3051,22 @@ gst_mpd_client_free (GstMpdClient * client)
g_free (client->mpd_base_uri); g_free (client->mpd_base_uri);
client->mpd_base_uri = NULL; client->mpd_base_uri = NULL;
if (client->downloader)
gst_object_unref (client->downloader);
client->downloader = NULL;
g_free (client); g_free (client);
} }
void
gst_mpd_client_set_uri_downloader (GstMpdClient * client,
GstUriDownloader * downloader)
{
if (client->downloader)
gst_object_unref (client->downloader);
client->downloader = gst_object_ref (downloader);
}
static void static void
gst_mpd_client_check_profiles (GstMpdClient * client) gst_mpd_client_check_profiles (GstMpdClient * client)
{ {

View file

@ -28,6 +28,7 @@
#define __GST_MPDPARSER_H__ #define __GST_MPDPARSER_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/uridownloader/gsturidownloader.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -514,6 +515,8 @@ struct _GstMpdClient
/* profiles */ /* profiles */
gboolean profile_isoff_ondemand; gboolean profile_isoff_ondemand;
GstUriDownloader * downloader;
}; };
/* Basic initialization/deinitialization functions */ /* Basic initialization/deinitialization functions */
@ -522,6 +525,8 @@ void gst_active_streams_free (GstMpdClient * client);
void gst_mpd_client_free (GstMpdClient * client); void gst_mpd_client_free (GstMpdClient * client);
void gst_media_fragment_info_clear (GstMediaFragmentInfo * fragment); void gst_media_fragment_info_clear (GstMediaFragmentInfo * fragment);
void gst_mpd_client_set_uri_downloader (GstMpdClient * client, GstUriDownloader * download);
/* MPD file parsing */ /* MPD file parsing */
gboolean gst_mpd_parse (GstMpdClient *client, const gchar *data, gint size); gboolean gst_mpd_parse (GstMpdClient *client, const gchar *data, gint size);

View file

@ -441,8 +441,9 @@ elements_mpg123audiodec_LDADD = \
elements_uvch264demux_CFLAGS = -DUVCH264DEMUX_DATADIR="$(srcdir)/elements/uvch264demux_data" \ elements_uvch264demux_CFLAGS = -DUVCH264DEMUX_DATADIR="$(srcdir)/elements/uvch264demux_data" \
$(AM_CFLAGS) $(AM_CFLAGS)
elements_dash_mpd_CFLAGS = $(AM_CFLAGS) $(LIBXML2_CFLAGS) elements_dash_mpd_CFLAGS = $(AM_CFLAGS) $(GST_PLUGINS_BAD_CFLAGS) $(LIBXML2_CFLAGS)
elements_dash_mpd_LDADD = $(LDADD) $(LIBXML2_LIBS) elements_dash_mpd_LDADD = $(LDADD) $(LIBXML2_LIBS) \
$(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-@GST_API_VERSION@.la
elements_dash_mpd_SOURCES = elements/dash_mpd.c elements_dash_mpd_SOURCES = elements/dash_mpd.c
pipelines_streamheader_CFLAGS = $(GIO_CFLAGS) $(AM_CFLAGS) pipelines_streamheader_CFLAGS = $(GIO_CFLAGS) $(AM_CFLAGS)