Author: duncan
Date: Sun Jan 21 17:25:06 2007
New Revision: 9034

Modified:
   branches/rel-1/freevo/local_conf.py.example
   branches/rel-1/freevo/share/skins/main/basic.fxd
   branches/rel-1/freevo/src/encodingcore.py
   branches/rel-1/freevo/src/plugins/idlebar/encoding.py
   branches/rel-1/freevo/src/video/plugins/dvdbackup.py
   branches/rel-1/freevo/src/video/plugins/reencode.py
   branches/rel-1/freevo/src/video/plugins/reencode2.py

Log:
Changed XViD to XviD
Added resolution and filename
Several fixes to the idlebar plugin


Modified: branches/rel-1/freevo/local_conf.py.example
==============================================================================
--- branches/rel-1/freevo/local_conf.py.example (original)
+++ branches/rel-1/freevo/local_conf.py.example Sun Jan 21 17:25:06 2007
@@ -429,6 +429,7 @@
 # ----------------------------------------------------------------------
 # plugin.activate('video.reencode2')
 # REENCODE_CONTAINER = 'avi'
+# REENCODE_RESOLUTION = 'Optimal'
 # REENCODE_VIDEOCODEC = 'XViD'
 # REENCODE_VIDEOBITRATE = 1000
 # REENCODE_AUDIOCODEC = 'MPEG 1 Layer 3 (mp3)'

Modified: branches/rel-1/freevo/share/skins/main/basic.fxd
==============================================================================
--- branches/rel-1/freevo/share/skins/main/basic.fxd    (original)
+++ branches/rel-1/freevo/share/skins/main/basic.fxd    Sun Jan 21 17:25:06 2007
@@ -713,8 +713,14 @@
         <layout label="video encoding info">
             <content x="0" y="0" type="text" spacing="20" font="default">
                 <item type="default">
+                    <if expression="disp_title">
+                        <text width="150" font="info value" mode="soft">Title: 
</text>
+                        <goto_pos x="10" mode="relative"/>
+                        <text font="info value" expression="disp_title" 
mode="soft" />
+                        <newline/>
+                    </if>
                     <if expression="disp_filename">
-                        <text width="150" font="info value" 
mode="soft">Program: </text>
+                        <text width="150" font="info value" mode="soft">File 
name: </text>
                         <goto_pos x="10" mode="relative"/>
                         <text font="info value" expression="disp_filename" 
mode="soft" />
                         <newline/>
@@ -725,6 +731,12 @@
                         <text font="info value" expression="disp_container" 
mode="soft" />
                         <newline/>
                     </if>
+                    <if expression="disp_resolution">
+                        <text width="150" font="info value" 
mode="soft">Resolution: </text>
+                        <goto_pos x="10" mode="relative"/>
+                        <text font="info value" expression="disp_resolution" 
mode="soft" />
+                        <newline/>
+                    </if>
                     <if expression="disp_videocodec">
                         <text width="150" font="info value" mode="soft">Video 
Codec: </text>
                         <goto_pos x="10" mode="relative"/>
@@ -755,12 +767,14 @@
                         <text font="info value" expression="disp_numpasses" 
mode="soft" />
                         <newline/>
                     </if>
+                    <!-- Not implemented in server
                     <if expression="disp_videofilter">
                         <text width="150" font="info value" 
mode="soft">Filter: </text>
                         <goto_pos x="10" mode="relative"/>
                         <text font="info value" expression="disp_videofilter" 
mode="soft" />
                         <newline/>
                     </if>
+                    -->
                 </item>
             </content>
         </layout>

Modified: branches/rel-1/freevo/src/encodingcore.py
==============================================================================
--- branches/rel-1/freevo/src/encodingcore.py   (original)
+++ branches/rel-1/freevo/src/encodingcore.py   Sun Jan 21 17:25:06 2007
@@ -59,7 +59,7 @@
 #the "container format" will remain hardcoded
 
 ContainerCapList = [ 'avi', 'mkv', 'mp4' ]
-VideoCodecList = [ 'MPEG 4 (lavc)', 'XViD', 'H.264', 'iPodv' ]
+VideoCodecList = [ 'MPEG 4 (lavc)', 'XviD', 'H.264', 'iPodv' ]
 AudioCodecList = [ 'MPEG 1 Layer 3 (mp3)', 'Ogg', 'AAC', 'iPoda' ]
 
 VFDict = {
@@ -81,7 +81,7 @@
 
 MencoderMapping = {
     'MPEG 4 (lavc)' : ["copy", "lavc", ["-lavcopts", 
"vcodec=mpeg4:vhq:vqmin=2:v4mv:trell:autoaspect:vbitrate=%s%s"]],
-    'XViD' : ["copy", "xvid", ["-xvidencopts", "bitrate=%s%s"]],
+    'XviD' : ["copy", "xvid", ["-xvidencopts", "bitrate=%s%s"]],
     'MPEG 1 Layer 3 (mp3)' : ["frameno", "mp3lame", ["-lameopts", 
"cbr:br=%s"]],
     'iPodv' : ["lavc", "lavc", ["-lavcopts", 
"vcodec=mpeg4:vbitrate=%s%s:mbd=2:cmp=2:subcmp=2:trell=yes:v4mv=yes:vglobal=1:acodec=aac:abitrate=128:aic=2:aglobal=1"],
 ["-of", "lavf"], ["-ffourcc", "mp4v"], ["-lavfopts", 
"format=mp4:i_certify_that_my_video_stream_does_not_use_b_frames"]],
     'iPoda' : ["lavc", "lavc", ["-lavcopts", 
"acodec=aac:abitrate=%s:aic=2:aglobal=1"], ["-lavfopts", 
"format=mp4:i_certify_that_my_video_stream_does_not_use_b_frames"]]
@@ -352,7 +352,7 @@
         #deinterlacer test vf += ["pp=lb"]
         #set appropriate videopass , codec independant (lavc is vpass, xvid is 
pass)
         if passnr > 0 :
-            if self.vcodec == "XViD":
+            if self.vcodec == "XviD":
                 passname = ":pass=%s"
             else:
                 passname = ":vpass=%s"
@@ -365,7 +365,7 @@
 
         #in case of xvid and anamorphic dvd, add scaling to compensate AR..
         #if we didn't find cropping we have no res, so no tricks
-        if self.vcodec == "XViD" and self.crop:
+        if self.vcodec == "XviD" and self.crop:
             if self.ana:
                 #calculate a decent resized picturesize, res must still be a 
multiple of 16
                 yscaled = (self.cropres[1] * 0.703125)

Modified: branches/rel-1/freevo/src/plugins/idlebar/encoding.py
==============================================================================
--- branches/rel-1/freevo/src/plugins/idlebar/encoding.py       (original)
+++ branches/rel-1/freevo/src/plugins/idlebar/encoding.py       Sun Jan 21 
17:25:06 2007
@@ -241,6 +241,9 @@
             screen_height = osd.height + 2*osd.y
 
             used_width = font.font.stringsize(self.jobs) - 1
+            # ensure that the box width is between min and max
+            used_width = max(used_width, 200)
+            used_width = min(used_width, 280)
             used_height = self.font_h
             if self.running:
                 w, h = self.getimage(self.boximg, osd).get_size()
@@ -249,9 +252,6 @@
                 for text in self.text:
                     used_width = max(used_width, font.font.stringsize(text))
                     used_height += self.font_h
-            # ensure that the box width is between min and max
-            used_width = max(used_width, 200)
-            used_width = min(used_width, 280)
 
             _debug_('screen_width=%s, screen_height=%s, used_width=%s, 
used_height=%s, font_h=%s' % \
                 (screen_width, screen_height, used_width, used_height, 
self.font_h), 2)
@@ -272,7 +272,7 @@
             self.by = osd.y
             self.tx = self.bx + self.boxborder + self.padding
             self.ty = self.by + self.boxborder + self.padding
-            #self.textw = min(self.textw, self.idlebar_max - self.bx - 30)
+            self.textw = min(self.textw, self.idlebar_max - self.bx - 30)
 
 
     def draw(self, (type, object), osd):

Modified: branches/rel-1/freevo/src/video/plugins/dvdbackup.py
==============================================================================
--- branches/rel-1/freevo/src/video/plugins/dvdbackup.py        (original)
+++ branches/rel-1/freevo/src/video/plugins/dvdbackup.py        Sun Jan 21 
17:25:06 2007
@@ -82,10 +82,10 @@
     def encoding_profile_menu(self, menuw=None, arg=None):
         #create a menu with a few encoding options (1cd, 2cd, xvid, mpeg4)
         #args : tuple, (videocodec, size, multipass
-        menu_items = [ menu.MenuItem("XViD, 700mb", self.create_job, 
(1,700,False,0)) ]
-        menu_items.append( menu.MenuItem("XViD, 700mb, High Quality", 
self.create_job, (1,700,True,0)) )
-        menu_items.append( menu.MenuItem("XViD, 1400mb", self.create_job, 
(1,1400,False,0)) )
-        menu_items.append( menu.MenuItem("XViD, 1400mb, High Quality", 
self.create_job, (1,1400,True,0)) )
+        menu_items = [ menu.MenuItem("XviD, 700mb", self.create_job, 
(1,700,False,0)) ]
+        menu_items.append( menu.MenuItem("XviD, 700mb, High Quality", 
self.create_job, (1,700,True,0)) )
+        menu_items.append( menu.MenuItem("XviD, 1400mb", self.create_job, 
(1,1400,False,0)) )
+        menu_items.append( menu.MenuItem("XviD, 1400mb, High Quality", 
self.create_job, (1,1400,True,0)) )
         menu_items.append( menu.MenuItem("DivX, 700mb", self.create_job, 
(0,700,False,0)) )
         menu_items.append( menu.MenuItem("DivX, 700mb, High Quality", 
self.create_job, (0,700,True,0)) )
         menu_items.append( menu.MenuItem("DivX, 1400mb", self.create_job, 
(0,1400,False,0)) )

Modified: branches/rel-1/freevo/src/video/plugins/reencode.py
==============================================================================
--- branches/rel-1/freevo/src/video/plugins/reencode.py (original)
+++ branches/rel-1/freevo/src/video/plugins/reencode.py Sun Jan 21 17:25:06 2007
@@ -80,10 +80,10 @@
         _debug_('encoding_profile_menu(self, menuw=None, arg=None)')
         #create a menu with a few encoding options (1cd, 2cd, xvid, mpeg4)
         #args : tuple, (videocodec, size, multipass
-        menu_items = [ menu.MenuItem("XViD, 800bps", self.create_job, 
(0,0,1,None,700,False,800)) ]
-        menu_items.append( menu.MenuItem("XViD, 800bps, High Quality", 
self.create_job, (0,0,1,None,700,True,800)) )
-        menu_items.append( menu.MenuItem("XViD, 1200bps", self.create_job, 
(0,0,1,None,1400,False,1200)) )
-        menu_items.append( menu.MenuItem("XViD, 1200bps, High Quality", 
self.create_job, (0,0,1,None,1400,True,1200)) )
+        menu_items = [ menu.MenuItem("XviD, 800bps", self.create_job, 
(0,0,1,None,700,False,800)) ]
+        menu_items.append( menu.MenuItem("XviD, 800bps, High Quality", 
self.create_job, (0,0,1,None,700,True,800)) )
+        menu_items.append( menu.MenuItem("XviD, 1200bps", self.create_job, 
(0,0,1,None,1400,False,1200)) )
+        menu_items.append( menu.MenuItem("XviD, 1200bps, High Quality", 
self.create_job, (0,0,1,None,1400,True,1200)) )
         menu_items.append( menu.MenuItem("DivX, 800bps", self.create_job, 
(0,0,0,None,700,False,800)) )
         menu_items.append( menu.MenuItem("DivX, 800bps, High Quality", 
self.create_job, (0,0,0,None,700,True,800)) )
         menu_items.append( menu.MenuItem("DivX, 1200bps", self.create_job, 
(0,0,0,None,1400,False,1200)) )

Modified: branches/rel-1/freevo/src/video/plugins/reencode2.py
==============================================================================
--- branches/rel-1/freevo/src/video/plugins/reencode2.py        (original)
+++ branches/rel-1/freevo/src/video/plugins/reencode2.py        Sun Jan 21 
17:25:06 2007
@@ -54,9 +54,12 @@
     def __init__(self):
         _debug_('__init__(self)')
         plugin.ItemPlugin.__init__(self)
+        self.title = ''
+        self.source = ''
         self.filename = ''
         self.profile = {}
         self.profile['container'] = config.REENCODE_CONTAINER
+        self.profile['resolution'] = config.REENCODE_RESOLUTION
         self.profile['videocodec'] = config.REENCODE_VIDEOCODEC
         self.profile['audiocodec'] = config.REENCODE_AUDIOCODEC
         self.profile['numpasses'] = config.REENCODE_NUMPASSES
@@ -66,18 +69,19 @@
 
 
     def config(self):
-        '''config is called automatically,
-        freevo plugins -i video.reencode returns the info
+        '''config is called automatically, for default settings run:
+        freevo plugins -i video.reencode2
         '''
         _debug_('config(self)', 1)
         return [
             ('REENCODE_CONTAINER', 'avi', 'Container type'),
-            ('REENCODE_VIDEOCODEC', 'H.264', 'Video codec'),
-            ('REENCODE_VIDEOBITRATE', '1200', 'Video bit rate'),
-            ('REENCODE_AUDIOCODEC', 'AAC', 'Audio codec'),
-            ('REENCODE_AUDIOBITRATE', '192', 'Audio bit rate'),
+            ('REENCODE_RESOLUTION', 'Optimal', 'Container type'),
+            ('REENCODE_VIDEOCODEC', 'XviD', 'Video codec'),
+            ('REENCODE_VIDEOBITRATE', '800', 'Video bit rate'),
+            ('REENCODE_AUDIOCODEC', 'MPEG 1 Layer 3 (mp3)', 'Audio codec'),
+            ('REENCODE_AUDIOBITRATE', '128', 'Audio bit rate'),
             ('REENCODE_NUMPASSES', '2', 'Number of passes'),
-            ('REENCODE_VIDEOFILTER', 'High', 'Quality'),
+            ('REENCODE_VIDEOFILTER', 'None', 'Video Filter'),
         ]
 
 
@@ -88,18 +92,15 @@
 
     def actions(self, item):
         _debug_('actions(self, item)', 1)
-        _debug_('item.__dict__:' % item.__dict__, 3)
 
         if item.type == 'video' and item.mode == 'file':
-            (filename, extn) = os.path.splitext(item.filename)
-            self.dvdsource = item.filename
-
+            self.item = item
             self.title = item.name
             self.source = item.filename
-            self.filename = filename+'.avi'
-
-            self.item = item
-            return [ (self.encoding_profile_menu, _('Compress this 
program...')) ]
+            (filename, extn) = os.path.splitext(item.filename)
+            self.filename = filename+'.'+self.profile['container']
+            _debug_('item.__dict__:' % item.__dict__, 3)
+            return [ (self.encoding_profile_menu, _('Transcode this 
program...')) ]
         return []
 
 
@@ -108,22 +109,25 @@
         of an item, the attr represents the expression in the skin
         '''
         _debug_('getattr(self, attr=%r)' % (attr), 2)
-        if attr == 'disp_filename':
-            #return '%s' % (os.path.split(self.filename)[1])
+        if attr == 'disp_title':
             return '%s' % (self.title)
-        if attr == 'disp_container':
+        if attr == 'disp_filename':
+            return '%s' % (os.path.split(self.filename)[1])
+        elif attr == 'disp_container':
             return '%s' % (self.profile['container'])
-        if attr == 'disp_videocodec':
+        elif attr == 'disp_resolution':
+            return '%s' % (self.profile['resolution'])
+        elif attr == 'disp_videocodec':
             return '%s' % (self.profile['videocodec'])
-        if attr == 'disp_videobitrate':
+        elif attr == 'disp_videobitrate':
             return '%s' % (self.profile['videobitrate'])
-        if attr == 'disp_audiocodec':
+        elif attr == 'disp_audiocodec':
             return '%s' % (self.profile['audiocodec'])
-        if attr == 'disp_audiobitrate':
+        elif attr == 'disp_audiobitrate':
             return '%s' % (self.profile['audiobitrate'])
-        if attr == 'disp_numpasses':
+        elif attr == 'disp_numpasses':
             return '%s' % (self.profile['numpasses'])
-        if attr == 'disp_videofilter':
+        elif attr == 'disp_videofilter':
             return '%s' % (self.profile['videofilter'])
         return '"%s" not defined' % (attr)
 
@@ -134,6 +138,7 @@
         menu_items += [ menu.MenuItem(_('Start Encoding'), self.create_job, 
self.profile) ] 
         menu_items += [ menu.MenuItem(_('Select Encoding Profile'), 
action=self.select_profile) ]
         menu_items += [ menu.MenuItem(_('Modify Container'), 
action=self.mod_container) ]
+        menu_items += [ menu.MenuItem(_('Modify Resolution'), 
action=self.mod_resolution) ]
         menu_items += [ menu.MenuItem(_('Modify Video Codec'), 
action=self.mod_videocodec) ]
         menu_items += [ menu.MenuItem(_('Modify Video Bitrate'), 
action=self.mod_videobitrate) ]
         menu_items += [ menu.MenuItem(_('Modify Audio Codec'), 
action=self.mod_audiocodec) ]
@@ -148,8 +153,8 @@
     def select_profile(self, arg=None, menuw=None):
         _debug_('select_profile(self, arg=None, menuw=None)', 1)
         menu_items = []
-        menu_items += [ menu.MenuItem(_('Xvid High Quality'), 
action=self.select_encoding_profile, arg='xvid_high') ] 
         menu_items += [ menu.MenuItem(_('Xvid Low Quality'), 
action=self.select_encoding_profile, arg='xvid_low') ] 
+        menu_items += [ menu.MenuItem(_('Xvid High Quality'), 
action=self.select_encoding_profile, arg='xvid_high') ] 
         menu_items += [ menu.MenuItem(_('iPod'), 
action=self.select_encoding_profile, arg='ipod') ] 
         encoding_menu = menu.Menu(_('Select Profile'), menu_items, item_types 
= 'video encoding menu')
         encoding_menu.infoitem = self
@@ -166,6 +171,16 @@
         menuw.pushmenu(container_menu)
         menuw.refresh()
 
+    def mod_resolution(self, arg=None, menuw=None):
+        _debug_('mod_resolution(self, arg=%r, menuw=%r)' % (arg, menuw), 1)
+        items = []
+        for resolution in ('Optimal','320:240'):
+            items.append(menu.MenuItem(resolution, action=self.alter_prop, 
arg=('resolution', resolution)))
+        resolution_menu = menu.Menu(_('Modify Resolution'), items, item_types 
= 'video encoding menu')
+        resolution_menu.infoitem = self
+        menuw.pushmenu(resolution_menu)
+        menuw.refresh()
+
     def mod_videocodec(self, arg=None, menuw=None):
         _debug_('mod_videocodec(self, arg=%r, menuw=%r)' % (arg, menuw), 1)
         items = []
@@ -228,24 +243,27 @@
 
     def select_encoding_profile(self, arg=None, menuw=None):
         _debug_('select_encoding_profile(self, arg=%r, menuw=%r)' % (arg, 
menuw), 1)
-        if arg == 'xvid_high':
+        if arg == 'xvid_low':
             self.profile['container'] = 'avi'
-            self.profile['videocodec'] = 'XViD'
-            self.profile['videobitrate'] = 1200
+            self.profile['resolution'] = 'Optimal'
+            self.profile['videocodec'] = 'XviD'
+            self.profile['videobitrate'] = 800
             self.profile['audiocodec'] = 'MPEG 1 Layer 3 (mp3)'
             self.profile['audiobitrate'] = 128
-            self.profile['numpasses'] = 2
+            self.profile['numpasses'] = 1
             self.profile['videofilter'] = 'None'
-        elif arg == 'xvid_low':
+        elif arg == 'xvid_high':
             self.profile['container'] = 'avi'
-            self.profile['videocodec'] = 'XViD'
-            self.profile['videobitrate'] = 800
+            self.profile['resolution'] = 'Optimal'
+            self.profile['videocodec'] = 'XviD'
+            self.profile['videobitrate'] = 1200
             self.profile['audiocodec'] = 'MPEG 1 Layer 3 (mp3)'
             self.profile['audiobitrate'] = 128
-            self.profile['numpasses'] = 1
+            self.profile['numpasses'] = 2
             self.profile['videofilter'] = 'None'
         elif arg == 'ipod':
             self.profile['container'] = 'mp4'
+            self.profile['resolution'] = '320:240'
             self.profile['videocodec'] = 'iPodv'
             self.profile['videobitrate'] = 1200
             self.profile['audiocodec'] = 'iPoda'
@@ -256,6 +274,8 @@
             _debug_('Unknown Profile "%s"' % (arg), 0)
             self.error(_('Unknown Profile')+(' "%s"' % (arg)))
             return
+        (filename, extn) = os.path.splitext(self.filename)
+        self.filename = filename+'.'+self.profile['container']
 
         if menuw:
             menuw.back_one_menu(arg='reload')
@@ -267,6 +287,10 @@
 
         if prop == 'container':
             self.profile['container'] = val
+            (filename, extn) = os.path.splitext(self.filename)
+            self.filename = filename+'.'+self.profile['container']
+        elif prop == 'resolution':
+            self.profile['resolution'] = val
         elif prop == 'videocodec':
             self.profile['videocodec'] = val
         elif prop == 'videobitrate':
@@ -303,6 +327,7 @@
 
         box = PopupBox(text=_('Please wait, analyzing video...'))
         box.show()
+        print 'DJW:filename:', self.filename
         (status, resp) = initEncodeJob(self.source, self.filename, self.title)
         _debug_('initEncodeJob:status:%s resp:%s' % (status, resp))
         box.destroy()
@@ -318,7 +343,8 @@
             self.error(resp)
             return
 
-        (status, resp) = setVideoCodec(idnr, profile['videocodec'], 0, 
profile['numpasses'], profile['videobitrate'])
+        multipass = profile['numpasses'] > 1
+        (status, resp) = setVideoCodec(idnr, profile['videocodec'], 0, 
multipass, profile['videobitrate'])
         _debug_('setVideoCodec:status:%s resp:%s' % (status, resp))
         if not status:
             self.error(resp)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to