History

zerocodec: Cosmetics

Be consistent with error messages and code formatting.

Derek Buitenhuis committed 14 years ago

Commit d6124d01 parent 759901f1 file · +13 −14Browse files

Unified · Split

libavcodec/zerocodec.c+13−14
@@ -23,7 +23,7 @@ · 22 unmodified lines
2323 typedef struct {
2424 AVFrame previous_frame;
2525 z_stream zstream;
26− int size;
26+ int size;
2727 } ZeroCodecContext;
2828
2929 static int zerocodec_decode_frame(AVCodecContext *avctx, void *data,
@@ -33,7 +33,8 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, · 3 unmodified lines
3333 AVFrame *pic = avctx->coded_frame;
3434 AVFrame *prev_pic = &zc->previous_frame;
3535 z_stream *zstream = &zc->zstream;
36− uint8_t *prev = prev_pic->data[0], *dst;
36+ uint8_t *prev = prev_pic->data[0];
37+ uint8_t *dst;
3738 int i, j, zret;
3839
3940 pic->reference = 3;
@@ -43,7 +44,7 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, · 3 unmodified lines
4344 pic->pict_type = AV_PICTURE_TYPE_I;
4445 } else {
4546 if (!prev) {
46− av_log(avctx, AV_LOG_ERROR, "Missing reference frame!\n");
47+ av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
4748 return AVERROR_INVALIDDATA;
4849 }
4950 pic->key_frame = 0;
@@ -56,16 +57,15 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, · 6 unmodified lines
5657 }
5758
5859 zret = inflateReset(zstream);
59−
6060 if (zret != Z_OK) {
61− av_log(avctx, AV_LOG_ERROR, "Could not reset inflate: %d\n", zret);
62− return AVERROR(EINVAL);
61+ av_log(avctx, AV_LOG_ERROR, "Could not reset inflate: %d.\n", zret);
62+ return AVERROR_INVALIDDATA;
6363 }
6464
65− zstream->next_in = avpkt->data;
66− zstream->avail_in = avpkt->size;
65+ zstream->next_in = avpkt->data;
66+ zstream->avail_in = avpkt->size;
6767
68− dst = pic->data[0];
68+ dst = pic->data[0];
6969
7070 /**
7171 * ZeroCodec has very simple interframe compression. If a value
@@ -75,11 +75,12 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, · 3 unmodified lines
7575 for (i = 0; i < avctx->height; i++) {
7676 zstream->next_out = dst;
7777 zstream->avail_out = avctx->width << 1;
78+
7879 zret = inflate(zstream, Z_SYNC_FLUSH);
7980 if (zret != Z_OK && zret != Z_STREAM_END) {
8081 av_log(avctx, AV_LOG_ERROR,
81− "Inflate failed with return code: %d\n", zret);
82− return AVERROR(EINVAL);
82+ "Inflate failed with return code: %d.\n", zret);
83+ return AVERROR_INVALIDDATA;
8384 }
8485
8586 if (!(avpkt->flags & AV_PKT_FLAG_KEY))
@@ -137,14 +138,12 @@ static av_cold int zerocodec_decode_init(AVCodecContext *avctx) · 51 unmodified lines
137138 zstream->opaque = Z_NULL;
138139
139140 zret = inflateInit(zstream);
140−
141141 if (zret != Z_OK) {
142− av_log(avctx, AV_LOG_ERROR, "Could not initialize inflate: %d\n", zret);
142+ av_log(avctx, AV_LOG_ERROR, "Could not initialize inflate: %d.\n", zret);
143143 return AVERROR(ENOMEM);
144144 }
145145
146146 avctx->coded_frame = avcodec_alloc_frame();
147−
148147 if (!avctx->coded_frame) {
149148 av_log(avctx, AV_LOG_ERROR, "Could not allocate frame buffer.\n");
150149 zerocodec_decode_close(avctx);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t