X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?p=living-lab-site.git;a=blobdiff_plain;f=application%2Fhelpers%2Fvideo_helper.php;fp=application%2Fhelpers%2Fvideo_helper.php;h=aa7c3841c2dd8469234a50c2ef9e7e61bfa84d0a;hp=a172183f65d2c9ce592f2506da0b8916b3b03361;hb=141bdb84bf143c29a6c50eef3aee18541d2fc0e4;hpb=66dc2204a919e2c29b2aa9330ea18026d58540d9 diff --git a/application/helpers/video_helper.php b/application/helpers/video_helper.php index a172183..aa7c384 100644 --- a/application/helpers/video_helper.php +++ b/application/helpers/video_helper.php @@ -158,6 +158,7 @@ function get_av_info($file_name) . $file_name . '" 2> /dev/null', 'r'); $tag = NULL; + $codec_type = NULL; while ( ($r = fgets($h, 512)) !== FALSE) { @@ -175,10 +176,6 @@ function get_av_info($file_name) if ($tag == 'FORMAT') { - // Duration - if (preg_match('/^duration=/', $r)) - $duration = format_duration(floatval(_parse_value($r))); - // Size if (preg_match('/^size=/', $r)) $size = intval(_parse_value ($r)); @@ -197,6 +194,15 @@ function get_av_info($file_name) // DAR if (preg_match('/^display_aspect_ratio=/', $r)) $dar = _parse_value($r); + + // Codec Type + if (preg_match('/^codec_type=/', $r)) + $codec_type = _parse_value($r); + + // Duration + if (preg_match('/^duration=/', $r) + && strcmp($codec_type, 'video') == 0) + $duration = format_duration(floatval(_parse_value($r))); } } @@ -261,19 +267,19 @@ function prepare_formats($formats, $av_info, $elim_dupl_res=FALSE) } // Eliminate formats with duplicate resolutions. - if ($elim_dupl_res) - { - for ($i = 1; $i < count($transcode_configs); $i++) - { - if ($transcode_configs[$i]['v_resolution'] - === $transcode_configs[$i - 1]['v_resolution']) - { - unset($transcode_configs[$i - 1]); - unset($db_formats[$i - 1]); - $i--; - } - } - } +// if ($elim_dupl_res) +// { +// for ($i = 1; $i < count($transcode_configs); $i++) +// { +// if ($transcode_configs[$i]['v_resolution'] +// === $transcode_configs[$i - 1]['v_resolution']) +// { +// unset($transcode_configs[$i - 1]); +// unset($db_formats[$i - 1]); +// $i--; +// } +// } +// } return array('transcode_configs'=>$transcode_configs, 'db_formats'=>$db_formats);