Sign up here and you can log into the forum!

HD Homerun streaming problem[SOLVED}

Discussion, features, plugins--everything about zoster's UMSP UPnP Media Server software

Re: HD Homerun streaming problem[SOLVED}   

Postby BigBreaker » Wed Oct 13, 2010 5:57 am

I would be interested in a "baked" solution to this as well. Ideally a media server would be recording the streams so that you can time shift and that media server would host, not the HD Homerun directly. Still, it would be nice to be able to pick up the live stream for things like sports that are more fun in real-time.
BigBreaker
WDTVer
 
Posts: 25
Joined: Fri May 14, 2010 5:33 am

Re: HD Homerun streaming problem[SOLVED}   

Postby PaulF » Sat Oct 16, 2010 10:13 pm

I gave up on my "solution" a while back when it kept hanging my router so bad that I had to power cycle it. I have a new router so I will try again. If it works with the new router, I guess I should bundle the hdhr_config and udpxy with scripts into an app.bin. I'm not sure how to do app.bins(including where to upload them). More later.

The ideal solution would be porting the hdhr_config C code to PHP and figuring out how to do an HTTP interface/proxy to a UDP streamer without having to use udpxy.
User avatar
PaulF
Developer
 
Posts: 427
Joined: Sat May 08, 2010 8:34 pm
Location: Oregon

Re: HD Homerun streaming problem[SOLVED}   

Postby PaulF » Mon Oct 18, 2010 8:46 pm

I got the HDHR working with cable clear QAM. SD works fine, but HD has sound, but no picture. I am posting my code(copied mostly from the IPTV thread) hoping for help. I left a lot of debug code in and commented out the debug file dump code.

First run the HDHR setup on you PC and edit the Guide Names and Numbers to taste, click apply. The Quick TV program line up looks like it will appear on the WDTV. Next copy the line up xml to your WDTV stick as hdhomerun.xml. My xml is here:
Code: Select all
C:\Documents and Settings\All Users\Application Data\Silicondust\HDHomeRun\Digital Cable.xml


Copy udpxy.app.bin to your WDTV stick.

S00custom-options
Code: Select all
mkdir -p /tmp/stick
mount /dev/sda1 /tmp/stick


/conf/umsp.php
Code: Select all
        $myMediaItems[] = array(   
            'id'         => 'umsp://plugins/hdhomerun?channel_list=/tmp/stick/hdhomerun.xml',
            'parentID'   => '0',
            'restricted' => '1',
            'dc:title'   => 'HDHR Streams',
            'upnp:class' => 'object.container',
        );

hdhomerun.php
Code: Select all
<?php
function dump_var($prmName = null, $prmFile = '/tmp/umsp-log.txt'){
    ob_start();   
    foreach($prmName as $key => $value){
        printf("[%s] DUMP of hdhomerun.php \$$key\n", date('H:i:s'));       
        var_dump($value);
    }
    $content = ob_get_contents();   
    ob_end_clean();   
    #Uncomment lines for debug   
    #$myFile = $prmFile;
    #$fh = fopen($myFile, 'a') or die();
    #fwrite($fh, $content . "\r\n");
    #fclose($fh);
}


function _pluginMain($prmQuery) {
    dump_var(compact('prmQuery'));
    $queryData = array();
    parse_str($prmQuery, $queryData);
    if ($queryData['channel_list'] !='') {
        $items = _pluginChannelList($queryData['channel_list']);
        return $items;
    }
    return NULL;
}

function cmp($a, $b)
{
    $anum = explode(' ', $a['dc:title']);
    $bnum = explode(' ', $b['dc:title']);
    return ( $anum[0] < $bnum[0] ? -1 : 1 ); #sort by title's unique guide number
}

function _pluginChannelList($prmFeedList) {
    $command = 'hdhomerun_config FFFFFFFF set /tuner1/channel none';
    $commandresult = exec($command);
    dump_var(compact('command','commandresult'));
    dump_var(compact('prmFeedList'));
    $feedlistXML = file_get_contents($prmFeedList);
    $simplexml = new SimpleXMLElement($feedlistXML);
    dump_var(compact('simplexml'));
    foreach ($simplexml->Program as $program) {
        if((string)$program->Enabled == 'true'){
            $url = sprintf('http://localhost:4080/rtp/239.255.1.1:%s', (string)$program->ProgramNumber + 50000);
            $param_string = 'freq=' . (string)$program->Frequency .
                '&amp;prog=' . (string)$program->ProgramNumber .
                '&amp;itemurl=' . $url;
            $MediaItems[] = array (
            'id'                => 'umsp://plugins/hdhomerun?' . $url,
            'dc:title'          =>  sprintf('%-4s%s',(string)$program->GuideNumber, (string)$program->Name),
            'res'               => 'http://127.0.0.1/umsp/plugins/hdhomerun-proxy.php?'. $param_string,
            'upnp:class'        => 'object.item.videoItem',
            'protocolInfo'      => 'http-get:*:*:*',
            );
        }
    }
    usort($MediaItems, "cmp");
    dump_var(compact('MediaItems'));
    return $MediaItems;
} # end function

?>

hdhomerun-proxy.php
Code: Select all
<?php
function dump_var($prmName = null, $prmFile = '/tmp/umsp-log.txt'){
    ob_start();   
    foreach($prmName as $key => $value){
        printf("[%s] DUMP of hdhomerun-proxy.php \$$key\n", date('H:i:s'));
        var_dump($value);
    }
    $content = ob_get_contents();   
    ob_end_clean();   
    #Uncomment lines for debug
    $myFile = $prmFile;
    $fh = fopen($myFile, 'a') or die();
    fwrite($fh, $content . "\r\n");
    fclose($fh);
}


$itemProgram = $_GET['prog'];
$itemFrequency = $_GET['freq'];
$rawURL = $_GET['itemurl'];
dump_var(compact('itemProgram','itemFrequency','','rawURL'));

$command = 'hdhomerun_config FFFFFFFF set /tuner1/channel auto:' . $itemFrequency;
$commandresult = exec($command);
dump_var(compact('command','commandresult'));

$command = 'hdhomerun_config FFFFFFFF set /tuner1/program ' . $itemProgram;
$commandresult = exec($command);
dump_var(compact('command','commandresult'));

$command = sprintf('hdhomerun_config FFFFFFFF set /tuner1/target rtp://239.255.1.1:%s', $itemProgram + 50000);
$commandresult = exec($command);
dump_var(compact('command','commandresult'));

$parsedURL = parse_url($rawURL);
$itemHost = $parsedURL['host'];
if(isset($parsedURL['query'])){
    $itemPath = $parsedURL['path'].'?'. $parsedURL['query'];
} else {
    $itemPath = $parsedURL['path'];
}
$itemPort = $parsedURL['port'];

_http_streamGet($itemHost, ($itemPath ? $itemPath : "/"), ($itemPort ? $itemPort : 80));

function _http_streamGet($prmHost, $prmPath, $prmPort) {
   
   dump_var(compact('prmHost','prmPath','prmPort'));
   $fp = fsockopen($prmHost, $prmPort, $errno, $errstr, 30);
   if (!$fp) {
      dump_var(compact('errstr','errno'));
   } else {
      $out  = "GET ". $prmPath ." HTTP/1.1" ."\r\n";
      $out .= "User-Agent: Wget/1.12 (elf)" ."\r\n";
      $out .= "Host: " . $prmHost . "\r\n";
      $out .= "Cache-Control: no-cache" ."\r\n";
      $out .= "Connection: Close"."\r\n"."\r\n";
      fwrite($fp, $out);     
      dump_var(compact('fp'));
      dump_var(compact('out'));
      $headerpassed = false;
      while ($headerpassed == false) {
         $line = fgets($fp);
         dump_var(compact('line'));
         list($tag, $value) = explode(": ", $line, 2);
         
         if (stristr($tag, 'Location')) {
            $target_url = trim($value);
            $url_data_string = http_build_query(array('itemurl' => $target_url));
            header("Location: http://127.0.0.1/umsp/plugins/hdhomerun-proxy.php?".$url_data_string);
            continue;
         }
         if (trim($line) == "") {
            $headerpassed = true;
            header("Content-Type: video/mpeg");
            header("Content-Size: 65535");
            header("Content-Length: 65535");
         }
         header($line);
      }
      dump_var(compact('fp'));
      fpassthru($fp);
      dump_var(compact('fp'));
      fclose($fp);
   }
}

?>


Good luck. Any comment or suggestions welcome. I especially would like to know why the udpxy is needed when the WDTV lists UDP and RTP as stream types it accepts directly.
User avatar
PaulF
Developer
 
Posts: 427
Joined: Sat May 08, 2010 8:34 pm
Location: Oregon

Re: HD Homerun streaming problem[SOLVED}   

Postby jm9 » Tue Oct 26, 2010 7:48 am

PaulF wrote:I got the HDHR working with cable clear QAM. SD works fine, but HD has sound, but no picture.

You didn't happen to try this with ATSC broadcasts, did you?

Code: Select all
$url = sprintf('http://localhost:4080/rtp/239.255.1.1:%s', (string)$program->ProgramNumber + 50000);

where did this IP address (239.255.1.1) come from?
jm9
WDTVer
 
Posts: 25
Joined: Tue Sep 21, 2010 8:51 am

Re: HD Homerun streaming problem[SOLVED}   

Postby PaulF » Mon Nov 01, 2010 10:28 pm

jm9 wrote:
PaulF wrote:I got the HDHR working with cable clear QAM. SD works fine, but HD has sound, but no picture.

You didn't happen to try this with ATSC broadcasts, did you?

Code: Select all
$url = sprintf('http://localhost:4080/rtp/239.255.1.1:%s', (string)$program->ProgramNumber + 50000);

where did this IP address (239.255.1.1) come from?
I haven't tried ATSC. I just copied the most of the code from the IPTV thread. 239.255.1.1 is the multicast group address, what ever that is. uppxy listens on localhost:4080. udpxy has an web i/f at <wdtivelive address>:4080/status that explains your question.
User avatar
PaulF
Developer
 
Posts: 427
Joined: Sat May 08, 2010 8:34 pm
Location: Oregon

Re: HD Homerun streaming problem[SOLVED}   

Postby jm9 » Mon Nov 15, 2010 1:10 pm

Well, that is one problem: while the HDHomeRun will multicast, it will take down a network if the network is not set up to handle it. If you are getting SD but not HD, Your HD content is taking down your network because it is being distributed as multicast.

Make these changes and see what happens:
Code: Select all
$url = sprintf('http://localhost:4080/rtp/[hdhomerun address]:%s',


Code: Select all
$command = sprintf('hdhomerun_config FFFFFFFF set /tuner1/target rtp://[wdtv live address]:%s',


I'll load up the ext3 firmware at some point and change everything to unicast and see if I can get it working for broadcast.
jm9
WDTVer
 
Posts: 25
Joined: Tue Sep 21, 2010 8:51 am

Re: HD Homerun streaming problem[SOLVED}   

Postby PaulF » Tue Nov 16, 2010 3:08 pm

jm9 wrote:Well, that is one problem: while the HDHomeRun will multicast, it will take down a network if the network is not set up to handle it. If you are getting SD but not HD, Your HD content is taking down your network because it is being distributed as multicast.

Make these changes and see what happens:
Code: Select all
$url = sprintf('http://localhost:4080/rtp/[hdhomerun address]:%s',


Code: Select all
$command = sprintf('hdhomerun_config FFFFFFFF set /tuner1/target rtp://[wdtv live address]:%s',


I'll load up the ext3 firmware at some point and change everything to unicast and see if I can get it working for broadcast.
That did not work at all. I had tried going the direct route a long time ago and switched to udpxy that does multicasting only. The hdhomerun can write to a file. I may try writing to a pipe and then having the USMP serve the pipe as a file.
User avatar
PaulF
Developer
 
Posts: 427
Joined: Sat May 08, 2010 8:34 pm
Location: Oregon

Re: HD Homerun streaming problem[SOLVED}   

Postby nastero » Wed Dec 22, 2010 12:40 am

Where can I find the link to download the udpxy.app.bin? I have the HDHR and would like to test this with the wdtv live.
nastero
n00b
 
Posts: 3
Joined: Wed Nov 10, 2010 5:56 pm

Re: HD Homerun streaming problem[SOLVED}   

Postby malahal » Fri Jun 03, 2011 12:18 am

nastero wrote:Where can I find the link to download the udpxy.app.bin? I have the HDHR and would like to test this with the wdtv live.


Any more progress on this one? I have got a hdhomerun tuner and would like to view the live stream. I could record scheduled streams using wdtv live box, but would love to watch live TV!
malahal
n00b
 
Posts: 15
Joined: Sat Oct 09, 2010 6:45 am

Re: HD Homerun streaming problem[SOLVED}   

Postby LAYGO » Sun Oct 07, 2012 4:35 pm

I wonder if there ever was any resolution to this? I'd like to see the WDTV used like a DVR without my desktop needing to be powered up.
LAYGO
n00b
 
Posts: 7
Joined: Sat Nov 05, 2011 1:45 pm

Previous

Return to UMSP Media Server

Who is online

Users browsing this forum: No registered users and 1 guest