Commit dd6533e1 authored by diego's avatar diego

whitespace cosmetics: K&R coding style, prettyprinting


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@20381 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent bba01e2d
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
* License along with FFmpeg; if not, write to the Free Software * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "avcodec.h" #include "avcodec.h"
#include "pnm.h" #include "pnm.h"
...@@ -32,7 +33,7 @@ static void pnm_get(PNMContext *sc, char *str, int buf_size) ...@@ -32,7 +33,7 @@ static void pnm_get(PNMContext *sc, char *str, int buf_size)
int c; int c;
/* skip spaces and comments */ /* skip spaces and comments */
for(;;) { for (;;) {
c = *sc->bytestream++; c = *sc->bytestream++;
if (c == '#') { if (c == '#') {
do { do {
...@@ -52,7 +53,8 @@ static void pnm_get(PNMContext *sc, char *str, int buf_size) ...@@ -52,7 +53,8 @@ static void pnm_get(PNMContext *sc, char *str, int buf_size)
*s = '\0'; *s = '\0';
} }
int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s){ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
{
char buf1[32], tuple_type[32]; char buf1[32], tuple_type[32];
int h, w, depth, maxval; int h, w, depth, maxval;
...@@ -72,7 +74,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s){ ...@@ -72,7 +74,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s){
maxval = -1; maxval = -1;
depth = -1; depth = -1;
tuple_type[0] = '\0'; tuple_type[0] = '\0';
for(;;) { for (;;) {
pnm_get(s, buf1, sizeof(buf1)); pnm_get(s, buf1, sizeof(buf1));
if (!strcmp(buf1, "WIDTH")) { if (!strcmp(buf1, "WIDTH")) {
pnm_get(s, buf1, sizeof(buf1)); pnm_get(s, buf1, sizeof(buf1));
......
...@@ -23,8 +23,7 @@ ...@@ -23,8 +23,7 @@
#include "pnm.h" #include "pnm.h"
static int pnm_parse(AVCodecParserContext *s, static int pnm_parse(AVCodecParserContext *s, AVCodecContext *avctx,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size, const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size) const uint8_t *buf, int buf_size)
{ {
...@@ -32,31 +31,31 @@ static int pnm_parse(AVCodecParserContext *s, ...@@ -32,31 +31,31 @@ static int pnm_parse(AVCodecParserContext *s,
PNMContext pnmctx; PNMContext pnmctx;
int next; int next;
for(; pc->overread>0; pc->overread--){ for (; pc->overread > 0; pc->overread--) {
pc->buffer[pc->index++]= pc->buffer[pc->overread_index++]; pc->buffer[pc->index++]= pc->buffer[pc->overread_index++];
} }
retry: retry:
if(pc->index){ if (pc->index) {
pnmctx.bytestream_start= pnmctx.bytestream_start =
pnmctx.bytestream= pc->buffer; pnmctx.bytestream = pc->buffer;
pnmctx.bytestream_end= pc->buffer + pc->index; pnmctx.bytestream_end = pc->buffer + pc->index;
}else{ } else {
pnmctx.bytestream_start= pnmctx.bytestream_start =
pnmctx.bytestream= (uint8_t *) buf; /* casts avoid warnings */ pnmctx.bytestream = (uint8_t *) buf; /* casts avoid warnings */
pnmctx.bytestream_end= (uint8_t *) buf + buf_size; pnmctx.bytestream_end = (uint8_t *) buf + buf_size;
} }
if(ff_pnm_decode_header(avctx, &pnmctx) < 0){ if (ff_pnm_decode_header(avctx, &pnmctx) < 0) {
if(pnmctx.bytestream < pnmctx.bytestream_end){ if (pnmctx.bytestream < pnmctx.bytestream_end) {
if(pc->index){ if (pc->index) {
pc->index=0; pc->index = 0;
}else{ } else {
buf++; buf++;
buf_size--; buf_size--;
} }
goto retry; goto retry;
} }
#if 0 #if 0
if(pc->index && pc->index*2 + FF_INPUT_BUFFER_PADDING_SIZE < pc->buffer_size && buf_size > pc->index){ if (pc->index && pc->index * 2 + FF_INPUT_BUFFER_PADDING_SIZE < pc->buffer_size && buf_size > pc->index) {
memcpy(pc->buffer + pc->index, buf, pc->index); memcpy(pc->buffer + pc->index, buf, pc->index);
pc->index += pc->index; pc->index += pc->index;
buf += pc->index; buf += pc->index;
...@@ -64,17 +63,17 @@ retry: ...@@ -64,17 +63,17 @@ retry:
goto retry; goto retry;
} }
#endif #endif
next= END_NOT_FOUND; next = END_NOT_FOUND;
}else{ } else {
next= pnmctx.bytestream - pnmctx.bytestream_start next = pnmctx.bytestream - pnmctx.bytestream_start
+ avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); + avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
if(pnmctx.bytestream_start!=buf) if (pnmctx.bytestream_start != buf)
next-= pc->index; next -= pc->index;
if(next > buf_size) if (next > buf_size)
next= END_NOT_FOUND; next = END_NOT_FOUND;
} }
if(ff_combine_frame(pc, next, &buf, &buf_size)<0){ if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
*poutbuf = NULL; *poutbuf = NULL;
*poutbuf_size = 0; *poutbuf_size = 0;
return buf_size; return buf_size;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment