Now that pix_fmt, width, and height are directly embedded in the AVFrame,
there is no need to pass these values as separate arguments.
... | ... |
@@ -1648,11 +1648,9 @@ static int output_packet(AVInputStream *ist, int ist_index, |
1648 | 1648 |
if (ost->input_video_filter && ost->source_index == ist_index) { |
1649 | 1649 |
if (!picture.sample_aspect_ratio.num) |
1650 | 1650 |
picture.sample_aspect_ratio = ist->st->sample_aspect_ratio; |
1651 |
+ picture.pts = ist->pts; |
|
1651 | 1652 |
// add it to be filtered |
1652 |
- av_vsrc_buffer_add_frame2(ost->input_video_filter, &picture, |
|
1653 |
- ist->pts, |
|
1654 |
- ist->st->codec->width, ist->st->codec->height, |
|
1655 |
- ist->st->codec->pix_fmt, ""); //TODO user setable params |
|
1653 |
+ av_vsrc_buffer_add_frame2(ost->input_video_filter, &picture, ""); //TODO user setable params |
|
1656 | 1654 |
} |
1657 | 1655 |
} |
1658 | 1656 |
} |
... | ... |
@@ -29,7 +29,6 @@ |
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 { |
40 | 40 |
} BufferSourceContext; |
41 | 41 |
|
42 | 42 |
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 | 43 |
const char *sws_param) |
46 | 44 |
{ |
47 | 45 |
BufferSourceContext *c = buffer_filter->priv; |
... | ... |
@@ -59,14 +56,14 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, |
59 | 59 |
snprintf(c->sws_param, 255, "%d:%d:%s", c->w, c->h, sws_param); |
60 | 60 |
} |
61 | 61 |
|
62 |
- if(width != c->w || height != c->h || pix_fmt != c->pix_fmt){ |
|
62 |
+ if (frame->width != c->w || frame->height != c->h || frame->format != c->pix_fmt) { |
|
63 | 63 |
AVFilterContext *scale= buffer_filter->outputs[0]->dst; |
64 | 64 |
AVFilterLink *link; |
65 | 65 |
|
66 | 66 |
av_log(buffer_filter, AV_LOG_INFO, |
67 | 67 |
"Buffer video input changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n", |
68 | 68 |
c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name, |
69 |
- width, height, av_pix_fmt_descriptors[pix_fmt].name); |
|
69 |
+ frame->width, frame->height, av_pix_fmt_descriptors[frame->format].name); |
|
70 | 70 |
|
71 | 71 |
if(!scale || strcmp(scale->filter->name,"scale")){ |
72 | 72 |
AVFilter *f= avfilter_get_by_name("scale"); |
... | ... |
@@ -92,39 +89,26 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, |
92 | 92 |
scale->filter->init(scale, c->sws_param, NULL); |
93 | 93 |
} |
94 | 94 |
|
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; |
|
95 |
+ c->pix_fmt = scale->inputs[0]->format = frame->format; |
|
96 |
+ c->w = scale->inputs[0]->w = frame->width; |
|
97 |
+ c->h = scale->inputs[0]->h = frame->height; |
|
98 | 98 |
|
99 | 99 |
link= scale->outputs[0]; |
100 | 100 |
if ((ret = link->srcpad->config_props(link)) < 0) |
101 | 101 |
return ret; |
102 | 102 |
} |
103 | 103 |
|
104 |
+ c->frame = *frame; |
|
104 | 105 |
memcpy(c->frame.data , frame->data , sizeof(frame->data)); |
105 | 106 |
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 | 107 |
c->has_frame = 1; |
116 | 108 |
|
117 | 109 |
return 0; |
118 | 110 |
} |
119 | 111 |
|
120 |
-int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, |
|
121 |
- int64_t pts) |
|
112 |
+int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame) |
|
122 | 113 |
{ |
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, ""); |
|
114 |
+ return av_vsrc_buffer_add_frame2(buffer_filter, frame, ""); |
|
128 | 115 |
} |
129 | 116 |
|
130 | 117 |
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) |
... | ... |
@@ -195,7 +179,6 @@ static int request_frame(AVFilterLink *link) |
195 | 195 |
c->frame.data, c->frame.linesize, |
196 | 196 |
picref->format, link->w, link->h); |
197 | 197 |
avfilter_copy_frame_props(picref, &c->frame); |
198 |
- picref->pts = c->pts; |
|
199 | 198 |
|
200 | 199 |
avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); |
201 | 200 |
avfilter_draw_slice(link, 0, link->h, 1); |
... | ... |
@@ -30,12 +30,9 @@ |
30 | 30 |
#include "libavcodec/avcodec.h" /* AVFrame */ |
31 | 31 |
#include "avfilter.h" |
32 | 32 |
|
33 |
-int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, |
|
34 |
- int64_t pts); |
|
33 |
+int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame); |
|
35 | 34 |
|
36 | 35 |
int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, |
37 |
- int64_t pts, int width, |
|
38 |
- int height, enum PixelFormat pix_fmt, |
|
39 | 36 |
const char *sws_param); |
40 | 37 |
|
41 | 38 |
#endif /* AVFILTER_VSRC_BUFFER_H */ |