[FFmpeg-devel] [PATCH 3/3] libxvid: encode a dummy frame to get the extradata.
Michael Niedermayer
michaelni at gmx.at
Sun Apr 8 10:05:08 CEST 2012
On Sun, Apr 08, 2012 at 12:58:22AM +0200, Nicolas George wrote:
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavcodec/libxvidff.c | 29 +++++++++++++++++++++++++++++
> 1 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c
> index e1015d9..d297dfe 100644
> --- a/libavcodec/libxvidff.c
> +++ b/libavcodec/libxvidff.c
> @@ -734,6 +734,35 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) {
> xvid_enc_create.bquant_ratio = 100 * avctx->b_quant_factor;
> if( avctx->max_b_frames > 0 && !x->quicktime_format ) xvid_enc_create.global |= XVID_GLOBAL_PACKED;
>
> + /* Encode a dummy frame to get the extradata immediately */
> + if (x->quicktime_format) {
> + AVFrame picture;
> + AVPacket packet;
> + int size, got_packet, ret;
> +
> + xerr = xvid_encore(NULL, XVID_ENC_CREATE, &xvid_enc_create, NULL);
> + if( xerr ) {
> + av_log(avctx, AV_LOG_ERROR, "Xvid: Could not create encoder reference\n");
> + return -1;
> + }
> + x->encoder_handle = xvid_enc_create.handle;
> + avctx->coded_frame = &x->encoded_picture;
> + avcodec_get_frame_defaults(&picture);
> + size = avctx->width * avctx->height;
> + picture.data[0] = av_malloc(size + size / 2);
thats too small when w or h is odd
dunno if that gets rejected elsewhere
rest of patch left to our xvid experts to review
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120408/bbefa8ce/attachment.asc>
More information about the ffmpeg-devel
mailing list