mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-08 18:39:54 +00:00
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:
parent
30bc72d6c7
commit
5ca336226e
2 changed files with 29 additions and 2 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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:
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue