1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

wv: K&R formatting cosmetics

This commit is contained in:
Anton Khirnov 2012-07-28 12:42:25 +02:00 committed by Diego Biurrun
parent 193cdd9a3e
commit 29d70274ec

View File

@ -78,7 +78,8 @@ static int wv_probe(AVProbeData *p)
return 0; return 0;
} }
static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int append) static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb,
int append)
{ {
WVContext *wc = ctx->priv_data; WVContext *wc = ctx->priv_data;
uint32_t tag, ver; uint32_t tag, ver;
@ -111,7 +112,8 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
size = wc->blksize; size = wc->blksize;
} }
wc->flags = AV_RL32(wc->extra + 4); wc->flags = AV_RL32(wc->extra + 4);
// blocks with zero samples don't contain actual audio information and should be ignored /* Blocks with zero samples don't contain actual audio information
* and should be ignored */
if (!AV_RN32(wc->extra)) if (!AV_RN32(wc->extra))
return 0; return 0;
// parse flags // parse flags
@ -127,7 +129,8 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
if ((rate == -1 || !chan) && !wc->block_parsed) { if ((rate == -1 || !chan) && !wc->block_parsed) {
int64_t block_end = avio_tell(pb) + wc->blksize - 24; int64_t block_end = avio_tell(pb) + wc->blksize - 24;
if (!pb->seekable) { if (!pb->seekable) {
av_log(ctx, AV_LOG_ERROR, "Cannot determine additional parameters\n"); av_log(ctx, AV_LOG_ERROR,
"Cannot determine additional parameters\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
while (avio_tell(pb) < block_end) { while (avio_tell(pb) < block_end) {
@ -140,7 +143,8 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
switch (id & 0x3F) { switch (id & 0x3F) {
case 0xD: case 0xD:
if (size <= 1) { if (size <= 1) {
av_log(ctx, AV_LOG_ERROR, "Insufficient channel information\n"); av_log(ctx, AV_LOG_ERROR,
"Insufficient channel information\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
chan = avio_r8(pb); chan = avio_r8(pb);
@ -163,7 +167,8 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
chmask = avio_rl24(pb); chmask = avio_rl24(pb);
break; break;
default: default:
av_log(ctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size); av_log(ctx, AV_LOG_ERROR,
"Invalid channel info size %d\n", size);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
break; break;
@ -177,26 +182,37 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
avio_skip(pb, 1); avio_skip(pb, 1);
} }
if (rate == -1) { if (rate == -1) {
av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n"); av_log(ctx, AV_LOG_ERROR,
"Cannot determine custom sampling rate\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
avio_seek(pb, block_end - wc->blksize + 24, SEEK_SET); avio_seek(pb, block_end - wc->blksize + 24, SEEK_SET);
} }
if(!wc->bpp) wc->bpp = bpp; if (!wc->bpp)
if(!wc->chan) wc->chan = chan; wc->bpp = bpp;
if(!wc->chmask) wc->chmask = chmask; if (!wc->chan)
if(!wc->rate) wc->rate = rate; wc->chan = chan;
if (!wc->chmask)
wc->chmask = chmask;
if (!wc->rate)
wc->rate = rate;
if (wc->flags && bpp != wc->bpp) { if (wc->flags && bpp != wc->bpp) {
av_log(ctx, AV_LOG_ERROR, "Bits per sample differ, this block: %i, header block: %i\n", bpp, wc->bpp); av_log(ctx, AV_LOG_ERROR,
"Bits per sample differ, this block: %i, header block: %i\n",
bpp, wc->bpp);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if (wc->flags && !wc->multichannel && chan != wc->chan) { if (wc->flags && !wc->multichannel && chan != wc->chan) {
av_log(ctx, AV_LOG_ERROR, "Channels differ, this block: %i, header block: %i\n", chan, wc->chan); av_log(ctx, AV_LOG_ERROR,
"Channels differ, this block: %i, header block: %i\n",
chan, wc->chan);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if (wc->flags && rate != -1 && rate != wc->rate) { if (wc->flags && rate != -1 && rate != wc->rate) {
av_log(ctx, AV_LOG_ERROR, "Sampling rate differ, this block: %i, header block: %i\n", rate, wc->rate); av_log(ctx, AV_LOG_ERROR,
"Sampling rate differ, this block: %i, header block: %i\n",
rate, wc->rate);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
wc->blksize = size - 24; wc->blksize = size - 24;
@ -245,8 +261,7 @@ static int wv_read_header(AVFormatContext *s)
return 0; return 0;
} }
static int wv_read_packet(AVFormatContext *s, static int wv_read_packet(AVFormatContext *s, AVPacket *pkt)
AVPacket *pkt)
{ {
WVContext *wc = s->priv_data; WVContext *wc = s->priv_data;
int ret; int ret;
@ -320,7 +335,8 @@ static int wv_read_packet(AVFormatContext *s,
pkt->pts = wc->soff; pkt->pts = wc->soff;
block_samples = AV_RN32(wc->extra); block_samples = AV_RN32(wc->extra);
if (block_samples > INT32_MAX) if (block_samples > INT32_MAX)
av_log(s, AV_LOG_WARNING, "Too many samples in block: %"PRIu32"\n", block_samples); av_log(s, AV_LOG_WARNING,
"Too many samples in block: %"PRIu32"\n", block_samples);
else else
pkt->duration = block_samples; pkt->duration = block_samples;
@ -328,7 +344,8 @@ static int wv_read_packet(AVFormatContext *s,
return 0; return 0;
} }
static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) static int wv_read_seek(AVFormatContext *s, int stream_index,
int64_t timestamp, int flags)
{ {
AVStream *st = s->streams[stream_index]; AVStream *st = s->streams[stream_index];
WVContext *wc = s->priv_data; WVContext *wc = s->priv_data;