hlsdemux2: Add preload equality helper

Add a helper function that compares two preload hints for equality based on URI
and requested byte range.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883>
This commit is contained in:
Jan Schmidt 2022-10-13 05:17:59 +11:00 committed by GStreamer Marge Bot
parent 30bc72d6c7
commit 5ca336226e
2 changed files with 29 additions and 2 deletions

View file

@ -164,6 +164,25 @@ gst_m3u8_preload_hint_unref (GstM3U8PreloadHint * hint)
}
}
gboolean
gst_m3u8_preload_hint_equal (GstM3U8PreloadHint * hint1,
GstM3U8PreloadHint * hint2)
{
if (hint1->hint_type != hint2->hint_type)
return FALSE;
if (!g_str_equal (hint1->uri, hint2->uri))
return FALSE;
if (hint1->offset != hint2->offset)
return FALSE;
if (hint1->size != hint2->size)
return FALSE;
return TRUE;
}
static GstM3U8InitFile *
gst_m3u8_init_file_new (gchar * uri, gint64 size, gint64 offset)
{

View file

@ -184,11 +184,16 @@ gst_m3u8_partial_segment_ref (GstM3U8PartialSegment *part);
void
gst_m3u8_partial_segment_unref (GstM3U8PartialSegment *part);
/* Set up as flags, so we can form a bitmask
* of seen hint types */
enum _GstM3U8PreloadHintType {
M3U8_PRELOAD_HINT_MAP,
M3U8_PRELOAD_HINT_PART,
M3U8_PRELOAD_HINT_NONE = (0 << 0),
M3U8_PRELOAD_HINT_MAP = (1 << 0),
M3U8_PRELOAD_HINT_PART = (1 << 1),
};
#define M3U8_PRELOAD_HINT_ALL (M3U8_PRELOAD_HINT_PART | M3U8_PRELOAD_HINT_MAP)
/**
* GstM3U8PreloadHint:
*
@ -211,6 +216,9 @@ gst_m3u8_preload_hint_ref (GstM3U8PreloadHint *hint);
void
gst_m3u8_preload_hint_unref (GstM3U8PreloadHint *hint);
gboolean
gst_m3u8_preload_hint_equal (GstM3U8PreloadHint *hint1, GstM3U8PreloadHint *hint2);
/**
* GstM3U8MediaSegment:
*