MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / cinepak_decode_frame

Function cinepak_decode_frame

libavcodec/cinepak.c:450–496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450static int cinepak_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
451 int *got_frame, AVPacket *avpkt)
452{
453 const uint8_t *buf = avpkt->data;
454 int ret = 0, buf_size = avpkt->size;
455 CinepakContext *s = avctx->priv_data;
456 int num_strips;
457
458 s->data = buf;
459 s->size = buf_size;
460
461 if (s->size < 10)
462 return AVERROR_INVALIDDATA;
463
464 num_strips = AV_RB16 (&s->data[8]);
465
466 //Empty frame, do not waste time
467 if (!num_strips && (!s->palette_video || !av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL)))
468 return buf_size;
469
470 if ((ret = cinepak_predecode_check(s)) < 0) {
471 av_log(avctx, AV_LOG_ERROR, "cinepak_predecode_check failed\n");
472 return ret;
473 }
474
475 if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
476 return ret;
477
478 if (s->palette_video) {
479 ff_copy_palette(s->pal, avpkt, avctx);
480 }
481
482 if ((ret = cinepak_decode(s)) < 0) {
483 av_log(avctx, AV_LOG_ERROR, "cinepak_decode failed\n");
484 }
485
486 if (s->palette_video)
487 memcpy (s->frame->data[1], s->pal, AVPALETTE_SIZE);
488
489 if ((ret = av_frame_ref(rframe, s->frame)) < 0)
490 return ret;
491
492 *got_frame = 1;
493
494 /* report that the buffer was completely consumed */
495 return buf_size;
496}
497
498static av_cold int cinepak_decode_end(AVCodecContext *avctx)
499{

Callers

nothing calls this directly

Calls 7

av_packet_get_side_dataFunction · 0.85
cinepak_predecode_checkFunction · 0.85
av_logFunction · 0.85
ff_reget_bufferFunction · 0.85
ff_copy_paletteFunction · 0.85
cinepak_decodeFunction · 0.85
av_frame_refFunction · 0.85

Tested by

no test coverage detected