comparison mplayer.c @ 26720:d68c3cd43cd4

Change subtitle selection order by giving "indirect" ways of specifying the desired subtitle track the least priority. Selection of displayed subtitles by language (-slang) and default track attribute is only performed if all other ways have failed. They are not directly controllable by the user (especially default tracks), therefore they should not override -sub, -vobsub and even auto-subs. Based on a patch by Sergey Malkovsky (mplayer.win32_gmail_com).
author eugeni
date Mon, 12 May 2008 20:40:39 +0000
parents 4cf30c0ca561
children ea0f7d488ed9
comparison
equal deleted inserted replaced
26719:3abd1629658b 26720:d68c3cd43cd4
3462 } 3462 }
3463 3463
3464 if (mpctx->global_sub_size) { 3464 if (mpctx->global_sub_size) {
3465 // find the best sub to use 3465 // find the best sub to use
3466 int vobsub_index_id = vobsub_get_index_by_id(vo_vobsub, vobsub_id); 3466 int vobsub_index_id = vobsub_get_index_by_id(vo_vobsub, vobsub_id);
3467 if (dvdsub_id < 0 && dvdsub_lang) 3467 mpctx->global_sub_pos = -1; // no subs by default
3468 dvdsub_id = demuxer_sub_track_by_lang(mpctx->demuxer, dvdsub_lang);
3469 if (dvdsub_id < 0)
3470 dvdsub_id = demuxer_default_sub_track(mpctx->demuxer);
3471 if (vobsub_index_id >= 0) { 3468 if (vobsub_index_id >= 0) {
3472 // if user asks for a vobsub id, use that first. 3469 // if user asks for a vobsub id, use that first.
3473 mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_VOBSUB] + vobsub_index_id; 3470 mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_VOBSUB] + vobsub_index_id;
3474 } else if (dvdsub_id >= 0 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) { 3471 } else if (dvdsub_id >= 0 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) {
3475 // if user asks for a dvd sub id, use that next. 3472 // if user asks for a dvd sub id, use that next.
3476 mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id; 3473 mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id;
3477 } else if (mpctx->global_sub_indices[SUB_SOURCE_SUBS] >= 0) { 3474 } else if (mpctx->global_sub_indices[SUB_SOURCE_SUBS] >= 0) {
3478 // if there are text subs to use, use those. (autosubs come last here) 3475 // if there are text subs to use, use those. (autosubs come last here)
3479 mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_SUBS]; 3476 mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_SUBS];
3477 } else if (dvdsub_id < 0 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) {
3478 // finally select subs by language and container hints
3479 if (dvdsub_id < 0 && dvdsub_lang)
3480 dvdsub_id = demuxer_sub_track_by_lang(mpctx->demuxer, dvdsub_lang);
3481 if (dvdsub_id < 0)
3482 dvdsub_id = demuxer_default_sub_track(mpctx->demuxer);
3483 if (dvdsub_id >= 0)
3484 mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id;
3480 /* 3485 /*
3481 } else if (mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) { 3486 } else if (mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) {
3482 // if nothing else works, get subs from the demuxer. 3487 // if nothing else works, get subs from the demuxer.
3483 mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX]; 3488 mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX];
3484 */ 3489 */
3485 } else {
3486 // nothing worth doing automatically.
3487 mpctx->global_sub_pos = -1;
3488 } 3490 }
3489 // rather than duplicate code, use the SUB_SELECT handler to init the right one. 3491 // rather than duplicate code, use the SUB_SELECT handler to init the right one.
3490 mpctx->global_sub_pos--; 3492 mpctx->global_sub_pos--;
3491 mp_property_do("sub",M_PROPERTY_STEP_UP,NULL, mpctx); 3493 mp_property_do("sub",M_PROPERTY_STEP_UP,NULL, mpctx);
3492 if(subdata) 3494 if(subdata)