On Fri, June 26, 2009 5:07 pm, Duncan Webb wrote:
> Adam Charrett wrote:
>> On Fri, June 26, 2009 11:16 am, Adam Charrett wrote:
>>> On Thu, June 25, 2009 8:11 pm, Michel Hoogervorst wrote:
>>>>> The dialog.x11_overlay_display replaces the default mplayer display
>>>>> to
>>>>> display a pretty pause and play icon instead of the text messages.
>>>>
>>>> Ok, I understand. This should indeed be better looking... but without
>>>> a
>>>> progress-bar when seeking, and some info about the selected subtitle
>>>> when
>>>> pressing the subtitle-button this is pretty useless... especially when
>>>> playing a dvd with lots of subtitles it can be an anoyance when you're
>>>> not
>>>> able to see which one you just selected...
>>> The overlay display stuff is still pretty much in development and needs
>>> someone with some artistic ability (ie. not me :-)) to design a nicer
>>> display for the seeking/pause display. Fancy a go, it should be
>>> reasonable
>>> easy as there is a GUI design tool for the dialogs (freevo
>>> osddesigner).
>>> As for the subtitles, I hold my hands up I didn't think of this as I
>>> don't
>>> use it in video, I'm not even sure mplayer supports outputing this
>>> information to freevo via the console. I'll have to see if it is
>>> possible
>>> to turn on the mplayer osd just for subtitle selection.
>>>
>>
>> Duncan, Michel could you try the attached patch (with the
>> x11_osd_display
>> enabled) to see if mplayer now displays the subtitles being selected?
>>
>> The patch was against the latest 1_9_1 tip.
>
>
> Hi Adam,
>
> Would you like to do this patch the other way around. Only set the
> osdlevel 0 to osd messages that you have replaced and restore it
> afterwards?
>
> I'm still not sure that I like it because it may not be able to
> correctly handle all the mplayer commands, for example:
>
> EVENTS['video']['FFWD'] = Event(VIDEO_SEND_MPLAYER_CMD, arg='speed_mult
> 2.0')
>
> This one doubles the playback speed of mplayer for every FFWD event.
> Even though I see that you have done this for user commands.

Hi Duncan,

the patch already handled that, but I've done what you suggested and
reversed the patch, only done some v minor testing on it but it seems to
work (ie doesn't crash) when the new MPLAYER_USE_FREEVO_OSD is False or
True. I've defaulted the variable to False for the moment so the OSD won't
get used unless enabled.

Cheers

Adam
diff -ur freevo-1.9.1/src/video/plugins/mplayer.py freevo-tmp/src/video/plugins/mplayer.py
--- freevo-1.9.1/src/video/plugins/mplayer.py	2009-06-26 12:34:06.000000000 +0100
+++ freevo-tmp/src/video/plugins/mplayer.py	2009-06-29 13:31:14.000000000 +0100
@@ -57,7 +57,8 @@
         # register mplayer as the object to play video
         plugin.register(MPlayer(), plugin.VIDEO_PLAYER, True)
 
-
+    def config(self):
+        return (('MPLAYER_USE_FREEVO_OSD', False,  'Use the skinnable freevo OSD (if available) rather than the inbuilt mplayer OSD'),)
 
 class MPlayer:
     """
@@ -193,7 +194,6 @@
             'af': [],
             'vf': [],
             'url': url,
-            'disable_osd': False,
         }
 
         if config.CONF.x or config.CONF.y:
@@ -260,10 +260,6 @@
         if os.path.isfile(os.path.splitext(item.filename)[0]+'.edl'):
             args['edl'] = '-edl %s' % str(os.path.splitext(item.filename)[0]+'.edl')
 
-        if dialog.overlay_display_supports_dialogs:
-            # Disable the mplayer OSD if we have a better option.
-            args['disable_osd'] = True
-
         # Mplayer command and standard arguments
         if set_vcodec:
             if item['deinterlace']:
@@ -348,7 +344,6 @@
         command += args['fxd_args'].split()
         command += args['af'] and ['-af', '%s' % ','.join(args['af'])] or []
         command += args['vf'] and ['-vf', '%s' % ','.join(args['vf'])] or []
-        command += args['disable_osd'] and ['-osdlevel', '0'] or []
 
         # use software scaler?
         #XXX these need to be in the arg list as the scaler will add vf args
@@ -451,7 +446,7 @@
             return True
 
         if event == TOGGLE_OSD:
-            if dialog.is_dialog_supported():
+            if config.MPLAYER_USE_FREEVO_OSD and dialog.is_dialog_supported():
                 if self.paused:
                     dialog.show_play_state(dialog.PLAY_STATE_PAUSE , self.get_stored_time_info)
                 else:
@@ -461,17 +456,24 @@
             return True
 
         if event == PAUSE or event == PLAY:
-            self.paused = not self.paused
-            # We have to store the current time before displaying the dialog
-            # otherwise the act of requesting the current position resumes playback!
-            if self.paused:
-                self.stored_time_info = self.get_time_info()
-                dialog.show_play_state(dialog.PLAY_STATE_PAUSE, self.get_time_info)
-                self.app.write('pause\n')
-            else:
-                self.app.write('speed_set 1.0\n')
-                dialog.show_play_state(dialog.PLAY_STATE_PLAY, self.get_time_info)
+            if config.MPLAYER_USE_FREEVO_OSD and dialog.is_dialog_supported():
+                print 'Using Freevo OSD'
+                self.paused = not self.paused
+                # We have to store the current time before displaying the dialog
+                # otherwise the act of requesting the current position resumes playback!
+                self.enable_osd(False)
+
+                if self.paused:
+                    self.stored_time_info = self.get_time_info()
+                    dialog.show_play_state(dialog.PLAY_STATE_PAUSE, self.get_stored_time_info)
+                    self.app.write('pause\n')
+                else:
+                    self.app.write('pause\n')
+                    dialog.show_play_state(dialog.PLAY_STATE_PLAY, self.get_time_info)
 
+                self.enable_osd(True)
+            else:
+                self.app.write('pause\n')
             return True
 
         if event == SEEK:
@@ -501,13 +503,18 @@
 
                     dialog.show_message(_('Seeking not possible'))
                     return False
-
-            if event.arg > 0:
-                dialog.show_play_state(dialog.PLAY_STATE_SEEK_FORWARD, self.get_time_info)
-            else:
-                dialog.show_play_state(dialog.PLAY_STATE_SEEK_BACK, self.get_time_info)
+            if config.MPLAYER_USE_FREEVO_OSD and dialog.is_dialog_supported():
+                self.enable_osd(False)
+                if event.arg > 0:
+                    dialog.show_play_state(dialog.PLAY_STATE_SEEK_FORWARD, self.get_time_info)
+                else:
+                    dialog.show_play_state(dialog.PLAY_STATE_SEEK_BACK, self.get_time_info)
+                self.paused = False    
 
             self.app.write('seek %s\n' % event.arg)
+
+            if config.MPLAYER_USE_FREEVO_OSD and dialog.is_dialog_supported():
+                self.enable_osd(True)
             return True
 
         if event == VIDEO_AVSYNC:
@@ -529,6 +536,15 @@
         # nothing found? Try the eventhandler of the object who called us
         return self.item.eventhandler(event)
 
+    def enable_osd(self, enable):
+        # Only need to do this if we have an overlay display as otherwise the
+        # mplayer osd will already be enabled.
+        if dialog.is_dialog_supported():
+            if enable:
+                self.app.write('pausing_keep set_property osdlevel 1\n')
+            else:
+                self.app.write('pausing_keep set_property osdlevel 0\n')
+
     def show_message(self, message):
         self.app.write('osd_show_text "%s"\n' % message);
 
------------------------------------------------------------------------------
_______________________________________________
Freevo-users mailing list
Freevo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to