Changeset 417
- Timestamp:
- 10/10/07 00:25:08 (11 months ago)
- Files:
-
- library/perl/trunk/FFmpeg-Command/Changes (modified) (1 diff)
- library/perl/trunk/FFmpeg-Command/lib/FFmpeg/Command.pm (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
library/perl/trunk/FFmpeg-Command/Changes
r272 r417 1 1 Revision history for FFmpeg-Command 2 3 0.07 Wed Oct 10 4 Support timeout(), stdout() and stderr() methods. 5 Thanks to Yasuhiro Horiuchi. 2 6 3 7 0.06 Sun Sep 24 library/perl/trunk/FFmpeg-Command/lib/FFmpeg/Command.pm
r416 r417 3 3 use warnings; 4 4 use strict; 5 our $VERSION = '0.0 6';5 our $VERSION = '0.07'; 6 6 7 7 use base qw( Class::Accessor::Fast Class::ErrorHandler ); 8 __PACKAGE__->mk_accessors( qw( input_file output_file ffmpeg options ) );8 __PACKAGE__->mk_accessors( qw( input_file output_file ffmpeg options timeout stdout stderr ) ); 9 9 10 10 use IPC::Run qw( start ); … … 33 33 input_file => '', 34 34 output_file => '', 35 timeout => 0, 35 36 }; 36 37 bless $self, $class; … … 89 90 my $self = shift; 90 91 91 my ( $in, $out, $err ); 92 my @opts = ( \$self->{stdin}, \$self->{stdout}, \$self->{stderr} ); 93 push @opts, IPC::Run::timeout($self->timeout) if $self->timeout; 94 92 95 my $h = eval { 93 start [ $self->ffmpeg, '-y', '-i', $self->input_file, @{ $self->options }, $self->output_file ], 94 \$in, \$out, \$err; 96 start( 97 [ 98 $self->ffmpeg, 99 '-y', 100 '-i', $self->input_file, 101 @{ $self->options }, 102 $self->output_file 103 ], 104 @opts, 105 ); 95 106 }; 96 107 … … 101 112 else { 102 113 finish $h or do { 103 $self->error($ err);114 $self->error($self->stderr); 104 115 return; 105 116 }; … … 132 143 }); 133 144 145 # Set timeout 146 $ffmpeg->timeout(300); 147 134 148 # Convert a video file into iPod playable format. 135 149 $ffmpeg->output_options({ 136 file => $output_file,150 file => $output_file, 137 151 device => 'ipod', 138 152 }); … … 204 218 You can omit this argument and this module searches ffmpeg command within PATH environment variable. 205 219 220 =head2 timeout() 221 222 Set command timeout.Default is 0. 206 223 207 224 =head2 input_options({ %options }) … … 291 308 An alias of execute() 292 309 310 =head2 stdout() 311 312 Get ffmpeg command output to stdout. 313 314 =head2 stderr() 315 316 Get ffmpeg command output to stderr. 293 317 294 318 =head1 AUTHOR
