summaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_mp.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-28 03:27:39 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-28 03:32:00 +0200
commitef906390043010cde8844ec30da79926f2f8b846 (patch)
tree65c82baae0f9dcce8115e6ef9743d285ed5cc6f4 /libavfilter/vf_mp.c
parent86190afbda0c6e663596d799a939a7ffca8e7cfa (diff)
downloadffmpeg-streaming-ef906390043010cde8844ec30da79926f2f8b846.zip
ffmpeg-streaming-ef906390043010cde8844ec30da79926f2f8b846.tar.gz
avfilter/vf_mp: preserve pixel format when possible
Fixes Ticket2577 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_mp.c')
-rw-r--r--libavfilter/vf_mp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavfilter/vf_mp.c b/libavfilter/vf_mp.c
index 3cf22f8..9414c7a 100644
--- a/libavfilter/vf_mp.c
+++ b/libavfilter/vf_mp.c
@@ -249,6 +249,7 @@ typedef struct {
AVFilterContext *avfctx;
int frame_returned;
char *filter;
+ enum AVPixelFormat in_pix_fmt;
} MPContext;
#define OFFSET(x) offsetof(MPContext, x)
@@ -543,6 +544,10 @@ int ff_vf_next_put_image(struct vf_instance *vf,mp_image_t *mpi, double pts){
for(i=0; conversion_map[i].fmt && mpi->imgfmt != conversion_map[i].fmt; i++);
picref->format = conversion_map[i].pix_fmt;
+ for(i=0; conversion_map[i].fmt && m->in_pix_fmt != conversion_map[i].pix_fmt; i++);
+ if (mpi->imgfmt == conversion_map[i].fmt)
+ picref->format = conversion_map[i].pix_fmt;
+
memcpy(picref->linesize, mpi->stride, FFMIN(sizeof(picref->linesize), sizeof(mpi->stride)));
for(i=0; i<4 && mpi->stride[i]; i++){
@@ -796,6 +801,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
for(i=0; conversion_map[i].fmt && conversion_map[i].pix_fmt != inlink->format; i++);
ff_mp_image_setfmt(mpi,conversion_map[i].fmt);
+ m->in_pix_fmt = inlink->format;
memcpy(mpi->planes, inpic->data, FFMIN(sizeof(inpic->data) , sizeof(mpi->planes)));
memcpy(mpi->stride, inpic->linesize, FFMIN(sizeof(inpic->linesize), sizeof(mpi->stride)));
OpenPOWER on IntegriCloud