baudm / mplayer.py

Lightweight Python wrapper for MPlayer
http://pypi.python.org/pypi/mplayer.py
GNU Lesser General Public License v3.0
117 stars 32 forks source link

GtkPlayerView exits on source change #6

Closed baudm closed 9 years ago

baudm commented 9 years ago

Original issue 3 created by baudm on 2011-03-18T22:30:53.000Z:

What steps will reproduce the problem?

  1. Create sample program that uses GtkPlayerView (Qt probably also)
  2. Use player.loadfile
  3. change the loaded file by calling player.loadfile again

What is the expected output? What do you see instead? Expected is to switch the video file playing. Insteda the application is closed.

What version of the product are you using? On what operating system? latest hg clone from today (March 18)

Please provide any additional information below.

Some debugging showed that during changing the files GtkPlayerView._handle_data is called. It assumes that once you get "EOF code" this is the end.

In mp_core.h there are the EOF codes:

define PT_NEXT_ENTRY 1

define PT_PREV_ENTRY -1

define PT_NEXT_SRC 2

define PT_PREV_SRC -2

define PT_UP_NEXT 3

define PT_UP_PREV -3

define PT_STOP 4

I changed the method to check for "EOF code: 4" which works for me.

baudm commented 9 years ago

Comment #1 originally posted by baudm on 2011-03-19T06:44:05.000Z:

Actually, the application will not close unless you connect the 'complete' signal to gtk.main_quit(). But I guess that's where the problem lies--what does the 'complete' signal actually mean?

First of all, thank you for bringing this up. I haven't really focused on the GTK/Qt-integration classes lately. I think a better approach would be to get rid of the 'complete' signal altogether and just replace it with seven separate signals namely:

  1. pt_next_entry
  2. pt_prev_entry
  3. pt_next_src
  4. pt_prev_src
  5. pt_up_next
  6. pt_up_prev
  7. pt_stop

This way, the corresponding signal would be emitted depending on the EOF code.

baudm commented 9 years ago

Comment #2 originally posted by baudm on 2011-08-28T15:18:14.000Z:

This has been fixed/improved since revision e03cdd3f41e9. The complete/completed signal has been replaced with the 'eof' signal. The main difference is that with the 'eof' signal, the EOF code is passed to its callbacks/slots.