<div dir="ltr"><div><div><div>Thanks for hanging in there with me Stephen. I have actually been trying to hack something together, but my c++ is rusty and I'm not too familiar with the Qt framework... My latest attempt was to try and get the http status and redefine the url variable if the status code is 302.<br><br>From mythtv/mythtv/libs/libmythtv/recorders/httptsstreamhandler.cpp starting at line 133<br><br>Original:<br><br>    // the HTTP request<br>    m_replylock.lock();<br>    m_reply = m_mgr.get(QNetworkRequest(url));<br>    m_replylock.unlock();<br><br>Changes:<br><br> // the HTTP request<br>    m_replylock.lock();<br>    m_reply = m_mgr.get(QNetworkRequest(url));<br>    m_replyStatus = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);<br>    if (m_replyStatus == 302)<br>        {<br>            const QUrl url = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();<br>        }<br>    m_replylock.unlock();<br><br><br></div>The code compiles, but it is still not using the redirected URL as far as I can tell. I am going to keep hacking away tomorrow, but if you have any suggestions I am open to them.<br><br></div>Thanks,<br></div>Dave<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 14, 2016 at 11:48 PM, Stephen Worthington <span dir="ltr"><<a href="mailto:stephen_agent@jsw.gen.nz" target="_blank">stephen_agent@jsw.gen.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, 14 Jun 2016 18:05:27 -0400, you wrote:<br>
<br>
>On Tue, Jun 14, 2016 at 2:52 PM, Stephen Worthington <<br>
><a href="mailto:stephen_agent@jsw.gen.nz">stephen_agent@jsw.gen.nz</a>> wrote:<br>
><br>
>> On Tue, 14 Jun 2016 12:24:03 -0400, you wrote:<br>
>><br>
>> >Basically, I am trying to use mythbackend as a PVR for a paid IPTV<br>
>> service,<br>
>> >but the back end fails to stream any data from the URL.<br>
>> ><br>
>> >I used mythtv-setup to create an IPTV capture card using an m3u file with<br>
>> >the following format:<br>
>> ><br>
>> >#EXTM3U<br>
>> >#EXTINF:-1,300 - ANIMAL PLANET HD<br>
>> >#EXTMYTHTV:xmltvid=57394<br>
>> ><a href="http://2.welcm.tv:8000/live/xxx@xyz.com/xxxpasswordxxx/5010.ts" rel="noreferrer" target="_blank">http://2.welcm.tv:8000/live/xxx@xyz.com/xxxpasswordxxx/5010.ts</a><br>
>> ><br>
>> ><br>
>> >I successfully added the channels and program data and can see the<br>
>> channels<br>
>> >and program data on my Kodi front end as well as in Mythweb.<br>
>> ><br>
>> >However, when I go to watch a channel live or record a program, I am not<br>
>> >getting any data streaming into the buffers. I set the timeout for the<br>
>> card<br>
>> >to 60000 ms, but it appears to only attempt the connection for a few<br>
>> >seconds at most. I can open the URLs just fine in VLC and the video starts<br>
>> >to play in just a few seconds.<br>
>> ><br>
>> >Here is a snippet from the back end log using --setverbose channel,record<br>
>> >and --setloglevel debug:<br>
>> ><br>
>> >2016-06-13 18:25:08.621845 I [5221/5743] StreamHandler<br>
>> >recorders/httptsstreamhandler.cpp:137 (DownloadStream) - HTTPReader(<br>
>> ><a href="http://2.welcm.tv:8000/live/xxx@xyz.com/xxxpasswordxxx/4649.ts" rel="noreferrer" target="_blank">http://2.welcm.tv:8000/live/xxx@xyz.com/xxxpasswordxxx/4649.ts</a>):<br>
>> >DownloadStream -- begin<br>
>> >2016-06-13 18:25:08.938128 I [5221/5743] StreamHandler<br>
>> >recorders/httptsstreamhandler.cpp:179 (DownloadStream) - HTTPReader(<br>
>> ><a href="http://2.welcm.tv:8000/live/xxx@xyz.com/xxxpasswordxxx/4649.ts" rel="noreferrer" target="_blank">http://2.welcm.tv:8000/live/xxx@xyz.com/xxxpasswordxxx/4649.ts</a>):<br>
>> >DownloadStream -- end<br>
>> >2016-06-13 18:25:08.938189 I [5221/5743] StreamHandler<br>
>> >recorders/httptsstreamhandler.cpp:114 (run) - HTTPTSSH(<br>
>> ><a href="http://2.welcm.tv:8000/live/xxx@xyz.com/xxxpasswordxxx/4649.ts" rel="noreferrer" target="_blank">http://2.welcm.tv:8000/live/xxx@xyz.com/xxxpasswordxxx/4649.ts</a>):<br>
>> >DownloadStream failed to receive bytes from<br>
>> ><a href="http://2.welcm.tv:8000/live/xxx@xyz.com/xxxpasswordxxx/4649.ts" rel="noreferrer" target="_blank">http://2.welcm.tv:8000/live/xxx@xyz.com/xxxpasswordxxx/4649.ts</a><br>
>> ><br>
>> >More from the same log: <a href="http://pastebin.com/4kFuWnxR" rel="noreferrer" target="_blank">http://pastebin.com/4kFuWnxR</a><br>
>> ><br>
>> >You can see that the entire attempt to stream the data only lasts a few<br>
>> >seconds. I thought that maybe the '@' symbol was causing an issue so I<br>
>> >tried to escape it using '\@', but it resulted in the same behavior.<br>
>> ><br>
>> >Here is mediainfo output from a sample stream I pulled through VLC:<br>
>> ><a href="http://pastebin.com/DCEUCbq7" rel="noreferrer" target="_blank">http://pastebin.com/DCEUCbq7</a><br>
>> ><br>
>> >I initially tried this setup on 0.27/fixes and encountered the same issue<br>
>> >so I did a fresh compile of 0.28/fixes and deleted/re-created the IPTV<br>
>> >tuner and sources to the same end.<br>
>> ><br>
>> >Here is my mythbackend version:<br>
>> ><br>
>> >MythTV Version : v0.28-35-g812ec08<br>
>> >MythTV Branch : fixes/0.28<br>
>> >Network Protocol : 88<br>
>> >Library API : 0.28.20160309-1<br>
>> >QT Version : 5.6.0<br>
>> >Options compiled in:<br>
>> > linux release use_hidesyms using_alsa using_oss using_pulse<br>
>> >using_pulseoutput using_backend using_bindings_perl using_bindings_python<br>
>> >using_bindings_php using_crystalhd using_dvb using_frontend<br>
>> using_hdhomerun<br>
>> >using_vbox using_ceton using_hdpvr using_ivtv using_joystick_menu<br>
>> >using_libcec using_libcrypto using_libdns_sd using_libxml2 using_lirc<br>
>> >using_mheg using_opengl using_opengl_video using_qtwebkit using_qtscript<br>
>> >using_qtdbus using_taglib using_v4l2 using_x11 using_xrandr using_xv<br>
>> >using_systemd_notify using_bindings_perl using_bindings_python<br>
>> >using_bindings_php using_freetype2 using_mythtranscode using_opengl<br>
>> >using_vaapi using_vdpau using_ffmpeg_threads using_mheg using_libass<br>
>> >using_libxml2<br>
>> ><br>
>> >It seems like the back end is *trying* to open the stream, but it doesn't<br>
>> >like what it is seeing so my initial thoughts were that it either doesn't<br>
>> >like the URL format, or that it is receiving data that it isn't<br>
>> expecting...<br>
>> ><br>
>> >Should this setup theoretically work? Is there a way to get more debugging<br>
>> >into to determine why the stream isn't opening?<br>
>> ><br>
>> >Any ideas are appreciated.<br>
>> ><br>
>> >Thanks,<br>
>> ><br>
>> >Dave<br>
>><br>
>> You can run Wireshark on the MythTV box to capture the traffic on port<br>
>> 8000 and see exactly what mythbackend is doing with its connection<br>
>> attempt.  And do the same with VLC and see what is different.<br>
<br>
>Thanks for the brilliant suggestion Stephen... I did run a wireshark<br>
>capture for both mythbackend and VLC. This is my first time using wireshark<br>
>so my analysis of the captures is very rudimentary. However, I did notice<br>
>that the mythbackend issued several GET requests for the URL and basically<br>
>nothing happened.  On the other hand, when VLC issued a GET request there<br>
>was a URL redirection (HTTP 302) and another URL which was followed by<br>
>another GET request to what looks like a dynamically created URL with a<br>
>hash value and a time stamp. It looks like mythbackend is failing, or at<br>
>least not getting the anticipated data returned when the stream is<br>
>requested. I could post the captures for comparison if anyone thinks that<br>
>would help, but I'm not sure how to save it as a text file.<br>
><br>
>Is there a way to tell the IPTV recorder to follow URL redirects or perhaps<br>
>some URL pre-processing to get the "final" URL to the capture card? I hope<br>
>I am not dead in the water on this one... Any ideas?<br>
<br>
</div></div>Anyone with Wireshark can read the original capture files, which is<br>
usually better than a text post anyway as you can do filtering and so<br>
on.  So it is better to post those if you have a place to post them<br>
on.  I just use my personal web server.  If there is extraneous data<br>
in a captured file, you can use a Wireshark filter (eg select one<br>
packet from the ones you want and do Analyze / Conversation Filter /<br>
TCP on it so that you only get the relevant TCP packets), then File /<br>
Export specified packets to save only those packets.<br>
<br>
>From your description, it looks like mythbackend does not have any<br>
code to handle 302 redirections, so for the moment, you may be out of<br>
luck getting it to work (unless you are up to adding that code<br>
yourself).  It is possible to download the MythTV source code and see<br>
what it does and does not do.  It is unlikely to be a major project to<br>
handle redirections - if you are really lucky, it will just be turning<br>
on the option to do redirections in a library call.  I did a quick<br>
browse of my copy of mythtv-trunk and the code for http streaming<br>
seems to be in mythtv/libs/libmythtv/recorders/httptsstreamhandler.*,<br>
but I have not had time to look at how it works yet.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
mythtv-users mailing list<br>
<a href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br>
<a href="http://lists.mythtv.org/mailman/listinfo/mythtv-users" rel="noreferrer" target="_blank">http://lists.mythtv.org/mailman/listinfo/mythtv-users</a><br>
<a href="http://wiki.mythtv.org/Mailing_List_etiquette" rel="noreferrer" target="_blank">http://wiki.mythtv.org/Mailing_List_etiquette</a><br>
MythTV Forums: <a href="https://forum.mythtv.org" rel="noreferrer" target="_blank">https://forum.mythtv.org</a><br>
</div></div></blockquote></div><br></div>