[PyQt] Trying to create SIP

Tomas Neverdauskas topazas at gmail.com
Tue Apr 23 08:58:27 BST 2013


Hi,

i'am trying to create python interface to QtAV project
https://github.com/wang-bin/QtAV (AvPlayer.h). Currently wrote this sip
file, but after executing got this "sip: syntax error" and no other hint is
provided.

Please help to parse this file, thank you.

%Module AVPlayer

%Import QtCore/QtCoremod.sip
%Import QtGui/QtGuimod.sip

namespace QtAV {

%TypeHeaderCode
#include <../src/QtAV/AVClock.h>
#include <../src/QtAV/AVDemuxer.h>
%End

class AudioOutput;
class AudioThread;
class VideoThread;
class AudioDecoder;
class VideoDecoder;
class VideoRenderer;
class AVClock;
class AVDemuxThread;
class VideoCapture;
class OSDFilter;
class AVPlayer : QObject
{
public:
    explicit AVPlayer(QObject *parent = 0);
    ~AVPlayer();

    //NOT const. This is the only way to access the clock.
    AVClock* masterClock();
    void setFile(const QString& path);
 QString file() const;
    bool load(const QString& path);
    bool load();
    bool isLoaded() const;
    qreal duration() const; //This function may be removed in the future.
    /*
     * default: [fmt: PNG, dir: capture, name: basename]
     * replace the existing capture; return the replaced one
     * set 0 will disable the capture
     */
    VideoCapture* setVideoCapture(VideoCapture* cap);
    VideoCapture *videoCapture();
    void setCaptureName(const QString& name);//TODO: remove. base name
    void setCaptureSaveDir(const QString& dir); //TODO: remove
    bool captureVideo();
    OSDFilter* setOSDFilter(OSDFilter* osd);
    OSDFilter* osdFilter();
    bool play(const QString& path);
 bool isPlaying() const;
    bool isPaused() const;
    //this will install the default EventFilter. To use customized filter,
register after this
    VideoRenderer* setRenderer(VideoRenderer* renderer);
    VideoRenderer* renderer();
    AudioOutput* audio();
    void setMute(bool mute);
    bool isMute() const;
    /*only 1 event filter is available. the previous one will be removed.
setPlayerEventFilter(0) will remove the event filter*/
    void setPlayerEventFilter(QObject *obj);

signals:
    void started();
    void stopped();

public slots:
    void pause(bool p);
    void play(); //replay
    void stop();
    void playNextFrame();
    void seek(qreal pos);
    void seekForward();
    void seekBackward();
    void updateClock(qint64 msecs); //update AVClock's external clock

protected slots:
    void resizeRenderer(const QSize& size);

public: //original was protected, but SIP complained that classes must be
public
    bool loaded;
    AVFormatContext *formatCtx; //changed when reading a packet
    AVCodecContext *aCodecCtx; //set once and not change
    AVCodecContext *vCodecCtx; //set once and not change
    QString path;
    QString capture_name;
    QString capture_dir;

    //the following things are required and must be setted not null
    AVDemuxer demuxer;
    AVDemuxThread *demuxer_thread;
    AVClock *clock;
    VideoRenderer *_renderer; //list?
    AudioOutput *_audio;
    AudioDecoder *audio_dec;
    VideoDecoder *video_dec;
    AudioThread *audio_thread;
    VideoThread *video_thread;

    //tODO: (un)register api
    QObject *event_filter;
    VideoCapture *video_capture;
    OSDFilter *osd;
};

} //namespace QtAV
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20130423/8116519d/attachment.html>


More information about the PyQt mailing list