diff options
author | Diego Biurrun <diego@biurrun.de> | 2005-12-17 18:14:38 +0000 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2005-12-17 18:14:38 +0000 |
commit | 115329f16062074e11ccf3b89ead6176606c9696 (patch) | |
tree | e98aa993905a702688bf821737ab9a443969fc28 /libavformat/mov.c | |
parent | d76319b1ab716320f6e6a4d690b85fe4504ebd5b (diff) | |
download | ffmpeg-115329f16062074e11ccf3b89ead6176606c9696.tar.gz |
COSMETICS: Remove all trailing whitespace.
Originally committed as revision 4749 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 3df408457b..a2de0d3c75 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -18,7 +18,7 @@ */ #include <limits.h> - + #include "avformat.h" #include "avi.h" @@ -28,7 +28,7 @@ /* * First version by Francois Revol revol@free.fr - * Seek function by Gael Chardon gael.dev@4now.net + * Seek function by Gael Chardon gael.dev@4now.net * * Features and limitations: * - reads most of the QT files I have (at least the structure), @@ -242,9 +242,9 @@ typedef struct MOVStreamContext { long sample_to_chunk_sz; MOV_sample_to_chunk_tbl *sample_to_chunk; long sample_to_chunk_index; - int sample_to_time_index; - long sample_to_time_sample; - uint64_t sample_to_time_time; + int sample_to_time_index; + long sample_to_time_sample; + uint64_t sample_to_time_time; int sample_to_ctime_index; int sample_to_ctime_sample; long sample_size; @@ -381,10 +381,10 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) /* empty */; a.size -= 8; - + if(a.size < 0) break; - + // av_log(NULL, AV_LOG_DEBUG, " i=%ld\n", i); if (c->parse_table[i].type == 0) { /* skip leaf atoms data */ // url_seek(pb, atom.offset+atom.size, SEEK_SET); @@ -693,7 +693,7 @@ static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) if((uint64_t)atom.size > (1<<30)) return -1; - + // currently SVQ3 decoder expect full STSD header - so let's fake it // this should be fixed and just SMI header should be passed av_free(st->codec->extradata); @@ -716,7 +716,7 @@ static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) if((uint64_t)atom.size > (1<<30)) return -1; - + // pass all frma atom to codec, needed at least for QDM2 av_free(st->codec->extradata); st->codec->extradata_size = atom.size; @@ -763,10 +763,10 @@ static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ entries = get_be32(pb); - + if(entries >= UINT_MAX/sizeof(int64_t)) return -1; - + sc->chunk_count = entries; sc->chunk_offsets = (int64_t*) av_malloc(entries * sizeof(int64_t)); if (!sc->chunk_offsets) @@ -781,7 +781,7 @@ static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) } } else return -1; - + for(i=0; i<c->fc->nb_streams; i++){ MOVStreamContext *sc2 = (MOVStreamContext *)c->fc->streams[i]->priv_data; if(sc2 && sc2->chunk_offsets){ @@ -966,7 +966,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) color_greyscale = st->codec->bits_per_sample & 0x20; /* if the depth is 2, 4, or 8 bpp, file is palettized */ - if ((color_depth == 2) || (color_depth == 4) || + if ((color_depth == 2) || (color_depth == 4) || (color_depth == 8)) { if (color_greyscale) { @@ -1049,7 +1049,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) get_be16(pb);//Reserved_2 //AMRSpecificBox.(10 bytes) - + get_be32(pb); //size get_be32(pb); //type=='damr' get_be32(pb); //vendor @@ -1070,7 +1070,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) st->codec->channels=1; } st->codec->bits_per_sample=16; - st->codec->bit_rate=0; /*It is not possible to tell this before we have + st->codec->bit_rate=0; /*It is not possible to tell this before we have an audio frame and even then every frame can be different*/ } else if( st->codec->codec_tag == MKTAG( 'm', 'p', '4', 's' )) @@ -1099,7 +1099,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) get_be16(pb); c->mp4=1; - + if(mp4_version==1) { url_fskip(pb,16); @@ -1109,13 +1109,13 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) a.size=size-(16+20); a.offset=url_ftell(pb); - + mov_read_default(c, pb, a); /* Get correct sample rate from extradata */ if(st->codec->extradata_size) { const int samplerate_table[] = { - 96000, 88200, 64000, 48000, 44100, 32000, + 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, 0, 0, 0 }; @@ -1139,7 +1139,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) /* fetch the 36-byte extradata needed for alac decoding */ st->codec->extradata_size = 36; - st->codec->extradata = (uint8_t*) + st->codec->extradata = (uint8_t*) av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_buffer(pb, st->codec->extradata, st->codec->extradata_size); } @@ -1222,7 +1222,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) } } } - + if(st->codec->codec_type==CODEC_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1) { st->codec->sample_rate= sc->time_scale; } @@ -1242,10 +1242,10 @@ static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ entries = get_be32(pb); - + if(entries >= UINT_MAX / sizeof(MOV_sample_to_chunk_tbl)) return -1; - + #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries); #endif @@ -1276,10 +1276,10 @@ static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ entries = get_be32(pb); - + if(entries >= UINT_MAX / sizeof(long)) return -1; - + sc->keyframe_count = entries; #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "keyframe_count = %ld\n", sc->keyframe_count); @@ -1565,7 +1565,7 @@ static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) get_byte(pb); /* version */ get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ edit_count= c->streams[c->fc->nb_streams-1]->edit_count = get_be32(pb); /* entries */ - + for(i=0; i<edit_count; i++){ get_be32(pb); /* Track duration */ get_be32(pb); /* Media time */ @@ -1609,7 +1609,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG( 's', 'k', 'i', 'p' ), mov_read_leaf }, { MKTAG( 's', 'm', 'h', 'd' ), mov_read_leaf }, /* sound media info header */ { MKTAG( 'S', 'M', 'I', ' ' ), mov_read_smi }, /* Sorenson extension ??? */ -{ MKTAG( 'a', 'v', 'c', 'C' ), mov_read_avcC }, +{ MKTAG( 'a', 'v', 'c', 'C' ), mov_read_avcC }, { MKTAG( 's', 't', 'b', 'l' ), mov_read_default }, { MKTAG( 's', 't', 'c', 'o' ), mov_read_stco }, { MKTAG( 's', 't', 'd', 'p' ), mov_read_default }, @@ -1663,8 +1663,8 @@ static void mov_free_stream_context(MOVStreamContext *sc) av_freep(&sc->sample_to_chunk); av_freep(&sc->sample_sizes); av_freep(&sc->keyframes); - av_freep(&sc->stts_data); - av_freep(&sc->ctts_data); + av_freep(&sc->stts_data); + av_freep(&sc->ctts_data); av_freep(&sc); } } @@ -1901,11 +1901,11 @@ again: } #ifdef MOV_MINOLTA_FIX - //Make sure that size is according to sample_size (Needed by .mov files + //Make sure that size is according to sample_size (Needed by .mov files //created on a Minolta Dimage Xi where audio chunks contains waste data in the end) //Maybe we should really not only check sc->sample_size, but also sc->sample_sizes //but I have no such movies - if (sc->sample_size > 0) { + if (sc->sample_size > 0) { int foundsize=0; for(i=0; i<(sc->sample_to_chunk_sz); i++) { if( (sc->sample_to_chunk[i].first)<=(sc->next_chunk) ) @@ -1966,22 +1966,22 @@ readchunk: av_get_packet(&s->pb, pkt, size); pkt->stream_index = sc->ffindex; - + // If the keyframes table exists, mark any samples that are in the table as key frames. // If no table exists, treat very sample as a key frame. - if (sc->keyframes) { + if (sc->keyframes) { a = 0; b = sc->keyframe_count - 1; - + while (a < b) { m = (a + b + 1) >> 1; if (sc->keyframes[m] > sc->current_sample) { b = m - 1; } else { a = m; - } + } } - + if (sc->keyframes[a] == sc->current_sample) pkt->flags |= PKT_FLAG_KEY; } @@ -2000,19 +2000,19 @@ readchunk: #endif mov->next_chunk_offset = offset + size; - - /* find the corresponding dts */ - if (sc && sc->sample_to_time_index < sc->stts_count && pkt) { + + /* find the corresponding dts */ + if (sc && sc->sample_to_time_index < sc->stts_count && pkt) { unsigned int count; uint64_t dts, pts; unsigned int duration = sc->stts_data[sc->sample_to_time_index].duration; count = sc->stts_data[sc->sample_to_time_index].count; - if ((sc->sample_to_time_sample + count) < sc->current_sample) { - sc->sample_to_time_sample += count; - sc->sample_to_time_time += count*duration; - sc->sample_to_time_index ++; + if ((sc->sample_to_time_sample + count) < sc->current_sample) { + sc->sample_to_time_sample += count; + sc->sample_to_time_time += count*duration; + sc->sample_to_time_index ++; duration = sc->stts_data[sc->sample_to_time_index].duration; - } + } dts = sc->sample_to_time_time + (sc->current_sample-1 - sc->sample_to_time_sample) * (int64_t)duration; /* find the corresponding pts */ if (sc->sample_to_ctime_index < sc->ctts_count) { @@ -2063,9 +2063,9 @@ static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti int64_t sample_file_offset; int32_t first_chunk_sample; int32_t sample_to_chunk_idx; - int sample_to_time_index; - long sample_to_time_sample = 0; - uint64_t sample_to_time_time = 0; + int sample_to_time_index; + long sample_to_time_sample = 0; + uint64_t sample_to_time_time = 0; int mov_idx; // Find the corresponding mov stream @@ -2097,20 +2097,20 @@ static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti for (i = 0; i < sc->stts_count; i++) { count = sc->stts_data[i].count; duration = sc->stts_data[i].duration; -//av_log(s, AV_LOG_DEBUG, "> sample_time %lli \n", (long)sample_time); -//av_log(s, AV_LOG_DEBUG, "> count=%i duration=%i\n", count, duration); +//av_log(s, AV_LOG_DEBUG, "> sample_time %lli \n", (long)sample_time); +//av_log(s, AV_LOG_DEBUG, "> count=%i duration=%i\n", count, duration); if ((start_time + count*duration) > sample_time) { - sample_to_time_time = start_time; - sample_to_time_index = i; - sample_to_time_sample = sample; + sample_to_time_time = start_time; + sample_to_time_index = i; + sample_to_time_sample = sample; sample += (sample_time - start_time) / duration; break; } sample += count; start_time += count * duration; - } - sample_to_time_time = start_time; - sample_to_time_index = i; + } + sample_to_time_time = start_time; + sample_to_time_index = i; /* NOTE: despite what qt doc say, the dt value (Display Time in qt vocabulary) computed with the stts atom is a decoding time stamp (dts) not a presentation time stamp. And as usual dts != pts for stream with b frames */ @@ -2198,7 +2198,7 @@ static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti sc->next_chunk = chunk; // +1 -1 (zero based) sc->sample_to_chunk_index = sample_to_chunk_idx; - // Update other streams + // Update other streams for (i = 0; i<mov->total_streams; i++) { MOVStreamContext *msc; if (i == mov_idx) continue; @@ -2213,17 +2213,17 @@ static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti } else { a = m; } -#ifdef DEBUG +#ifdef DEBUG /* av_log(s, AV_LOG_DEBUG, "a=%i (%li) b=%i (%li) m=%i (%li) stream #%i\n" , a, (long)msc->chunk_offsets[a], b, (long)msc->chunk_offsets[b], m, (long)msc->chunk_offsets[m], i); */ -#endif +#endif } msc->next_chunk = a; if (msc->chunk_offsets[a] < chunk_file_offset && a < (msc->chunk_count-1)) msc->next_chunk ++; -#ifdef DEBUG +#ifdef DEBUG av_log(s, AV_LOG_DEBUG, "Nearest next chunk for stream #%i is #%i @%lli\n", i, msc->next_chunk+1, msc->chunk_offsets[msc->next_chunk]); -#endif +#endif // Compute sample count and index in the sample_to_chunk table (what a pity) msc->sample_to_chunk_index = 0; msc->current_sample = 0; @@ -2234,19 +2234,19 @@ static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti } msc->current_sample += (msc->next_chunk - (msc->sample_to_chunk[msc->sample_to_chunk_index].first - 1)) * sc->sample_to_chunk[msc->sample_to_chunk_index].count; msc->left_in_chunk = msc->sample_to_chunk[msc->sample_to_chunk_index].count - 1; - // Find corresponding position in stts (used later to compute dts) - sample = 0; - start_time = 0; - for (msc->sample_to_time_index = 0; msc->sample_to_time_index < msc->stts_count; msc->sample_to_time_index++) { + // Find corresponding position in stts (used later to compute dts) + sample = 0; + start_time = 0; + for (msc->sample_to_time_index = 0; msc->sample_to_time_index < msc->stts_count; msc->sample_to_time_index++) { count = msc->stts_data[msc->sample_to_time_index].count; duration = msc->stts_data[msc->sample_to_time_index].duration; - if ((sample + count - 1) > msc->current_sample) { - msc->sample_to_time_time = start_time; - msc->sample_to_time_sample = sample; - break; - } - sample += count; - start_time += count * duration; + if ((sample + count - 1) > msc->current_sample) { + msc->sample_to_time_time = start_time; + msc->sample_to_time_sample = sample; + break; + } + sample += count; + start_time += count * duration; } sample = 0; for (msc->sample_to_ctime_index = 0; msc->sample_to_ctime_index < msc->ctts_count; msc->sample_to_ctime_index++) { @@ -2257,11 +2257,11 @@ static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti break; } sample += count; - } -#ifdef DEBUG + } +#ifdef DEBUG av_log(s, AV_LOG_DEBUG, "Next Sample for stream #%i is #%i @%i\n", i, msc->current_sample + 1, msc->sample_to_chunk_index + 1); -#endif - } +#endif + } return 0; } #endif @@ -2289,7 +2289,7 @@ static AVInputFormat mov_iformat = { mov_read_close, #if defined(MOV_SPLIT_CHUNKS) && defined(MOV_SEEK) mov_read_seek, -#endif +#endif }; int mov_init(void) |