<div dir="ltr"><div style>Hi,</div><div style><br></div><div style>i'am trying to create python interface to QtAV project <a href="https://github.com/wang-bin/QtAV">https://github.com/wang-bin/QtAV</a> (AvPlayer.h). Currently wrote this sip file, but after executing got this "sip: syntax error" and no other hint is provided.</div>
<div style><br></div><div style>Please help to parse this file, thank you.</div><div style><br></div><div style><div><font size="1">%Module AVPlayer</font></div><div><font size="1"><br></font></div><div><font size="1">%Import QtCore/QtCoremod.sip</font></div>
<div><font size="1">%Import QtGui/QtGuimod.sip</font></div><div><font size="1"><br></font></div><div><font size="1">namespace QtAV {</font></div><div><font size="1"><br></font></div><div><font size="1">%TypeHeaderCode</font></div>
<div><font size="1">#include <../src/QtAV/AVClock.h></font></div><div><font size="1">#include <../src/QtAV/AVDemuxer.h></font></div><div><font size="1">%End</font></div><div><font size="1"><br></font></div><div>
<font size="1">class AudioOutput;</font></div><div><font size="1">class AudioThread;</font></div><div><font size="1">class VideoThread;</font></div><div><font size="1">class AudioDecoder;</font></div><div><font size="1">class VideoDecoder;</font></div>
<div><font size="1">class VideoRenderer;</font></div><div><font size="1">class AVClock;</font></div><div><font size="1">class AVDemuxThread;</font></div><div><font size="1">class VideoCapture;</font></div><div><font size="1">class OSDFilter;</font></div>
<div><font size="1">class AVPlayer : QObject</font></div><div><font size="1">{</font></div><div><font size="1">public:</font></div><div><font size="1"> explicit AVPlayer(QObject *parent = 0);</font></div><div><font size="1"> ~AVPlayer();</font></div>
<div><font size="1"><br></font></div><div><font size="1"> //NOT const. This is the only way to access the clock.</font></div><div><font size="1"> AVClock* masterClock();</font></div><div><font size="1"> void setFile(const QString& path);</font></div>
<div><font size="1"><span class="" style="white-space:pre"> </span>QString file() const;</font></div><div><font size="1"> bool load(const QString& path);</font></div><div><font size="1"> bool load();</font></div>
<div><font size="1"> bool isLoaded() const;</font></div><div><font size="1"> qreal duration() const; //This function may be removed in the future.</font></div><div><font size="1"> /*</font></div><div><font size="1"> * default: [fmt: PNG, dir: capture, name: basename]</font></div>
<div><font size="1"> * replace the existing capture; return the replaced one</font></div><div><font size="1"> * set 0 will disable the capture</font></div><div><font size="1"> */</font></div><div><font size="1"> VideoCapture* setVideoCapture(VideoCapture* cap);</font></div>
<div><font size="1"> VideoCapture *videoCapture();</font></div><div><font size="1"> void setCaptureName(const QString& name);//TODO: remove. base name</font></div><div><font size="1"> void setCaptureSaveDir(const QString& dir); //TODO: remove</font></div>
<div><font size="1"> bool captureVideo();</font></div><div><font size="1"> OSDFilter* setOSDFilter(OSDFilter* osd);</font></div><div><font size="1"> OSDFilter* osdFilter();</font></div><div><font size="1"> bool play(const QString& path);</font></div>
<div><font size="1"><span class="" style="white-space:pre"> </span>bool isPlaying() const;</font></div><div><font size="1"> bool isPaused() const;</font></div><div><font size="1"> //this will install the default EventFilter. To use customized filter, register after this</font></div>
<div><font size="1"> VideoRenderer* setRenderer(VideoRenderer* renderer);</font></div><div><font size="1"> VideoRenderer* renderer();</font></div><div><font size="1"> AudioOutput* audio();</font></div><div><font size="1"> void setMute(bool mute);</font></div>
<div><font size="1"> bool isMute() const;</font></div><div><font size="1"> /*only 1 event filter is available. the previous one will be removed. setPlayerEventFilter(0) will remove the event filter*/</font></div><div>
<font size="1"> void setPlayerEventFilter(QObject *obj);</font></div><div><font size="1"><br></font></div><div><font size="1">signals:</font></div><div><font size="1"> void started();</font></div><div><font size="1"> void stopped();</font></div>
<div><font size="1"><br></font></div><div><font size="1">public slots:</font></div><div><font size="1"> void pause(bool p);</font></div><div><font size="1"> void play(); //replay</font></div><div><font size="1"> void stop();</font></div>
<div><font size="1"> void playNextFrame();</font></div><div><font size="1"> void seek(qreal pos);</font></div><div><font size="1"> void seekForward();</font></div><div><font size="1"> void seekBackward();</font></div>
<div><font size="1"> void updateClock(qint64 msecs); //update AVClock's external clock</font></div><div><font size="1"><br></font></div><div><font size="1">protected slots:</font></div><div><font size="1"> void resizeRenderer(const QSize& size);</font></div>
<div><font size="1"><br></font></div><div><font size="1">public: //original was protected, but SIP complained that classes must be public</font></div><div><font size="1"> bool loaded;</font></div><div><font size="1"> AVFormatContext<span class="" style="white-space:pre"> </span>*formatCtx; //changed when reading a packet</font></div>
<div><font size="1"> AVCodecContext *aCodecCtx; //set once and not change</font></div><div><font size="1"> AVCodecContext *vCodecCtx; //set once and not change</font></div><div><font size="1"> QString path;</font></div>
<div><font size="1"> QString capture_name;</font></div><div><font size="1"> QString capture_dir;</font></div><div><font size="1"><br></font></div><div><font size="1"> //the following things are required and must be setted not null</font></div>
<div><font size="1"> AVDemuxer demuxer;</font></div><div><font size="1"> AVDemuxThread *demuxer_thread;</font></div><div><font size="1"> AVClock *clock;</font></div><div><font size="1"> VideoRenderer *_renderer; //list?</font></div>
<div><font size="1"> AudioOutput *_audio;</font></div><div><font size="1"> AudioDecoder *audio_dec;</font></div><div><font size="1"> VideoDecoder *video_dec;</font></div><div><font size="1"> AudioThread *audio_thread;</font></div>
<div><font size="1"> VideoThread *video_thread;</font></div><div><font size="1"><br></font></div><div><font size="1"> //tODO: (un)register api</font></div><div><font size="1"> QObject *event_filter;</font></div>
<div>
<font size="1"> VideoCapture *video_capture;</font></div><div><font size="1"> OSDFilter *osd;</font></div><div><font size="1">};</font></div><div><font size="1"><br></font></div><div><font size="1">} //namespace QtAV</font></div>
<div><br></div></div></div>