[MPlayer-dev-eng] DVDNAV Next Issues

Benjamin Zores ben at geexbox.org
Sun Jan 27 11:54:10 CET 2008


Nico Sabbi a écrit :
> Il Sunday 27 January 2008 00:37:45 Ötvös Attila ha scritto:
>> Ezzel a dátummal: Saturday 26 January 2008 21.37.53 Benjamin Zores ezt írta:
>> Hi Benjamin Zores!

>> Index: mplayer.c
>> ===================================================================
>> --- mplayer.c   (revision 25852)
>> +++ mplayer.c   (working copy)
>> @@ -1909,6 +1909,47 @@
>>      if (decoded_frame && mpctx->nav_smpi != decoded_frame)
>>          mpctx->nav_smpi = mp_dvdnav_copy_mpi(mpctx->nav_smpi,decoded_frame);
>>  }
>> +
>> +/// Switch audio stream of DVDNAV
>> +static int mp_dvdnav_switch_audio(void) {
>> +    int new_aid=mp_dvdnav_get_current_audio(mpctx->stream);
>> +    int old_aid=mpctx->demuxer->audio->id;
>> +    int aid;
>> +
>> +    if (new_aid<0) {
>> +        demuxer_switch_audio(mpctx->demuxer, new_aid);
>> +        return 1;
>> +    }
>> +    if (new_aid==old_aid)
>> +        return 1;
>> +    aid = demuxer_switch_audio(mpctx->demuxer, new_aid);
>> +    if (aid!=new_aid)
>> +        return 0;
>> +    if (mpctx->demuxer->audio->id==-2) {
>> +        mpctx->demuxer->audio->id=-1;
>> +        return 1;
>> +    }
>> +    if (old_aid & 0x0F == new_aid & 0x0F)  // codec unchanged
>> +        return 1;
>> +    if (new_aid == -2 || (new_aid > -1 && old_aid != -2 &&
>> +                         mpctx->demuxer->audio->id != old_aid)) {
>> +        uninit_player(INITED_AO | INITED_ACODEC);
>> +        if (audio_id > -1 && mpctx->demuxer->audio->id != old_aid) {
>> +            sh_audio_t *sh2;
>> +            sh2 = mpctx->demuxer->a_streams[mpctx->demuxer->audio->id];
>> +            if (sh2) {
>> +                sh2->ds = mpctx->demuxer->audio;
>> +                mpctx->sh_audio = sh2;
>> +                reinit_audio_chain();
>> +            }
>> +        }
>> +    }
>> +    if (mpctx->demuxer->audio->id==-2)
>> +        mpctx->demuxer->audio->id=-1;
>> +    mp_dvdnav_is_audio_change(mpctx->stream,1);
>> +    return 1;
>> +}
>> +
>>  #endif /* USE_DVDNAV */
> 
> 
> this code shouldn't be anymore needed after Ben's last commit

I don't remember having commited anything like that but this piece of 
code is the exact copy of what switch_audio command property does.
Call the function instead of duplicating it.

Ben



More information about the MPlayer-dev-eng mailing list