Phonon error: libv4l2: error getting pixformat: Invalid argument

T

tausciam

Here is my code. I'm just trying to play an mp3 that I've clicked in a PyQT listwidget:

@pyqtSlot()
def item_clicked(self):
row = self.listWidget.currentRow()
song = musiclist[row]
QCoreApplication.setApplicationName("Phonon")
output = Phonon.AudioOutput(Phonon.MusicCategory)
m_media = Phonon.MediaObject()
Phonon.createPath(m_media, output)
m_media.setCurrentSource(Phonon.MediaSource(song))
m_media.play()

I'm running OpenSUSE Linux 12.3

Any ideas?
 
T

tausciam

Looking in /var/log/messages, every time I get that error I get:

[41553.128652] xc2028 9-0061: i2c input error: rc = -19 (should be 2)
[41553.152537] xc2028 9-0061: i2c input error: rc = -19 (should be 2)
[41553.355913] xc2028 9-0061: i2c input error: rc = -19 (should be 2)
[41553.379712] xc2028 9-0061: i2c input error: rc = -19 (should be 2)

and that's my video capture card! That has nothing to do with playing an mp3
 
C

Chris Angelico

Here is my code. I'm just trying to play an mp3 that I've clicked in a PyQT listwidget:

@pyqtSlot()
def item_clicked(self):
row = self.listWidget.currentRow()
song = musiclist[row]
QCoreApplication.setApplicationName("Phonon")
output = Phonon.AudioOutput(Phonon.MusicCategory)
m_media = Phonon.MediaObject()
Phonon.createPath(m_media, output)
m_media.setCurrentSource(Phonon.MediaSource(song))
m_media.play()

I can't help with Phonon itself, but here's a general comment: When
you have a problem like this, post the full exception traceback. Also,
if you can, try to cut down the example to the point where you can
post all the code, not just one method; if you make it so we can
actually run the script, it's that much more likely we can help you.
But mainly, the exception traceback - it's very helpful.

Help us to help you! :)

ChrisA
 
T

tausciam

It's not giving me an exception. Here is the code I used:

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.phonon import Phonon
import os
import sys, traceback

def lumberjack():
song = '/home/tannhaus/Music/A Perfect Circle/eMOTIVE/02 Imagine.mp3'
QCoreApplication.setApplicationName("Phonon")
output = Phonon.AudioOutput(Phonon.MusicCategory)
m_media = Phonon.MediaObject()
Phonon.createPath(m_media, output)
m_media.setCurrentSource(Phonon.MediaSource(song))
m_media.play()

class MainWindow(QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)

try:
lumberjack()
except IndexError:
exc_type, exc_value, exc_traceback = sys.exc_info()
print "*** print_tb:"
traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
print "*** print_exception:"
traceback.print_exception(exc_type, exc_value, exc_traceback,
limit=2, file=sys.stdout)
print "*** print_exc:"
traceback.print_exc()
print "*** format_exc, first and last line:"
formatted_lines = traceback.format_exc().splitlines()
print formatted_lines[0]
print formatted_lines[-1]
print "*** format_exception:"
print repr(traceback.format_exception(exc_type, exc_value,
exc_traceback))
print "*** extract_tb:"
print repr(traceback.extract_tb(exc_traceback))
print "*** format_tb:"
print repr(traceback.format_tb(exc_traceback))
print "*** tb_lineno:", exc_traceback.tb_lineno

if __name__=="__main__":
from sys import argv, exit

a=QApplication(argv)
m=MainWindow()
m.show()
m.raise_()
exit(a.exec_())


When I run it, the complete and only error I get is:

libv4l2: error getting pixformat: Invalid argument

When I check /var/log/messages, I see these messages:

2013-08-27T18:12:04.163062-05:00 tannhaus-PC kernel: [ 1786.397499] xc2028 9-0061: i2c input error: rc = -19 (should be 2)
2013-08-27T18:12:04.187054-05:00 tannhaus-PC kernel: [ 1786.421479] xc2028 9-0061: i2c input error: rc = -19 (should be 2)
2013-08-27T18:12:04.391057-05:00 tannhaus-PC kernel: [ 1786.625614] xc2028 9-0061: i2c input error: rc = -19 (should be 2)
2013-08-27T18:12:04.415052-05:00 tannhaus-PC kernel: [ 1786.649613] xc2028 9-0061: i2c input error: rc = -19 (should be 2)
 
T

tausciam

I unplugged the tv capture card and got no errors at all. It didn't cause it to crash when I had it plugged in. However, it appears that it's not actually playing the mp3. I don't hear it at all. I checked my sound mixer and no channels are muted.
 
T

tausciam

When I pare down the code to the following, I can't hear the mp3 play either:

#!/usr/bin/env python

import sip
sip.setapi('QString', 2)

import sys

from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon



class MainWindow(QtGui.QMainWindow):
def __init__(self):
super(QtGui.QMainWindow, self).__init__()
self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
self.mediaObject = Phonon.MediaObject(self)
self.metaInformationResolver = Phonon.MediaObject(self)
Phonon.createPath(self.mediaObject, self.audioOutput)
self.sources = "/home/tannhaus/Music/A Perfect Circle/eMOTIVE/02 Imagine.mp3"
self.metaInformationResolver.setCurrentSource(Phonon.MediaSource(self.sources))
self.mediaObject.play()

if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
app.setApplicationName("Music Player")
app.setQuitOnLastWindowClosed(True)

window = MainWindow()
window.show()

sys.exit(app.exec_())
 
T

tausciam

I've played around with it and got code that plays mp3s now. I'm not sure what I was doing wrong.... or why it plays now...but it does, so I'm going to use it:

#!/usr/bin/env python

import sip
sip.setapi('QString', 2)

import sys

from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon



class MainWindow(QtGui.QMainWindow):
def __init__(self):
super(QtGui.QMainWindow, self).__init__()
self.sources = "/home/tannhaus/Music/A Perfect Circle/eMOTIVE/02 Imagine.mp3"
self.mediaObject = Phonon.createPlayer(Phonon.MusicCategory)
self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
Phonon.createPath(self.mediaObject, self.audioOutput)
self.mediaObject.setCurrentSource(Phonon.MediaSource(self.sources))
self.mediaObject.play()

if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
app.setApplicationName("Music Player")
app.setQuitOnLastWindowClosed(True)

window = MainWindow()
window.show()

sys.exit(app.exec_())
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top