avfilter_copy_frame_props() avoids code duplication and increases robustness. The added files libavfilter/avcodec.[ch] are used for containing utilities useful for gluing togheter libavfilter and libavcodec.
Showing the changes to libavfilter/vsrc_buffer.c (1 of 9 files). Show all
Unified · Split
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | 26 | #include "avfilter.h" |
| 27 | +#include "avcodec.h" | |
| 27 | 28 | #include "vsrc_buffer.h" |
| 28 | 29 | #include "libavutil/imgutils.h" |
| 29 | 30 | |
| @@ -193,13 +194,9 @@ static int request_frame(AVFilterLink *link) · 163 unmodified lines | ||
| 193 | 194 | av_image_copy(picref->data, picref->linesize, |
| 194 | 195 | c->frame.data, c->frame.linesize, |
| 195 | 196 | picref->format, link->w, link->h); |
| 197 | + avfilter_copy_frame_props(picref, &c->frame); | |
| 198 | + picref->pts = c->pts; | |
| 196 | 199 | |
| 197 | − picref->pts = c->pts; | |
| 198 | − picref->video->sample_aspect_ratio = c->frame.sample_aspect_ratio; | |
| 199 | − picref->video->interlaced = c->frame.interlaced_frame; | |
| 200 | − picref->video->top_field_first = c->frame.top_field_first; | |
| 201 | − picref->video->key_frame = c->frame.key_frame; | |
| 202 | − picref->video->pict_type = c->frame.pict_type; | |
| 203 | 200 | avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); |
| 204 | 201 | avfilter_draw_slice(link, 0, link->h, 1); |
| 205 | 202 | avfilter_end_frame(link); |