Skip to content

Commit

Permalink
Write out samplerate instead of timescale
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio Arnold committed Dec 8, 2022
1 parent 03b76d9 commit 0939219
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion minimp4.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ typedef struct
{
// number of channels in the audio track.
unsigned channelcount;
unsigned samplerate_hz;
} a;

struct
Expand Down Expand Up @@ -1446,7 +1447,7 @@ static int mp4e_flush_index(MP4E_mux_t *mux)
WRITE_2(tr->info.u.a.channelcount); // channelcount
WRITE_2(16); // samplesize
WRITE_4(0); // pre_defined+reserved
WRITE_4((tr->info.time_scale << 16)); // samplerate == = {timescale of media}<<16;
WRITE_4((tr->info.u.a.samplerate_hz << 16)); // samplerate
}

ATOM_FULL(BOX_esds, 0);
Expand Down
1 change: 1 addition & 0 deletions minimp4_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ int main(int argc, char **argv)
tr.time_scale = 90000;
tr.default_duration = 0;
tr.u.a.channelcount = 1;
tr.u.a.samplerate_hz = AUDIO_RATE;
int audio_track_id = MP4E_add_track(mux, &tr);
MP4E_set_dsi(mux, audio_track_id, info.confBuf, info.confSize);
#endif
Expand Down

0 comments on commit 0939219

Please sign in to comment.