Commit e756effd authored by Stefano Sabatini's avatar Stefano Sabatini

lavfi/movie: fix display of pushed frame information

It was broken since 7e350379.

Also fix warnings:
libavfilter/src_movie.c: In function ‘describe_frame_to_str’:
libavfilter/src_movie.c:392:5: warning: ‘type’ is deprecated (declared at ./libavutil/frame.h:313) [-Wdeprecated-declarations]
libavfilter/src_movie.c:408:9: warning: ‘type’ is deprecated (declared at ./libavutil/frame.h:313) [-Wdeprecated-declarations]
parent bf96e547
...@@ -386,10 +386,10 @@ static int movie_config_output_props(AVFilterLink *outlink) ...@@ -386,10 +386,10 @@ static int movie_config_output_props(AVFilterLink *outlink)
} }
static char *describe_frame_to_str(char *dst, size_t dst_size, static char *describe_frame_to_str(char *dst, size_t dst_size,
AVFrame *frame, AVFrame *frame, enum AVMediaType frame_type,
AVFilterLink *link) AVFilterLink *link)
{ {
switch (frame->type) { switch (frame_type) {
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
snprintf(dst, dst_size, snprintf(dst, dst_size,
"video pts:%s time:%s size:%dx%d aspect:%d/%d", "video pts:%s time:%s size:%dx%d aspect:%d/%d",
...@@ -405,15 +405,12 @@ static char *describe_frame_to_str(char *dst, size_t dst_size, ...@@ -405,15 +405,12 @@ static char *describe_frame_to_str(char *dst, size_t dst_size,
frame->nb_samples); frame->nb_samples);
break; break;
default: default:
snprintf(dst, dst_size, "%s BUG", av_get_media_type_string(frame->type)); snprintf(dst, dst_size, "%s BUG", av_get_media_type_string(frame_type));
break; break;
} }
return dst; return dst;
} }
#define describe_frameref(f, link) \
describe_frame_to_str((char[1024]){0}, 1024, f, link)
static int rewind_file(AVFilterContext *ctx) static int rewind_file(AVFilterContext *ctx)
{ {
MovieContext *movie = ctx->priv; MovieContext *movie = ctx->priv;
...@@ -452,6 +449,7 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) ...@@ -452,6 +449,7 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id)
{ {
MovieContext *movie = ctx->priv; MovieContext *movie = ctx->priv;
AVPacket *pkt = &movie->pkt; AVPacket *pkt = &movie->pkt;
enum AVMediaType frame_type;
MovieStream *st; MovieStream *st;
int ret, got_frame = 0, pkt_out_id; int ret, got_frame = 0, pkt_out_id;
AVFilterLink *outlink; AVFilterLink *outlink;
...@@ -501,7 +499,8 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) ...@@ -501,7 +499,8 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id)
if (!movie->frame) if (!movie->frame)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
switch (st->st->codec->codec_type) { frame_type = st->st->codec->codec_type;
switch (frame_type) {
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
ret = avcodec_decode_video2(st->st->codec, movie->frame, &got_frame, pkt); ret = avcodec_decode_video2(st->st->codec, movie->frame, &got_frame, pkt);
break; break;
...@@ -537,10 +536,10 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) ...@@ -537,10 +536,10 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id)
return 0; return 0;
} }
movie->frame->pts = av_frame_get_best_effort_timestamp(movie->frame);
av_dlog(ctx, "movie_push_frame(): file:'%s' %s\n", movie->file_name, av_dlog(ctx, "movie_push_frame(): file:'%s' %s\n", movie->file_name,
describe_frameref(movie->frame, outlink)); describe_frame_to_str((char[1024]){0}, 1024, movie->frame, frame_type, outlink));
movie->frame->pts = av_frame_get_best_effort_timestamp(movie->frame);
ret = ff_filter_frame(outlink, movie->frame); ret = ff_filter_frame(outlink, movie->frame);
movie->frame = NULL; movie->frame = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment