1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-07-11 14:30:22 +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;
}
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;
uint32_t tag, ver;
@ -111,7 +112,8 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
size = wc->blksize;
}
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))
return 0;
// 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) {
int64_t block_end = avio_tell(pb) + wc->blksize - 24;
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;
}
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) {
case 0xD:
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;
}
chan = avio_r8(pb);
@ -163,7 +167,8 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
chmask = avio_rl24(pb);
break;
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;
}
break;
@ -177,26 +182,37 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
avio_skip(pb, 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;
}
avio_seek(pb, block_end - wc->blksize + 24, SEEK_SET);
}
if(!wc->bpp) wc->bpp = bpp;
if(!wc->chan) wc->chan = chan;
if(!wc->chmask) wc->chmask = chmask;
if(!wc->rate) wc->rate = rate;
if (!wc->bpp)
wc->bpp = bpp;
if (!wc->chan)
wc->chan = chan;
if (!wc->chmask)
wc->chmask = chmask;
if (!wc->rate)
wc->rate = rate;
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;
}
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;
}
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;
}
wc->blksize = size - 24;
@ -245,8 +261,7 @@ static int wv_read_header(AVFormatContext *s)
return 0;
}
static int wv_read_packet(AVFormatContext *s,
AVPacket *pkt)
static int wv_read_packet(AVFormatContext *s, AVPacket *pkt)
{
WVContext *wc = s->priv_data;
int ret;
@ -320,7 +335,8 @@ static int wv_read_packet(AVFormatContext *s,
pkt->pts = wc->soff;
block_samples = AV_RN32(wc->extra);
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
pkt->duration = block_samples;
@ -328,7 +344,8 @@ static int wv_read_packet(AVFormatContext *s,
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];
WVContext *wc = s->priv_data;