Ignore:
Timestamp:
2010-07-19T14:00:53+12:00 (13 years ago)
Author:
davidb
Message:

Adjustment of calling BaseMediaConverter to pass in additional input file parameter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/video/trunk/perllib/plugins/VideoConverter.pm

    r21824 r22432  
    208208# Here we use mediaInfo to get all the possible metadata in XML form that could then be parsed
    209209#the result will vary depending on the file type and how it was encoded
    210 sub mediaInfo_XML_Cmd   {
    211     my ($video, $outhandle, $verbosity) = @_;
    212    
    213     # Use MediaInfo CLI to get the file spec according to the requested parameter
     210sub mediaInfo_XML_Cmd {
     211    my ($video, $outhandle, $verbosity) = @_;
     212   
     213    # Use MediaInfo CLI to get the file spec according to the requested parameter
    214214    my $command = "mediainfo --Output=XML \"$video\"";
    215 
     215   
    216216    print $outhandle "  $command\n" if ($verbosity > 2);
    217217    my $result = '';
    218218    $result = `$command 2>&1`;
    219219    print $outhandle "  $result\n" if ($verbosity > 4);
    220    
     220   
    221221    # Return the asked spec
    222222    return ($result);
     
    224224
    225225#Here we parse the video specs contained in the XML text in order to create a metadata entry for each field
    226 sub mediaInfo_parse_XML     {
    227     my ($xmlTxt, $outhandle, $verbosity) = @_;
    228    
    229     my @parts = split(/<track\s+type=\"(.*?)\">/is,$xmlTxt);
    230    
    231     shift @parts; # Skip preamble
    232     my $metadata_table = {};
    233 
    234     while (@parts) {
    235         my $type = shift(@parts);
    236         my $vals = shift(@parts);
    237         my @fieldlist=();
    238         while ($vals =~ s/<(.*?)>(.*?)<\/\1>//) {
    239           my $metaname = $1;
    240           my $metaval  = $2;
    241           my $fullmetaname = "mi.$type\^$metaname";
    242           $metadata_table->{$fullmetaname}= $metaval;
    243           push(@fieldlist,$fullmetaname);
    244         }
    245        
    246         $metadata_table->{"mi.${type}Fields"}= join(",",@fieldlist);
    247        
     226sub mediaInfo_parse_XML {
     227    my ($xmlTxt, $outhandle, $verbosity) = @_;
     228   
     229    my @parts = split(/<track\s+type=\"(.*?)\">/is,$xmlTxt);
     230   
     231    shift @parts; # Skip preamble
     232    my $metadata_table = {};
     233   
     234    while (@parts) {
     235    my $type = shift(@parts);
     236    my $vals = shift(@parts);
     237    my @fieldlist=();
     238    while ($vals =~ s/<(.*?)>(.*?)<\/\1>//) {
     239        my $metaname = $1;
     240        my $metaval  = $2;
     241        my $fullmetaname = "mi.$type\^$metaname";
     242        $metadata_table->{$fullmetaname}= $metaval;
     243        push(@fieldlist,$fullmetaname);
    248244    }
    249245   
    250     return $metadata_table;
    251 
    252 }
    253 
    254 sub identify {
     246    $metadata_table->{"mi.${type}Fields"}= join(",",@fieldlist);
     247   
     248    }
     249   
     250    return $metadata_table;
     251
     252}
     253
     254sub identifyMI {
    255255    my ($video, $outhandle, $verbosity) = @_;
    256256
     
    291291
    292292
    293 sub identify2 {
     293sub identify {
    294294    my ($video, $outhandle, $verbosity) = @_;
    295295
     
    10011001
    10021002   
     1003    my $ifilename = $originalfilename || $filename;
     1004
    10031005    my ($stream_cmd,$ofla_filename,$ofla_file)
    1004     = $self->stream_flv_audio_cmd($originalfilename || $filename);
     1006    = $self->stream_flv_audio_cmd($ifilename);
    10051007   
    10061008   
     
    10111013
    10121014    my ($streamable_regenerated,$streamable_result,$streamable_had_error)
    1013     = $self->$optionally_run_general_cmd($stream_cmd,$ofla_filename,
     1015    = $self->$optionally_run_general_cmd($stream_cmd,
     1016                         $ifilename,$ofla_filename,
    10141017                         $streamable_options);
    10151018
     
    10721075    my $streaming_quality = "high";
    10731076   
     1077    my $ifilename = $originalfilename || $filename;
     1078
    10741079    my ($stream_cmd,$oflash_filename,$oflash_file)
    1075     = $self->stream_flv_video_cmd($originalfilename || $filename,
     1080    = $self->stream_flv_video_cmd($ifilename,
    10761081                     $video_width,$video_height,
    10771082                     $streaming_quality,
     
    10851090
    10861091    my ($streamable_regenerated,$streamable_result,$streamable_had_error)
    1087     = $self->$optionally_run_general_cmd($stream_cmd,$oflash_filename,$streamable_options);
     1092    = $self->$optionally_run_general_cmd($stream_cmd,
     1093                         $ifilename,$oflash_filename,
     1094                         $streamable_options);
    10881095   
    10891096    if (!$streamable_had_error) {
     
    11311138sub enable_h264_streaming
    11321139{
    1133     my $self = shift (@_);
     1140    my $self = shift (@_);
    11341141    my ($doc_obj,$originalfilename,$filename,$convertto_regenerated,
    11351142    $video_width,$video_height) = @_;
    1136    
     1143   
    11371144
    11381145    my $section = $doc_obj->get_top_section();
     
    11531160    my $streaming_HQ_AudioBitrate    = $self->{'streamingHQAudioBitrate'};
    11541161
     1162    my $ifilename = $originalfilename || $filename;
    11551163    my ($stream_cmd,$oflash_filename,$oflash_file)
    1156     = $self->stream_mp4_video_cmd($originalfilename || $filename,
     1164    = $self->stream_mp4_video_cmd($ifilename,
    11571165                     $streaming_HQ_size,
    11581166                     $streaming_HQ_VideoBitrate,
     
    11611169   
    11621170    my $streamable_options = { @{$self->{'handbrake_monitor'}},
    1163                                'message_prefix' => "MP4 Stream",
    1164                                'message' => "Generating streamable MP4 video: $oflash_file" };
     1171                   'message_prefix' => "MP4 Stream",
     1172                   'message' => "Generating streamable MP4 video: $oflash_file" };
    11651173   
    11661174
    11671175    my ($streamable_regenerated,$streamable_result,$streamable_had_error)
    1168     = $self->$optionally_run_general_cmd($stream_cmd,$oflash_filename,$streamable_options);
     1176    = $self->$optionally_run_general_cmd($stream_cmd,
     1177                         $ifilename,$oflash_filename,
     1178                         $streamable_options);
    11691179   
    11701180    if (!$streamable_had_error) {
Note: See TracChangeset for help on using the changeset viewer.