[Libav-user] avformat_find_stream_info fails with rtp

Dmitry Adjiev adjiev.dmitry at gmail.com
Sat Aug 16 21:33:21 CEST 2014


Hello.
Here is my code:

void RtpStream::stop()
{
    QMutexLocker guard(&mutex_);
    stopped_ = true;
}

void RtpStream::run()
{
    QMutexLocker guard(&mutex_);

    if (!ip_.isEmpty()) {
        QSharedPointer<AVInputFormat> fmt
(av_find_input_format(ip_.scheme().toLatin1() ), av_free);

        if (!fmt) {
            qDebug() << "RtpStream: can't finfd format";
            return;
        }

        stopped_ = false;
        AVFormatContext *ctx = avformat_alloc_context();
        ctx->interrupt_callback.callback = interruptHandler;
        ctx->interrupt_callback.opaque = this;
        int ret = 0;

        if (!ctx) {
            qDebug() << "RtpStream: can't alloc context";
            ret = avformat_open_input(&ctx,
ip_.toString().toLatin1().constData(), NULL, NULL);
        } else
            ret = avformat_open_input(&ctx,
ip_.toString().toLatin1().constData(), fmt.data(), NULL);

        if (ctx)
            sp_fmt_ctx_ = QSharedPointer<AVFormatContext> (ctx,
avformat_free_context);

        qDebug() << "RtpStream  ret " << ret;

        if (ret < 0) {
            showErrorString(ret, "RtpStream: can't open file");
            return;
        }

        //av_format_inject_global_side_data(ctx);

        ret = avformat_find_stream_info(ctx, NULL);

        if (ret < 0) {
            showErrorString(ret, "could not find codec parameters");
            return;
        }

        guard.unlock();

        while (!stopped_) {

            qDebug() << "RtpStream: I need to find decoder :-)";
        }
    }

    else
        qDebug() << "RtpStream: ip number is empty!";
}

avformat_find_stream_info always fails.
What I do wrong?

-- 
Regards,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140816/2e369257/attachment.html>


More information about the Libav-user mailing list