Ignore:
Timestamp:
2009-02-10T13:31:55+13:00 (15 years ago)
Author:
davidb
Message:

Mods to cached_convert so the $GSDLHOME is used rather then explicit directory name. That way the collection can be moved to another computer with Greenstone installed in a different place and the caching mechanism still works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/gsdl-video/trunk/perllib/plugins/VideoPlugin.pm

    r18476 r18490  
    362362
    363363
    364     my $convertto_command = "ffmpeg $main_opts -i \"$originalfilename\"";
     364    my $originalfilename_gsdlenv = $self->gsdlhome_independent($originalfilename);
     365    my $filename_gsdlenv = $self->gsdlhome_independent($filename);
     366
     367
     368    my $convertto_command = "ffmpeg $main_opts -i \"$originalfilename_gsdlenv\"";
    365369    $convertto_command .= " -ar 22050" if ($converttotype eq "flv");
    366     $convertto_command .= " -y \"$filename\"";
     370    $convertto_command .= " -y \"$filename_gsdlenv\"";
    367371
    368372    my $convertto_result;
     
    540544    my $thumbnailsize = $self->{'thumbnailsize'} || 100;
    541545    my $thumbnailtype = $self->{'thumbnailtype'} || 'jpg';
    542    
     546
     547    my $thumbnailwidth;
     548    my $thumbnailheight;
     549
     550    if ($video_width>$video_height) {
     551    my $scale_ratio = $video_height / $video_width;
     552    $thumbnailwidth = $thumbnailsize;
     553    $thumbnailheight = int($thumbnailsize * $scale_ratio);
     554    }
     555    else {
     556    my $scale_ratio = $video_width / $video_height;
     557    $thumbnailwidth = int($thumbnailsize * $scale_ratio);
     558    $thumbnailheight = $thumbnailsize;
     559    }
     560
    543561
    544562    my $thumbnailfile = &util::filename_cat($output_dir,"$ivideo_root.$thumbnailtype");
     
    548566    # Generate the thumbnail with convert, a la ImagePlug
    549567    my ($thumb_cmd ,$othumb_filename)
    550         = $videoconvert->keyframe_thumbnail_cmd($filename,$thumbnailfile,$thumbnailsize);
     568        = $videoconvert->keyframe_thumbnail_cmd($filename,$thumbnailfile,$thumbnailwidth,$thumbnailheight);
    551569
    552570    my $thumb_options = { 'verbosity' => $verbosity,
     
    626644    my $screenviewfilename = &util::filename_cat($output_dir,"$ivideo_root.$screenviewtype");
    627645
     646    my $screenviewwidth;
     647    my $screenviewheight;
     648   
     649    if ($video_width>$video_height) {
     650        my $scale_ratio = $video_height / $video_width;
     651        $screenviewwidth = $screenviewsize;
     652        $screenviewheight = int($screenviewsize * $scale_ratio);
     653    }
     654    else {
     655        my $scale_ratio = $video_width / $video_height;
     656        $screenviewwidth = int($screenviewsize * $scale_ratio);
     657        $screenviewheight = $screenviewsize;
     658    }
     659
     660
    628661    # make the screenview image
    629662
    630663    my ($screenview_cmd,$oscreenview_filename)
    631         = $videoconvert->keyframe_thumbnail_cmd($filename,$screenviewfilename,$screenviewsize);
     664        = $videoconvert->keyframe_thumbnail_cmd($filename,$screenviewfilename,$screenviewwidth,$screenviewheight);
    632665
    633666    my $screenview_options = { 'message_prefix' => "Screenview",
Note: See TracChangeset for help on using the changeset viewer.