Changeset 268

Show
Ignore:
Timestamp:
09/22/06 11:03:49 (2 years ago)
Author:
miya
Message:

Filter::FFmpeg: support extra_options

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plagger/trunk/lib/Plagger/Plugin/Filter/FFmpeg.pm

    r254 r268  
    5252 
    5353        my $output_file = File::Spec->catfile($self->conf->{dir}, "$file"); 
    54         $ff->output_options(
     54        my $output_options =
    5555            file    => encode($encoding, $output_file), 
    5656            device  => $self->conf->{device} || 'ipod', 
     
    5959            comment => encode($encoding, $entry->summary), 
    6060            %{ $self->conf->{options} || {} }, 
    61         }); 
    62  
     61        }; 
     62 
     63        if ( $self->conf->{extra_options} ) { 
     64            my %option_to_name = reverse %FFmpeg::Command::option; 
     65            my @extra_options =  split ' ', $self->conf->{extra_options}; 
     66            for ( @extra_options ){ 
     67                my $name = $option_to_name{$_}; 
     68                delete $output_options->{$name} if defined $output_options->{$name} and $name; 
     69            } 
     70            $ff->output_options($output_options); 
     71            $ff->options( @extra_options, @{ $ff->options } ); 
     72        } 
     73        else { 
     74            $ff->output_options($output_options); 
     75        } 
     76 
     77        use Data::Dumper; 
     78        warn Dumper($ff->options); 
    6379        unless( -e $output_file ){ 
    6480            $context->log( info => 'Converting ' . $enclosure->filename . ' ...' );