diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-02-18 02:20:19 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-02-18 02:20:19 +0100 |
commit | bbb61a1cd5cb2046e480f367a7ae58a32f2ef907 (patch) | |
tree | 0e7cc2b59558e2dc31d6b8752d90f6b5b5c886e5 /libavcodec/dv.c | |
parent | f6492476a63938cc66c51bf61c88407b7749f780 (diff) | |
parent | af468015d972c0dec5c8c37b2685ffa5cbe4ae87 (diff) | |
download | ffmpeg-bbb61a1cd5cb2046e480f367a7ae58a32f2ef907.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits)
als: prevent infinite loop in zero_remaining().
cook: prevent div-by-zero if channels is zero.
pamenc: switch to encode2().
svq1enc: switch to encode2().
dvenc: switch to encode2().
dpxenc: switch to encode2().
pngenc: switch to encode2().
v210enc: switch to encode2().
xwdenc: switch to encode2().
ttadec: use branchless unsigned-to-signed unfolding
avcodec: add a Sun Rasterfile encoder
sunrast: Move common defines to a new header file.
cdxl: fix video decoding for some files
cdxl: fix audio for some samples
apetag: add proper support for binary tags
ttadec: remove dead code
swscale: make access to filter data conditional on filter type.
swscale: update context offsets after removal of AlpMmxFilter.
prores: initialise encoder and decoder parts only when needed
swscale: make monowhite/black RGB-independent.
...
Conflicts:
Changelog
libavcodec/alsdec.c
libavcodec/dpxenc.c
libavcodec/golomb.h
libavcodec/pamenc.c
libavcodec/pngenc.c
libavformat/img2.c
libswscale/output.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dv.c')
-rw-r--r-- | libavcodec/dv.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/libavcodec/dv.c b/libavcodec/dv.c index da445a7699..4717de3924 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -42,6 +42,7 @@ #include "avcodec.h" #include "dsputil.h" #include "get_bits.h" +#include "internal.h" #include "put_bits.h" #include "simple_idct.h" #include "dvdata.h" @@ -1276,29 +1277,37 @@ static void dv_format_frame(DVVideoContext* c, uint8_t* buf) } -static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size, - void *data) +static int dvvideo_encode_frame(AVCodecContext *c, AVPacket *pkt, + const AVFrame *frame, int *got_packet) { DVVideoContext *s = c->priv_data; + int ret; s->sys = avpriv_dv_codec_profile(c); - if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) + if (!s->sys || dv_init_dynamic_tables(s->sys)) return -1; + if ((ret = ff_alloc_packet(pkt, s->sys->frame_size)) < 0) { + av_log(c, AV_LOG_ERROR, "Error getting output packet.\n"); + return ret; + } c->pix_fmt = s->sys->pix_fmt; - s->picture = *((AVFrame *)data); + s->picture = *frame; s->picture.key_frame = 1; s->picture.pict_type = AV_PICTURE_TYPE_I; - s->buf = buf; + s->buf = pkt->data; c->execute(c, dv_encode_video_segment, s->sys->work_chunks, NULL, dv_work_pool_size(s->sys), sizeof(DVwork_chunk)); emms_c(); - dv_format_frame(s, buf); + dv_format_frame(s, pkt->data); - return s->sys->frame_size; + pkt->flags |= AV_PKT_FLAG_KEY; + *got_packet = 1; + + return 0; } #endif @@ -1320,7 +1329,7 @@ AVCodec ff_dvvideo_encoder = { .id = CODEC_ID_DVVIDEO, .priv_data_size = sizeof(DVVideoContext), .init = dvvideo_init_encoder, - .encode = dvvideo_encode_frame, + .encode2 = dvvideo_encode_frame, .capabilities = CODEC_CAP_SLICE_THREADS, .pix_fmts = (const enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), |