Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/anim_movie.c
| Show First 20 Lines • Show All 505 Lines • ▼ Show 20 Lines | if (avcodec_open2(pCodecCtx, pCodec, NULL) < 0) { | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| if (pCodecCtx->pix_fmt == AV_PIX_FMT_NONE) { | if (pCodecCtx->pix_fmt == AV_PIX_FMT_NONE) { | ||||
| avcodec_close(anim->pCodecCtx); | avcodec_close(anim->pCodecCtx); | ||||
| avformat_close_input(&pFormatCtx); | avformat_close_input(&pFormatCtx); | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| frame_rate = av_get_r_frame_rate_compat(pFormatCtx->streams[videoStream]); | frame_rate = av_get_r_frame_rate_compat(pFormatCtx, pFormatCtx->streams[videoStream]); | ||||
| if (pFormatCtx->streams[videoStream]->nb_frames != 0) { | if (pFormatCtx->streams[videoStream]->nb_frames != 0) { | ||||
| anim->duration = pFormatCtx->streams[videoStream]->nb_frames; | anim->duration = pFormatCtx->streams[videoStream]->nb_frames; | ||||
| } | } | ||||
| else { | else { | ||||
| anim->duration = (int)(pFormatCtx->duration * | anim->duration = (int)(pFormatCtx->duration * | ||||
| av_q2d(frame_rate) / | av_q2d(frame_rate) / | ||||
| AV_TIME_BASE + 0.5f); | AV_TIME_BASE + 0.5f); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 461 Lines • ▼ Show 20 Lines | static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, | ||||
| av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: pos=%d\n", position); | av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: pos=%d\n", position); | ||||
| if (tc != IMB_TC_NONE) { | if (tc != IMB_TC_NONE) { | ||||
| tc_index = IMB_anim_open_index(anim, tc); | tc_index = IMB_anim_open_index(anim, tc); | ||||
| } | } | ||||
| v_st = anim->pFormatCtx->streams[anim->videoStream]; | v_st = anim->pFormatCtx->streams[anim->videoStream]; | ||||
| frame_rate = av_q2d(av_get_r_frame_rate_compat(v_st)); | frame_rate = av_q2d(av_get_r_frame_rate_compat(anim->pFormatCtx, v_st)); | ||||
| st_time = anim->pFormatCtx->start_time; | st_time = anim->pFormatCtx->start_time; | ||||
| pts_time_base = av_q2d(v_st->time_base); | pts_time_base = av_q2d(v_st->time_base); | ||||
| if (tc_index) { | if (tc_index) { | ||||
| new_frame_index = IMB_indexer_get_frame_index( | new_frame_index = IMB_indexer_get_frame_index( | ||||
| tc_index, position); | tc_index, position); | ||||
| old_frame_index = IMB_indexer_get_frame_index( | old_frame_index = IMB_indexer_get_frame_index( | ||||
| ▲ Show 20 Lines • Show All 408 Lines • Show Last 20 Lines | |||||