From: yu.dongliang <18588496441@163.com> Date: Wed, 12 Apr 2023 07:11:15 +0000 (+0800) Subject: tmp X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=62d7f52f79456fcc9268062ab6e7babd336bc1b6;p=simplay.git tmp --- diff --git a/simp_ffmpeg_input.c b/simp_ffmpeg_input.c index 496326e..baa55ee 100644 --- a/simp_ffmpeg_input.c +++ b/simp_ffmpeg_input.c @@ -121,6 +121,8 @@ static int _ffmpeg_input_open(simp_avio_t* io, const char* path) } if (priv->vidx >= 0) { + s = priv->fmt_ctx->streams[priv->vidx]; + ret = _video_init(priv); if (ret < 0) goto error; @@ -128,12 +130,15 @@ static int _ffmpeg_input_open(simp_avio_t* io, const char* path) io->width = priv->vcodec_ctx->width; io->height = priv->vcodec_ctx->height; io->pix_fmt = priv->vcodec_ctx->pix_fmt; - io->frame_rate = priv-> fmt_ctx->streams[priv->vidx]->r_frame_rate; + io->frame_rate.num = s->r_frame_rate.den; + io->frame_rate.den = s->r_frame_rate.num; io->sample_aspect_ratio = priv->vcodec_ctx->sample_aspect_ratio; io->x = 0; io->y = 0; io->vopen = 1; + + scf_loge("io->frame_rate: %d:%d\n", io->frame_rate.num, io->frame_rate.den); } if (priv->aidx >= 0) { @@ -145,6 +150,8 @@ static int _ffmpeg_input_open(simp_avio_t* io, const char* path) io->sample_rate = priv->acodec_ctx->time_base; io->channels = priv->acodec_ctx->channels; io->aopen = 1; + + scf_loge("io->sample_rate: %d:%d\n", io->sample_rate.num, io->sample_rate.den); } io->priv = priv; @@ -248,20 +255,18 @@ static int __ffmpeg_decode(simp_avio_t* io, AVCodecContext* dec_ctx, AVPacket* p if (nb_vframes) { (*nb_vframes)++; - io->frame_rate.num = s->r_frame_rate.den; - io->frame_rate.den = s->r_frame_rate.num; - f->frame->pts = f->frame->pts * av_q2d(s->time_base) / av_q2d(io->frame_rate); - scf_logd("frame->pts: %ld, stream_index: %d, s->r_frame_rate: %d:%d, s->time_base: %d:%d\n", + scf_logi("frame->pts: %ld, stream_index: %d, io->frame_rate: %d:%d, s->time_base: %d:%d\n", frame->pts, pkt->stream_index, - s->r_frame_rate.num, s->r_frame_rate.den, + io->frame_rate.num, io->frame_rate.den, s->time_base.num, s->time_base.den); } else { - io->sample_rate = s->time_base; + f->frame->pts = f->frame->pts * av_q2d(s->time_base) / av_q2d(io->sample_rate); - scf_logd("frame->pts: %ld, stream_index: %d, s->time_base: %d:%d\n", + scf_logi("frame->pts: %ld, stream_index: %d, io->sample_rate: %d:%d, s->time_base: %d:%d\n", frame->pts, pkt->stream_index, + io->sample_rate.num, io->sample_rate.den, s->time_base.num, s->time_base.den); }