Project

General

Profile

Bug #5970

Recordings playlist unusable with VLC

Added by Dave Pickles 11 months ago. Updated 11 months ago.

Status:
New
Priority:
Normal
Assignee:
Category:
PVR / DVR
Target version:
-
Start date:
2020-11-02
Due date:
% Done:

0%

Estimated time:
Found in version:
4.3-1912~g04dd1143f-dirty
Affected Versions:

Description

I'm investigating a problem reported in the forums at https://tvheadend.org/boards/5/topics/42839 where a user wants to get a playlist from Tvheadend containing a list of recordings. The playlist provided by eg http://tvhip:9981/playlist/channels doesn't work with VLC.

This is part of a playlist from the current development version:

#EXTM3U
#EXTINF:3960,New: Paddington Station 24/7:..
#EXT-X-TARGETDURATION:3960
#EXT-X-STREAM-INF:PROGRAM-ID=0cf4b7d3548c460289389d8dc89725dd,BANDWIDTH=0
#EXT-X-PROGRAM-DATE-TIME:2020-11-02T21:00:00+0000
http://192.168.1.1:9981/dvrfile/0cf4b7d3548c460289389d8dc89725dd
#EXTINF:3960,Ice Airport Alaska
#EXT-X-TARGETDURATION:3960
#EXT-X-STREAM-INF:PROGRAM-ID=7134684b741525839a40234c175c66c4,BANDWIDTH=8766
#EXT-X-PROGRAM-DATE-TIME:2020-10-29T23:00:00+0000
http://192.168.1.1:9981/dvrfile/7134684b741525839a40234c175c66c4
#EXTINF:2160,Chicago: Music Icons
#EXT-X-TARGETDURATION:2160
#EXT-X-STREAM-INF:PROGRAM-ID=ce1f6e06eb88a3e840771a910e47fb20,BANDWIDTH=1965
#EXT-X-PROGRAM-DATE-TIME:2020-10-28T16:00:00+0000
http://192.168.1.1:9981/dvrfile/ce1f6e06eb88a3e840771a910e47fb20

The function producing the playlist is http_dvr_list_playlist() in src/webui/webui.c. This was added about 8 years ago by copying from http_dvr_playlist() which is 10 years old. They are much older than RFC8216 (finalised in 2017) which describes the HLS playlist format.

I believe the reported problem occurs because the recordings playlist uses the format of an HLS playlist when it is not. An HLS playlist describes the media segments which make up a single programme, not a series of programmes which can be viewed individually.

In addition the playlist syntax doesn't follow RFC8216; the #EXT-X-STREAM-INF tag should be immediately followed by the stream URL, and there can be only one #EXT-X-TARGETDURATION in the entire playlist. Clients using the protocol (eg VLC) are required to ignore a playlist if it does not follow the RFC, hence the user issue reported.

The playlist also includes recordings to be made in the future (ie timers) as well as failed recordings. I suspect this is an error.

Below is a patch which fixes the issues reported. I'll submit a PR if it looks OK.

--- a/webui.c     2019-11-28 18:11:58.000000000 +0000
+++ b/webui.c     2020-11-02 12:25:29.341023679 +0000
@@ -861,7 +861,6 @@
   off_t fsize;
   time_t durration;
   struct tm tm;
-  int bandwidth;

   if (pltype != PLAYLIST_M3U)
     return HTTP_STATUS_BAD_REQUEST;
@@ -872,7 +871,7 @@
   htsbuf_append_str(hq, "#EXTM3U\n");
   LIST_FOREACH(de, &dvrentries, de_global_link) {
     fsize = dvr_get_filesize(de, 0);
-    if(!fsize)
+    if(fsize <= 0)
       continue;

     if (de->de_channel &&
@@ -883,16 +882,11 @@
       continue;

     durration  = dvr_entry_get_stop_time(de) - dvr_entry_get_start_time(de, 0);
-    bandwidth = ((8*fsize) / (durration*1024.0));
     strftime(buf, sizeof(buf), "%FT%T%z", localtime_r(&(de->de_start), &tm));

     htsbuf_qprintf(hq, "#EXTINF:%"PRItime_t",%s\n", durration, lang_str_get(de->de_title, NULL));

-    htsbuf_qprintf(hq, "#EXT-X-TARGETDURATION:%"PRItime_t"\n", durration);
     uuid = idnode_uuid_as_str(&de->de_id, ubuf);
-    htsbuf_qprintf(hq, "#EXT-X-STREAM-INF:PROGRAM-ID=%s,BANDWIDTH=%d\n", uuid, bandwidth);
-    htsbuf_qprintf(hq, "#EXT-X-PROGRAM-DATE-TIME:%s\n", buf);
-
     snprintf(buf, sizeof(buf), "/dvrfile/%s", uuid);
     htsbuf_qprintf(hq, "%s%s", hostpath, buf);

History

#1

Updated by Flole Systems 11 months ago

  • Assignee changed from Adam Sutton to Dave Pickles

Also available in: Atom PDF