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

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2012-12-05 18:24:43 +00:00
parent 835fd779a4
commit 4012cd6c4f
22 changed files with 64 additions and 63 deletions

View File

@ -80,7 +80,8 @@ static av_cold int end(AVCodecContext *avctx)
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;
AVFrame *p = &a->frame;
@ -89,7 +90,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
int y, ret, true_height;
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);
if(p->data[0])
@ -123,7 +124,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
*(AVFrame*)data = a->frame;
*data_size = sizeof(AVFrame);
*got_frame = 1;
return buf_size;
}

View File

@ -39,7 +39,7 @@ static av_cold int avui_decode_init(AVCodecContext *avctx)
}
static int avui_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
int *got_frame, AVPacket *avpkt)
{
AVFrame *pic = avctx->coded_frame;
const uint8_t *src = avpkt->data, *extradata = avctx->extradata;
@ -128,7 +128,7 @@ static int avui_decode_frame(AVCodecContext *avctx, void *data,
src += 4;
srca += 4;
}
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame *)data = *pic;
return avpkt->size;

View File

@ -129,7 +129,7 @@ static void draw_char(AVCodecContext *avctx, int c, int a)
}
static int decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
void *data, int *got_frame,
AVPacket *avpkt)
{
XbinContext *s = avctx->priv_data;
@ -201,7 +201,7 @@ static int decode_frame(AVCodecContext *avctx,
}
}
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame*)data = s->frame;
return buf_size;
}

View File

@ -70,7 +70,7 @@ static int brpix_decode_header(BRPixHeader *out, GetByteContext *pgb)
}
static int brpix_decode_frame(AVCodecContext *avctx,
void *data, int *data_size_out,
void *data, int *got_frame,
AVPacket *avpkt)
{
BRPixContext *s = avctx->priv_data;
@ -217,7 +217,7 @@ static int brpix_decode_frame(AVCodecContext *avctx,
}
*frame_out = s->frame;
*data_size_out = sizeof(AVFrame);
*got_frame = 1;
return avpkt->size;
}

View File

@ -46,8 +46,8 @@ typedef struct {
} CpiaContext;
static int cpia_decode_frame(AVCodecContext* avctx,
void* data, int* data_size, AVPacket* avpkt)
static int cpia_decode_frame(AVCodecContext *avctx,
void *data, int *got_frame, AVPacket* avpkt)
{
CpiaContext* const cpia = avctx->priv_data;
int i,j,ret;
@ -183,7 +183,7 @@ static int cpia_decode_frame(AVCodecContext* avctx,
}
}
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame*) data = *frame;
return avpkt->size;

View File

@ -536,7 +536,7 @@ static av_cold int init(AVCodecContext *avctx)
static inline CopyRet copy_frame(AVCodecContext *avctx,
BC_DTS_PROC_OUT *output,
void *data, int *data_size)
void *data, int *got_frame)
{
BC_STATUS ret;
BC_DTS_STATUS decoder_status = { 0, };
@ -696,7 +696,7 @@ static inline CopyRet copy_frame(AVCodecContext *avctx,
priv->pic.pkt_pts = pkt_pts;
if (!priv->need_second_field) {
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame *)data = priv->pic;
}
@ -733,7 +733,7 @@ static inline CopyRet copy_frame(AVCodecContext *avctx,
static inline CopyRet receive_frame(AVCodecContext *avctx,
void *data, int *data_size)
void *data, int *got_frame)
{
BC_STATUS ret;
BC_DTS_PROC_OUT output = {
@ -743,7 +743,7 @@ static inline CopyRet receive_frame(AVCodecContext *avctx,
CHDContext *priv = avctx->priv_data;
HANDLE dev = priv->dev;
*data_size = 0;
*got_frame = 0;
// Request decoded data from the driver
ret = DtsProcOutputNoCopy(dev, OUTPUT_PROC_TIMEOUT, &output);
@ -840,8 +840,8 @@ static inline CopyRet receive_frame(AVCodecContext *avctx,
priv->last_picture = output.PicInfo.picture_number - 1;
}
copy_ret = copy_frame(avctx, &output, data, data_size);
if (*data_size > 0) {
copy_ret = copy_frame(avctx, &output, data, got_frame);
if (*got_frame > 0) {
avctx->has_b_frames--;
priv->last_picture++;
av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Pipeline length: %u\n",
@ -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_DTS_STATUS decoder_status = { 0, };
@ -1026,8 +1026,8 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a
}
do {
rec_ret = receive_frame(avctx, data, data_size);
if (rec_ret == RET_OK && *data_size == 0) {
rec_ret = receive_frame(avctx, data, got_frame);
if (rec_ret == RET_OK && *got_frame == 0) {
/*
* This case is for when the encoded fields are stored
* 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
ret = DtsGetDriverStatus(dev, &decoder_status);
if (ret == BC_STS_SUCCESS &&
decoder_status.ReadyListCount > 0) {
rec_ret = receive_frame(avctx, data, data_size);
if ((rec_ret == RET_OK && *data_size > 0) ||
rec_ret = receive_frame(avctx, data, got_frame);
if ((rec_ret == RET_OK && *got_frame > 0) ||
rec_ret == RET_ERROR)
break;
}

View File

@ -1706,7 +1706,7 @@ static int dirac_decode_picture_header(DiracContext *s)
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];
int i, out_idx = 0;
@ -1723,7 +1723,7 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *data_size)
if (out) {
out->avframe.reference ^= DELAYED_PIC_REF;
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame *)picture = out->avframe;
}
@ -1827,7 +1827,7 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
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;
DiracFrame *picture = data;
@ -1843,11 +1843,11 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
s->current_picture = NULL;
*data_size = 0;
*got_frame = 0;
/* end of stream, so flush delayed pics */
if (buf_size == 0)
return get_delayed_pic(s, (AVFrame *)data, data_size);
return get_delayed_pic(s, (AVFrame *)data, got_frame);
for (;;) {
/*[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,
if (delayed_frame) {
delayed_frame->avframe.reference ^= DELAYED_PIC_REF;
*(AVFrame*)data = delayed_frame->avframe;
*data_size = sizeof(AVFrame);
*got_frame = 1;
}
} else if (s->current_picture->avframe.display_picture_number == s->frame_number) {
/* The right frame at the right time :-) */
*(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;
return buf_idx;

View File

@ -93,13 +93,13 @@ static unsigned decode_skip_count(GetBitContext* gb) {
* Decode a single frame
* @param avctx decoder context
* @param data decoded frame
* @param data_size size of the decoded frame
* @param got_frame have decoded frame
* @param buf input buffer
* @param buf_size input buffer size
* @return 0 success, -1 on error
*/
static int escape130_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@ -302,7 +302,7 @@ static int escape130_decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, &s->frame);
*(AVFrame*)data = s->frame = new_frame;
*data_size = sizeof(AVFrame);
*got_frame = 1;
return buf_size;
}

View File

@ -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,
void *data,
int *data_size,
int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@ -633,7 +633,7 @@ static int decode_frame(AVCodecContext *avctx,
}
*picture = s->picture;
*data_size = sizeof(AVPicture);
*got_frame = 1;
return buf_size;
}

View File

@ -1018,7 +1018,7 @@ static int jp2_find_codestream(J2kDecoderContext *s)
}
static int decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
void *data, int *got_frame,
AVPacket *avpkt)
{
J2kDecoderContext *s = avctx->priv_data;
@ -1061,7 +1061,7 @@ static int decode_frame(AVCodecContext *avctx,
cleanup(s);
*data_size = sizeof(AVPicture);
*got_frame = 1;
*picture = s->picture;
return bytestream2_tell(&s->g);

View File

@ -354,7 +354,7 @@ fail:
}
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;
Frame *frame;
@ -463,7 +463,7 @@ static int Stagefright_decode_frame(AVCodecContext *avctx, void *data,
}
s->prev_frame = ret_frame;
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame*)data = *ret_frame;
return orig_size;
}

View File

@ -115,7 +115,7 @@ static av_cold int utvideo_decode_init(AVCodecContext *avctx)
}
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;
AVFrame *pic = avctx->coded_frame;
@ -150,7 +150,7 @@ static int utvideo_decode_frame(AVCodecContext *avctx, void *data,
break;
}
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame *)data = *pic;
return avpkt->size;

View File

@ -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,
int *data_size, AVPacket *pkt)
int *got_frame, AVPacket *pkt)
{
PAFVideoDecContext *c = avctx->priv_data;
uint8_t code, *dst, *src, *end;
@ -357,7 +357,7 @@ static int paf_vid_decode(AVCodecContext *avctx, void *data,
c->current_frame = (c->current_frame + 1) & 3;
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame *)data = c->pic;
return pkt->size;

View File

@ -522,7 +522,7 @@ static int decode_picture(AVCodecContext *avctx)
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)
{
ProresContext *ctx = avctx->priv_data;
@ -574,7 +574,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
goto decode_picture;
}
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame*)data = *frame;
return avpkt->size;

View File

@ -38,7 +38,7 @@ static av_cold int y216_decode_init(AVCodecContext *avctx)
}
static int y216_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
int *got_frame, AVPacket *avpkt)
{
AVFrame *pic = avctx->coded_frame;
const uint16_t *src = (uint16_t *)avpkt->data;
@ -81,7 +81,7 @@ static int y216_decode_frame(AVCodecContext *avctx, void *data,
src += aligned_width << 1;
}
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame *)data = *pic;
return avpkt->size;

View File

@ -40,7 +40,7 @@ static av_cold int v308_decode_init(AVCodecContext *avctx)
}
static int v308_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
int *got_frame, AVPacket *avpkt)
{
AVFrame *pic = avctx->coded_frame;
const uint8_t *src = avpkt->data;
@ -81,7 +81,7 @@ static int v308_decode_frame(AVCodecContext *avctx, void *data,
v += pic->linesize[2];
}
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame *)data = *pic;
return avpkt->size;

View File

@ -37,7 +37,7 @@ static av_cold int v408_decode_init(AVCodecContext *avctx)
}
static int v408_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
int *got_frame, AVPacket *avpkt)
{
AVFrame *pic = avctx->coded_frame;
const uint8_t *src = avpkt->data;
@ -88,7 +88,7 @@ static int v408_decode_frame(AVCodecContext *avctx, void *data,
a += pic->linesize[3];
}
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame *)data = *pic;
return avpkt->size;

View File

@ -84,14 +84,14 @@ static void release_buffer(AVCodecContext *avctx, AVFrame *pic)
}
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;
AVFrame *pic = data;
int ret;
ret = ff_h264_decoder.decode(avctx, data, data_size, avpkt);
if (*data_size) {
ret = ff_h264_decoder.decode(avctx, data, got_frame, avpkt);
if (*got_frame) {
CVPixelBufferRef cv_buffer = (CVPixelBufferRef)pic->data[3];
CVPixelBufferLockBaseAddress(cv_buffer, 0);
pic->format = ctx->pix_fmt;

View File

@ -45,7 +45,7 @@ static int convert(uint8_t x)
}
static int xbm_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
int *got_frame, AVPacket *avpkt)
{
AVFrame *p = avctx->coded_frame;
const uint8_t *end, *ptr = avpkt->data;
@ -110,7 +110,7 @@ static int xbm_decode_frame(AVCodecContext *avctx, void *data,
p->key_frame = 1;
p->pict_type = AV_PICTURE_TYPE_I;
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame *)data = *p;
return avpkt->size;

View File

@ -124,7 +124,7 @@ static av_cold int xface_decode_close(AVCodecContext *avctx)
}
static int xface_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
void *data, int *got_frame,
AVPacket *avpkt)
{
XFaceContext *xface = avctx->priv_data;
@ -189,7 +189,7 @@ static int xface_decode_frame(AVCodecContext *avctx,
}
}
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame*)data = xface->frame;
return avpkt->size;

View File

@ -42,7 +42,7 @@ static av_cold int y41p_decode_init(AVCodecContext *avctx)
}
static int y41p_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
int *got_frame, AVPacket *avpkt)
{
AVFrame *pic = avctx->coded_frame;
uint8_t *src = avpkt->data;
@ -89,7 +89,7 @@ static int y41p_decode_frame(AVCodecContext *avctx, void *data,
}
}
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame *)data = *pic;
return avpkt->size;

View File

@ -38,7 +38,7 @@ static av_cold int yuv4_decode_init(AVCodecContext *avctx)
}
static int yuv4_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
int *got_frame, AVPacket *avpkt)
{
AVFrame *pic = avctx->coded_frame;
const uint8_t *src = avpkt->data;
@ -82,7 +82,7 @@ static int yuv4_decode_frame(AVCodecContext *avctx, void *data,
v += pic->linesize[2];
}
*data_size = sizeof(AVFrame);
*got_frame = 1;
*(AVFrame *)data = *pic;
return avpkt->size;