summaryrefslogtreecommitdiff
path: root/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2022-11-01 01:41:35 +1100
committerTim-Philipp Müller <tim@centricular.com>2022-11-01 11:51:44 +0000
commit9b8c71d1487c94a1b5dd784db9c1995786eae780 (patch)
treeac4296bbdce6d16f21258fa9ff3bfc351aded568 /subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c
parent9e6056b3064c14382dded008cb3d497e7c02d1bc (diff)
m3u8: Expose GstM3U8InitFile methods
Exposure ref/unref methods for the GstM3U8InitFile type, and add a gst_m3u8_init_file_equal() comparison method. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3307>
Diffstat (limited to 'subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c')
-rw-r--r--subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c27
1 files changed, 24 insertions, 3 deletions
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)
{