Пример #1
0
AVPlayer::AVPlayer(QObject *parent) :
    QObject(parent),loaded(false),capture_dir("capture"),_renderer(0),_audio(0)
  , audio_dec(0)
  , video_dec(0)
  , audio_thread(0)
  , video_thread(0)
  , event_filter(0),video_capture(0)
{
    qDebug("%s", aboutQtAV_PlainText().toUtf8().constData());
    /*
     * call stop() before the window(_renderer) closed to stop the waitcondition
     * If close the _renderer widget, the the _renderer may destroy before waking up.
     */
    connect(qApp, SIGNAL(aboutToQuit()), SLOT(stop()));
    clock = new AVClock(AVClock::AudioClock);
    //clock->setClockType(AVClock::ExternalClock);
	demuxer.setClock(clock);
    connect(&demuxer, SIGNAL(started()), clock, SLOT(start()));

    demuxer_thread = new AVDemuxThread(this);
    demuxer_thread->setDemuxer(&demuxer);

    setPlayerEventFilter(new EventFilter(this));
    setVideoCapture(new VideoCapture());
}
Пример #2
0
void aboutQtAV()
{
#if QTAV_HAVE(WIDGETS)
    QMessageBox::about(0, QObject::tr("About QtAV"), aboutQtAV_HTML());
#else
    qDebug() << aboutQtAV_PlainText();
#endif //QTAV_HAVE(WIDGETS)
}
Пример #3
0
QtAVDebug::QtAVDebug(QtMsgType t, QDebug *d)
    : type(t)
    , dbg(0)
{
    setQDebug(d); // call *dbg << gQtAVLogTag
    static bool sFirstRun = true;
    if (!sFirstRun)
        return;
    sFirstRun = false;
    //printf("Qt Logging first run........\n");
    // check environment var and call other functions at first Qt logging call
    // always override setLogLevel()
    QByteArray env = qgetenv("QTAV_LOG_LEVEL");
    if (!env.isEmpty()) {
        bool ok = false;
        const int level = env.toInt(&ok);
        if (ok) {
            if (level < (int)LogOff)
                setLogLevel(LogOff);
            else if (level > (int)LogAll)
                setLogLevel(LogAll);
            else
                setLogLevel((LogLevel)level);
        } else {
            env = env.toLower();
            if (env.endsWith("off"))
                setLogLevel(LogOff);
            else if (env.endsWith("debug"))
                setLogLevel(LogDebug);
            else if (env.endsWith("warning"))
                setLogLevel(LogWarning);
            else if (env.endsWith("critical"))
                setLogLevel(LogCritical);
            else if (env.endsWith("fatal"))
                setLogLevel(LogFatal);
            else if (env.endsWith("all") || env.endsWith("default"))
                setLogLevel(LogAll);
        }
    }
    env = qgetenv("QTAV_LOG_TAG");
    if (!env.isEmpty()) {
        gQtAVLogTag = env;
    }

    if ((int)logLevel() > (int)LogOff) {
        ffmpeg_version_print();
        printf("%s\n", aboutQtAV_PlainText().toLocal8Bit().constData());
        fflush(0);
    }
}