2009/7/10 Bernard Mentink <[email protected]>:
>
>
> On Thu, Jul 9, 2009 at 8:09 PM, John Molohan <[email protected]> wrote:
>>
>> Bernard Mentink wrote:
>> >
>> >
>> > On Thu, Jul 9, 2009 at 4:31 AM, John Percival <[email protected]
>> > <mailto:[email protected]>> wrote:
>> >
>> >     Hello,
>> >
>> >     I'm using Freevo 1.8.1, Ubuntu 9.04 and vlc  0.9.9a.
>> >
>> >     I' ve set 'VIDEO_PREFERED_PLAYER = 'vlc', the video plays fine and
>> >     I can control it via the keyboard.
>> >
>> >     However, I cannot get the remote control to work (it works
>> >     perfectly with mplayer and xine).
>> >
>> >     If I press the OK button I get: "no event mapping for key 'SELECT'
>> >     in context 'video'". I cannot find a vlc equivalent for e.g.
>> >     Event(VIDEO_SEND_XINE_CMD).
>> >
>> >     Is there some other configuration file I should be aware of to get
>> >     remote control commands through to vlc?
>> >
>> >     Thanks.
>> >
>> >
>> > I get the same even on freevo 1.9.0
>> >
>> > Cheers,
>> > Bernie
>> Does VLC have a 'slave' mode that supports being passed commands? If not
>> then that's the problem, if it does a quick look at the plugin code
>> comparing it to the xine plugin will show whether the remote events are
>> configured at all or not.
>>
>> John
>
> Hi John,
>
> It doesn't look like the plugin supports sending many events at all, all I
> see in the code is support for the PAUSE/STOP key, and that is all that
> works, there is nothing else supported.
> It's a shame really, as of all the players, vlc gives me the nicest looking
> TV picture.
>
> I woudn't mind having a go at coding it up if someone can give me pointers
> to where to look for help on the plugin format for TV. It looks like VLC
> supports various input event methods, I need someone to help me with which
> one to target ..
Hi
  I have attached an attempt at using vlc's python bindings. The main
problem is that the
bindings are only in the repo.  They aren't distributed in the release.
Also some files (applies to the others interfaces as well) don't seek.
(mpeg-ts for instance)
Also I had naming problems( the python binding was named vlc,as was
plugins in freevo)
so it wouldn't load load the binding without removing vlc.py plugin
from the video player.
I would suggest rc, though the mediacontrolapi is a better approach long term.


Documented here:
http://wiki.videolan.org/MediaControlAPI

Repository here:
https://trac.videolan.org/vlc/browser/bindings/python

Later

Jonathan
> Thanks,
> Bernie
>
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Freevo-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freevo-users
>
>



-- 

ASUS m3a78 mothorboard
AMD Athlon64 X2 Dual Core Processor 6000+ 3.1Ghz
4 Gigabytes of memory
Gigabyte NVidia 9400gt  Graphics adapter
Kworld ATSC 110 TV Capture Card
Kworld ATSC 115 TV Capture Card
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# vlc.py - the Freevo VLC module for video
# -----------------------------------------------------------------------
# $Id: vlc.py 10258 2008-01-03 21:27:20Z duncan $
#
# Notes:
#
# Activate this plugin by putting plugin.activate('video.vlc') in your
# local_conf.py. Than vlc will be used for DVDs when you SELECT the item.
# When you select a title directly in the menu, this plugin won't be used
# and the default player (mplayer) will be used. You need vlc-ui >= 0.9.22
# to use this.
#
# 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
#
# -----------------------------------------------------------------------


import time, os, re
import subprocess
import copy
import vlc

import config     # Configuration handler. reads config file.
import childapp   # Handle child applications
import rc         # The RemoteControl class.
import util



from event import *
import plugin


class PluginInterface(plugin.Plugin):
    """
    Vlc plugin for the video player.

    Activate this plugin by putting in your local_conf.py:
    | plugin.activate('video.vlc')

    Than vlc will be used for DVDs when you SELECT the item.  When
    you select a title directly in the menu, this plugin won't be used and the
    default player (mplayer) will be used. You need vlc-ui >= 0.9.22 to use this.
    """

    def __init__(self):
        plugin.Plugin.__init__(self)

        try:
            config.VLC_COMMAND
        except:
            print String(_( 'ERROR' )) + ': ' + \
                  String(_("'VLC_COMMAND' not defined, 'vlc' video plugin deactivated.\n" \
                           'please check the vlc section in freevo_config.py' ))
            return

        # register vlc as the object to play
        plugin.register(VlcControl(type), plugin.VIDEO_PLAYER, True)

    def config(self):
        return [ ('VLC_OPTIONS', 'None', 'Add your specific VLC options here'), ]




class VlcControl:
    """the main class to control vlc
    """
    def __init__(self, type):
        """
        Vlc contructor
        """
        self.name      = 'vlc'

        self.app_mode  = 'video'
        self.vlc_type = type
        self.player    = None
        self.plugins   = []

    def ShowMessage(self, msg):
        """
        Show a message on the OSD
        """
        _debug_("VLC: Show OSD Message: '%s'" % msg)
        self.player.display_text((msg, (vlc.RelativePosition,vlc.MediaTime,0) , (vlc.RelativePosition,vlc.MediaTime,10*1000)) )


    def rate(self, item):
        """
        How good can this player play the file:
        2 = good
        1 = possible, but not good
        0 = unplayable
        """
        try:
            _debug_('url=%r' % (item.url), 2)
            _debug_('mode=%r' % (item.mode), 2)
            _debug_('mimetype=%r' % (item.mimetype), 2)
            _debug_('network_play=%r' % (item.network_play), 2)
        except Exception, e:
            print e
        if item.url[:7] == 'rtsp://':
            _debug_('%r good' % (item.url))
            return 2
        if item.url.startswith('dvd://'):
            if item.url == 'dvd://':
                _debug_('%r good' % (item.url))
                return 1
            _debug_('%r unplayable' % (item.url))
            return 1
        if item.url.startswith('vcd://'):
            if item.url == 'vcd://':
                _debug_('%r good' % (item.url))
                return 1
            _debug_('%r unplayable' % (item.url))
            return 0
        if item.mimetype in config.VIDEO_VLC_SUFFIX:
            _debug_('%r good' % (item.url))
            return 2
        if item.mode in ('http') and not item.filename and not item.media:
            _debug_('%r unplayable' % (item.url), 2)
            return 1
        if item.network_play:
            _debug_('%r possible' % (item.url))
            return 1
        _debug_('%r unplayable' % (item.url))
        return 0


    def play(self, options, item):
        """
        play a dvd with vlc
        """
        self.item = item
        self.options = options
        self.item.elapsed = 0
        self.max_audio        = 0
        self.current_audio    = -1
        self.max_subtitle     = 0
        self.current_subtitle = -1
	self.mrl = -1

	if config.EVENTS.has_key(item.mode):
            self.app_mode = item.mode
        else:
            self.app_mode = 'video'

         
        if item.mode == 'dvd':
            for track in item.info['tracks']:
                if track.has_key('audio'):
                    self.max_audio = max(self.max_audio, len(track['audio']))

            for track in item.info['tracks']:
                if track.has_key('subtitles'):
                    self.max_subtitle = max(self.max_subtitle, len(track['subtitles']))

        if item.mode == 'dvd' and hasattr(item, 'filename') and item.filename and \
               item.filename.endswith('.iso'):
            # dvd:///full/path/to/image.iso/
            self.mrl = 'dvd://%s' % item.filename

        elif item.mode == 'dvd' and hasattr(item.media, 'devicename'):
            # dvd:///dev/dvd/2
            self.mrl = 'dvd://%s' % item.media.devicename

        elif item.mode == 'dvd': 
            # no devicename? Probably a mirror image on the HD
            self.mrl= item.url

        elif item.mode == 'vcd':
            # vcd:///dev/cdrom -- NO track support (?)
            self.mrl = 'vcd://%s' % item.media.devicename

        elif item.mode == 'rtsp' or item.mode == 'http':
            self.mrl = url
            self.item_length = -1 
        else:
            if (len(options) > 1):
                if (options[1] == '--playlist'):
                   # command.append(options[1])
                    self.mrl = options[2]
            else:
                self.mrl = item.url
        
	self.stdout_plugins = []

        rc.app(self)

        self.player = vlc.MediaControl(['--verbose', '0', '--osd', '--width', str(config.CONF.width),'--height', str(config.CONF.height) ] )
	self.player.set_mrl(self.mrl)
	self.player.start()

        return None


    def stop(self, event=None):
        """
        Stop vlc
        """

        if not self.player:
            return
        
        self.player.stop()
        self.player.exit()
        rc.app(None)
        self.player = None


    def eventhandler(self, event, menuw=None):
        """
        eventhandler for vlc control. If an event is not bound in this
        function it will be passed over to the items eventhandler
        """

        if not self.player:
            return self.item.eventhandler(event)

        if event in ( PLAY_END, USER_END ):
            self.stop()
            return self.item.eventhandler(event)

        if event == PAUSE or event == PLAY:
            self.player.pause()
            return True

        if event == STOP:
            self.stop(event)
            return self.item.eventhandler(event)

        if event == SEEK:
            pos = int(event.arg)
            self.player.set_media_position((vlc.RelativePosition,vlc.MediaTime,pos *1000))
            return True

        if event == OSD_MESSAGE:
            self.player.display_text((( "HELLO %s" % event.arg), ( vlc.RelativePosition,vlc.MediaTime, 0) , (vlc.RelativePosition,vlc.MediaTime,10000) ))
            return True

        # nothing found? Try the eventhandler of the object who called us
        return self.item.eventhandler(event)




------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Freevo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to