mirror of https://git.ffmpeg.org/ffmpeg.git
msvideo1enc: switch to encode2()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
8060403011
commit
73f8f7e839
|
@ -62,19 +62,26 @@ enum MSV1Mode{
|
||||||
|
|
||||||
static const int remap[16] = { 0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15 };
|
static const int remap[16] = { 0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15 };
|
||||||
|
|
||||||
static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data)
|
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||||
|
const AVFrame *pict, int *got_packet)
|
||||||
{
|
{
|
||||||
Msvideo1EncContext * const c = avctx->priv_data;
|
Msvideo1EncContext * const c = avctx->priv_data;
|
||||||
AVFrame *pict = data;
|
|
||||||
AVFrame * const p = &c->pic;
|
AVFrame * const p = &c->pic;
|
||||||
uint16_t *src;
|
uint16_t *src;
|
||||||
uint8_t *prevptr;
|
uint8_t *prevptr;
|
||||||
uint8_t *dst = buf;
|
uint8_t *dst, *buf;
|
||||||
int keyframe = 1;
|
int keyframe = 1;
|
||||||
int no_skips = 1;
|
int no_skips = 1;
|
||||||
int i, j, k, x, y;
|
int i, j, k, x, y, ret;
|
||||||
int skips = 0;
|
int skips = 0;
|
||||||
|
|
||||||
|
if (!pkt->data &&
|
||||||
|
(ret = av_new_packet(pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE)) < 0) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
dst= buf= pkt->data;
|
||||||
|
|
||||||
*p = *pict;
|
*p = *pict;
|
||||||
if(!c->prev)
|
if(!c->prev)
|
||||||
c->prev = av_malloc(avctx->width * 3 * (avctx->height + 3));
|
c->prev = av_malloc(avctx->width * 3 * (avctx->height + 3));
|
||||||
|
@ -245,8 +252,11 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void
|
||||||
c->keyint++;
|
c->keyint++;
|
||||||
p->pict_type= keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
|
p->pict_type= keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
|
||||||
p->key_frame= keyframe;
|
p->key_frame= keyframe;
|
||||||
|
if (keyframe) pkt->flags |= AV_PKT_FLAG_KEY;
|
||||||
|
pkt->size = dst - buf;
|
||||||
|
*got_packet = 1;
|
||||||
|
|
||||||
return dst - buf;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -295,7 +305,7 @@ AVCodec ff_msvideo1_encoder = {
|
||||||
.id = CODEC_ID_MSVIDEO1,
|
.id = CODEC_ID_MSVIDEO1,
|
||||||
.priv_data_size = sizeof(Msvideo1EncContext),
|
.priv_data_size = sizeof(Msvideo1EncContext),
|
||||||
.init = encode_init,
|
.init = encode_init,
|
||||||
.encode = encode_frame,
|
.encode2 = encode_frame,
|
||||||
.close = encode_end,
|
.close = encode_end,
|
||||||
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB555, PIX_FMT_NONE},
|
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB555, PIX_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Microsoft Video-1"),
|
.long_name = NULL_IF_CONFIG_SMALL("Microsoft Video-1"),
|
||||||
|
|
Loading…
Reference in New Issue