On Fri, 27 Jul 2012 19:21:44 -0400, Derek Buitenhuis <[email protected]> wrote: > +static int cllc_decode_frame(AVCodecContext *avctx, void *data, > + int *data_size, AVPacket *avpkt) > +{ > + CLLCContext *ctx = avctx->priv_data; > + AVFrame *pic = avctx->coded_frame; > + uint8_t *src = avpkt->data; > + uint32_t info_tag, info_offset, coding_type; > + GetBitContext gb; > + int ret; > + > + if (pic->data[0]) > + avctx->release_buffer(avctx, pic); > + > + pic->reference = 0; > + > + /* Skip the INFO header if present */ > + info_offset = 0; > + info_tag = AV_RL32(src); > + if (info_tag == MKTAG('I', 'N', 'F', 'O')) { > + info_offset = AV_RL32(src + 4) + 8; > + src += info_offset; > + > + av_log(avctx, AV_LOG_DEBUG, "Skipping INFO chunk.\n"); > + } > + > + /* bswap16 the buffer since CLLC's bitreader works in 16-bit WORDS */ > + ctx->dsp.bswap16_buf((uint16_t *) ctx->swapped_buf, (uint16_t *) src, > + (avpkt->size - info_offset) / 2); > + > + init_get_bits(&gb, ctx->swapped_buf, (avpkt->size - info_offset) * 8); > + > + /* > + * Read in coding type. The types are as follows: > + * > + * 0 - YUY2 > + * 1 - BGR24 (Triples) > + * 2 - BGR24 (Quads) > + * 3 - BGRA > + */ > + coding_type = (AV_RL32(src) >> 8) & 0xFF; > + av_log(avctx, AV_LOG_DEBUG, "Frame coding type: %d\n", coding_type); > + > + switch(coding_type) { > + case 1: > + avctx->pix_fmt = PIX_FMT_BGR24; > + avctx->bits_per_raw_sample = 8; > + > + if (avctx->get_buffer(avctx, pic) < 0) { > + av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); > + return AVERROR(ENOMEM); > + } > + > + ret = decode_bgr24_frame(ctx, &gb, pic); > + if (ret < 0) > + return ret; > + > + break; > + default: > + av_log(avctx, AV_LOG_ERROR, "Unknown coding type: %d\n.", > coding_type); > + return AVERROR_INVALIDDATA; > + } > + > + pic->key_frame = 1; > + pic->pict_type = AV_PICTURE_TYPE_I; > + > + *data_size = sizeof(AVFrame);
It's not data_size. It's got_frame_ptr. Write 1 there. -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
