forked from FFmpeg/FFmpeg
cljr: use the AVFrame API properly.
This commit is contained in:
parent
4a8a35bc1f
commit
845020ed89
1 changed files with 9 additions and 7 deletions
|
@ -98,16 +98,18 @@ AVCodec ff_cljr_decoder = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_CLJR_ENCODER
|
#if CONFIG_CLJR_ENCODER
|
||||||
typedef struct CLJRContext {
|
|
||||||
AVFrame picture;
|
|
||||||
} CLJRContext;
|
|
||||||
|
|
||||||
static av_cold int encode_init(AVCodecContext *avctx)
|
static av_cold int encode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
CLJRContext * const a = avctx->priv_data;
|
avctx->coded_frame = av_frame_alloc();
|
||||||
|
if (!avctx->coded_frame)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
avctx->coded_frame = &a->picture;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static av_cold int encode_close(AVCodecContext *avctx)
|
||||||
|
{
|
||||||
|
av_frame_free(&avctx->coded_frame);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,9 +157,9 @@ AVCodec ff_cljr_encoder = {
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"),
|
.long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"),
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.id = AV_CODEC_ID_CLJR,
|
.id = AV_CODEC_ID_CLJR,
|
||||||
.priv_data_size = sizeof(CLJRContext),
|
|
||||||
.init = encode_init,
|
.init = encode_init,
|
||||||
.encode2 = encode_frame,
|
.encode2 = encode_frame,
|
||||||
|
.close = encode_close,
|
||||||
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV411P,
|
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV411P,
|
||||||
AV_PIX_FMT_NONE },
|
AV_PIX_FMT_NONE },
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue