diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-02-10 00:38:13 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-02-10 01:20:07 +0100 |
commit | 8c6ebab747ca8311b81ff4d0a7c17ef60b372f32 (patch) | |
tree | 677444f33cd2ee65df88809ca820ed57d2077ca3 /libavcodec/rawenc.c | |
parent | ea4037162fb0afa871e5312a7b23c828d2b85066 (diff) | |
parent | c57fe49da8feda7d2e6c266978250a15a83e0484 (diff) | |
download | ffmpeg-8c6ebab747ca8311b81ff4d0a7c17ef60b372f32.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (26 commits)
eac3dec: replace undefined 1<<31 with INT32_MIN in noise generation
yadif: specify array size outside DECLARE_ALIGNED
prores: specify array size outside DECLARE_ALIGNED brackets.
WavPack demuxer: set packet duration
tta: use skip_bits_long()
mxfdec: Ignore the last entry in Avid's index table segments
mxfdec: Sanity-check SampleRate
mxfdec: Handle small EditUnitByteCount
mxfdec: Consider OPAtom files that do not have exactly one EC to be OP1a
mxfdec: Don't crash in mxf_packet_timestamps() if current_edit_unit overflows
mxfdec: Zero nb_ptses in mxf_compute_ptses_fake_index()
mxfdec: Sanity check PreviousPartition
mxfdec: Never seek back in local sets and KLVs
mxfdec: Move the current_partition check inside mxf_read_header()
mxfdec: Fix infinite loop in mxf_packet_timestamps()
mxfdec: Check eof_reached in mxf_read_local_tags()
mxfdec: Check for NULL component
mxfdec: Make sure mxf->nb_index_tables > 0 in mxf_packet_timestamps()
mxfdec: Make sure x < index_table->nb_ptses
build: Add missing directories to DIRS declarations.
...
Conflicts:
doc/build_system.txt
doc/fate.texi
libavfilter/x86/yadif_template.c
libavformat/mxfdec.c
libavutil/Makefile
tests/fate/audio.mak
tests/fate/prores.mak
tests/fate/screen.mak
tests/fate/video.mak
tests/ref/fate/bethsoft-vid
tests/ref/fate/cscd
tests/ref/fate/dfa4
tests/ref/fate/nuv
tests/ref/fate/vp8-sign-bias
tests/ref/fate/wmv8-drm
tests/ref/lavf/gxf
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/rawenc.c')
-rw-r--r-- | libavcodec/rawenc.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c index 8fc9cd9fc0..577a8fc98a 100644 --- a/libavcodec/rawenc.c +++ b/libavcodec/rawenc.c @@ -26,6 +26,7 @@ #include "avcodec.h" #include "raw.h" +#include "internal.h" #include "libavutil/pixdesc.h" #include "libavutil/intreadwrite.h" @@ -40,19 +41,29 @@ static av_cold int raw_init_encoder(AVCodecContext *avctx) return 0; } -static int raw_encode(AVCodecContext *avctx, - unsigned char *frame, int buf_size, void *data) +static int raw_encode(AVCodecContext *avctx, AVPacket *pkt, + const AVFrame *frame, int *got_packet) { - int ret = avpicture_layout((AVPicture *)data, avctx->pix_fmt, avctx->width, - avctx->height, frame, buf_size); + int ret = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); + + if (ret < 0) + return ret; + + if ((ret = ff_alloc_packet(pkt, ret)) < 0) + return ret; + if ((ret = avpicture_layout((const AVPicture *)frame, avctx->pix_fmt, avctx->width, + avctx->height, pkt->data, pkt->size)) < 0) + return ret; if(avctx->codec_tag == AV_RL32("yuv2") && ret > 0 && avctx->pix_fmt == PIX_FMT_YUYV422) { int x; for(x = 1; x < avctx->height*avctx->width*2; x += 2) - frame[x] ^= 0x80; + pkt->data[x] ^= 0x80; } - return ret; + pkt->flags |= AV_PKT_FLAG_KEY; + *got_packet = 1; + return 0; } AVCodec ff_rawvideo_encoder = { @@ -61,6 +72,6 @@ AVCodec ff_rawvideo_encoder = { .id = CODEC_ID_RAWVIDEO, .priv_data_size = sizeof(AVFrame), .init = raw_init_encoder, - .encode = raw_encode, + .encode2 = raw_encode, .long_name = NULL_IF_CONFIG_SMALL("raw video"), }; |