Skip to content

Commit

Permalink
[editor] switch all audio tracks if possible
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.berlios.de/avidemux/branches/avidemux_2.6_branch_mean@7641 30592fff-cfd4-0310-bf0e-8235a3c7be26
  • Loading branch information
mean committed Nov 1, 2011
1 parent 14b4378 commit 5601778
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions avidemux/common/ADM_editor/ADM_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,26 +515,25 @@ double duration;
WAVHeader *wav;
aviInfo info;
uint32_t ref;


if(false==_segments.getRefFromTime(xtime,&ref))
{
ADM_warning("[Editor::changeAudioStream] Cannot get ref video for time %"LLD" ms\n",xtime/1000);
return 0;
}
_VIDEOS *v=_segments.getRefVideo(ref);
ADM_assert(v);
uint32_t nb=v->audioTracks.size();
if(newstream>=nb)
int n=_segments.getNbRefVideos();
packetBufferSize=0; // Flush PCM decoder
for(int i=0;i<n;i++)
{
ADM_warning("[Editor::changeAudioStream] New stream exceeds # of stream (%d/%d)\n",(int)newstream,(int)nb);
return false;
_VIDEOS *v=_segments.getRefVideo(i);
uint32_t nb=v->audioTracks.size();
if(newstream>=nb)
{
ADM_warning("[Editor::changeAudioStream] New stream exceeds # of stream (%d/%d)\n",(int)newstream,(int)nb);
continue;
}
v->currentAudioStream=newstream;
if(!i) // update general info for track 0
{
wavHeader.frequency=v->audioTracks[newstream]->wavheader.frequency;
wavHeader.channels=v->audioTracks[newstream]->wavheader.channels;
}
ADM_info("Switched to track %d for video %d\n",newstream,i);
}
v->currentAudioStream=newstream;
// Change our header also
wavHeader.frequency=v->audioTracks[newstream]->wavheader.frequency;
wavHeader.channels=v->audioTracks[newstream]->wavheader.channels;
//ADM_warning("New fq=%d\n",(int)wavHeader.frequency);
return true;
}

Expand Down

0 comments on commit 5601778

Please sign in to comment.