35 #include <mp4v2/mp4v2.h>
36 #ifdef HAVE_SYS_STAT_H
50 const char *
const ext = strrchr(filename,
'.');
51 if(ext && (!strncasecmp(ext,
".m4a", 4) ||
52 !strncasecmp(ext,
".mp4", 4) ||
53 !strncasecmp(ext,
".aac", 4)) )
75 const char *
const filename)
81 MP4FileHandle mp4file;
83 const char *trackType;
89 #ifdef MP4_DETAILS_ALL
90 mp4file = MP4Read(filename, 0);
92 mp4file = MP4Read(filename);
94 if (mp4file == MP4_INVALID_FILE_HANDLE)
100 trackID = MP4FindTrackId(mp4file, 0, NULL, 0);
101 trackType = MP4GetTrackType(mp4file, trackID);
103 if (!strcmp(trackType, MP4_AUDIO_TRACK_TYPE)) {
105 const MP4Tags *mp4tags = MP4TagsAlloc();
108 MP4TagsFetch(mp4tags, mp4file);
112 MP4TagsFree(mp4tags);
119 fstat(fileno(in), &filestat);
120 p->
size = filestat.st_size;
121 p->
mtime = filestat.st_mtime;
128 unsigned short timeScale = MP4GetTrackTimeScale(mp4file, trackID);
129 MP4Duration trackDuration = MP4GetTrackDuration(mp4file, trackID);
130 unsigned long msDuration = MP4ConvertFromTrackDuration(mp4file, trackID,
131 trackDuration, MP4_MSECS_TIME_SCALE) / 1000;
132 unsigned long avgBitRate = ( MP4GetTrackBitRate(mp4file, trackID) + 500 ) / 1000;
148 if (mp4tags->releaseDate)
149 p->
date = atoi(mp4tags->releaseDate);
155 p->
track = mp4tags->track->index;
158 p->
posn = mp4tags->disk->index;
160 MP4TagsFree(mp4tags);
164 #ifdef MP4_CLOSE_DO_NOT_COMPUTE_BITRATE
165 MP4Close(mp4file, 0);