Ejemplo n.º 1
0
/**
 * Divine file format with media info
 * @param string $ps_path
 * @return string mime type usable for media processing back-end, e.g. video/mp4
 */
function caMediaInfoGuessFileFormat($ps_path)
{
    if (!caMediaInfoInstalled()) {
        return false;
    }
    $va_media_metadata = caExtractMetadataWithMediaInfo($ps_path);
    switch ($va_media_metadata['VIDEO']['Format']) {
        case 'DV':
            return 'video/x-dv';
        case 'MPEG-4':
            return 'video/mp4';
        case 'AVI':
            return 'video/avi';
        case 'Matroska':
            return 'video/x-matroska';
        case 'AVC':
            return 'video/quicktime';
            // @todo add more popular formats here!
        // @todo add more popular formats here!
        default:
            return false;
    }
}
Ejemplo n.º 2
0
 public function read($filepath)
 {
     if (!file_exists($filepath)) {
         $this->postError(1650, _t("File %1 does not exist", $filepath), "WLPlugVideo->read()");
         $this->handle = "";
         $this->filepath = "";
         return false;
     }
     if (!($this->handle && $this->handle["filepath"] == $filepath)) {
         $ID3 = new getID3();
         $ID3->option_max_2gb_check = false;
         $this->handle = $this->ohandle = $ID3->analyze($filepath);
         if ($this->opb_mediainfo_available) {
             $this->metadata = caExtractMetadataWithMediaInfo($this->ops_mediainfo_path, $filepath);
         } else {
             $this->metadata = $this->handle;
         }
         if (!$this->handle['mime_type']) {
             // is it Ogg?
             $info = new OggParser($filepath);
             if (!$info->LastError) {
                 $this->handle = $this->ohandle = $info->Streams;
                 $this->handle['mime_type'] = 'video/ogg';
                 $this->handle['playtime_seconds'] = $this->handle['duration'];
             }
         }
         // force MPEG-4 files to use video/mp4 mimetype rather than the video/quicktime
         // mimetype getID3 returns. This will allow us to distinguish MPEG-4 files, which can
         // be played in HTML5 and Flash players from older Quicktime files which cannot.
         if ($this->handle["mime_type"] === 'video/quicktime') {
             if ($this->_isMPEG4($this->handle)) {
                 $this->handle["mime_type"] = 'video/mp4';
             }
         }
     }
     //
     // Versions of getID3 to at least 1.7.7 throw an error that should be a warning
     // when parsing MPEG-4 files, so we supress it here, otherwise we'd never be able
     // to parse MPEG-4 files.
     //
     if (isset($this->handle["error"]) && is_array($this->handle["error"]) && sizeof($this->handle["error"]) == 1) {
         if (preg_match("/does not fully support MPEG-4/", $this->handle['error'][0])) {
             $this->handle['error'] = array();
         }
         if (preg_match("/claims to go beyond end-of-file/", $this->handle['error'][0])) {
             $this->handle['error'] = array();
         }
         if (preg_match("/because beyond 2GB limit of PHP filesystem functions/", $this->handle['error'][0])) {
             $this->handle['error'] = array();
         }
     }
     $w = $h = null;
     if (!(isset($this->handle["error"]) && is_array($this->handle["error"]) && sizeof($this->handle["error"]) > 0)) {
         $this->filepath = $filepath;
         // getID3 sometimes reports the wrong width and height in the resolution_x and resolution_y indices for FLV files, but does
         // report correct values in the 'meta' block. So for FLV only we try to take values from the 'meta' block first.
         if ($this->handle["mime_type"] == 'video/x-flv' && is_array($this->handle['meta']) && is_array($this->handle['meta']['onMetaData'])) {
             $w = $this->handle['meta']['onMetaData']['width'];
             $h = $this->handle['meta']['onMetaData']['height'];
         } else {
             if ($this->handle['mime_type'] == 'video/ogg') {
                 $w = $this->handle['theora']['width'];
                 $h = $this->handle['theora']['height'];
             }
         }
         if (!$w || !$h) {
             $w = $this->handle["video"]["resolution_x"];
             $h = $this->handle["video"]["resolution_y"];
         }
         if (!$w || !$h) {
             // maybe it's stuck in a stream?
             if (is_array($this->handle["video"]["streams"])) {
                 foreach ($this->handle["video"]["streams"] as $vs_key => $va_stream_info) {
                     $w = $this->handle["video"]["streams"][$vs_key]["resolution_x"];
                     $h = $this->handle["video"]["streams"][$vs_key]["resolution_y"];
                     if ($w > 0 && $h > 0) {
                         break;
                     }
                 }
             }
         }
         $this->properties["width"] = $w;
         $this->properties["height"] = $h;
         $this->properties["mimetype"] = $this->handle["mime_type"];
         $this->properties["typename"] = $this->typenames[$this->properties["mimetype"]] ? $this->typenames[$this->properties["mimetype"]] : "Unknown";
         $this->properties["duration"] = $this->handle["playtime_seconds"];
         $this->properties["filesize"] = filesize($filepath);
         # -- get bandwidth
         switch ($this->properties["mimetype"]) {
             case 'audio/x-realaudio':
                 $video_streams = array();
                 $audio_streams = array();
                 if (is_array($this->handle["real"]["chunks"])) {
                     foreach ($this->handle["real"]["chunks"] as $chunk) {
                         if ($chunk["name"] == "MDPR") {
                             if (in_array($chunk["mime_type"], array("video/x-pn-realvideo", "video/x-pn-multirate-realvideo"))) {
                                 $video_streams[] = $chunk["max_bit_rate"];
                             } else {
                                 if (in_array($chunk["mime_type"], array("audio/x-pn-realaudio", "audio/x-pn-multirate-realaudio"))) {
                                     $audio_streams[] = $chunk["max_bit_rate"];
                                 }
                             }
                         }
                     }
                     sort($video_streams);
                     sort($audio_streams);
                     $this->properties["has_video"] = sizeof($video_streams) ? 1 : 0;
                     $this->properties["has_audio"] = sizeof($audio_streams) ? 1 : 0;
                 } else {
                     // old real format
                     if (is_array($this->handle["real"]["old_ra_header"])) {
                         if ($this->properties["filesize"] - $this->handle["real"]["old_ra_header"]["audio_bytes"] > 0) {
                             $this->properties["has_video"] = 1;
                             $video_streams[] = ($this->properties["filesize"] - $this->handle["real"]["old_ra_header"]["audio_bytes"]) * 8 / $this->properties["duration"];
                         } else {
                             $this->properties["has_video"] = 0;
                         }
                         if ($this->handle["real"]["old_ra_header"]["audio_bytes"] > 0) {
                             $this->properties["has_audio"] = 1;
                             $audio_streams[] = $this->handle["real"]["old_ra_header"]["audio_bytes"] * 8 / $this->properties["duration"];
                         } else {
                             $this->properties["has_audio"] = 0;
                         }
                     } else {
                         $this->properties["has_video"] = 0;
                         $this->properties["has_audio"] = 0;
                     }
                 }
                 $this->properties["type_specific"] = array("real" => $this->handle["real"]);
                 $this->properties["title"] = $this->handle["real"]["comments"]["title"];
                 $this->properties["author"] = $this->handle["real"]["comments"]["artist"];
                 $this->properties["copyright"] = "";
                 $this->properties["description"] = $this->handle["real"]["comments"]["comment"];
                 $this->properties["bandwidth"] = array("min" => (sizeof($video_streams) ? $video_streams[0] : 0) + (sizeof($audio_streams) ? $audio_streams[0] : 0), "max" => (sizeof($video_streams) ? $video_streams[sizeof($video_streams) - 1] : 0) + (sizeof($audio_streams) ? $audio_streams[sizeof($audio_streams) - 1] : 0));
                 break;
             case 'video/x-ms-asf':
             case 'video/x-ms-wmv':
                 $this->properties["has_video"] = sizeof($this->handle["asf"]["video_media"]) ? 1 : 0;
                 $this->properties["has_audio"] = sizeof($this->handle["asf"]["audio_media"]) ? 1 : 0;
                 $this->properties["type_specific"] = array("asf" => $this->handle["asf"]);
                 $this->properties["title"] = $this->handle["asf"]["comments"]["title"];
                 $this->properties["author"] = $this->handle["asf"]["comments"]["artist"];
                 $this->properties["copyright"] = $this->handle["asf"]["comments"]["copyright"];
                 $this->properties["description"] = $this->handle["asf"]["comments"]["comment"];
                 $this->properties["bandwidth"] = array("min" => 0, "max" => $this->handle["bitrate"]);
                 break;
             case 'video/quicktime':
             case 'video/mp4':
                 $this->properties["has_video"] = isset($this->handle["video"]["bitrate"]) && sizeof($this->handle["video"]["bitrate"]) ? 1 : 0;
                 $this->properties["has_audio"] = isset($this->handle["audio"]["bitrate"]) && sizeof($this->handle["audio"]["bitrate"]) ? 1 : 0;
                 $this->properties["type_specific"] = array();
                 $this->properties["title"] = "";
                 $this->properties["author"] = "";
                 $this->properties["copyright"] = "";
                 $this->properties["description"] = "";
                 $this->properties["bandwidth"] = array("min" => (int) $this->handle["theora"]['nombitrate'] + (int) $this->handle["vorbis"]['bitrate'], "max" => (int) $this->handle["theora"]['nombitrate'] + (int) $this->handle["vorbis"]['bitrate']);
                 break;
             case 'video/ogg':
                 $this->properties["has_video"] = isset($this->handle["theora"]) ? 1 : 0;
                 $this->properties["has_audio"] = isset($this->handle["vorbis"]) ? 1 : 0;
                 $this->properties["type_specific"] = array();
                 $this->properties["title"] = "";
                 $this->properties["author"] = "";
                 $this->properties["copyright"] = "";
                 $this->properties["description"] = "";
                 $this->properties["bandwidth"] = array("min" => $this->handle["bitrate"], "max" => $this->handle["bitrate"]);
                 break;
             case 'application/x-shockwave-flash':
                 $this->properties["has_video"] = $this->handle["header"]["frame_width"] > 0 ? 1 : 0;
                 $this->properties["has_audio"] = 1;
                 $this->properties["type_specific"] = array("header" => $this->handle["header"]);
                 $this->properties["title"] = "";
                 $this->properties["author"] = "";
                 $this->properties["copyright"] = "";
                 $this->properties["description"] = "";
                 $this->properties["bandwidth"] = array("min" => $this->handle["filesize"] / $this->handle["playtime_seconds"], "max" => $this->handle["filesize"] / $this->handle["playtime_seconds"]);
                 break;
             case 'video/mpeg':
                 $this->properties["has_video"] = isset($this->handle["video"]["bitrate"]) && sizeof($this->handle["video"]["bitrate"]) ? 1 : 0;
                 $this->properties["has_audio"] = isset($this->handle["audio"]["bitrate"]) && sizeof($this->handle["audio"]["bitrate"]) ? 1 : 0;
                 $this->properties["type_specific"] = array();
                 $this->properties["title"] = "";
                 $this->properties["author"] = "";
                 $this->properties["copyright"] = "";
                 $this->properties["description"] = "";
                 $this->properties["bandwidth"] = array("min" => $this->handle["bitrate"], "max" => $this->handle["bitrate"]);
                 break;
             case 'video/x-flv':
                 $this->properties["has_video"] = sizeof($this->handle["header"]["hasVideo"]) ? 1 : 0;
                 $this->properties["has_audio"] = sizeof($this->handle["header"]["hasAudio"]) ? 1 : 0;
                 $this->properties["type_specific"] = array("header" => $this->handle["header"]);
                 $this->properties["title"] = "";
                 $this->properties["author"] = "";
                 $this->properties["copyright"] = "";
                 $this->properties["description"] = "";
                 $vn_bitrate = $this->handle["filesize"] / $this->handle["playtime_seconds"];
                 $this->properties["bandwidth"] = array("min" => $vn_bitrate, "max" => $vn_bitrate);
                 break;
         }
         $this->oproperties = $this->properties;
         return 1;
     } else {
         $this->postError(1650, join("; ", $this->handle["error"]), "WLPlugVideo->read()");
         $this->handle = "";
         $this->filepath = "";
         return false;
     }
 }
Ejemplo n.º 3
0
 public function read($filepath)
 {
     if (!file_exists($filepath)) {
         $this->postError(1650, _t("File %1 does not exist", $filepath), "WLPlugAudio->read()");
         $this->handle = "";
         $this->filepath = "";
         return false;
     }
     if (!($this->handle && $this->handle["filepath"] == $filepath)) {
         $ID3 = new getid3();
         $info = $ID3->analyze($filepath);
         if ($info["mime_type"] === 'audio/x-wave') {
             $info["mime_type"] = 'audio/x-wav';
         }
         $this->handle = $this->ohandle = $info;
         if ($this->opb_mediainfo_available) {
             $this->metadata = caExtractMetadataWithMediaInfo($this->ops_mediainfo_path, $filepath);
         } else {
             $this->metadata = $this->handle;
         }
         if (!$this->handle['mime_type']) {
             // is it Ogg?
             $info = new OggParser($filepath);
             if (!$info->LastError) {
                 if (!isset($info->Streams['theora'])) {
                     $this->handle = $this->ohandle = $info->Streams;
                     $this->handle['mime_type'] = 'audio/ogg';
                     $this->handle['playtime_seconds'] = $this->handle['duration'];
                 }
             }
         }
     }
     if (!(isset($this->handle["error"]) && is_array($this->handle["error"]) && sizeof($this->handle["error"]) > 0)) {
         $this->filepath = $filepath;
         //$this->properties  = $this->handle;
         $this->properties["mimetype"] = $this->handle["mime_type"];
         $this->properties["typename"] = $this->typenames[$this->properties["mimetype"]] ? $this->typenames[$this->properties["mimetype"]] : "Unknown";
         $this->properties["duration"] = $this->handle["playtime_seconds"];
         $this->properties["filesize"] = filesize($filepath);
         switch ($this->properties["mimetype"]) {
             case 'audio/mpeg':
                 if (is_array($this->handle["tags"]["id3v1"]["title"])) {
                     $this->properties["title"] = join("; ", $this->handle["tags"]["id3v1"]["title"]);
                 }
                 if (is_array($this->handle["tags"]["id3v1"]["artist"])) {
                     $this->properties["author"] = join("; ", $this->handle["tags"]["id3v1"]["artist"]);
                 }
                 if (is_array($this->handle["tags"]["id3v1"]["comment"])) {
                     $this->properties["copyright"] = join("; ", $this->handle["tags"]["id3v1"]["comment"]);
                 }
                 if (is_array($this->handle["tags"]["id3v1"]["album"]) && is_array($this->handle["tags"]["id3v1"]["year"]) && is_array($this->handle["tags"]["id3v1"]["genre"])) {
                     $this->properties["description"] = join("; ", $this->handle["tags"]["id3v1"]["album"]) . " " . join("; ", $this->handle["tags"]["id3v1"]["year"]) . " " . join("; ", $this->handle["tags"]["id3v1"]["genre"]);
                 }
                 $this->properties["type_specific"] = array("audio" => $this->handle["audio"], "tags" => $this->handle["tags"]);
                 $this->properties["bandwidth"] = array("min" => $this->handle["bitrate"], "max" => $this->handle["bitrate"]);
                 $this->properties["getID3_tags"] = $this->handle["tags"];
                 $this->properties["bitrate"] = $input_bitrate = $this->handle["bitrate"];
                 $this->properties["channels"] = $input_channels = $this->handle["audio"]["channels"];
                 $this->properties["sample_frequency"] = $input_sample_frequency = $this->handle["audio"]["sample_rate"];
                 $this->properties["duration"] = $this->handle["playtime_seconds"];
                 break;
             case 'audio/x-aiff':
                 $this->properties["type_specific"] = array("audio" => $this->handle["audio"], "riff" => $this->handle["riff"]);
                 $this->properties["bandwidth"] = array("min" => $this->handle["bitrate"], "max" => $this->handle["bitrate"]);
                 $this->properties["getID3_tags"] = array();
                 $this->properties["bitrate"] = $input_bitrate = $this->handle["bitrate"];
                 $this->properties["channels"] = $input_channels = $this->handle["audio"]["channels"];
                 $this->properties["sample_frequency"] = $input_sample_frequency = $this->handle["audio"]["sample_rate"];
                 $this->properties["duration"] = $this->handle["playtime_seconds"];
                 break;
             case 'audio/x-wav':
                 $this->properties["type_specific"] = array();
                 $this->properties["audio"] = $this->handle["audio"];
                 $this->properties["bandwidth"] = array("min" => $this->handle["bitrate"], "max" => $this->handle["bitrate"]);
                 $this->properties["getID3_tags"] = array();
                 $this->properties["bitrate"] = $input_bitrate = $this->handle["bitrate"];
                 $this->properties["channels"] = $input_channels = $this->handle["audio"]["channels"];
                 $this->properties["sample_frequency"] = $this->handle["audio"]["sample_rate"];
                 $this->properties["duration"] = $this->handle["playtime_seconds"];
                 break;
             case 'audio/mp4':
                 $this->properties["type_specific"] = array();
                 $this->properties["audio"] = $this->handle["audio"];
                 $this->properties["bandwidth"] = array("min" => $this->handle["bitrate"], "max" => $this->handle["bitrate"]);
                 $this->properties["getID3_tags"] = array();
                 $this->properties["bitrate"] = $input_bitrate = $this->handle["bitrate"];
                 $this->properties["channels"] = $input_channels = $this->handle["audio"]["channels"];
                 $this->properties["sample_frequency"] = $input_sample_frequency = $this->handle["audio"]["sample_rate"];
                 $this->properties["duration"] = $this->handle["playtime_seconds"];
                 break;
             case 'audio/ogg':
                 $this->properties["type_specific"] = array();
                 $this->properties["audio"] = $this->handle['vorbis'];
                 $this->properties["bandwidth"] = array("min" => $this->handle['vorbis']['bitrate'], "max" => $this->handle['vorbis']['bitrate']);
                 $this->properties["getID3_tags"] = array();
                 $this->properties["bitrate"] = $input_bitrate = $this->handle['vorbis']['bitrate'];
                 $this->properties["channels"] = $input_channels = $this->handle["vorbis"]["channels"];
                 $this->properties["sample_frequency"] = $input_sample_frequency = $this->handle["vorbis"]["samplerate"];
                 $this->properties["duration"] = $this->handle["playtime_seconds"];
                 break;
         }
         $this->oproperties = $this->properties;
         return 1;
     } else {
         $this->postError(1650, join("; ", $this->handle["error"]), "WLPlugAudio->read()");
         $this->handle = "";
         $this->filepath = "";
         return false;
     }
 }
Ejemplo n.º 4
0
 public function read($filepath)
 {
     if (!file_exists($filepath)) {
         $this->postError(1650, _t("File %1 does not exist", $filepath), "WLPlugVideo->read()");
         $this->opa_media_metadata = array();
         $this->filepath = null;
         return false;
     }
     if (!($this->opa_media_metadata && $this->opa_media_metadata["filepath"] == $filepath)) {
         // first try mediainfo
         if ($vs_mimetype = caMediaInfoGuessFileFormat($filepath)) {
             $va_media_metadata = caExtractMetadataWithMediaInfo($filepath);
             $va_media_metadata['filepath'] = $filepath;
             $va_media_metadata['mime_type'] = $vs_mimetype;
             // Set properties for framerate and starting timecode
             $o_tc = new TimecodeParser();
             $o_tc->setTimebase($vn_framerate = trim(str_replace("fps", "", $va_media_metadata['VIDEO']['Frame rate'])));
             $o_tc->parse($va_media_metadata['OTHER']['Time code of first frame']);
             $this->properties['timecode_offset'] = (int) $o_tc->getSeconds();
             $this->properties['framerate'] = $vn_framerate;
             $this->opa_media_metadata = $va_media_metadata;
         } elseif ($vs_mimetype = caGetID3GuessFileFormat($filepath)) {
             // then try getid3
             $this->opa_media_metadata = caExtractMetadataWithGetID3($filepath);
             $this->properties['timecode_offset'] = 0;
             // getID3 doesn't return offsets
             $this->properties['framerate'] = (double) $this->opa_media_metadata['video']['frame_rate'];
         } else {
             // lastly, try ogg/ogv
             $this->opa_media_metadata = caExtractMediaMetadataWithOggParser($filepath);
             $this->properties['timecode_offset'] = 0;
             // OggParser doesn't return offsets
             $this->properties['framerate'] = (double) $this->opa_media_metadata['duration'] > 0 ? (double) $this->opa_media_metadata['framecount'] / (double) $this->opa_media_metadata['duration'] : 0;
         }
     }
     if (!$this->opa_media_metadata['mime_type']) {
         return false;
     }
     // divineFileFormat() should prevent that, but you never know
     $w = $h = null;
     if (!(isset($this->opa_media_metadata["error"]) && is_array($this->opa_media_metadata["error"]) && sizeof($this->opa_media_metadata["error"]) > 0)) {
         $this->filepath = $filepath;
         // getID3 sometimes reports the wrong width and height in the resolution_x and resolution_y indices for FLV files, but does
         // report correct values in the 'meta' block. So for FLV only we try to take values from the 'meta' block first.
         if ($this->opa_media_metadata["mime_type"] == 'video/x-flv' && is_array($this->opa_media_metadata['meta']) && is_array($this->opa_media_metadata['meta']['onMetaData'])) {
             $w = $this->opa_media_metadata['meta']['onMetaData']['width'];
             $h = $this->opa_media_metadata['meta']['onMetaData']['height'];
         } else {
             if ($this->opa_media_metadata['mime_type'] == 'video/ogg') {
                 $w = $this->opa_media_metadata['theora']['width'];
                 $h = $this->opa_media_metadata['theora']['height'];
             }
         }
         if (!$w || !$h) {
             $w = $this->opa_media_metadata["video"]["resolution_x"];
             $h = $this->opa_media_metadata["video"]["resolution_y"];
         }
         if (!$w || !$h) {
             // maybe it's stuck in a stream?
             if (is_array($this->opa_media_metadata["video"]["streams"])) {
                 foreach ($this->opa_media_metadata["video"]["streams"] as $vs_key => $va_stream_info) {
                     $w = $this->opa_media_metadata["video"]["streams"][$vs_key]["resolution_x"];
                     $h = $this->opa_media_metadata["video"]["streams"][$vs_key]["resolution_y"];
                     if ($w > 0 && $h > 0) {
                         break;
                     }
                 }
             }
         }
         // maybe it came from mediainfo?
         if (!$w || !$h) {
             if (isset($this->opa_media_metadata['VIDEO']['Width'])) {
                 $w = preg_replace("/[\\D]/", '', $this->opa_media_metadata['VIDEO']['Width']);
             }
             if (isset($this->opa_media_metadata['VIDEO']['Height'])) {
                 $h = preg_replace("/[\\D]/", '', $this->opa_media_metadata['VIDEO']['Height']);
             }
         }
         $this->properties["width"] = $w;
         $this->properties["height"] = $h;
         $this->properties["mimetype"] = $this->opa_media_metadata["mime_type"];
         $this->properties["typename"] = $this->typenames[$this->properties["mimetype"]] ? $this->typenames[$this->properties["mimetype"]] : "Unknown";
         $this->properties["duration"] = $this->opa_media_metadata["playtime_seconds"];
         // getID3 sometimes messes up the duration. mediainfo seems a little more reliable so use it if it's available
         if ($this->opb_mediainfo_available && ($vn_mediainfo_duration = caExtractVideoFileDurationWithMediaInfo($filepath))) {
             $this->properties['duration'] = $this->opa_media_metadata["playtime_seconds"] = $vn_mediainfo_duration;
         }
         $this->properties["filesize"] = filesize($filepath);
         # -- get bandwidth
         switch ($this->properties["mimetype"]) {
             // in this case $this->opa_media_metadata definitely came from mediainfo
             // so the array structure is a little different than getID3
             case 'video/x-dv':
                 $this->properties["has_video"] = isset($this->opa_media_metadata["VIDEO"]["Duration"]) ? 1 : 0;
                 $this->properties["has_audio"] = isset($this->opa_media_metadata["AUDIO"]["Duration"]) ? 1 : 0;
                 $this->properties["type_specific"] = array();
                 $this->properties["title"] = $this->opa_media_metadata["GENERAL"]["Complete name"];
                 $this->properties["author"] = "";
                 $this->properties["copyright"] = "";
                 $this->properties["description"] = "";
                 $vn_bitrate = preg_replace("/[\\D]/", '', $this->opa_media_metadata['VIDEO']['Bit rate']);
                 $this->properties["bandwidth"] = array("min" => 0, "max" => $vn_bitrate);
                 break;
             case 'video/x-ms-asf':
             case 'video/x-ms-wmv':
                 $this->properties["has_video"] = sizeof($this->opa_media_metadata["asf"]["video_media"]) ? 1 : 0;
                 $this->properties["has_audio"] = sizeof($this->opa_media_metadata["asf"]["audio_media"]) ? 1 : 0;
                 $this->properties["type_specific"] = array("asf" => $this->opa_media_metadata["asf"]);
                 $this->properties["title"] = $this->opa_media_metadata["asf"]["comments"]["title"];
                 $this->properties["author"] = $this->opa_media_metadata["asf"]["comments"]["artist"];
                 $this->properties["copyright"] = $this->opa_media_metadata["asf"]["comments"]["copyright"];
                 $this->properties["description"] = $this->opa_media_metadata["asf"]["comments"]["comment"];
                 $this->properties["bandwidth"] = array("min" => 0, "max" => $this->opa_media_metadata["bitrate"]);
                 break;
             case 'video/quicktime':
             case 'video/mp4':
                 $this->properties["has_video"] = isset($this->opa_media_metadata["video"]["bitrate"]) && sizeof($this->opa_media_metadata["video"]["bitrate"]) ? 1 : 0;
                 $this->properties["has_audio"] = isset($this->opa_media_metadata["audio"]["bitrate"]) && sizeof($this->opa_media_metadata["audio"]["bitrate"]) ? 1 : 0;
                 $this->properties["type_specific"] = array();
                 $this->properties["title"] = "";
                 $this->properties["author"] = "";
                 $this->properties["copyright"] = "";
                 $this->properties["description"] = "";
                 $this->properties["bandwidth"] = array("min" => (int) $this->opa_media_metadata["theora"]['nombitrate'] + (int) $this->opa_media_metadata["vorbis"]['bitrate'], "max" => (int) $this->opa_media_metadata["theora"]['nombitrate'] + (int) $this->opa_media_metadata["vorbis"]['bitrate']);
                 break;
             case 'video/ogg':
                 $this->properties["has_video"] = isset($this->opa_media_metadata["theora"]) ? 1 : 0;
                 $this->properties["has_audio"] = isset($this->opa_media_metadata["vorbis"]) ? 1 : 0;
                 $this->properties["type_specific"] = array();
                 $this->properties["title"] = "";
                 $this->properties["author"] = "";
                 $this->properties["copyright"] = "";
                 $this->properties["description"] = "";
                 $this->properties["bandwidth"] = array("min" => $this->opa_media_metadata["bitrate"], "max" => $this->opa_media_metadata["bitrate"]);
                 break;
             case 'application/x-shockwave-flash':
                 $this->properties["has_video"] = $this->opa_media_metadata["header"]["frame_width"] > 0 ? 1 : 0;
                 $this->properties["has_audio"] = 1;
                 $this->properties["type_specific"] = array("header" => $this->opa_media_metadata["header"]);
                 $this->properties["title"] = "";
                 $this->properties["author"] = "";
                 $this->properties["copyright"] = "";
                 $this->properties["description"] = "";
                 $this->properties["bandwidth"] = array("min" => $this->opa_media_metadata["filesize"] / $this->opa_media_metadata["playtime_seconds"], "max" => $this->opa_media_metadata["filesize"] / $this->opa_media_metadata["playtime_seconds"]);
                 break;
             case 'video/mpeg':
                 $this->properties["has_video"] = isset($this->opa_media_metadata["video"]["bitrate"]) && sizeof($this->opa_media_metadata["video"]["bitrate"]) ? 1 : 0;
                 $this->properties["has_audio"] = isset($this->opa_media_metadata["audio"]["bitrate"]) && sizeof($this->opa_media_metadata["audio"]["bitrate"]) ? 1 : 0;
                 $this->properties["type_specific"] = array();
                 $this->properties["title"] = "";
                 $this->properties["author"] = "";
                 $this->properties["copyright"] = "";
                 $this->properties["description"] = "";
                 $this->properties["bandwidth"] = array("min" => $this->opa_media_metadata["bitrate"], "max" => $this->opa_media_metadata["bitrate"]);
                 break;
             case 'video/x-flv':
                 $this->properties["has_video"] = sizeof($this->opa_media_metadata["header"]["hasVideo"]) ? 1 : 0;
                 $this->properties["has_audio"] = sizeof($this->opa_media_metadata["header"]["hasAudio"]) ? 1 : 0;
                 $this->properties["type_specific"] = array("header" => $this->opa_media_metadata["header"]);
                 $this->properties["title"] = "";
                 $this->properties["author"] = "";
                 $this->properties["copyright"] = "";
                 $this->properties["description"] = "";
                 $vn_bitrate = $this->opa_media_metadata["filesize"] / $this->opa_media_metadata["playtime_seconds"];
                 $this->properties["bandwidth"] = array("min" => $vn_bitrate, "max" => $vn_bitrate);
                 break;
         }
         $this->oproperties = $this->properties;
         return 1;
     } else {
         $this->postError(1650, join("; ", $this->opa_media_metadata["error"]), "WLPlugVideo->read()");
         $this->opa_media_metadata = "";
         $this->filepath = "";
         return false;
     }
 }