Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the program number #195

Closed
joaoppp opened this issue Mar 7, 2019 · 64 comments
Closed

Set the program number #195

joaoppp opened this issue Mar 7, 2019 · 64 comments
Labels
kodi issue Issue likely in kodi and not the addon

Comments

@joaoppp
Copy link

joaoppp commented Mar 7, 2019

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
Copy link
Member

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

@joaoppp
Copy link
Author

joaoppp commented Mar 7, 2019

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
Copy link
Member

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
Copy link
Author

joaoppp commented Mar 8, 2019

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

@phunkyfish
Copy link
Member

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
Copy link
Member

Could you explain the use case behind this please?

@joaoppp
Copy link
Author

joaoppp commented Mar 9, 2019

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
Copy link
Author

joaoppp commented Mar 9, 2019

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
Copy link
Member

phunkyfish commented Mar 9, 2019

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
Copy link
Author

joaoppp commented Mar 9, 2019

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
Copy link
Author

joaoppp commented Mar 9, 2019

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
Copy link
Member

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
Copy link
Member

phunkyfish commented Mar 9, 2019

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
Copy link
Author

joaoppp commented Mar 9, 2019

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
Copy link
Author

joaoppp commented Mar 9, 2019

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
Copy link
Member

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

@phunkyfish
Copy link
Member

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
Copy link
Member

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
Copy link
Author

joaoppp commented Mar 10, 2019

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
Copy link
Author

joaoppp commented Mar 10, 2019

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
Copy link
Author

joaoppp commented Mar 10, 2019

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
Copy link
Member

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

@phunkyfish
Copy link
Member

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
Copy link
Author

joaoppp commented Mar 10, 2019

@joaoppp
Copy link
Author

joaoppp commented Mar 10, 2019

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

@phunkyfish
Copy link
Member

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

@joaoppp
Copy link
Author

joaoppp commented Mar 10, 2019

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
Copy link
Member

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

@joaoppp
Copy link
Author

joaoppp commented Mar 10, 2019

Already did and it works :)

@phunkyfish
Copy link
Member

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

@phunkyfish
Copy link
Member

phunkyfish commented Mar 20, 2019

Then it’s just one bug to file luckily.

What I don’t understand is why more users don’t have the same issue.

@joaoppp
Copy link
Author

joaoppp commented Mar 24, 2019

I have a workaround. Not as fast and with many features as you @phunkyfish have it now, and for that you are doing a good job. The workaround is a old version of this plugin with PVR API 5.10.1 (https://github.com/kodi-pvr/pvr.vuplus/tree/e2efab9eecfce2fc4feefa2f47250e4dc5eb7a60) with this patch:

--- src/client.cpp
+++ src/client.cpp
@@ -26,6 +26,7 @@
 #include "VuData.h"
 #include <p8-platform/util/StringUtils.h>
 #include "p8-platform/util/util.h"
+#include <regex>
 
 using namespace std;
 using namespace ADDON;
@@ -408,6 +409,15 @@
   strncpy(properties[1].strName, PVR_STREAM_PROPERTY_ISREALTIMESTREAM, sizeof(properties[1].strName) - 1);
   strncpy(properties[1].strValue, "true", sizeof(properties[1].strValue) - 1);
   *iPropertiesCount = 2;
+
+  std::cmatch cm; 
+  if (std::regex_match(strStreamURL.c_str(), cm, std::regex("https?://[^/]+/[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:([0-9a-f]+):.*?", std::regex_constants::icase))) {
+    XBMC->Log(LOG_INFO, "%s - Set program to %s.", __FUNCTION__, std::to_string(strtol(cm.str(1).c_str(), NULL, 16)).c_str());
+    strncpy(properties[2].strName, "program", sizeof(properties[2].strName) - 1);
+    strncpy(properties[2].strValue, std::to_string(strtol(cm.str(1).c_str(), NULL, 16)).c_str(), sizeof(properties[2].strValue) - 1);
+    (*iPropertiesCount)++;
+  }
+
   return PVR_ERROR_NO_ERROR;
 }
 

@FernetMenta This problem have a simple fix at kodi, and don't envolves changing nothing in this plugin or in any kodi API.
In 2017 I shared with the community this peace of code accepted by you:

        // skip programs without or empty audio/video streams
        for (unsigned int i = 0; nProgram == UINT_MAX && i < m_pFormatContext->nb_programs; i++)
        {
          for (unsigned int j = 0; j < m_pFormatContext->programs[i]->nb_stream_indexes; j++)
          {
            int idx = m_pFormatContext->programs[i]->stream_index[j];
            AVStream *st = m_pFormatContext->streams[idx];
            if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->codec_info_nb_frames > 0) ||
                (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->sample_rate > 0))
            {
              nProgram = i;
              break;
            }
          }
        }

but it requires a avformat_find_stream_info() before.
A simple patch for this:

--- xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -459,7 +459,7 @@
   m_bAVI = strcmp(m_pFormatContext->iformat->name, "avi") == 0;
   m_bSup = strcmp(m_pFormatContext->iformat->name, "sup") == 0;
 
-  if (m_streaminfo)
+  if (m_streaminfo || m_pFormatContext->nb_programs > 0)
   {
     /* to speed up dvd switches, only analyse very short */
     if(m_pInput->IsStreamType(DVDSTREAM_TYPE_DVD))

@phunkyfish I will try to explore the openATV source to understand what's going on, and then report the bug. Can you point me where to look?

@FernetMenta
Copy link
Contributor

@joaoppp this patch is wrong. nb_programs is greater 0 for a lot of cases streaminfo is not desired. btw: in order to fix some other issues, streaminfo needs to be skipped for all mpegts.

@joaoppp
Copy link
Author

joaoppp commented Mar 24, 2019

@joaoppp this patch is wrong. nb_programs is greater 0 for a lot of cases streaminfo is not desired. btw: in order to fix some other issues, streaminfo needs to be skipped for all mpegts.

@FernetMenta But if avformat_find_stream_info() is skipped how would this work?

        // skip programs without or empty audio/video streams
        for (unsigned int i = 0; nProgram == UINT_MAX && i < m_pFormatContext->nb_programs; i++)
        {
          for (unsigned int j = 0; j < m_pFormatContext->programs[i]->nb_stream_indexes; j++)
          {
            int idx = m_pFormatContext->programs[i]->stream_index[j];
            AVStream *st = m_pFormatContext->streams[idx];
            if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->codec_info_nb_frames > 0) ||
                (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->sample_rate > 0))
            {
              nProgram = i;
              break;
            }
          }
        }

Is there any better way?

@FernetMenta
Copy link
Contributor

try moving this code to CDVDDemuxFFmpeg::CreateStreams. this method gets called after every streamchange.

@phunkyfish
Copy link
Member

@phunkyfish I will try to explore the openATV source to understand what's going on, and then report the bug. Can you point me where to look?

Afraid I don't know @joaoppp. With Enigma2 I usually post in the images forum and track down the component to report the bug in from there. I assume this would be a core issue.

@joaoppp
Copy link
Author

joaoppp commented Mar 29, 2019

@FernetMenta
What about replace this:

        // skip programs without or empty audio/video streams
        for (unsigned int i = 0; nProgram == UINT_MAX && i < m_pFormatContext->nb_programs; i++)
        {
          for (unsigned int j = 0; j < m_pFormatContext->programs[i]->nb_stream_indexes; j++)
          {
            int idx = m_pFormatContext->programs[i]->stream_index[j];
            AVStream *st = m_pFormatContext->streams[idx];
            if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->codec_info_nb_frames > 0) ||
                (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->sample_rate > 0))
            {
              nProgram = i;
              break;
            }
          }
        }

by this: (tested and working)

        // select the program of the first audio or video stream packet found (FIFO)
        AVStream *st;
        unsigned int maxpkts = 25;
        while (nProgram == UINT_MAX && maxpkts-- && (m_pkt.result = av_read_frame(m_pFormatContext, &m_pkt.pkt)) >= 0)
        {
          st = m_pFormatContext->streams[m_pkt.pkt.stream_index];
          if (st->codecpar && (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))
          {
            for (unsigned int i = 0; nProgram == UINT_MAX && i < m_pFormatContext->nb_programs; i++)
            {
              for (unsigned int j = 0; j < m_pFormatContext->programs[i]->nb_stream_indexes; j++)
              {
                if ((int)m_pFormatContext->programs[i]->stream_index[j] == m_pkt.pkt.stream_index)
                {
                  nProgram = i;
                  break;
                }
              }
            }
          }
          m_pkt.result = -1;
          av_packet_unref(&m_pkt.pkt);
        }
  • This method replaces a method that was not working because it required a prior avformat_find_stream_info(), that was not being done for mpegts.
  • This method is potentially faster to play the stream, because it will use a FIFO, first stream found will be the first to be used.
  • This method can avoid problems when potentially a stream can be described in the header but not receiving packets for that stream.

@joaoppp
Copy link
Author

joaoppp commented Mar 29, 2019

@phunkyfish I will try to explore the openATV source to understand what's going on, and then report the bug. Can you point me where to look?

Afraid I don't know @joaoppp. With Enigma2 I usually post in the images forum and track down the component to report the bug in from there. I assume this would be a core issue.

I will investigate this thanks.

@phunkyfish
Copy link
Member

@joaoppp have you tried transcoding yet?

@phunkyfish
Copy link
Member

phunkyfish commented Apr 26, 2019

I wonder is this the same issue as #208

So an MPTS stream, can you check if you can playback a recording from your STB?

@phunkyfish
Copy link
Member

@joaoppp?

@phunkyfish
Copy link
Member

@joaoppp are you still there?

phunkyfish added a commit to phunkyfish/pvr.vuplus that referenced this issue May 27, 2019
phunkyfish added a commit to phunkyfish/pvr.vuplus that referenced this issue May 27, 2019
@phunkyfish
Copy link
Member

Have created two PR's one for Leia (#230) and one for matrix (#229).

@joaoppp can you test either of these?

phunkyfish added a commit to phunkyfish/pvr.vuplus that referenced this issue May 27, 2019
phunkyfish added a commit to phunkyfish/pvr.vuplus that referenced this issue May 27, 2019
phunkyfish added a commit to phunkyfish/pvr.vuplus that referenced this issue May 27, 2019
phunkyfish added a commit to phunkyfish/pvr.vuplus that referenced this issue May 27, 2019
phunkyfish added a commit to phunkyfish/pvr.vuplus that referenced this issue May 28, 2019
phunkyfish added a commit to phunkyfish/pvr.vuplus that referenced this issue May 28, 2019
phunkyfish added a commit to phunkyfish/pvr.vuplus that referenced this issue Jun 6, 2019
phunkyfish added a commit to phunkyfish/pvr.vuplus that referenced this issue Jun 6, 2019
@phunkyfish
Copy link
Member

Closing, please see #237 for solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kodi issue Issue likely in kodi and not the addon
Projects
None yet
Development

No branches or pull requests

3 participants