Skip to content

Commit 302c16c

Browse files
committed
... would have been a lot easier if the author just emailed me the new files instead of my having to find these in a roundabout way.
1 parent 9906bb7 commit 302c16c

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

trunk/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ EXPORT_MODULES = export/generic.pm \
2929
export/ffmpeg/DVCD.pm \
3030
export/ffmpeg/DVD.pm \
3131
export/ffmpeg/VCD.pm \
32+
export/ffmpeg/PSP.pm \
3233
export/mencoder/XviD.pm
3334
MODULE_SUBDIRS = transcode \
3435
ffmpeg \

trunk/export/ffmpeg/PSP.pm

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#
2+
# $Date$
3+
# $Revision$
4+
# $Author$
5+
#
6+
# export::ffmpeg::PSP
7+
#
8+
# obtained and slightly modified from http://mysettopbox.tv/phpBB2/viewtopic.php?t=5030&
9+
#
10+
11+
package export::ffmpeg::PSP;
12+
use base 'export::ffmpeg';
13+
14+
# Load the myth and nuv utilities, and make sure we're connected to the database
15+
use nuv_export::shared_utils;
16+
use nuv_export::cli;
17+
use nuv_export::ui;
18+
use mythtv::db;
19+
use mythtv::recordings;
20+
21+
# Load the following extra parameters from the commandline
22+
23+
sub new {
24+
my $class = shift;
25+
my $self = {
26+
'cli' => qr/\bpsp\b/i,
27+
'name' => 'Export to PSP',
28+
'enabled' => 1,
29+
'errors' => [],
30+
'defaults' => {},
31+
};
32+
bless($self, $class);
33+
34+
# Initialize the default parameters
35+
$self->load_defaults();
36+
37+
# Initialize and check for ffmpeg
38+
$self->init_ffmpeg();
39+
40+
# Can we even encode psp?
41+
if (!$self->can_encode('psp')) {
42+
push @{$self->{'errors'}}, "Your ffmpeg installation doesn't support encoding to psp video.";
43+
}
44+
if (!$self->can_encode('aac')) {
45+
push @{$self->{'errors'}}, "Your ffmpeg installation doesn't support encoding to aac audio.";
46+
}
47+
# Any errors? disable this function
48+
$self->{'enabled'} = 0 if ($self->{'errors'} && @{$self->{'errors'}} > 0);
49+
# Return
50+
return $self;
51+
}
52+
53+
# Load default settings
54+
sub load_defaults {
55+
my $self = shift;
56+
# Load the parent module's settings
57+
$self->SUPER::load_defaults();
58+
# Not really anything to add
59+
}
60+
61+
# Gather settings from the user
62+
sub gather_settings {
63+
my $self = shift;
64+
# Load the parent module's settings
65+
$self->SUPER::gather_settings();
66+
}
67+
68+
sub export {
69+
my $self = shift;
70+
my $episode = shift;
71+
# Load nuv info
72+
load_finfo($episode);
73+
# Force to 4:3 aspect ratio
74+
$self->{'out_aspect'} = 1.3333;
75+
$self->{'aspect_stretched'} = 1;
76+
# PAL or NTSC?
77+
my $standard = ($episode->{'finfo'}{'fps'} =~ /^2(?:5|4\.9)/) ? 'PAL' : 'NTSC';
78+
$self->{'width'} = 320;
79+
$self->{'height'} = ($standard eq 'PAL') ? '288' : '240';
80+
$self->{'out_fps'} = ($standard eq 'PAL') ? 25 : 29.97;
81+
# Build the transcode string
82+
my $safe_title = shell_escape($episode->{'show_name'}." - ".$episode->{'title'});
83+
$self->{'ffmpeg_xtra'} = " -b 768"
84+
." -ab 32 -ar 24000 -acodec aac"
85+
." -bitexact -f psp -title $safe_title";
86+
# Execute the parent method
87+
$self->SUPER::export($episode, ".mp4");
88+
}
89+
90+
1; #return true
91+
92+
# vim:ts=4:sw=4:ai:et:si:sts=4

trunk/nuvexport

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
require export::ffmpeg::DivX;
6060
require export::ffmpeg::ASF;
6161
require export::ffmpeg::MP3;
62+
require export::ffmpeg::PSP;
6263
}
6364
elsif ($export_prog eq 'mencoder') {
6465
find_program('mencoder')
@@ -91,6 +92,7 @@
9192
push @Exporters, export::ffmpeg::DivX->new;
9293
push @Exporters, export::ffmpeg::ASF->new;
9394
push @Exporters, export::ffmpeg::MP3->new;
95+
push @Exporters, export::ffmpeg::PSP->new;
9496
}
9597
elsif ($export_prog eq 'mencoder') {
9698
push @Exporters, export::mencoder::XviD->new;

0 commit comments

Comments
 (0)