GList *walk;
GstM3U8MediaFile *file;
guint count;
+ guint min_distance = 0;
g_return_val_if_fail (client != NULL, FALSE);
return FALSE;
}
+ if (GST_M3U8_CLIENT_IS_LIVE (client)) {
+ /* min_distance is used to make sure the seek range is never closer than
+ GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE fragments from the end of a live
+ playlist - see 6.3.3. "Playing the Playlist file" of the HLS draft */
+ min_distance = GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE;
+ }
count = g_list_length (client->current->files);
- /* count is used to make sure the seek range is never closer than
- GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE fragments from the end of the
- playlist - see 6.3.3. "Playing the Playlist file" of the HLS draft */
for (walk = client->current->files;
- walk && count >= GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE; walk = walk->next) {
+ walk && count >= min_distance; walk = walk->next) {
file = walk->data;
--count;
duration += file->duration;
GstM3U8Client *client;
GstM3U8 *pl;
GstM3U8MediaFile *file;
+ gint64 start = -1;
+ gint64 stop = -1;
client = load_playlist (LIVE_PLAYLIST);
assert_equals_string (file->uri,
"https://priv.example.com/fileSequence2683.ts");
assert_equals_int (file->sequence, 2683);
+ fail_unless (gst_m3u8_client_get_seek_range (client, &start, &stop));
+ assert_equals_int64 (start, 0);
+ assert_equals_float (stop / (double) GST_SECOND, 16.0);
gst_m3u8_client_free (client);
}
GstM3U8Client *client;
GstM3U8 *pl;
GstM3U8MediaFile *file;
+ gint64 start = -1;
+ gint64 stop = -1;
client = load_playlist (DOUBLES_PLAYLIST);
assert_equals_float (file->duration / (double) GST_SECOND, 10.2344);
file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 3));
assert_equals_float (file->duration / (double) GST_SECOND, 9.92);
+ fail_unless (gst_m3u8_client_get_seek_range (client, &start, &stop));
+ assert_equals_int64 (start, 0);
+ assert_equals_float (stop / (double) GST_SECOND,
+ 10.321 + 9.6789 + 10.2344 + 9.92);
gst_m3u8_client_free (client);
}