Ticket #9266: mythweb-streaming_aspect_fix.patch
File mythweb-streaming_aspect_fix.patch, 4.6 KB (added by , 13 years ago) |
---|
-
branches/release-0-24-fixes/mythplugins/mythweb/tv/classes/Program.php
788 788 789 789 public function getAspect() { 790 790 global $db; 791 $aspect = $db->query_col('SELECT recordedmarkup.type 791 $sh = $db->query('SELECT recordedmarkup.data FROM recordedmarkup WHERE recordedmarkup.chanid=? AND recordedmarkup.starttime=FROM_UNIXTIME(?) AND (recordedmarkup.type=30 OR recordedmarkup.type=31) AND recordedmarkup.data AND (recordedmarkup.mark=0 OR recordedmarkup.mark=1) IS NOT NULL ORDER BY recordedmarkup.type', $this->chanid, $this->recstartts); 792 $x = $sh->fetch_col(); # type = 30 793 if( $x) $y = $sh->fetch_col(); # type = 31 794 795 if( $x && $y && $x > 720 ) 796 { 797 return $x/$y; 798 } 799 else 800 { 801 $aspect = $db->query_col('SELECT recordedmarkup.type 792 802 FROM recordedmarkup 793 803 WHERE recordedmarkup.chanid = ? 794 804 AND recordedmarkup.starttime = FROM_UNIXTIME(?) … … 805 815 $this->chanid, 806 816 $this->recstartts 807 817 ); 808 switch($aspect) { 809 case 10: 810 return 1; 811 case 11: 812 return 4/3; 813 case 12: 814 return 16/9; 815 case 13: 816 return 2.21/1; 817 case 14: 818 return 4/3; 819 default: 820 return 4/3; 821 } 818 switch($aspect) { 819 case 10: 820 return 1; 821 case 11: 822 return 4/3; 823 case 12: 824 return 16/9; 825 case 13: 826 return 2.21/1; 827 case 14: 828 return 4/3; 829 default: 830 return 4/3; 831 } 832 } 822 833 } 823 834 824 835 } -
branches/release-0-24-fixes/mythplugins/mythweb/stream/stream_flv.pl
55 55 my ($abitrate) = $sh->fetchrow_array; 56 56 $sh->finish(); 57 57 # auto-detect height based on aspect ratio 58 $sh = $dbh->prepare('SELECT data FROM recordedmarkup WHERE chanid=? AND starttime=FROM_UNIXTIME(?) AND (type=30 OR type=31) AND mark=0AND data IS NOT NULL ORDER BY type');58 $sh = $dbh->prepare('SELECT data FROM recordedmarkup WHERE chanid=? AND starttime=FROM_UNIXTIME(?) AND (type=30 OR type=31) AND (mark=0 OR mark=1) AND data IS NOT NULL ORDER BY type'); 59 59 $sh->execute($chanid,$starttime); 60 60 $x = $sh->fetchrow_array; # type = 30 61 61 $y = $sh->fetchrow_array if ($x); # type = 31 62 62 $width = round_even($width); 63 if ($x && $y) { 64 $height = round_even($width * ($y/$x)); 65 } else { 66 $height = round_even($width * 3/4); 63 64 if (!$x || !$y || $x <= 720) { # <=720 means SD 65 $sh->finish(); 66 $sh = $dbh->prepare('SELECT recordedmarkup.type 67 FROM recordedmarkup 68 WHERE recordedmarkup.chanid = ? 69 AND recordedmarkup.starttime = FROM_UNIXTIME(?) 70 AND recordedmarkup.type IN (10, 11, 12, 13, 14) 71 GROUP BY recordedmarkup.type 72 ORDER BY SUM((SELECT IFNULL(rm.mark, recordedmarkup.mark) 73 FROM recordedmarkup AS rm 74 WHERE rm.chanid = recordedmarkup.chanid 75 AND rm.starttime = recordedmarkup.starttime 76 AND rm.type IN (10, 11, 12, 13, 14) 77 AND rm.mark > recordedmarkup.mark 78 ORDER BY rm.mark ASC LIMIT 1)- recordedmarkup.mark) DESC 79 LIMIT 1' 80 ); 81 $sh->execute($chanid,$starttime); 82 $aspect = $sh->fetchrow_array; 83 84 if( $aspect == 10 ) { 85 $x = $y = 1; 86 } elsif( $aspect == 11 ) { 87 $x = 4; $y = 3; 88 } elsif( $aspect == 12 ) { 89 $x = 16; $y = 9; 90 } elsif( $aspect == 13 ) { 91 $x = 2.21; $y = 1; 92 } elsif( $aspect == 14 ) { 93 $x = 4; $y = 3; 94 } else { 95 $x = 4; $y = 3; 96 } 67 97 } 98 $height = round_even($width * ($y/$x)); 68 99 $sh->finish(); 69 100 70 101 $width = 320 unless ($width && $width > 1);