static int truemotion1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int ret, buf_size = avpkt->size; TrueMotion1Context *s = avctx->priv_data; s->buf = buf; s->size = buf_size; if ((ret = truemotion1_decode_header(s)) < 0) return ret; if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; if (compression_types[s->compression].algorithm == ALGO_RGB24H) { truemotion1_decode_24bit(s); } else if (compression_types[s->compression].algorithm != ALGO_NOP) { truemotion1_decode_16bit(s); } if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; /* report that the buffer was completely consumed */ return buf_size; }
static int truemotion1_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { TrueMotion1Context *s = avctx->priv_data; s->buf = buf; s->size = buf_size; if (truemotion1_decode_header(s) == -1) return -1; s->frame.reference = 1; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if (avctx->reget_buffer(avctx, &s->frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } if (compression_types[s->compression].algorithm == ALGO_RGB24H) { truemotion1_decode_24bit(s); } else if (compression_types[s->compression].algorithm != ALGO_NOP) { truemotion1_decode_16bit(s); } *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; /* report that the buffer was completely consumed */ return buf_size; }
static int truemotion1_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { TrueMotion1Context *s = avctx->priv_data; s->buf = buf; s->size = buf_size; if (truemotion1_decode_header(s) == -1) return -1; s->frame.reference = 1; if (avctx->get_buffer(avctx, &s->frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } /* check for a do-nothing frame and copy the previous frame */ if (compression_types[s->compression].algorithm == ALGO_NOP) { memcpy(s->frame.data[0], s->prev_frame.data[0], s->frame.linesize[0] * s->avctx->height); } else if (compression_types[s->compression].algorithm == ALGO_RGB24H) { truemotion1_decode_24bit(s); } else { truemotion1_decode_16bit(s); } if (s->prev_frame.data[0]) avctx->release_buffer(avctx, &s->prev_frame); /* shuffle frames */ s->prev_frame = s->frame; *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; /* report that the buffer was completely consumed */ return buf_size; }