[FFmpeg-devel] [PATCH 2/2] libutvideo: Add Ut Video encoder wrapper

Derek Buitenhuis derek.buitenhuis at gmail.com
Sun Mar 4 02:36:15 CET 2012


On 03/03/2012 8:26 PM, Clément Bœsch wrote:
> Please use the -M option for this, and mention it in the description.

Yeah, thanks for the tip.

>>  libutvideo_decoder_deps="libutvideo gpl"
>> +libutvideo_encoder_derps="libutvideo gpl"
> herp derp

Muscle memory... fixed.

>> +
>> +    /* Check before we alloc anything */
>> +    if (avctx->prediction_method != 0 && avctx->prediction_method != 2) {
>> +        av_log(avctx, AV_LOG_ERROR, "Invalid precition method.\n");
>
> precision*

Fixed.

> info = av_malloc(sizeof(*info));

No-can-do, good sir. At least not completely. The cast must stay.

libutvideoenc.cpp: In function ‘int utvideo_encode_init(AVCodecContext*)’:
libutvideoenc.cpp:78:42: error: invalid conversion from ‘void*’ to 
‘UtVideoExtra*’ [-fpermissive]

This is because of it being C++.

> No need to av_mallocz?

Nope. libutvideo actually does a memset internally before
copying over the extradata. :)

>> +    /*
>> +     * We use this buffer to hold teh data that Ut Video returns,
>
> the*

Fixed.

>> +    utv->buffer = (uint8_t *)av_malloc(utv->buf_size * sizeof(uint8_t));
>
> ditto, also sizeof(uint8_t) is and will always be 1

OK. Cast must stay, though.

>> +    if (utv->buffer == NULL) {
>
> some people prefer if (!utv->buffer)

I prefer it this way. It just happens to be that NULL == 0. I'd
prefer it more verbose like this.

>> +    avctx->coded_frame->key_frame = keyframe ? 1 : 0;
>> +    avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
>> +
>> +    pkt->flags |= AV_PKT_FLAG_KEY;
>
> Is it intra only? If so, I wonder if you shouldn't update is_intra_only()
> in libavformat/utils.c.

Yeah it is, and I should. I'll also add CODEC_CAP_LOSSLESS or whatever
the relevant capability is, which I just realized I forgot.

I'll send a v2 patch once Michael, and whoever else wants to, reviews
it.

Cheers,

- Derek


More information about the ffmpeg-devel mailing list