Commit 4012cd6c authored by Paul B Mahol's avatar Paul B Mahol

lavc: fix decode_frame() third parameter semantics for rest of video decoders

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 835fd779
...@@ -80,7 +80,8 @@ static av_cold int end(AVCodecContext *avctx) ...@@ -80,7 +80,8 @@ static av_cold int end(AVCodecContext *avctx)
return 0; return 0;
} }
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{ {
AVRnContext *a = avctx->priv_data; AVRnContext *a = avctx->priv_data;
AVFrame *p = &a->frame; AVFrame *p = &a->frame;
...@@ -89,7 +90,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac ...@@ -89,7 +90,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
int y, ret, true_height; int y, ret, true_height;
if(a->is_mjpeg) if(a->is_mjpeg)
return ff_mjpeg_decode_frame(avctx, data, data_size, avpkt); return ff_mjpeg_decode_frame(avctx, data, got_frame, avpkt);
true_height = buf_size / (2*avctx->width); true_height = buf_size / (2*avctx->width);
if(p->data[0]) if(p->data[0])
...@@ -123,7 +124,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac ...@@ -123,7 +124,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
} }
*(AVFrame*)data = a->frame; *(AVFrame*)data = a->frame;
*data_size = sizeof(AVFrame); *got_frame = 1;
return buf_size; return buf_size;
} }
......
...@@ -39,7 +39,7 @@ static av_cold int avui_decode_init(AVCodecContext *avctx) ...@@ -39,7 +39,7 @@ static av_cold int avui_decode_init(AVCodecContext *avctx)
} }
static int avui_decode_frame(AVCodecContext *avctx, void *data, static int avui_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt) int *got_frame, AVPacket *avpkt)
{ {
AVFrame *pic = avctx->coded_frame; AVFrame *pic = avctx->coded_frame;
const uint8_t *src = avpkt->data, *extradata = avctx->extradata; const uint8_t *src = avpkt->data, *extradata = avctx->extradata;
...@@ -128,7 +128,7 @@ static int avui_decode_frame(AVCodecContext *avctx, void *data, ...@@ -128,7 +128,7 @@ static int avui_decode_frame(AVCodecContext *avctx, void *data,
src += 4; src += 4;
srca += 4; srca += 4;
} }
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame *)data = *pic; *(AVFrame *)data = *pic;
return avpkt->size; return avpkt->size;
......
...@@ -129,7 +129,7 @@ static void draw_char(AVCodecContext *avctx, int c, int a) ...@@ -129,7 +129,7 @@ static void draw_char(AVCodecContext *avctx, int c, int a)
} }
static int decode_frame(AVCodecContext *avctx, static int decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *got_frame,
AVPacket *avpkt) AVPacket *avpkt)
{ {
XbinContext *s = avctx->priv_data; XbinContext *s = avctx->priv_data;
...@@ -201,7 +201,7 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -201,7 +201,7 @@ static int decode_frame(AVCodecContext *avctx,
} }
} }
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame*)data = s->frame; *(AVFrame*)data = s->frame;
return buf_size; return buf_size;
} }
......
...@@ -70,7 +70,7 @@ static int brpix_decode_header(BRPixHeader *out, GetByteContext *pgb) ...@@ -70,7 +70,7 @@ static int brpix_decode_header(BRPixHeader *out, GetByteContext *pgb)
} }
static int brpix_decode_frame(AVCodecContext *avctx, static int brpix_decode_frame(AVCodecContext *avctx,
void *data, int *data_size_out, void *data, int *got_frame,
AVPacket *avpkt) AVPacket *avpkt)
{ {
BRPixContext *s = avctx->priv_data; BRPixContext *s = avctx->priv_data;
...@@ -217,7 +217,7 @@ static int brpix_decode_frame(AVCodecContext *avctx, ...@@ -217,7 +217,7 @@ static int brpix_decode_frame(AVCodecContext *avctx,
} }
*frame_out = s->frame; *frame_out = s->frame;
*data_size_out = sizeof(AVFrame); *got_frame = 1;
return avpkt->size; return avpkt->size;
} }
......
...@@ -46,8 +46,8 @@ typedef struct { ...@@ -46,8 +46,8 @@ typedef struct {
} CpiaContext; } CpiaContext;
static int cpia_decode_frame(AVCodecContext* avctx, static int cpia_decode_frame(AVCodecContext *avctx,
void* data, int* data_size, AVPacket* avpkt) void *data, int *got_frame, AVPacket* avpkt)
{ {
CpiaContext* const cpia = avctx->priv_data; CpiaContext* const cpia = avctx->priv_data;
int i,j,ret; int i,j,ret;
...@@ -183,7 +183,7 @@ static int cpia_decode_frame(AVCodecContext* avctx, ...@@ -183,7 +183,7 @@ static int cpia_decode_frame(AVCodecContext* avctx,
} }
} }
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame*) data = *frame; *(AVFrame*) data = *frame;
return avpkt->size; return avpkt->size;
......
...@@ -536,7 +536,7 @@ static av_cold int init(AVCodecContext *avctx) ...@@ -536,7 +536,7 @@ static av_cold int init(AVCodecContext *avctx)
static inline CopyRet copy_frame(AVCodecContext *avctx, static inline CopyRet copy_frame(AVCodecContext *avctx,
BC_DTS_PROC_OUT *output, BC_DTS_PROC_OUT *output,
void *data, int *data_size) void *data, int *got_frame)
{ {
BC_STATUS ret; BC_STATUS ret;
BC_DTS_STATUS decoder_status = { 0, }; BC_DTS_STATUS decoder_status = { 0, };
...@@ -696,7 +696,7 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, ...@@ -696,7 +696,7 @@ static inline CopyRet copy_frame(AVCodecContext *avctx,
priv->pic.pkt_pts = pkt_pts; priv->pic.pkt_pts = pkt_pts;
if (!priv->need_second_field) { if (!priv->need_second_field) {
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame *)data = priv->pic; *(AVFrame *)data = priv->pic;
} }
...@@ -733,7 +733,7 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, ...@@ -733,7 +733,7 @@ static inline CopyRet copy_frame(AVCodecContext *avctx,
static inline CopyRet receive_frame(AVCodecContext *avctx, static inline CopyRet receive_frame(AVCodecContext *avctx,
void *data, int *data_size) void *data, int *got_frame)
{ {
BC_STATUS ret; BC_STATUS ret;
BC_DTS_PROC_OUT output = { BC_DTS_PROC_OUT output = {
...@@ -743,7 +743,7 @@ static inline CopyRet receive_frame(AVCodecContext *avctx, ...@@ -743,7 +743,7 @@ static inline CopyRet receive_frame(AVCodecContext *avctx,
CHDContext *priv = avctx->priv_data; CHDContext *priv = avctx->priv_data;
HANDLE dev = priv->dev; HANDLE dev = priv->dev;
*data_size = 0; *got_frame = 0;
// Request decoded data from the driver // Request decoded data from the driver
ret = DtsProcOutputNoCopy(dev, OUTPUT_PROC_TIMEOUT, &output); ret = DtsProcOutputNoCopy(dev, OUTPUT_PROC_TIMEOUT, &output);
...@@ -840,8 +840,8 @@ static inline CopyRet receive_frame(AVCodecContext *avctx, ...@@ -840,8 +840,8 @@ static inline CopyRet receive_frame(AVCodecContext *avctx,
priv->last_picture = output.PicInfo.picture_number - 1; priv->last_picture = output.PicInfo.picture_number - 1;
} }
copy_ret = copy_frame(avctx, &output, data, data_size); copy_ret = copy_frame(avctx, &output, data, got_frame);
if (*data_size > 0) { if (*got_frame > 0) {
avctx->has_b_frames--; avctx->has_b_frames--;
priv->last_picture++; priv->last_picture++;
av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Pipeline length: %u\n", av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Pipeline length: %u\n",
...@@ -868,7 +868,7 @@ static inline CopyRet receive_frame(AVCodecContext *avctx, ...@@ -868,7 +868,7 @@ static inline CopyRet receive_frame(AVCodecContext *avctx,
} }
static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
{ {
BC_STATUS ret; BC_STATUS ret;
BC_DTS_STATUS decoder_status = { 0, }; BC_DTS_STATUS decoder_status = { 0, };
...@@ -1026,8 +1026,8 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a ...@@ -1026,8 +1026,8 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a
} }
do { do {
rec_ret = receive_frame(avctx, data, data_size); rec_ret = receive_frame(avctx, data, got_frame);
if (rec_ret == RET_OK && *data_size == 0) { if (rec_ret == RET_OK && *got_frame == 0) {
/* /*
* This case is for when the encoded fields are stored * This case is for when the encoded fields are stored
* separately and we get a separate avpkt for each one. To keep * separately and we get a separate avpkt for each one. To keep
...@@ -1052,8 +1052,8 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a ...@@ -1052,8 +1052,8 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a
ret = DtsGetDriverStatus(dev, &decoder_status); ret = DtsGetDriverStatus(dev, &decoder_status);
if (ret == BC_STS_SUCCESS && if (ret == BC_STS_SUCCESS &&
decoder_status.ReadyListCount > 0) { decoder_status.ReadyListCount > 0) {
rec_ret = receive_frame(avctx, data, data_size); rec_ret = receive_frame(avctx, data, got_frame);
if ((rec_ret == RET_OK && *data_size > 0) || if ((rec_ret == RET_OK && *got_frame > 0) ||
rec_ret == RET_ERROR) rec_ret == RET_ERROR)
break; break;
} }
......
...@@ -1706,7 +1706,7 @@ static int dirac_decode_picture_header(DiracContext *s) ...@@ -1706,7 +1706,7 @@ static int dirac_decode_picture_header(DiracContext *s)
return 0; return 0;
} }
static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *data_size) static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)
{ {
DiracFrame *out = s->delay_frames[0]; DiracFrame *out = s->delay_frames[0];
int i, out_idx = 0; int i, out_idx = 0;
...@@ -1723,7 +1723,7 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *data_size) ...@@ -1723,7 +1723,7 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *data_size)
if (out) { if (out) {
out->avframe.reference ^= DELAYED_PIC_REF; out->avframe.reference ^= DELAYED_PIC_REF;
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame *)picture = out->avframe; *(AVFrame *)picture = out->avframe;
} }
...@@ -1827,7 +1827,7 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int ...@@ -1827,7 +1827,7 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
return 0; return 0;
} }
static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt) static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)
{ {
DiracContext *s = avctx->priv_data; DiracContext *s = avctx->priv_data;
DiracFrame *picture = data; DiracFrame *picture = data;
...@@ -1843,11 +1843,11 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *data_size, ...@@ -1843,11 +1843,11 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
} }
s->current_picture = NULL; s->current_picture = NULL;
*data_size = 0; *got_frame = 0;
/* end of stream, so flush delayed pics */ /* end of stream, so flush delayed pics */
if (buf_size == 0) if (buf_size == 0)
return get_delayed_pic(s, (AVFrame *)data, data_size); return get_delayed_pic(s, (AVFrame *)data, got_frame);
for (;;) { for (;;) {
/*[DIRAC_STD] Here starts the code from parse_info() defined in 9.6 /*[DIRAC_STD] Here starts the code from parse_info() defined in 9.6
...@@ -1905,15 +1905,15 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *data_size, ...@@ -1905,15 +1905,15 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (delayed_frame) { if (delayed_frame) {
delayed_frame->avframe.reference ^= DELAYED_PIC_REF; delayed_frame->avframe.reference ^= DELAYED_PIC_REF;
*(AVFrame*)data = delayed_frame->avframe; *(AVFrame*)data = delayed_frame->avframe;
*data_size = sizeof(AVFrame); *got_frame = 1;
} }
} else if (s->current_picture->avframe.display_picture_number == s->frame_number) { } else if (s->current_picture->avframe.display_picture_number == s->frame_number) {
/* The right frame at the right time :-) */ /* The right frame at the right time :-) */
*(AVFrame*)data = s->current_picture->avframe; *(AVFrame*)data = s->current_picture->avframe;
*data_size = sizeof(AVFrame); *got_frame = 1;
} }
if (*data_size) if (*got_frame)
s->frame_number = picture->avframe.display_picture_number + 1; s->frame_number = picture->avframe.display_picture_number + 1;
return buf_idx; return buf_idx;
......
...@@ -93,13 +93,13 @@ static unsigned decode_skip_count(GetBitContext* gb) { ...@@ -93,13 +93,13 @@ static unsigned decode_skip_count(GetBitContext* gb) {
* Decode a single frame * Decode a single frame
* @param avctx decoder context * @param avctx decoder context
* @param data decoded frame * @param data decoded frame
* @param data_size size of the decoded frame * @param got_frame have decoded frame
* @param buf input buffer * @param buf input buffer
* @param buf_size input buffer size * @param buf_size input buffer size
* @return 0 success, -1 on error * @return 0 success, -1 on error
*/ */
static int escape130_decode_frame(AVCodecContext *avctx, static int escape130_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *got_frame,
AVPacket *avpkt) AVPacket *avpkt)
{ {
const uint8_t *buf = avpkt->data; const uint8_t *buf = avpkt->data;
...@@ -302,7 +302,7 @@ static int escape130_decode_frame(AVCodecContext *avctx, ...@@ -302,7 +302,7 @@ static int escape130_decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, &s->frame); avctx->release_buffer(avctx, &s->frame);
*(AVFrame*)data = s->frame = new_frame; *(AVFrame*)data = s->frame = new_frame;
*data_size = sizeof(AVFrame); *got_frame = 1;
return buf_size; return buf_size;
} }
......
...@@ -223,7 +223,7 @@ static int rle_uncompress(const uint8_t *src, int ssize, uint8_t *dst, int dsize ...@@ -223,7 +223,7 @@ static int rle_uncompress(const uint8_t *src, int ssize, uint8_t *dst, int dsize
static int decode_frame(AVCodecContext *avctx, static int decode_frame(AVCodecContext *avctx,
void *data, void *data,
int *data_size, int *got_frame,
AVPacket *avpkt) AVPacket *avpkt)
{ {
const uint8_t *buf = avpkt->data; const uint8_t *buf = avpkt->data;
...@@ -633,7 +633,7 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -633,7 +633,7 @@ static int decode_frame(AVCodecContext *avctx,
} }
*picture = s->picture; *picture = s->picture;
*data_size = sizeof(AVPicture); *got_frame = 1;
return buf_size; return buf_size;
} }
......
...@@ -1018,7 +1018,7 @@ static int jp2_find_codestream(J2kDecoderContext *s) ...@@ -1018,7 +1018,7 @@ static int jp2_find_codestream(J2kDecoderContext *s)
} }
static int decode_frame(AVCodecContext *avctx, static int decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *got_frame,
AVPacket *avpkt) AVPacket *avpkt)
{ {
J2kDecoderContext *s = avctx->priv_data; J2kDecoderContext *s = avctx->priv_data;
...@@ -1061,7 +1061,7 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -1061,7 +1061,7 @@ static int decode_frame(AVCodecContext *avctx,
cleanup(s); cleanup(s);
*data_size = sizeof(AVPicture); *got_frame = 1;
*picture = s->picture; *picture = s->picture;
return bytestream2_tell(&s->g); return bytestream2_tell(&s->g);
......
...@@ -354,7 +354,7 @@ fail: ...@@ -354,7 +354,7 @@ fail:
} }
static int Stagefright_decode_frame(AVCodecContext *avctx, void *data, static int Stagefright_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt) int *got_frame, AVPacket *avpkt)
{ {
StagefrightContext *s = (StagefrightContext*)avctx->priv_data; StagefrightContext *s = (StagefrightContext*)avctx->priv_data;
Frame *frame; Frame *frame;
...@@ -463,7 +463,7 @@ static int Stagefright_decode_frame(AVCodecContext *avctx, void *data, ...@@ -463,7 +463,7 @@ static int Stagefright_decode_frame(AVCodecContext *avctx, void *data,
} }
s->prev_frame = ret_frame; s->prev_frame = ret_frame;
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame*)data = *ret_frame; *(AVFrame*)data = *ret_frame;
return orig_size; return orig_size;
} }
......
...@@ -115,7 +115,7 @@ static av_cold int utvideo_decode_init(AVCodecContext *avctx) ...@@ -115,7 +115,7 @@ static av_cold int utvideo_decode_init(AVCodecContext *avctx)
} }
static int utvideo_decode_frame(AVCodecContext *avctx, void *data, static int utvideo_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt) int *got_frame, AVPacket *avpkt)
{ {
UtVideoContext *utv = (UtVideoContext *)avctx->priv_data; UtVideoContext *utv = (UtVideoContext *)avctx->priv_data;
AVFrame *pic = avctx->coded_frame; AVFrame *pic = avctx->coded_frame;
...@@ -150,7 +150,7 @@ static int utvideo_decode_frame(AVCodecContext *avctx, void *data, ...@@ -150,7 +150,7 @@ static int utvideo_decode_frame(AVCodecContext *avctx, void *data,
break; break;
} }
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame *)data = *pic; *(AVFrame *)data = *pic;
return avpkt->size; return avpkt->size;
......
...@@ -245,7 +245,7 @@ static int decode_0(AVCodecContext *avctx, uint8_t code, uint8_t *pkt) ...@@ -245,7 +245,7 @@ static int decode_0(AVCodecContext *avctx, uint8_t code, uint8_t *pkt)
} }
static int paf_vid_decode(AVCodecContext *avctx, void *data, static int paf_vid_decode(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *pkt) int *got_frame, AVPacket *pkt)
{ {
PAFVideoDecContext *c = avctx->priv_data; PAFVideoDecContext *c = avctx->priv_data;
uint8_t code, *dst, *src, *end; uint8_t code, *dst, *src, *end;
...@@ -357,7 +357,7 @@ static int paf_vid_decode(AVCodecContext *avctx, void *data, ...@@ -357,7 +357,7 @@ static int paf_vid_decode(AVCodecContext *avctx, void *data,
c->current_frame = (c->current_frame + 1) & 3; c->current_frame = (c->current_frame + 1) & 3;
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame *)data = c->pic; *(AVFrame *)data = c->pic;
return pkt->size; return pkt->size;
......
...@@ -522,7 +522,7 @@ static int decode_picture(AVCodecContext *avctx) ...@@ -522,7 +522,7 @@ static int decode_picture(AVCodecContext *avctx)
return 0; return 0;
} }
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt) AVPacket *avpkt)
{ {
ProresContext *ctx = avctx->priv_data; ProresContext *ctx = avctx->priv_data;
...@@ -574,7 +574,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, ...@@ -574,7 +574,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
goto decode_picture; goto decode_picture;
} }
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame*)data = *frame; *(AVFrame*)data = *frame;
return avpkt->size; return avpkt->size;
......
...@@ -38,7 +38,7 @@ static av_cold int y216_decode_init(AVCodecContext *avctx) ...@@ -38,7 +38,7 @@ static av_cold int y216_decode_init(AVCodecContext *avctx)
} }
static int y216_decode_frame(AVCodecContext *avctx, void *data, static int y216_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt) int *got_frame, AVPacket *avpkt)
{ {
AVFrame *pic = avctx->coded_frame; AVFrame *pic = avctx->coded_frame;
const uint16_t *src = (uint16_t *)avpkt->data; const uint16_t *src = (uint16_t *)avpkt->data;
...@@ -81,7 +81,7 @@ static int y216_decode_frame(AVCodecContext *avctx, void *data, ...@@ -81,7 +81,7 @@ static int y216_decode_frame(AVCodecContext *avctx, void *data,
src += aligned_width << 1; src += aligned_width << 1;
} }
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame *)data = *pic; *(AVFrame *)data = *pic;
return avpkt->size; return avpkt->size;
......
...@@ -40,7 +40,7 @@ static av_cold int v308_decode_init(AVCodecContext *avctx) ...@@ -40,7 +40,7 @@ static av_cold int v308_decode_init(AVCodecContext *avctx)
} }
static int v308_decode_frame(AVCodecContext *avctx, void *data, static int v308_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt) int *got_frame, AVPacket *avpkt)
{ {
AVFrame *pic = avctx->coded_frame; AVFrame *pic = avctx->coded_frame;
const uint8_t *src = avpkt->data; const uint8_t *src = avpkt->data;
...@@ -81,7 +81,7 @@ static int v308_decode_frame(AVCodecContext *avctx, void *data, ...@@ -81,7 +81,7 @@ static int v308_decode_frame(AVCodecContext *avctx, void *data,
v += pic->linesize[2]; v += pic->linesize[2];
} }
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame *)data = *pic; *(AVFrame *)data = *pic;
return avpkt->size; return avpkt->size;
......
...@@ -37,7 +37,7 @@ static av_cold int v408_decode_init(AVCodecContext *avctx) ...@@ -37,7 +37,7 @@ static av_cold int v408_decode_init(AVCodecContext *avctx)
} }
static int v408_decode_frame(AVCodecContext *avctx, void *data, static int v408_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt) int *got_frame, AVPacket *avpkt)
{ {
AVFrame *pic = avctx->coded_frame; AVFrame *pic = avctx->coded_frame;
const uint8_t *src = avpkt->data; const uint8_t *src = avpkt->data;
...@@ -88,7 +88,7 @@ static int v408_decode_frame(AVCodecContext *avctx, void *data, ...@@ -88,7 +88,7 @@ static int v408_decode_frame(AVCodecContext *avctx, void *data,
a += pic->linesize[3]; a += pic->linesize[3];
} }
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame *)data = *pic; *(AVFrame *)data = *pic;
return avpkt->size; return avpkt->size;
......
...@@ -84,14 +84,14 @@ static void release_buffer(AVCodecContext *avctx, AVFrame *pic) ...@@ -84,14 +84,14 @@ static void release_buffer(AVCodecContext *avctx, AVFrame *pic)
} }
static int vdadec_decode(AVCodecContext *avctx, static int vdadec_decode(AVCodecContext *avctx,
void *data, int *data_size, AVPacket *avpkt) void *data, int *got_frame, AVPacket *avpkt)
{ {
VDADecoderContext *ctx = avctx->priv_data; VDADecoderContext *ctx = avctx->priv_data;
AVFrame *pic = data; AVFrame *pic = data;
int ret; int ret;
ret = ff_h264_decoder.decode(avctx, data, data_size, avpkt); ret = ff_h264_decoder.decode(avctx, data, got_frame, avpkt);
if (*data_size) { if (*got_frame) {
CVPixelBufferRef cv_buffer = (CVPixelBufferRef)pic->data[3]; CVPixelBufferRef cv_buffer = (CVPixelBufferRef)pic->data[3];
CVPixelBufferLockBaseAddress(cv_buffer, 0); CVPixelBufferLockBaseAddress(cv_buffer, 0);
pic->format = ctx->pix_fmt; pic->format = ctx->pix_fmt;
......
...@@ -45,7 +45,7 @@ static int convert(uint8_t x) ...@@ -45,7 +45,7 @@ static int convert(uint8_t x)
} }
static int xbm_decode_frame(AVCodecContext *avctx, void *data, static int xbm_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt) int *got_frame, AVPacket *avpkt)
{ {
AVFrame *p = avctx->coded_frame; AVFrame *p = avctx->coded_frame;
const uint8_t *end, *ptr = avpkt->data; const uint8_t *end, *ptr = avpkt->data;
...@@ -110,7 +110,7 @@ static int xbm_decode_frame(AVCodecContext *avctx, void *data, ...@@ -110,7 +110,7 @@ static int xbm_decode_frame(AVCodecContext *avctx, void *data,
p->key_frame = 1; p->key_frame = 1;
p->pict_type = AV_PICTURE_TYPE_I; p->pict_type = AV_PICTURE_TYPE_I;
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame *)data = *p; *(AVFrame *)data = *p;
return avpkt->size; return avpkt->size;
......
...@@ -124,7 +124,7 @@ static av_cold int xface_decode_close(AVCodecContext *avctx) ...@@ -124,7 +124,7 @@ static av_cold int xface_decode_close(AVCodecContext *avctx)
} }
static int xface_decode_frame(AVCodecContext *avctx, static int xface_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *got_frame,
AVPacket *avpkt) AVPacket *avpkt)
{ {
XFaceContext *xface = avctx->priv_data; XFaceContext *xface = avctx->priv_data;
...@@ -189,7 +189,7 @@ static int xface_decode_frame(AVCodecContext *avctx, ...@@ -189,7 +189,7 @@ static int xface_decode_frame(AVCodecContext *avctx,
} }
} }
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame*)data = xface->frame; *(AVFrame*)data = xface->frame;
return avpkt->size; return avpkt->size;
......
...@@ -42,7 +42,7 @@ static av_cold int y41p_decode_init(AVCodecContext *avctx) ...@@ -42,7 +42,7 @@ static av_cold int y41p_decode_init(AVCodecContext *avctx)
} }
static int y41p_decode_frame(AVCodecContext *avctx, void *data, static int y41p_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt) int *got_frame, AVPacket *avpkt)
{ {
AVFrame *pic = avctx->coded_frame; AVFrame *pic = avctx->coded_frame;
uint8_t *src = avpkt->data; uint8_t *src = avpkt->data;
...@@ -89,7 +89,7 @@ static int y41p_decode_frame(AVCodecContext *avctx, void *data, ...@@ -89,7 +89,7 @@ static int y41p_decode_frame(AVCodecContext *avctx, void *data,
} }
} }
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame *)data = *pic; *(AVFrame *)data = *pic;
return avpkt->size; return avpkt->size;
......
...@@ -38,7 +38,7 @@ static av_cold int yuv4_decode_init(AVCodecContext *avctx) ...@@ -38,7 +38,7 @@ static av_cold int yuv4_decode_init(AVCodecContext *avctx)
} }
static int yuv4_decode_frame(AVCodecContext *avctx, void *data, static int yuv4_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt) int *got_frame, AVPacket *avpkt)
{ {
AVFrame *pic = avctx->coded_frame; AVFrame *pic = avctx->coded_frame;
const uint8_t *src = avpkt->data; const uint8_t *src = avpkt->data;
...@@ -82,7 +82,7 @@ static int yuv4_decode_frame(AVCodecContext *avctx, void *data, ...@@ -82,7 +82,7 @@ static int yuv4_decode_frame(AVCodecContext *avctx, void *data,
v += pic->linesize[2]; v += pic->linesize[2];
} }
*data_size = sizeof(AVFrame); *got_frame = 1;
*(AVFrame *)data = *pic; *(AVFrame *)data = *pic;
return avpkt->size; return avpkt->size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment