Author: duncan
Date: Wed Jan 17 21:59:54 2007
New Revision: 8987

Added:
   branches/rel-1/freevo/src/video/plugins/bilingual.py   (contents, props 
changed)
Modified:
   branches/rel-1/freevo/ChangeLog
   branches/rel-1/freevo/src/video/plugins/mplayer.py

Log:
[ 1582292 ] Dual language audio
New plug-in added and mplayer adapted for playing it


Modified: branches/rel-1/freevo/ChangeLog
==============================================================================
--- branches/rel-1/freevo/ChangeLog     (original)
+++ branches/rel-1/freevo/ChangeLog     Wed Jan 17 21:59:54 2007
@@ -37,6 +37,7 @@
  * New weather helper to grab the weather using cron (F#1603052)
  * New webserver library, allows playing/viewing on your local machine 
(F#1592806)
  * New webserver remote, allows controlling freevo from a web page (F#1624110)
+ * New video plug-in to play bilingual recordings (F#1582292)
  * Updated cdbackup plug-in to accept CD_RIP_CASE and CD_RIP_REPLACE_SPACE 
(F#1616046)
  * Updated directory configuration to allow disabling of smart abbreviated 
item names (F#1602952)
  * Updated idlebar clock plug-in to allow CLOCK_FORMAT to be used (F#1605951)

Added: branches/rel-1/freevo/src/video/plugins/bilingual.py
==============================================================================
--- (empty file)
+++ branches/rel-1/freevo/src/video/plugins/bilingual.py        Wed Jan 17 
21:59:54 2007
@@ -0,0 +1,100 @@
+# -*- coding: iso-8859-1 -*-
+# -----------------------------------------------------------------------
+# bilingual.py - A plugin to add options to play bilingual recordings.
+# -----------------------------------------------------------------------
+# $Id$
+#
+# Notes:
+#    To activate, put the following line in local_conf.py:
+#       plugin.activate('video.bilingual')
+# ToDo:
+#
+# -----------------------------------------------------------------------
+# Freevo - A Home Theater PC framework
+# Copyright (C) 2002 Krister Lagerstrom, et al.
+# Please see the file freevo/Docs/CREDITS for a complete list of authors.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
+# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# -----------------------------------------------------------------------
+
+
+from os.path import join, split
+import plugin
+import menu
+import os
+import config
+from video.encodingclient import *
+from gui.AlertBox import AlertBox
+from gui.PopupBox import PopupBox
+
+DEBUG = config.DEBUG
+
+class PluginInterface(plugin.ItemPlugin):
+    """
+    Plug-in to play tv recordings which have bilingual audio
+    """
+
+    def __init__(self):
+        _debug_('__init__(self)', 2)
+        plugin.ItemPlugin.__init__(self)
+        self.item = None
+
+
+    def config(self):
+        '''config is called automatically,
+        freevo plugins -i video.bilingual returns the info
+        '''
+        _debug_('config(self)', 2)
+        return [
+            ('BILINGUAL_PATH', '/usr/bin/cdrecord', 'Path to bilingual'),
+        ]
+
+
+    def actions(self, item):
+        '''Determines if an action applies to the menu
+        
+        Normally, the only way to record bilingual audio is with a recent
+        version of the ivtv driver (>=0.8.2) the ideas is that you can select 
the
+        left, right or both channels and this information is passed to the 
player
+        as part of the item, i.e. item.language_selection.
+        '''
+        _debug_('actions(self, item)', 2)
+        if item.type == 'video' and item.mode == 'file':
+            _debug_('len(item.info[\'audio\'])=%d' % (len(item.info['audio'])))
+            _debug_('item[\'audio\'][0][\'codec\']=%r' % 
(item['audio'][0]['codec']))
+            if len(item.info['audio']) == 1:
+                if item['audio'][0]['codec'] == 'MP2A':
+                    self.item = item
+                    return [ (self.language_selection_menu, _('Bilingual 
language selection')) ]
+        return []
+
+
+    def language_selection_menu(self, menuw=None, arg=None):
+        _debug_('language_selection_menu(self, menuw=%r, arg=%r)' % (menuw, 
arg), 2)
+        menu_items = []
+        menu_items += [ menu.MenuItem(_('Play Both Channels'), 
self.language_selection, (self.item, 'both'))  ]
+        menu_items += [ menu.MenuItem(_('Play Left Channel'),  
self.language_selection, (self.item, 'left'))  ]
+        menu_items += [ menu.MenuItem(_('Play Right Channel'), 
self.language_selection, (self.item, 'right')) ]
+        moviemenu = menu.Menu(_('Language Menu'), menu_items)
+        menuw.pushmenu(moviemenu)
+
+
+    def language_selection(self, menuw=None, arg=None):
+        _debug_('language_selection(self, menuw=%r, arg=%r)' % (menuw, arg), 2)
+        arg[0].selected_language = arg[1]
+        menuw.back_one_menu()
+
+

Modified: branches/rel-1/freevo/src/video/plugins/mplayer.py
==============================================================================
--- branches/rel-1/freevo/src/video/plugins/mplayer.py  (original)
+++ branches/rel-1/freevo/src/video/plugins/mplayer.py  Wed Jan 17 21:59:54 2007
@@ -195,10 +195,17 @@
             else:
                additional_args += [ '-aid', str(item.selected_audio) ]
 
+        # This comes from the bilingual language selection menu
+        if item.selected_language:
+            if item.selected_language == 'left':
+                additional_args += [ '-af', 'pan=2:1:1:0:0' ]
+            elif item.selected_language == 'right':
+                additional_args += [ '-af', 'pan=2:0:0:1:1' ]
+
         if item['deinterlace'] and config.MPLAYER_VF_INTERLACED:
-                additional_args += [ '-vf', config.MPLAYER_VF_INTERLACED ]
+            additional_args += [ '-vf', config.MPLAYER_VF_INTERLACED ]
         elif config.MPLAYER_VF_PROGRESSIVE:
-                additional_args += [ '-vf', config.MPLAYER_VF_PROGRESSIVE ]
+            additional_args += [ '-vf', config.MPLAYER_VF_PROGRESSIVE ]
 
         if os.path.isfile(os.path.splitext(item.filename)[0]+'.edl'):
            additional_args += [ '-edl', 
str(os.path.splitext(item.filename)[0]+'.edl') ]

-------------------------------------------------------------------------
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