Browse code

zerocodec: Cosmetics

Be consistent with error messages and code formatting.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>

Derek Buitenhuis authored on 2012/08/04 10:41:24
Showing 1 changed files
... ...
@@ -23,7 +23,7 @@
23 23
 typedef struct {
24 24
     AVFrame  previous_frame;
25 25
     z_stream zstream;
26
-    int size;
26
+    int      size;
27 27
 } ZeroCodecContext;
28 28
 
29 29
 static int zerocodec_decode_frame(AVCodecContext *avctx, void *data,
... ...
@@ -33,7 +33,8 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data,
33 33
     AVFrame *pic         = avctx->coded_frame;
34 34
     AVFrame *prev_pic    = &zc->previous_frame;
35 35
     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;
37 38
     int i, j, zret;
38 39
 
39 40
     pic->reference = 3;
... ...
@@ -43,7 +44,7 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data,
43 43
         pic->pict_type = AV_PICTURE_TYPE_I;
44 44
     } else {
45 45
         if (!prev) {
46
-            av_log(avctx, AV_LOG_ERROR, "Missing reference frame!\n");
46
+            av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
47 47
             return AVERROR_INVALIDDATA;
48 48
         }
49 49
         pic->key_frame = 0;
... ...
@@ -56,16 +57,15 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data,
56 56
     }
57 57
 
58 58
     zret = inflateReset(zstream);
59
-
60 59
     if (zret != Z_OK) {
61
-        av_log(avctx, AV_LOG_ERROR, "Could not reset inflate: %d\n", zret);
62
-        return AVERROR(EINVAL);
60
+        av_log(avctx, AV_LOG_ERROR, "Could not reset inflate: %d.\n", zret);
61
+        return AVERROR_INVALIDDATA;
63 62
     }
64 63
 
65 64
     zstream->next_in  = avpkt->data;
66 65
     zstream->avail_in = avpkt->size;
67 66
 
68
-    dst  = pic->data[0];
67
+    dst = pic->data[0];
69 68
 
70 69
     /**
71 70
      * ZeroCodec has very simple interframe compression. If a value
... ...
@@ -79,8 +79,8 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data,
79 79
         zret = inflate(zstream, Z_SYNC_FLUSH);
80 80
         if (zret != Z_OK && zret != Z_STREAM_END) {
81 81
             av_log(avctx, AV_LOG_ERROR,
82
-                   "Inflate failed with return code: %d\n", zret);
83
-            return AVERROR(EINVAL);
82
+                   "Inflate failed with return code: %d.\n", zret);
83
+            return AVERROR_INVALIDDATA;
84 84
         }
85 85
 
86 86
         if (!(avpkt->flags & AV_PKT_FLAG_KEY))
... ...
@@ -138,14 +138,12 @@ static av_cold int zerocodec_decode_init(AVCodecContext *avctx)
138 138
     zstream->opaque = Z_NULL;
139 139
 
140 140
     zret = inflateInit(zstream);
141
-
142 141
     if (zret != Z_OK) {
143
-        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);
144 143
         return AVERROR(ENOMEM);
145 144
     }
146 145
 
147 146
     avctx->coded_frame = avcodec_alloc_frame();
148
-
149 147
     if (!avctx->coded_frame) {
150 148
         av_log(avctx, AV_LOG_ERROR, "Could not allocate frame buffer.\n");
151 149
         zerocodec_decode_close(avctx);