From: Andre Noll Date: Mon, 9 Aug 2021 16:22:35 +0000 (+0200) Subject: mp4: Remove some dead code. X-Git-Tag: v0.7.1~7^2~135 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=4348eab9a04464214d5bc83f4656b7076d447f32;p=paraslash.git mp4: Remove some dead code. Commented out code, pointless preprocessor directives and a condition with empty body. --- diff --git a/mp4.c b/mp4.c index 9368a790..bb5409e6 100644 --- a/mp4.c +++ b/mp4.c @@ -8,7 +8,6 @@ #include "para.h" #include "mp4.h" -#define USE_TAGGING int32_t mp4ff_total_tracks(const mp4ff_t * f) { return f->total_tracks; @@ -40,8 +39,6 @@ static int32_t mp4ff_atom_get_size(const int8_t * data) d = (uint8_t) data[3]; result = (a << 24) | (b << 16) | (c << 8) | d; - //if (result > 0 && result < 8) result = 8; - return (int32_t) result; } @@ -343,8 +340,6 @@ static uint64_t mp4ff_atom_read_header(mp4ff_t * f, uint8_t * atom_type, *header_size = 16; size = mp4ff_read_int64(f); } - //printf("%c%c%c%c\n", atom_header[4], atom_header[5], atom_header[6], atom_header[7]); - *atom_type = mp4ff_atom_name_to_type(atom_header[4], atom_header[5], atom_header[6], atom_header[7]); return size; @@ -359,19 +354,14 @@ static int need_parse_when_meta_only(uint8_t atom_type) { switch (atom_type) { case ATOM_EDTS: -// case ATOM_MDIA: -// case ATOM_MINF: case ATOM_DRMS: case ATOM_SINF: case ATOM_SCHI: -// case ATOM_STBL: -// case ATOM_STSD: case ATOM_STTS: case ATOM_STSZ: case ATOM_STZ2: case ATOM_STCO: case ATOM_STSC: -// case ATOM_CTTS: case ATOM_FRMA: case ATOM_IVIV: case ATOM_PRIV: @@ -1079,8 +1069,6 @@ static int32_t mp4ff_parse_tag(mp4ff_t * f, const uint8_t parent_atom_type, done = 1; } } else if (parent_atom_type == ATOM_TRACK || parent_atom_type == ATOM_DISC) { - /* if (!done && subsize - header_size >= 8 + 8) */ - /* modified by AJS */ if (!done && (subsize - header_size) >= (sizeof (char) + sizeof (uint8_t) * 3 + sizeof (uint32_t) + /* version + flags + reserved */ +(parent_atom_type == ATOM_TRACK ? sizeof (uint16_t) : 0) /* leading uint16_t if ATOM_TRACK */ +sizeof (uint16_t) /* track / disc */ @@ -1240,11 +1228,9 @@ static int32_t mp4ff_atom_read(mp4ff_t * f, const int32_t size, } else if (atom_type == ATOM_MDHD) { /* track header */ mp4ff_read_mdhd(f); -#ifdef USE_TAGGING } else if (atom_type == ATOM_META) { /* iTunes Metadata box */ mp4ff_read_meta(f, size); -#endif } mp4ff_set_position(f, dest_position); @@ -1302,12 +1288,6 @@ static int32_t parse_atoms(mp4ff_t * f, int meta_only) f->file_size += size; f->last_atom = atom_type; - if (atom_type == ATOM_MDAT && f->moov_read) { - /* moov atom is before mdat, we can stop reading when mdat is encountered */ - /* file position will stay at beginning of mdat data */ -// break; - } - if (atom_type == ATOM_MOOV && size > header_size) { f->moov_read = 1; f->moov_offset = mp4ff_position(f) - header_size; @@ -1417,17 +1397,11 @@ void mp4ff_close(mp4ff_t * ff) free(ff->track[i]->ctts_sample_count); if (ff->track[i]->ctts_sample_offset) free(ff->track[i]->ctts_sample_offset); -#ifdef ITUNES_DRM - if (ff->track[i]->p_drms) - drms_free(ff->track[i]->p_drms); -#endif free(ff->track[i]); } } -#ifdef USE_TAGGING mp4ff_tag_delete(&(ff->tags)); -#endif if (ff) free(ff); @@ -1819,13 +1793,8 @@ static stdmeta_entry stdmetas[] = { {"\xA9" "day", "date"}, {"\xA9" "too", "tool"}, {"\xA9" "cmt", "comment"}, -// {"\xA9" "gen","genre"}, {"cpil", "compilation"}, -// {"trkn","track"}, -// {"disk","disc"}, -// {"gnre","genre"}, {"covr", "cover"}, - /* added by AJS */ {"aART", "album_artist"}, }; @@ -1842,7 +1811,6 @@ static const char *find_standard_meta(const char *name) //returns atom name if f static void membuffer_write_std_tag(membuffer * buf, const char *name, const char *value) { - /* added by AJS */ uint32_t flags = 1; /* special check for compilation flag */