Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新版的FFMPEG有许多api已经废弃了,能提供下项目内某些函数的思路嘛? #50

Open
swltown opened this issue Apr 6, 2024 · 0 comments

Comments

@swltown
Copy link

swltown commented Apr 6, 2024

int VideoCtl::audio_thread(void *arg)
{
VideoState *is = (VideoState *)arg;
AVFrame *frame = av_frame_alloc();
Frame *af;

int got_frame = 0;
AVRational tb;
int ret = 0;

if (!frame)
    return AVERROR(ENOMEM);

do {
    if ((got_frame = decoder_decode_frame(&is->auddec, frame, NULL)) < 0)
        goto the_end;

    if (got_frame) {
        tb = { 1, frame->sample_rate };

        if (!(af = frame_queue_peek_writable(&is->sampq)))
            goto the_end;

        af->pts = (frame->pts == AV_NOPTS_VALUE) ? NAN : frame->pts * av_q2d(tb);
        af->pos = av_frame_get_pkt_pos(frame);
        af->serial = is->auddec.pkt_serial;
        af->duration = av_q2d({ frame->nb_samples, frame->sample_rate });

        av_frame_move_ref(af->frame, frame);
        frame_queue_push(&is->sampq);

    }
} while (ret >= 0 || ret == AVERROR(EAGAIN) || ret == AVERROR_EOF);

the_end:

av_frame_free(&frame);
return ret;

}
比如说这个函数,新版本里面av_frame_get_pkt_pos已经废弃,Frame这个自定义的结构体是必须要用到pos这个成员吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant