fourccLookup example

if (isset($trackarray['PixelCropTop']))    { $track_info['crop_top']    = $trackarray['PixelCropTop']}
                        if (isset($trackarray['PixelCropLeft']))   { $track_info['crop_left']   = $trackarray['PixelCropLeft']}
                        if (isset($trackarray['PixelCropRight']))  { $track_info['crop_right']  = $trackarray['PixelCropRight']}
                        if (isset($trackarray['DefaultDuration'])) { $track_info['frame_rate']  = round(1000000000 / $trackarray['DefaultDuration'], 3)}
                        if (isset($trackarray['CodecName']))       { $track_info['codec']       = $trackarray['CodecName']}

                        switch ($trackarray['CodecID']) {
                            case 'V_MS/VFW/FOURCC':
                                getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);

                                $parsed = getid3_riff::ParseBITMAPINFOHEADER($trackarray['CodecPrivate']);
                                $track_info['codec'] = getid3_riff::fourccLookup($parsed['fourcc']);
                                $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed;
                                break;

                            /*case 'V_MPEG4/ISO/AVC': $h264['profile'] = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 1, 1)); $h264['level'] = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 3, 1)); $rn = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 4, 1)); $h264['NALUlength'] = ($rn & 3) + 1; $rn = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 5, 1)); $nsps = ($rn & 31); $offset = 6; for ($i = 0; $i < $nsps; $i ++) { $length = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 2)); $h264['SPS'][] = substr($trackarray['CodecPrivate'], $offset + 2, $length); $offset += 2 + $length; } $npps = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 1)); $offset += 1; for ($i = 0; $i < $npps; $i ++) { $length = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 2)); $h264['PPS'][] = substr($trackarray['CodecPrivate'], $offset + 2, $length); $offset += 2 + $length; } $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $h264; break;*/
$thisfile_riff_raw_strh_current['wLanguage']             = $this->EitherEndian2Int(substr($strhData, 14, 2));
                                            $thisfile_riff_raw_strh_current['dwInitialFrames']       = $this->EitherEndian2Int(substr($strhData, 16, 4));
                                            $thisfile_riff_raw_strh_current['dwScale']               = $this->EitherEndian2Int(substr($strhData, 20, 4));
                                            $thisfile_riff_raw_strh_current['dwRate']                = $this->EitherEndian2Int(substr($strhData, 24, 4));
                                            $thisfile_riff_raw_strh_current['dwStart']               = $this->EitherEndian2Int(substr($strhData, 28, 4));
                                            $thisfile_riff_raw_strh_current['dwLength']              = $this->EitherEndian2Int(substr($strhData, 32, 4));
                                            $thisfile_riff_raw_strh_current['dwSuggestedBufferSize'] = $this->EitherEndian2Int(substr($strhData, 36, 4));
                                            $thisfile_riff_raw_strh_current['dwQuality']             = $this->EitherEndian2Int(substr($strhData, 40, 4));
                                            $thisfile_riff_raw_strh_current['dwSampleSize']          = $this->EitherEndian2Int(substr($strhData, 44, 4));
                                            $thisfile_riff_raw_strh_current['rcFrame']               = $this->EitherEndian2Int(substr($strhData, 48, 4));

                                            $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strh_current['fccHandler']);
                                            $thisfile_video['fourcc']             = $thisfile_riff_raw_strh_current['fccHandler'];
                                            if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) {
                                                $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']);
                                                $thisfile_video['fourcc']             = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'];
                                            }
                                            $thisfile_video['codec']              = $thisfile_riff_video_current['codec'];
                                            $thisfile_video['pixel_aspect_ratio'] = (float) 1;
                                            switch ($thisfile_riff_raw_strh_current['fccHandler']) {
                                                case 'HFYU': // Huffman Lossless Codec                                                 case 'IRAW': // Intel YUV Uncompressed                                                 case 'YUY2': // Uncompressed YUV 4:2:2
if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
                            foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
                                if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
                                    $thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate'];
                                    $thisfile_video['streams'][$streamnumber]['bitrate'] = $dataarray['bitrate'];
                                    $thisfile_video['bitrate'] += $dataarray['bitrate'];
                                    break;
                                }
                            }
                        }

                        $thisfile_asf_videomedia_currentstream['format_data']['codec'] = getid3_riff::fourccLookup($thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc']);

                        $thisfile_video['streams'][$streamnumber]['fourcc']          = $thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc'];
                        $thisfile_video['streams'][$streamnumber]['codec']           = $thisfile_asf_videomedia_currentstream['format_data']['codec'];
                        $thisfile_video['streams'][$streamnumber]['resolution_x']    = $thisfile_asf_videomedia_currentstream['image_width'];
                        $thisfile_video['streams'][$streamnumber]['resolution_y']    = $thisfile_asf_videomedia_currentstream['image_height'];
                        $thisfile_video['streams'][$streamnumber]['bits_per_sample'] = $thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel'];
                        break;

                    default:
                        break;
                }
            }
Home | Imprint | This part of the site doesn't use cookies.