Hello, I'm trying to remove the waiting time between two parts when playing a video cut in multiple files and played joined with the config.AUTOJOIN feature or a .fxd file.
I've made a patch that appends the subitems to the same call to mplayer or xine. In mplayer it uses -fixed-vo to use the same window. This way the gap between files is smaller. It works for me but I think we should do more testing, see if it's the best way of doing that or what implications could have this change in other plugins. Thank you
Index: src/video/plugins/xine.py =================================================================== --- src/video/plugins/xine.py (revision 10948) +++ src/video/plugins/xine.py (working copy) @@ -144,6 +144,39 @@ return 0 + def parse_url(self, item, options): + + if item.mode == 'dvd' and hasattr(item, 'filename') and item.filename and \ + item.filename.endswith('.iso'): + # dvd:///full/path/to/image.iso/ + url = 'dvd://%s/' % item.filename + + elif item.mode == 'dvd' and hasattr(item.media, 'devicename'): + # dvd:///dev/dvd/2 + url = 'dvd://%s/%s' % (item.media.devicename, item.url[6:]) + + elif item.mode == 'dvd': # no devicename? Probably a mirror image on the HD + url = item.url + + elif item.mode == 'vcd': + # vcd:///dev/cdrom -- NO track support (?) + url = 'vcd://%s' % item.media.devicename + + elif item.mimetype == 'cue': + url = 'vcd://%s' % item.filename + if not is_subitem: + self.app_mode = 'vcd' + + else: + if (len(options) > 1): + if (options[1] == '--playlist'): + url = '%s %s' % (options[1],options[2]) + else: + url = item.url + + return url + + def play(self, options, item): """ play video media with xine """ _debug_('play(options=%r, item=%r)' % (options, item), 2) @@ -155,6 +188,9 @@ else: self.app_mode = 'video' + if item.mimetype == 'cue': + self.app_mode = 'vcd' + if plugin.getbyname('MIXER'): plugin.getbyname('MIXER').reset() @@ -180,35 +216,20 @@ 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/ - command.append('dvd://%s/' % item.filename) + if item.subitems: + for i in item.subitems: + item.set_next_available_subitem() + if item.current_subitem: + url = self.parse_url(item.current_subitem, options) + command.append(url) - elif item.mode == 'dvd' and hasattr(item.media, 'devicename'): - # dvd:///dev/dvd/2 - command.append('dvd://%s/%s' % (item.media.devicename, item.url[6:])) + item.current_subitem = None - elif item.mode == 'dvd': # no devicename? Probably a mirror image on the HD - command.append(item.url) + else: + url = self.parse_url(item, options) + command.append(url) - elif item.mode == 'vcd': - # vcd:///dev/cdrom -- NO track support (?) - command.append('vcd://%s' % item.media.devicename) - elif item.mimetype == 'cue': - command.append('vcd://%s' % item.filename) - self.app_mode = 'vcd' - - else: - if (len(options) > 1): - if (options[1] == '--playlist'): - #command.append('%s %s' % (options[1],options[2])) - command.append(options[1]) - command.append(options[2]) - else: - command.append(item.url) - self.stdout_plugins = [] rc.app(self) Index: src/video/plugins/mplayer.py =================================================================== --- src/video/plugins/mplayer.py (revision 10948) +++ src/video/plugins/mplayer.py (working copy) @@ -104,29 +104,17 @@ return 0 - def play(self, options, item): - """ - play a videoitem with mplayer - """ - _debug_('options=%r' % (options,), 2) - for k, v in item.__dict__.items(): - _debug_('item[%s]=%r' % (k, v), 2) + def parse_url(self, item, is_subitem=False): + mode = item.mode + url = item.url - mode = item.mode - url = item.url - - self.options = options - self.item = item - self.item_info = None - self.item_length = -1 - self.item.elapsed = 0 - if mode == 'file': url = item.url[6:] - self.item_info = mmpython.parse(url) - if hasattr(self.item_info, 'get_length'): - self.item_length = self.item_info.get_endpos() - self.dynamic_seek_control = True + if not is_subitem: + self.item_info = mmpython.parse(url) + if hasattr(self.item_info, 'get_length'): + self.item_length = self.item_info.get_endpos() + self.dynamic_seek_control = True if url.startswith('dvd://') and url[-1] == '/': url += '1' @@ -139,15 +127,29 @@ url = item.url + str(i+1) try: - _debug_('MPlayer.play(): mode=%s, url=%s' % (mode, url)) + _debug_('parse_url(): mode=%s, url=%s, is_subitem=%s' % (mode, url, is_subitem)) except UnicodeError: - _debug_('MPlayer.play(): [non-ASCII data]') + _debug_('parse_url(): [non-ASCII data]') - if mode == 'file' and not os.path.isfile(url): - # This event allows the videoitem which contains subitems to - # try to play the next subitem - return '%s\nnot found' % os.path.basename(url) + return url + + def play(self, options, item): + """ + play a videoitem with mplayer + """ + _debug_('options=%r' % (options,), 2) + for k, v in item.__dict__.items(): + _debug_('item[%s]=%r' % (k, v), 2) + + self.options = options + self.item = item + self.item_info = None + self.item_length = -1 + self.item.elapsed = 0 + + url = self.parse_url(item) + set_vcodec = False if item['xvmc'] and item['type'][:6] in ['MPEG-1', 'MPEG-2', 'MPEG-T']: set_vcodec = True @@ -347,8 +349,21 @@ command = self.sort_filter(command) - command += ['%(url)s' % args] + if item.subitems: + command += ['-fixed-vo'] + for i in item.subitems: + item.set_next_available_subitem() + if item.current_subitem: + url = self.parse_url(item.current_subitem, True) + command += [ url ] + + item.current_subitem = None + + else: + command += ['%(url)s' % args] + + _debug_(' '.join(command[1:])) #if plugin.getbyname('MIXER'): @@ -356,6 +371,7 @@ rc.app(self) self.app = MPlayerApp(command, self) + return None @@ -475,12 +491,12 @@ return True if event == VIDEO_NEXT_AUDIOLANG: - self.app.write('switch_audio\n') - return True + self.app.write('switch_audio\n') + return True if event == VIDEO_NEXT_SUBTITLE: - self.app.write('sub_select\n') - return True + self.app.write('sub_select\n') + return True if event == OSD_MESSAGE: self.app.write('osd_show_text "%s"\n' % event.arg); Index: src/video/videoitem.py =================================================================== --- src/video/videoitem.py (revision 10948) +++ src/video/videoitem.py (working copy) @@ -604,44 +604,6 @@ self.variants[0].play(arg, menuw) return - # if we have subitems (a movie with more than one file), - # we start playing the first that is physically available - if self.subitems: - self.error_in_subitem = 0 - self.last_error_msg = '' - self.current_subitem = None - - result = self.set_next_available_subitem() - if self.current_subitem: # 'result' is always 1 in this case - # The media is available now for playing - # Pass along the options, without loosing the subitem's own - # options - if self.current_subitem.mplayer_options: - if self.mplayer_options: - # With this set the player options are incorrect when there is more than 1 item - #self.current_subitem.mplayer_options += ' ' + self.mplayer_options - pass - else: - self.current_subitem.mplayer_options = self.mplayer_options - # When playing a subitem, the menu must be hidden. If it is not, - # the playing will stop after the first subitem, since the - # PLAY_END/USER_END event is not forwarded to the parent - # videoitem. - # And besides, we don't need the menu between two subitems. - self.menuw.hide() - self.last_error_msg = self.current_subitem.play(arg, self.menuw) - if self.last_error_msg: - self.error_in_subitem = 1 - # Go to the next playable subitem, using the loop in - # eventhandler() - self.eventhandler(PLAY_END) - - elif not result: - # No media at all was found: error - ConfirmBox(text=(_('No media found for "%s".\nPlease insert the media "%s".')) % - (self.name, self.media_id), handler=self.play).show() - return - # normal plackback of one file if self.url.startswith('file://'): file = self.filename @@ -775,31 +737,6 @@ if self.plugin_eventhandler(event, menuw): return True - # PLAY_END: do we have to play another file? - if self.subitems and not self.variants: - if event == PLAY_END: - if not hasattr(self, 'error_in_subitem'): - # I have no idea how this can happen, but it does - self.error_in_subitem = 0 - self.set_next_available_subitem() - # Loop until we find a subitem which plays without error - while self.current_subitem: - _debug_('playing next item') - error = self.current_subitem.play(menuw=menuw) - if error: - self.last_error_msg = error - self.error_in_subitem = 1 - self.set_next_available_subitem() - else: - return True - if self.error_in_subitem: - # No more subitems to play, and an error occured - self.menuw.show() - AlertBox(text=self.last_error_msg).show() - - elif event == USER_END: - pass - # show configure menu if event == MENU: if self.player:
signature.asc
Description: Digital signature
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel