summaryrefslogtreecommitdiff
path: root/libavcodec/libschroedingerenc.c
diff options
context:
space:
mode:
authorAnuradha Suraparaju <anuradha@rd.bbc.co.uk>2009-08-15 11:59:53 +0000
committerDiego Biurrun <diego@biurrun.de>2009-08-15 11:59:53 +0000
commitd15f2e00c5a0c2b84f1a1f457044b6e57ca7e63d (patch)
tree0b005cec238ba7221133904d7188276696e27787 /libavcodec/libschroedingerenc.c
parent0ebe3b8e2bf74503d7c9cc383e29254a3cb06d55 (diff)
Fix bug caused by difference in stride and picture width.
When a frame is allocated using libschroedinger routines, the frame data size does not match the actual frame size if the width is not a multiple of 16. So we cannot do a straightforward memcpy of the frame returned by libschroedinger into the FFmpeg picture as the stride differs from the width. Fix this bug by allocating for the libschroedinger frame with the dimensions in AVCodecContext within libavcodec and passing the frame to libschroedinger. patch by Anuradha Suraparaju, anuradha rd.bbc.co uk Originally committed as revision 19653 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/libschroedingerenc.c')
-rw-r--r--libavcodec/libschroedingerenc.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c
index 94033cc256..9f8d95cc3e 100644
--- a/libavcodec/libschroedingerenc.c
+++ b/libavcodec/libschroedingerenc.c
@@ -223,15 +223,13 @@ static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext,
/* Input line size may differ from what the codec supports. Especially
* when transcoding from one format to another. So use avpicture_layout
* to copy the frame. */
- in_frame = schro_frame_new_and_alloc(NULL,
- p_schro_params->frame_format,
- p_schro_params->format->width,
- p_schro_params->format->height);
-
- avpicture_layout((AVPicture *)in_data, avccontext->pix_fmt,
- avccontext->width, avccontext->height,
- in_frame->components[0].data,
- p_schro_params->frame_size);
+ in_frame = ff_create_schro_frame(avccontext, p_schro_params->frame_format);
+
+ if (in_frame)
+ avpicture_layout((AVPicture *)in_data, avccontext->pix_fmt,
+ avccontext->width, avccontext->height,
+ in_frame->components[0].data,
+ p_schro_params->frame_size);
return in_frame;
}