summaryrefslogtreecommitdiff
path: root/libavcodec/rawenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-09-05 11:56:23 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-09-05 11:56:23 +0200
commitc41a59330f49c16acfa9b0552608fa1f41a0d823 (patch)
treefea6895f6fa3aaab77e2829ac3bbd42cfaacc35e /libavcodec/rawenc.c
parent5d859e59809f38334592fc43f8ae70a23b5a9597 (diff)
downloadffmpeg-c41a59330f49c16acfa9b0552608fa1f41a0d823.tar.gz
avcodec/rawenc: Use AVFrame parameters instead of AVCodecContext
This allows encoding raw frames with changing dimensions Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/rawenc.c')
-rw-r--r--libavcodec/rawenc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c
index 75e726920a..c23225fe60 100644
--- a/libavcodec/rawenc.c
+++ b/libavcodec/rawenc.c
@@ -49,21 +49,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
static int raw_encode(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *frame, int *got_packet)
{
- int ret = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
+ int ret = avpicture_get_size(frame->format, frame->width, frame->height);
if (ret < 0)
return ret;
if ((ret = ff_alloc_packet2(avctx, pkt, ret, ret)) < 0)
return ret;
- if ((ret = avpicture_layout((const AVPicture *)frame, avctx->pix_fmt, avctx->width,
- avctx->height, pkt->data, pkt->size)) < 0)
+ if ((ret = avpicture_layout((const AVPicture *)frame, frame->format, frame->width,
+ frame->height, pkt->data, pkt->size)) < 0)
return ret;
if(avctx->codec_tag == AV_RL32("yuv2") && ret > 0 &&
- avctx->pix_fmt == AV_PIX_FMT_YUYV422) {
+ frame->format == AV_PIX_FMT_YUYV422) {
int x;
- for(x = 1; x < avctx->height*avctx->width*2; x += 2)
+ for(x = 1; x < frame->height*frame->width*2; x += 2)
pkt->data[x] ^= 0x80;
}
pkt->flags |= AV_PKT_FLAG_KEY;