Page 1 of 1

How to set active track of MPEG-4 file

Posted: 12 Jun 2009 02:36
by MyKey_
Hi there,

how can I set the active track of an MPEG-4 audio file?
I want to accomplish the same thing as changing the "Audio Track" in the menu.

[EDIT: To be more specific, I am programming on a plugin that allows to select a specific track through a parameter when opening a MPEG-4 audio file. The additional parameter itself was rather straight foreward, but I can't find out how to actually play a track. VLC automatically selects the first track and I can only change it manually through the menu.]

Thanks in advance!

Re: How to set active track of MPEG-4 file

Posted: 12 Jun 2009 15:21
by MyKey_
Hi, it's me again!

I finally got it to work:

When creating a structure for a MPEG-4 track in modules/demux/mp4/mp4.c in method MP4_TrackCreate, the field p_track->b_enable has to be adjusted.
When it is set for the first time

Code: Select all

p_track->b_enable = ( ( p_tkhd->data.p_tkhd->i_flags&MP4_TRACK_ENABLED ) != 0 );
I can as well choose to disable all other tracks:

Code: Select all

p_track->b_enable = ( ( p_tkhd->data.p_tkhd->i_flags&MP4_TRACK_ENABLED ) != 0 ) && b_is_my_selected_track;
It works but keeps the other tracks in the "Audio Track" sub menu.
On second thought, I may prevent all other tracks from being created if I only call MP4_TrackCreate for the one track I want.

I'll let you know if it works.