aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/jvdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-05 01:18:48 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-05 01:18:48 +0100
commitdcbc748ad11b7a683c54b4afc350f734adcded4e (patch)
tree9386abe2d1139c16a1f54c691ffaebc18a46475a /libavformat/jvdec.c
parent20be510887d0985c370957371025d5d7f721bb79 (diff)
parentd509ae5be0a9bac35a4cedbe68b774a74446bb27 (diff)
downloadffmpeg-dcbc748ad11b7a683c54b4afc350f734adcded4e.tar.gz
Merge commit 'd509ae5be0a9bac35a4cedbe68b774a74446bb27'
* commit 'd509ae5be0a9bac35a4cedbe68b774a74446bb27': jvdec: K&R formatting cosmetics Conflicts: libavcodec/jvdec.c libavformat/jvdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/jvdec.c')
-rw-r--r--libavformat/jvdec.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 27ec7ad317..e8d44b0fd8 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -27,6 +27,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
+
#include "avformat.h"
#include "internal.h"
@@ -96,17 +97,18 @@ static int read_header(AVFormatContext *s)
avio_skip(pb, 4);
- ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
- ast->codec->codec_tag = 0; /* no fourcc */
- ast->codec->sample_rate = avio_rl16(pb);
- ast->codec->channels = 1;
+ ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
+ ast->codec->codec_tag = 0; /* no fourcc */
+ ast->codec->sample_rate = avio_rl16(pb);
+ ast->codec->channels = 1;
ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
avio_skip(pb, 10);
- ast->index_entries = av_malloc(ast->nb_index_entries * sizeof(*ast->index_entries));
+ ast->index_entries = av_malloc(ast->nb_index_entries *
+ sizeof(*ast->index_entries));
if (!ast->index_entries)
return AVERROR(ENOMEM);
@@ -115,18 +117,18 @@ static int read_header(AVFormatContext *s)
return AVERROR(ENOMEM);
offset = 0x68 + ast->nb_index_entries * 16;
- for(i = 0; i < ast->nb_index_entries; i++) {
+ for (i = 0; i < ast->nb_index_entries; i++) {
AVIndexEntry *e = ast->index_entries + i;
JVFrame *jvf = jv->frames + i;
/* total frame size including audio, video, palette data and padding */
- e->size = avio_rl32(pb);
- e->timestamp = i;
- e->pos = offset;
- offset += e->size;
+ e->size = avio_rl32(pb);
+ e->timestamp = i;
+ e->pos = offset;
+ offset += e->size;
- jvf->audio_size = avio_rl32(pb);
- jvf->video_size = avio_rl32(pb);
+ jvf->audio_size = avio_rl32(pb);
+ jvf->video_size = avio_rl32(pb);
jvf->palette_size = avio_r8(pb) ? 768 : 0;
if ((jvf->video_size | jvf->audio_size) & ~0xFFFFFF ||
@@ -137,19 +139,19 @@ static int read_header(AVFormatContext *s)
read_close(s);
return AVERROR_INVALIDDATA;
}
- jvf->audio_size =
- jvf->video_size =
+ jvf->audio_size =
+ jvf->video_size =
jvf->palette_size = 0;
}
if (avio_r8(pb))
- av_log(s, AV_LOG_WARNING, "unsupported audio codec\n");
+ av_log(s, AV_LOG_WARNING, "unsupported audio codec\n");
jvf->video_type = avio_r8(pb);
avio_skip(pb, 1);
e->timestamp = jvf->audio_size ? audio_pts : AV_NOPTS_VALUE;
- audio_pts += jvf->audio_size;
+ audio_pts += jvf->audio_size;
e->flags = jvf->video_type != 1 ? AVINDEX_KEYFRAME : 0;
}
@@ -168,10 +170,10 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
const AVIndexEntry *e = ast->index_entries + jv->pts;
const JVFrame *jvf = jv->frames + jv->pts;
- switch(jv->state) {
+ switch (jv->state) {
case JV_AUDIO:
jv->state++;
- if (jvf->audio_size ) {
+ if (jvf->audio_size) {
if (av_get_packet(s->pb, pkt, jvf->audio_size) < 0)
return AVERROR(ENOMEM);
pkt->stream_index = 0;
@@ -187,7 +189,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(ENOMEM);
AV_WL32(pkt->data, jvf->video_size);
- pkt->data[4] = jvf->video_type;
+ pkt->data[4] = jvf->video_type;
if ((size = avio_read(pb, pkt->data + JV_PREAMBLE_SIZE, size)) < 0)
return AVERROR(EIO);
memset(pkt->data + JV_PREAMBLE_SIZE + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
@@ -220,10 +222,10 @@ static int read_seek(AVFormatContext *s, int stream_index,
AVStream *ast = s->streams[0];
int i;
- if (flags & (AVSEEK_FLAG_BYTE|AVSEEK_FLAG_FRAME))
+ if (flags & (AVSEEK_FLAG_BYTE | AVSEEK_FLAG_FRAME))
return AVERROR(ENOSYS);
- switch(stream_index) {
+ switch (stream_index) {
case 0:
i = av_index_search_timestamp(ast, ts, flags);
break;