Ticket #8206: pseudostreaming.4.patch

File pseudostreaming.4.patch, 4.2 KB (added by Vitold <vitold.md@…>, 14 years ago)
  • modules/stream/handler.pl

    diff -ur mythweb_ori/modules/stream/handler.pl mythweb/modules/stream/handler.pl
    old new  
    3030    elsif ($ENV{'REQUEST_URI'} =~ /\.flvp$/i) {
    3131        require "modules/$Path[0]/stream_flvp.pl";
    3232    }
    33     elsif ($ENV{'REQUEST_URI'} =~ /\.flv$/i) {
     33    elsif ($ENV{'REQUEST_URI'} =~ /\.flv\?.+$/i) {
    3434        require "modules/$Path[0]/stream_flv.pl";
    3535    }
    3636# Mpeg4?
  • modules/stream/stream_flv.pl

    diff -ur mythweb_ori/modules/stream/stream_flv.pl mythweb/modules/stream/stream_flv.pl
    old new  
    2929    }
    3030    sub shutdown_handler {
    3131        kill(1, $ffmpeg_pid) if ($ffmpeg_pid);
    32         kill(-1, $ffmpeg_pgid) if ($ffmpeg_pid);
     32
     33        # this cause an internal server error
     34        # kill(-1, $ffmpeg_pgid) if ($ffmpeg_pid);
    3335    }
    3436
    3537# Find ffmpeg
     
    7274    $vbitrate = 256 unless ($vbitrate && $vbitrate > 1);
    7375    $abitrate = 64  unless ($abitrate && $abitrate > 1);
    7476
     77    if ("$ENV{'REQUEST_URI'}" =~ /start\=(\d+)$/i) {
     78            $start = $1; }
     79    else {
     80            $start = 0; }
     81
    7582    my $ffmpeg_command = $ffmpeg
    7683                        .' -y'
     84                        .' -ss '.shell_escape("$start")
    7785                        .' -i '.shell_escape($filename)
    7886                        .' -s '.shell_escape("${width}x${height}")
    7987                        .' -g 30'
     
    98106    $dur = `ffmpeg -i $filename 2>&1 | grep "Duration" | cut -d ' ' -f 4 | sed s/,//`;
    99107    if ($dur && $dur =~ /\d*:\d*:.*/) {
    100108        @times = split(':',$dur);
    101         $lengthSec = $times[0]*3600+$times[1]*60+$times[2];
     109        $lengthSec = ($times[0]*3600+$times[1]*60+$times[2])-$start;
    102110        $size = int($lengthSec*($vbitrate*1000+$abitrate*1000)/8);
    103111        print header(-type => 'video/x-flv','Content-Length' => $size);
    104112    } else {
    105113        print header(-type => 'video/x-flv');
    106114    }
    107115
     116
     117
     118
    108119    my $buffer;
    109120    if (read DATA, $buffer, 53) {
    110121        print $buffer;
  • modules/tv/tmpl/default/detail.php

    diff -ur mythweb_ori/modules/tv/tmpl/default/detail.php mythweb/modules/tv/tmpl/default/detail.php
    old new  
    554554            <script>
    555555                flowplayer(
    556556                    "player",
    557                     "<?php echo root_url ?>tv/flowplayer-3.1.1.swf", {
     557                    "<?php echo root_url ?>tv/flowplayer-3.1.5.swf", {
    558558                    playlist: [
    559559                        // this first PNG clip works as a splash image
    560560                        {
     
    563563                            },
    564564                        // Then we have the video
    565565                        {
     566                            provider: "pseudo",
    566567                            url: "<?php echo video_url($program, 'flv'); ?>",
    567568                            duration: <?php echo $program->length ?>,
    568569                            autoPlay: false,
     
    571572                            // waste bandwidth and CPU on the remote machine.
    572573                            autoBuffering: false
    573574                            }
    574                         ]}
     575                     
     576                    ],
     577                    plugins: { 
     578                        pseudo: {
     579                            url: "flowplayer.mythpseudostreaming.swf"
     580                        }
     581                    }
     582                    }
     583
    575584                    );
    576585            </script>
    577586<?php       } elseif (file_exists('modules/tv/MFPlayer.swf')) { ?>
     
    689698<?php   } else { ?>
    690699                <a href="<?php echo $program->url ?>" title="<?php echo t('Direct Download') ?>"
    691700                    ><img src="<?php echo $program->thumb_url($flv_w,0) ?>" width="<?php echo $flv_w ?>"></a>
    692 <?php   } ?></td>
     701<?php   } ?>
    693702            </div>
    694703            <div class="x-links">
    695704                <a href="<?php echo video_url($program, 'asx') ?>" title="<?php echo t('ASX Stream') ?>"