diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c index 511ce43d7b..d27d4ca777 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c @@ -38,7 +38,6 @@ #define GST_CAT_DEFAULT hls2_debug -static void gst_m3u8_init_file_unref (GstM3U8InitFile * self); static gchar *uri_join (const gchar * uri, const gchar * path); GstHLSMediaPlaylist * @@ -124,7 +123,7 @@ gst_m3u8_init_file_new (gchar * uri) return file; } -static GstM3U8InitFile * +GstM3U8InitFile * gst_m3u8_init_file_ref (GstM3U8InitFile * ifile) { g_assert (ifile != NULL && ifile->ref_count > 0); @@ -133,7 +132,7 @@ gst_m3u8_init_file_ref (GstM3U8InitFile * ifile) return ifile; } -static void +void gst_m3u8_init_file_unref (GstM3U8InitFile * self) { g_return_if_fail (self != NULL && self->ref_count > 0); @@ -144,6 +143,28 @@ gst_m3u8_init_file_unref (GstM3U8InitFile * self) } } +gboolean +gst_m3u8_init_file_equal (const GstM3U8InitFile * ifile1, + const GstM3U8InitFile * ifile2) +{ + if (ifile1 == ifile2) + return TRUE; + + if (ifile1 == NULL && ifile2 != NULL) + return FALSE; + if (ifile1 != NULL && ifile2 == NULL) + return FALSE; + + if (!g_str_equal (ifile1->uri, ifile2->uri)) + return FALSE; + if (ifile1->offset != ifile2->offset) + return FALSE; + if (ifile1->size != ifile2->size) + return FALSE; + + return TRUE; +} + static gboolean int_from_string (gchar * ptr, gchar ** endptr, gint * val) { diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.h b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.h index 63238fdb72..41d864218f 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.h +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.h @@ -158,6 +158,10 @@ struct _GstM3U8InitFile guint ref_count; /* ATOMIC */ }; +GstM3U8InitFile *gst_m3u8_init_file_ref (GstM3U8InitFile * ifile); +void gst_m3u8_init_file_unref (GstM3U8InitFile * ifile); +gboolean gst_m3u8_init_file_equal (const GstM3U8InitFile * ifile1, const GstM3U8InitFile *ifile2); + GstM3U8MediaSegment * gst_m3u8_media_segment_ref (GstM3U8MediaSegment * mfile);