comparison sp5xdec.c @ 9355:54bc8a2727b0 libavcodec

Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an AVPacket argument rather than a const uint8_t *buf + int buf_size. This allows passing of packet-specific flags from demuxer to decoder, such as the keyframe flag, which appears necessary to playback corePNG P-frames. Patch by Thilo Borgmann thilo.borgmann googlemail com, see also the thread "Google Summer of Code participation" on the mailinglist.
author rbultje
date Tue, 07 Apr 2009 15:59:50 +0000
parents e9d9d946f213
children b8140a218b1d
comparison
equal deleted inserted replaced
9354:174309386512 9355:54bc8a2727b0
30 #include "sp5x.h" 30 #include "sp5x.h"
31 31
32 32
33 static int sp5x_decode_frame(AVCodecContext *avctx, 33 static int sp5x_decode_frame(AVCodecContext *avctx,
34 void *data, int *data_size, 34 void *data, int *data_size,
35 const uint8_t *buf, int buf_size) 35 AVPacket *avpkt)
36 { 36 {
37 const uint8_t *buf = avpkt->data;
38 int buf_size = avpkt->size;
39 AVPacket avpkt_recoded;
37 #if 0 40 #if 0
38 MJpegDecodeContext *s = avctx->priv_data; 41 MJpegDecodeContext *s = avctx->priv_data;
39 #endif 42 #endif
40 const int qscale = 5; 43 const int qscale = 5;
41 const uint8_t *buf_ptr, *buf_end; 44 const uint8_t *buf_ptr, *buf_end;
87 /* EOI */ 90 /* EOI */
88 recoded[j++] = 0xFF; 91 recoded[j++] = 0xFF;
89 recoded[j++] = 0xD9; 92 recoded[j++] = 0xD9;
90 93
91 avctx->flags &= ~CODEC_FLAG_EMU_EDGE; 94 avctx->flags &= ~CODEC_FLAG_EMU_EDGE;
92 i = ff_mjpeg_decode_frame(avctx, data, data_size, recoded, j); 95 av_init_packet(&avpkt_recoded);
96 avpkt_recoded.data = recoded;
97 avpkt_recoded.size = j;
98 i = ff_mjpeg_decode_frame(avctx, data, data_size, &avpkt_recoded);
93 99
94 av_free(recoded); 100 av_free(recoded);
95 101
96 #else 102 #else
97 /* SOF */ 103 /* SOF */