aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vsrc_buffer.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-05-15 19:18:02 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-05-15 19:18:02 +0200
commitd46aada5c2c71b9b0a259e62699cab25837053b2 (patch)
treeab474244a6fda04d8a10d25201620cdaee11c3c6 /libavfilter/vsrc_buffer.c
parent66b1f210c024a08ba00e4a730e64940d248b8717 (diff)
parent5a153604c930792aa7f00c55cbf3c470f582dfb7 (diff)
downloadffmpeg-d46aada5c2c71b9b0a259e62699cab25837053b2.tar.gz
Merge branch 'master' into oldabi
* master: (403 commits) Initial caf muxer. Support decoding of amr_nb and gsm in caf. Fix decoding of msrle samples with 1bpp. udp: remove resource.h inclusion, it breaks mingw compilation. ffmpeg: Allow seting and cycling through debug modes. Fix FSF address copy paste error in some license headers. Add an aac sample which uses LTP to fate-aac. ffmpeg: Help for interactive keys. UDP: dont use thread_t as truth value. swscale: fix compile on mingw32 [PATCH] Update pixdesc_be fate refs after adding 9/10bit YUV420P formats. arm: properly mark external symbol call ffmpeg: Interactivity support. Try pressing +-hs. swscale: 10l forgot git add this change from ronald. AVFrame: only set parameters from AVCodecContext in decode_video*() when no frame reordering is used. avcodec_default_get_buffer: init picture parameters. swscale: properly inline bits/endianness in yuv2yuvX16inC(). swscale: fix clipping of 9/10bit YUV420P. Add av_clip_uintp2() function Support more QT 1bpp rawvideo files. ... Conflicts: libavcodec/flacenc.c libavcodec/h261dec.c libavcodec/h263dec.c libavcodec/mpeg12.c libavcodec/msrle.c libavcodec/options.c libavcodec/qpeg.c libavcodec/rv34.c libavcodec/svq1dec.c libavcodec/svq3.c libavcodec/vc1dec.c libavcodec/version.h libavfilter/avfilter.h libavformat/file.c libavformat/options.c libavformat/rtpproto.c libavformat/udp.c libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vsrc_buffer.c')
-rw-r--r--libavfilter/vsrc_buffer.c52
1 files changed, 20 insertions, 32 deletions
diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c
index c683d51e6f..84f3b33c3f 100644
--- a/libavfilter/vsrc_buffer.c
+++ b/libavfilter/vsrc_buffer.c
@@ -24,23 +24,21 @@
*/
#include "avfilter.h"
+#include "avcodec.h"
#include "vsrc_buffer.h"
#include "libavutil/imgutils.h"
typedef struct {
- int64_t pts;
AVFrame frame;
int has_frame;
int h, w;
enum PixelFormat pix_fmt;
AVRational time_base; ///< time_base to set in the output link
- AVRational pixel_aspect;
+ AVRational sample_aspect_ratio;
char sws_param[256];
} BufferSourceContext;
int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame,
- int64_t pts, AVRational pixel_aspect, int width,
- int height, enum PixelFormat pix_fmt,
const char *sws_param)
{
BufferSourceContext *c = buffer_filter->priv;
@@ -58,12 +56,14 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame,
snprintf(c->sws_param, 255, "%d:%d:%s", c->w, c->h, sws_param);
}
- if(width != c->w || height != c->h || pix_fmt != c->pix_fmt){
+ if (frame->width != c->w || frame->height != c->h || frame->format != c->pix_fmt) {
AVFilterContext *scale= buffer_filter->outputs[0]->dst;
AVFilterLink *link;
- av_log(buffer_filter, AV_LOG_INFO, "Changing filter graph input to accept %dx%d %d (%d %d)\n",
- width,height,pix_fmt, c->pix_fmt, scale && scale->outputs ? scale->outputs[0]->format : -123);
+ av_log(buffer_filter, AV_LOG_INFO,
+ "Buffer video input changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
+ c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name,
+ frame->width, frame->height, av_pix_fmt_descriptors[frame->format].name);
if(!scale || strcmp(scale->filter->name,"scale")){
AVFilter *f= avfilter_get_by_name("scale");
@@ -89,36 +89,26 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame,
scale->filter->init(scale, c->sws_param, NULL);
}
- c->pix_fmt= scale->inputs[0]->format= pix_fmt;
- c->w= scale->inputs[0]->w= width;
- c->h= scale->inputs[0]->h= height;
+ c->pix_fmt = scale->inputs[0]->format = frame->format;
+ c->w = scale->inputs[0]->w = frame->width;
+ c->h = scale->inputs[0]->h = frame->height;
link= scale->outputs[0];
if ((ret = link->srcpad->config_props(link)) < 0)
return ret;
}
+ c->frame = *frame;
memcpy(c->frame.data , frame->data , sizeof(frame->data));
memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize));
- c->frame.interlaced_frame= frame->interlaced_frame;
- c->frame.top_field_first = frame->top_field_first;
- c->frame.key_frame = frame->key_frame;
- c->frame.pict_type = frame->pict_type;
- c->pts = pts;
- c->pixel_aspect = pixel_aspect;
c->has_frame = 1;
return 0;
}
-int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
- int64_t pts, AVRational pixel_aspect)
+int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame)
{
- BufferSourceContext *c = buffer_filter->priv;
-
- return av_vsrc_buffer_add_frame2(buffer_filter, frame,
- pts, pixel_aspect, c->w,
- c->h, c->pix_fmt, "");
+ return av_vsrc_buffer_add_frame2(buffer_filter, frame, "");
}
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
@@ -130,7 +120,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
if (!args ||
(n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d", &c->w, &c->h, pix_fmt_str,
&c->time_base.num, &c->time_base.den,
- &c->pixel_aspect.num, &c->pixel_aspect.den)) != 7) {
+ &c->sample_aspect_ratio.num, &c->sample_aspect_ratio.den)) != 7) {
av_log(ctx, AV_LOG_ERROR, "Expected 7 arguments, but only %d found in '%s'\n", n, args);
return AVERROR(EINVAL);
}
@@ -143,7 +133,10 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
}
}
- av_log(ctx, AV_LOG_INFO, "w:%d h:%d pixfmt:%s\n", c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name);
+ av_log(ctx, AV_LOG_INFO, "w:%d h:%d pixfmt:%s tb:%d/%d sar:%d/%d\n",
+ c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name,
+ c->time_base.num, c->time_base.den,
+ c->sample_aspect_ratio.num, c->sample_aspect_ratio.den);
return 0;
}
@@ -162,7 +155,7 @@ static int config_props(AVFilterLink *link)
link->w = c->w;
link->h = c->h;
- link->sample_aspect_ratio = c->pixel_aspect;
+ link->sample_aspect_ratio = c->sample_aspect_ratio;
link->time_base = c->time_base;
return 0;
@@ -188,13 +181,8 @@ static int request_frame(AVFilterLink *link)
av_image_copy(picref->data, picref->linesize,
c->frame.data, c->frame.linesize,
picref->format, link->w, link->h);
+ avfilter_copy_frame_props(picref, &c->frame);
- picref->pts = c->pts;
- picref->video->pixel_aspect = c->pixel_aspect;
- picref->video->interlaced = c->frame.interlaced_frame;
- picref->video->top_field_first = c->frame.top_field_first;
- picref->video->key_frame = c->frame.key_frame;
- picref->video->pict_type = c->frame.pict_type;
avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
avfilter_draw_slice(link, 0, link->h, 1);
avfilter_end_frame(link);