aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/bfi.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-02 02:48:34 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-02 03:10:30 +0100
commit4121148388f4fd02ace89eca364904d3ea8bcfe7 (patch)
treec346f6906942b7a12c5c1f06e9d11205ea5660ab /libavcodec/bfi.c
parentef611095f0d0c1256cbb6654f94cae61a60f2736 (diff)
parentf15f02c204e5fe355e084923c34dda1c6c3a66ec (diff)
downloadffmpeg-4121148388f4fd02ace89eca364904d3ea8bcfe7.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: avconv: make -frames work for all types of streams, not just video. bfi: K&R cosmetics bgmc: K&R cleanup rawdec: Set start_time to 0 for raw audio files. Detect 'yuv2' as rawvideo also in avi. rawdec: propagate pict_type information to the output frame rawdec: Support more QT 1bpp rawvideo files. avconv: free bitstream filters threads: limit the number of automatic threads to MAX_AUTO_THREADS avplay: K&R cleanup fate: use rgb24 as output format for dfa tests threads: set thread_count to 1 when thread support is disabled threads: introduce CODEC_CAP_AUTO_THREADS and add it to libx264 Conflicts: ffplay.c libavcodec/avcodec.h libavcodec/pthread.c libavcodec/version.h tests/ref/fate/dfa1 tests/ref/fate/dfa10 tests/ref/fate/dfa11 tests/ref/fate/dfa2 tests/ref/fate/dfa3 tests/ref/fate/dfa4 tests/ref/fate/dfa5 tests/ref/fate/dfa6 tests/ref/fate/dfa7 tests/ref/fate/dfa8 tests/ref/fate/dfa9 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/bfi.c')
-rw-r--r--libavcodec/bfi.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c
index 25863cb7d5..2aa1a4cb65 100644
--- a/libavcodec/bfi.c
+++ b/libavcodec/bfi.c
@@ -37,7 +37,7 @@ typedef struct BFIContext {
uint32_t pal[256];
} BFIContext;
-static av_cold int bfi_decode_init(AVCodecContext * avctx)
+static av_cold int bfi_decode_init(AVCodecContext *avctx)
{
BFIContext *bfi = avctx->priv_data;
avctx->pix_fmt = PIX_FMT_PAL8;
@@ -46,7 +46,7 @@ static av_cold int bfi_decode_init(AVCodecContext * avctx)
return 0;
}
-static int bfi_decode_frame(AVCodecContext * avctx, void *data,
+static int bfi_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data, *buf_end = avpkt->data + avpkt->size;
@@ -73,11 +73,11 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
bfi->frame.pict_type = AV_PICTURE_TYPE_I;
bfi->frame.key_frame = 1;
/* Setting the palette */
- if(avctx->extradata_size>768) {
+ if (avctx->extradata_size > 768) {
av_log(NULL, AV_LOG_ERROR, "Palette is too large.\n");
return -1;
}
- pal = (uint32_t *) bfi->frame.data[1];
+ pal = (uint32_t *)bfi->frame.data[1];
for (i = 0; i < avctx->extradata_size / 3; i++) {
int shift = 16;
*pal = 0xFF << 24;
@@ -96,16 +96,17 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
memcpy(bfi->frame.data[1], bfi->pal, sizeof(bfi->pal));
}
- buf += 4; //Unpacked size, not required.
+ buf += 4; // Unpacked size, not required.
while (dst != frame_end) {
- static const uint8_t lentab[4]={0,2,0,1};
- unsigned int byte = *buf++, av_uninit(offset);
- unsigned int code = byte >> 6;
+ static const uint8_t lentab[4] = { 0, 2, 0, 1 };
+ unsigned int byte = *buf++, av_uninit(offset);
+ unsigned int code = byte >> 6;
unsigned int length = byte & ~0xC0;
if (buf >= buf_end) {
- av_log(avctx, AV_LOG_ERROR, "Input resolution larger than actual frame.\n");
+ av_log(avctx, AV_LOG_ERROR,
+ "Input resolution larger than actual frame.\n");
return -1;
}
@@ -125,7 +126,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
}
/* Do boundary check */
- if (dst + (length<<lentab[code]) > frame_end)
+ if (dst + (length << lentab[code]) > frame_end)
break;
switch (code) {
@@ -172,7 +173,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
dst += bfi->frame.linesize[0];
}
*data_size = sizeof(AVFrame);
- *(AVFrame *) data = bfi->frame;
+ *(AVFrame *)data = bfi->frame;
return buf_size;
}