kodi-pvr / pvr.vuplus

Kodi's Enigma2 client add-on
GNU General Public License v2.0
56 stars 55 forks source link

Set the program number #195

Closed joaoppp closed 5 years ago

joaoppp commented 5 years ago

I'm requesting that for each channel the mpegts program number be included too if exists at m3u EXTVLCOPT:program, so it would then be picked by kodi at:

  // in case of mpegts and we have not seen pat/pmt, defer creation of streams
  if (!skipCreateStreams || m_pFormatContext->nb_programs > 0)
  {
    unsigned int nProgram = UINT_MAX;
    if (m_pFormatContext->nb_programs > 0)
    {
      // select the correct program if requested
      CVariant programProp(pInput->GetProperty("program"));
      if (!programProp.isNull())
      {
        int programNumber = static_cast<int>(programProp.asInteger());

        for (unsigned int i = 0; i < m_pFormatContext->nb_programs; ++i)
        {
          if (m_pFormatContext->programs[i]->program_num == programNumber)
          {
            nProgram = i;
            break;
          }
        }
      }
phunkyfish commented 5 years ago

This would appear to be kodi centric and not related to the addon. I stand to be corrected.

joaoppp commented 5 years ago

So a PVR addon can't modify the pInput property named program. Kodi should have expose that property to PVR addons use it. Thanks.

phunkyfish commented 5 years ago

All the addon does is pass the stream to kodi. I would imagine it’s Inputstream.adaptive that demuxes it and plays it back.

joaoppp commented 5 years ago

@phunkyfish I remembered now that I asked this question to FernetMenta in 2017 and he told me https://github.com/xbmc/xbmc/pull/12660 will add this capability. Is this correct today?

phunkyfish commented 5 years ago

That would be true however the addon uses inputstreams for live tv/radio so neither of those functions are used (and should not be).

So if an M3U is used the only thing read from it is the URL. If I pass the m3u8 directly kodi fails to load it. I.e. I have no way to add the property you are looking for.

phunkyfish commented 5 years ago

Could you explain the use case behind this please?

joaoppp commented 5 years ago

Kodi by default picks the mpegts program number of stream 0, but not always this is the correct program number that the enigma2 is sending. When this happens kodi will hang with a black screen.

joaoppp commented 5 years ago

So if an M3U is used the only thing read from it is the URL. If I pass the m3u8 directly kodi fails to load it. I.e. I have no way to add the property you are looking for.

There are two methods that I know to discover the program number: 1) downloading the web/stream.m3u of each channel and look for the EXTVLCOPT:program 2) the simpler method is matching it at the e2servicereference of web/getservices

phunkyfish commented 5 years ago

Do you have some examples of both 1 and 2?

I only see this this is an M3U8:

`

EXTM3U

EXTVLCOPT--http-reconnect=true

EXTINF:-1,RTÉ One

http://192.168.1.201:8002/1:0:19:835:3EA:2174:EEEE0000:0:0:0: `

And I don't see anything for web/getservices

joaoppp commented 5 years ago

And I don't see anything for web/getservices

I mean the URI %sweb/getservices?sRef=%s that will download a xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<e2servicelist>
    <e2service>
        <e2servicereference>1:0:1:191:27:36:CE40000:0:0:0:</e2servicereference>
        <e2servicename>Test channel</e2servicename>
    </e2service>
</e2servicelist>

With this xml we know e2servicereference of "Test channel", and that program number is 401 for "Test channel" because in the e2servicereference -> 1:0:1:191:27:36:CE40000:0:0:0: the hexadecimal 191 equals 401

joaoppp commented 5 years ago

I only see this this is an M3U8:

#EXTM3U #EXTVLCOPT--http-reconnect=true #EXTINF:-1,RTÉ One http://192.168.1.201:8002/1:0:19:835:3EA:2174:EEEE0000:0:0:0:

In my case I get a m3u8 like this:

#EXTM3U 
#EXTVLCOPT--http-reconnect=true 
#EXTINF:-1,Test channel
#EXTVLCOPT:program=401
http://192.168.0.65:8001/1:0:1:191:27:36:CE40000:0:0:0:
phunkyfish commented 5 years ago

It doesn't make sense. Mine never chooses the wrong program and it's never on program 0.

What platform and version are you using? Can you supply a full debug log?

phunkyfish commented 5 years ago

In the addon settings, in the connection tab, do you have this setting enabled or disabled under streaming?

Enable automatic configuration for live streams

joaoppp commented 5 years ago

In the addon settings, in the connection tab, do you have this setting enabled or disabled under streaming?

Enable automatic configuration for live streams

I have the default disabled. With this option enabled do any difference?

joaoppp commented 5 years ago

It doesn't make sense. Mine never chooses the wrong program and it's never on program 0.

What platform and version are you using? Can you supply a full debug log?

I didn't say program 0, kodi default to stream 0 whatever program number it is. My platform is openATV 6.3, but this is not related to the platform, it is related to the transponder stream mpegts. Look at this av_find_stream_info of the mpegts, by default kodi will pick stream 0 that is Program 520, but that is not the right program, the right program number is Program 401 with stream 12 and 13.

2019-03-09 12:29:28.659 T:139857049405184   DEBUG: Open - av_find_stream_info finished
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]: Input #0, mpegts, from 'pvr://channels/tv/All channels/pvr.vuplus_1.pvr':
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Duration: N/A, start: 80905.503878, bitrate: N/A
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 4
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 5
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:27[0x22], 0, 1/90000: Unknown: none ([5][0][0][0] / 0x0005)
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 401
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:13[0x1010], 29, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 50 fps, 50 tbr, 90k tbn
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:12[0x1011](eng), 23, 1/90000: Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 402
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:25[0x1020], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:26[0x1021](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 403
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:23[0x1df0], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:24[0x1df1](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 405
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:14[0x1081](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:15[0x1080], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 406
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:16[0x10d0], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:17[0x10d1](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 409
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:18[0x1054](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:20[0x1051](por), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:19[0x1040], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 410
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:21[0x1046](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:22[0x1045], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 459
2019-03-09 12:29:28.659 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:28[0x193b], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:29[0x193c](por), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 462
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:30[0x1036], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:31[0x1037](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 520
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:1[0x1d20], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:0[0x1d21](por), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 521
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:0[0x1d21](por), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:1[0x1d20], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 523
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:2[0x1d23](por), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:3[0x1d22], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 524
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:4[0x1d25](por), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:5[0x1d24], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 1602
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:6[0x1e30], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:7[0x1e31](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 1609
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:8[0x1e20], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:9[0x1e21](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 1610
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:10[0x1e00], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:11[0x1e01](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 5030
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:12[0x1011](eng), 23, 1/90000: Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:13[0x1010], 29, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 50 fps, 50 tbr, 90k tbn
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 5032
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:14[0x1081](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:15[0x1080], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.660 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 5033
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:16[0x10d0], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:17[0x10d1](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 5034
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:18[0x1054](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:19[0x1040], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:20[0x1051](por), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 5035
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:21[0x1046](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:22[0x1045], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 5036
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:23[0x1df0], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:24[0x1df1](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 5037
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:25[0x1020], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:26[0x1021](eng), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 5038
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:1[0x1d20], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:0[0x1d21](por), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 5040
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:3[0x1d22], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:2[0x1d23](por), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:   Program 5041
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:5[0x1d24], 0, 1/90000: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
2019-03-09 12:29:28.661 T:139857049405184    INFO: ffmpeg[7F3301BFC700]:     Stream #0:4[0x1d25](por), 0, 1/90000: Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels
phunkyfish commented 5 years ago

I see now. That option I mentioned won’t make a difference.

phunkyfish commented 5 years ago

If I could find a stream that worked the same way I could try some things out, such as sending the m3u8 file before the stream etc.

phunkyfish commented 5 years ago

Logically you would think the first available video stream would be chosen. The choice here appears to be random as there are two other programs that are stream 0. 521 and 5038.

joaoppp commented 5 years ago

If I could find a stream that worked the same way I could try some things out, such as sending the m3u8 file before the stream etc.

I try loading the channel m3u8 with IPTV Simple Client but still didn't load the correct program. It ignores the #EXTVLCOPT:program=401

joaoppp commented 5 years ago

Logically you would think the first available video stream would be chosen. The choice here appears to be random as there are two other programs that are stream 0. 521 and 5038.

I think will pick the first program with stream 0 that encounter in the mpegts.

joaoppp commented 5 years ago

That would be true however the addon uses inputstreams for live tv/radio so neither of those functions are used (and should not be).

greping the pvr.vuplus source found:

src/Enigma2.h:  const std::string GetLiveStreamURL(const PVR_CHANNEL &channelinfo);
src/client.cpp:  const std::string streamURL = enigma->GetLiveStreamURL(channel);
src/Enigma2.cpp:const std::string Enigma2::GetLiveStreamURL(const PVR_CHANNEL &channelinfo)

It uses GetLiveStreamURL Is not just a case of replacing GetLiveStreamURL by GetChannelStreamProperties?

  1. Replace API function GetLiveStreamURL() by GetChannelStreamProperties()

    Todo for addon maintainers: Remove GetLiveStreamURL from your addon implementation. If your addon supports Live TV and/or Radio and it does implement live stream functions (OpenLiveStream, ...) (bHandlesInputStream set to false) you must implement the new API function. The new function basically does what GetLiveStreamURL did, but besides from the stream URL (as a new property "streamurl") you can now also supply additional properties required to open the stream.

phunkyfish commented 5 years ago

No, that is a helper function. It’s not synonymous with the API function.

phunkyfish commented 5 years ago

So it appears the support is not in kodi at all for some reason. Can I ask where you got the code snippet you started this issue with? I.e. where in the source?

joaoppp commented 5 years ago

The code is from xbmc DVDDemuxFFmpeg.cpp https://github.com/xbmc/xbmc/blob/35974005423894fc554dbc9b212988ab4768486a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp#L516

joaoppp commented 5 years ago

The pvr.iptvsimple uses the new API, but ignores EXTVLCOPT:program

phunkyfish commented 5 years ago

Does pvr.iptvsimple read the program value and add it to the stream Properties correctly?

joaoppp commented 5 years ago

Does pvr.iptvsimple read the program value and add it to the stream Properties correctly?

It is not coded to read "EXTVLCOPT:program", ignores it.

phunkyfish commented 5 years ago

Can you build pvr.iptvsimple? Adding support for that is easy and as least you could test it then.

joaoppp commented 5 years ago

Already did and it works :)

phunkyfish commented 5 years ago

Great, you should submit that as a PR for other simpleiptv users

joaoppp commented 5 years ago

This is the patch I made, but I'm not a programmer, please review the code and submit you.

--- <PVRIptvData.cpp>
+++ <PVRIptvData.cpp>
@@ -49,7 +49,7 @@
 #define CHANNEL_LOGO_EXTENSION  ".png"
 #define SECONDS_IN_DAY          86400
 #define GENRES_MAP_FILENAME     "genres.xml"
+#define M3U_PROGRAM_MARKER      "#EXTVLCOPT:program="

 using namespace ADDON;
 using namespace rapidxml;
@@ -476,6 +476,10 @@
       if (ReadMarkerValue(strLine, PLAYLIST_TYPE_MARKER) == "VOD")
         bIsRealTime = false;
     }
+    else if (StringUtils::Left(strLine, strlen(M3U_PROGRAM_MARKER)) == M3U_PROGRAM_MARKER)
+    {
+      tmpChannel.properties.insert({"program", ReadMarkerValue(strLine, M3U_PROGRAM_MARKER)});
+    }
     else if (strLine[0] != '#')
     {
       XBMC->Log(LOG_DEBUG,
phunkyfish commented 5 years ago

Sure

phunkyfish commented 5 years ago

@ksooo when using an input stream is there anyway to pass the default program/stream to use through to kodi?

joaoppp commented 5 years ago

This was the m3u I load to pvr.iptvsimple

#EXTM3U
#EXTINF:-1,Test Channel
#EXTVLCOPT:program=401
http://192.168.0.65:8001/1:0:1:191:27:36:CE40000:0:0:0:
joaoppp commented 5 years ago

@phunkyfish Using the GetChannelStreamProperties() API imply losing functionality?

phunkyfish commented 5 years ago

Yes, it would appear so. The timeshift and recording functionality is all based on input streams. That appears to be the one thing missing when using them.

Unless the API can be modified so the OpenLiveStream call, and possibly on OpenRecordedStream can take this extra parameter I don't see how it can be done.

joaoppp commented 5 years ago

Using the GetChannelStreamProperties() API imply losing functionality?

Yes, it would appear so. The timeshift and recording functionality is all based on input streams. That appears to be the one thing missing when using them.

Unless the API can be modified so the OpenLiveStream call, and possibly on OpenRecordedStream can take this extra parameter I don't see how it can be done.

@FernetMenta Can this be added to the API? Is there any other way to use GetChannelStreamProperties() and don't lose timeshift and recording functionality?

phunkyfish commented 5 years ago

I can add a feature to store the program number from the service reference in the next PR, but it won't be any use until there is some way to pass it through to the demuxer.

joaoppp commented 5 years ago

I can add a feature to store the program number from the service reference in the next PR, but it won't be any use until there is some way to pass it through to the demuxer.

ok, thanks

joaoppp commented 5 years ago

Yes, it would appear so. The timeshift and recording functionality is all based on input streams. That appears to be the one thing missing when using them.

@phunkyfish For the recording functionality GetRecordingStreamProperties couldn't be used?

phunkyfish commented 5 years ago

It’s the same issue, both live and recorded streams use input streams. So the properties calls are not used.

FernetMenta commented 5 years ago

Passing a mpegts stream with multiple programs over a network, LAN / WiFi, makes no sense. Backends like mediaportal generate a PAT/PMT for a selected channel and include only this.

phunkyfish commented 5 years ago

That’s fair, @joaoppp is this something that can be fixed on the Enigma2 backend?

I know Enigma2 just records the stream as it arrives over the air so may not be possible.

phunkyfish commented 5 years ago

If it’s a provider issue (I.e. not Enigma2) than I’m not sure how you would solve for this.

phunkyfish commented 5 years ago

Have you looked at transcoding? Not familiar with it myself but it’s possible that would allow you to pass only the selected stream from your Enigma2 device.

joaoppp commented 5 years ago

Passing a mpegts stream with multiple programs over a network, LAN / WiFi, makes no sense. Backends like mediaportal generate a PAT/PMT for a selected channel and include only this.

@FernetMenta I agree with you, Enigma2 should generate a new PAT/PMT for that channel only. but instead it keeps the PAT/PMT and sends the streams from that channel, discarding the streams from all the other channels. But the new PVR API could solve this? GetChannelStreamProperties() and GetRecordingStreamProperties()

@phunkyfish What if kodi handle the InputStream?

FernetMenta commented 5 years ago

But the new PVR API could solve this?

Sure, but the fact that it can be done does not mean that it makes much sense. Kodi is already hard to maintain and this would introduce an additional edge case for one of the less popular backends.

but instead it keeps the PAT/PMT and sends the streams from that channel, discarding the streams from all the other channels.

This is IMO a violation of the mpegts specification.

phunkyfish commented 5 years ago

Please look at transcoding on your Enigma2 device. Logically this would take the relevant stream and process just that as a workaround. Not sure if it rewrites the PAT/PMT.

BTW, this should be filed as an Enigma2 bug and resolution should lie there.

phunkyfish commented 5 years ago

Out of interest what enigma2 version/image are you using?

joaoppp commented 5 years ago

@phunkyfish OpenATV 6.3, but all images do the same way.