Now that pix_fmt, width, and height are directly embedded in the AVFrame, there is no need to pass these values as separate arguments.
Showing the changes to libavfilter/vsrc_buffer.c (1 of 3 files). Show all
Unified · Split
| @@ -29,7 +29,6 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "libavutil/imgutils.h" |
| 30 | 30 | |
| 31 | 31 | typedef struct { |
| 32 | − int64_t pts; | |
| 33 | 32 | AVFrame frame; |
| 34 | 33 | int has_frame; |
| 35 | 34 | int h, w; |
| @@ -40,8 +39,6 @@ typedef struct { · 4 unmodified lines | ||
| 40 | 39 | } BufferSourceContext; |
| 41 | 40 | |
| 42 | 41 | int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, |
| 43 | − int64_t pts, int width, | |
| 44 | − int height, enum PixelFormat pix_fmt, | |
| 45 | 42 | const char *sws_param) |
| 46 | 43 | { |
| 47 | 44 | BufferSourceContext *c = buffer_filter->priv; |
| @@ -59,14 +56,14 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, · 11 unmodified lines | ||
| 59 | 56 | snprintf(c->sws_param, 255, "%d:%d:%s", c->w, c->h, sws_param); |
| 60 | 57 | } |
| 61 | 58 | |
| 62 | − if(width != c->w || height != c->h || pix_fmt != c->pix_fmt){ | |
| 59 | + if (frame->width != c->w || frame->height != c->h || frame->format != c->pix_fmt) { | |
| 63 | 60 | AVFilterContext *scale= buffer_filter->outputs[0]->dst; |
| 64 | 61 | AVFilterLink *link; |
| 65 | 62 | |
| 66 | 63 | av_log(buffer_filter, AV_LOG_INFO, |
| 67 | 64 | "Buffer video input changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n", |
| 68 | 65 | c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name, |
| 69 | − width, height, av_pix_fmt_descriptors[pix_fmt].name); | |
| 66 | + frame->width, frame->height, av_pix_fmt_descriptors[frame->format].name); | |
| 70 | 67 | |
| 71 | 68 | if(!scale || strcmp(scale->filter->name,"scale")){ |
| 72 | 69 | AVFilter *f= avfilter_get_by_name("scale"); |
| @@ -92,39 +89,26 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, · 19 unmodified lines | ||
| 92 | 89 | scale->filter->init(scale, c->sws_param, NULL); |
| 93 | 90 | } |
| 94 | 91 | |
| 95 | − c->pix_fmt= scale->inputs[0]->format= pix_fmt; | |
| 96 | − c->w= scale->inputs[0]->w= width; | |
| 97 | − c->h= scale->inputs[0]->h= height; | |
| 92 | + c->pix_fmt = scale->inputs[0]->format = frame->format; | |
| 93 | + c->w = scale->inputs[0]->w = frame->width; | |
| 94 | + c->h = scale->inputs[0]->h = frame->height; | |
| 98 | 95 | |
| 99 | 96 | link= scale->outputs[0]; |
| 100 | 97 | if ((ret = link->srcpad->config_props(link)) < 0) |
| 101 | 98 | return ret; |
| 102 | 99 | } |
| 103 | 100 | |
| 101 | + c->frame = *frame; | |
| 104 | 102 | memcpy(c->frame.data , frame->data , sizeof(frame->data)); |
| 105 | 103 | memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize)); |
| 106 | − c->frame.width = frame->width; | |
| 107 | − c->frame.height = frame->height; | |
| 108 | − c->frame.format = frame->format; | |
| 109 | − c->frame.interlaced_frame= frame->interlaced_frame; | |
| 110 | − c->frame.top_field_first = frame->top_field_first; | |
| 111 | − c->frame.key_frame = frame->key_frame; | |
| 112 | − c->frame.pict_type = frame->pict_type; | |
| 113 | − c->frame.sample_aspect_ratio = frame->sample_aspect_ratio; | |
| 114 | − c->pts = pts; | |
| 115 | 104 | c->has_frame = 1; |
| 116 | 105 | |
| 117 | 106 | return 0; |
| 118 | 107 | } |
| 119 | 108 | |
| 120 | −int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, | |
| 121 | − int64_t pts) | |
| 109 | +int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame) | |
| 122 | 110 | { |
| 123 | − BufferSourceContext *c = buffer_filter->priv; | |
| 124 | − | |
| 125 | − return av_vsrc_buffer_add_frame2(buffer_filter, frame, | |
| 126 | − pts, c->w, | |
| 127 | − c->h, c->pix_fmt, ""); | |
| 111 | + return av_vsrc_buffer_add_frame2(buffer_filter, frame, ""); | |
| 128 | 112 | } |
| 129 | 113 | |
| 130 | 114 | static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) |
| @@ -195,7 +179,6 @@ static int request_frame(AVFilterLink *link) · 64 unmodified lines | ||
| 195 | 179 | c->frame.data, c->frame.linesize, |
| 196 | 180 | picref->format, link->w, link->h); |
| 197 | 181 | avfilter_copy_frame_props(picref, &c->frame); |
| 198 | − picref->pts = c->pts; | |
| 199 | 182 | |
| 200 | 183 | avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); |
| 201 | 184 | avfilter_draw_slice(link, 0, link->h, 1); |