Mercurial > mplayer.hg
comparison command.c @ 25251:80804f0631f4
Skip empty vobsub streams when selecting subtitles.
author | ulion |
---|---|
date | Mon, 03 Dec 2007 04:08:36 +0000 |
parents | 5a4fad628819 |
children | fa776bd7ebc4 |
comparison
equal
deleted
inserted
replaced
25250:9fd84c723f76 | 25251:80804f0631f4 |
---|---|
1307 #ifdef USE_ASS | 1307 #ifdef USE_ASS |
1308 ass_track = 0; | 1308 ass_track = 0; |
1309 #endif | 1309 #endif |
1310 | 1310 |
1311 if (source == SUB_SOURCE_VOBSUB) { | 1311 if (source == SUB_SOURCE_VOBSUB) { |
1312 vobsub_id = | 1312 vobsub_id = vobsub_get_id_by_index(vo_vobsub, mpctx->global_sub_pos - mpctx->global_sub_indices[SUB_SOURCE_VOBSUB]); |
1313 mpctx->global_sub_pos - | |
1314 mpctx->global_sub_indices[SUB_SOURCE_VOBSUB]; | |
1315 } else if (source == SUB_SOURCE_SUBS) { | 1313 } else if (source == SUB_SOURCE_SUBS) { |
1316 mpctx->set_of_sub_pos = | 1314 mpctx->set_of_sub_pos = |
1317 mpctx->global_sub_pos - mpctx->global_sub_indices[SUB_SOURCE_SUBS]; | 1315 mpctx->global_sub_pos - mpctx->global_sub_indices[SUB_SOURCE_SUBS]; |
1318 #ifdef USE_ASS | 1316 #ifdef USE_ASS |
1319 if (ass_enabled && mpctx->set_of_ass_tracks[mpctx->set_of_sub_pos]) | 1317 if (ass_enabled && mpctx->set_of_ass_tracks[mpctx->set_of_sub_pos]) |
1470 is_cur_source = sub_source(mpctx) == source; | 1468 is_cur_source = sub_source(mpctx) == source; |
1471 switch (action) { | 1469 switch (action) { |
1472 case M_PROPERTY_GET: | 1470 case M_PROPERTY_GET: |
1473 if (!arg) | 1471 if (!arg) |
1474 return M_PROPERTY_ERROR; | 1472 return M_PROPERTY_ERROR; |
1475 *(int *) arg = (is_cur_source) ? mpctx->global_sub_pos - offset : -1; | 1473 if (is_cur_source) { |
1474 *(int *) arg = mpctx->global_sub_pos - offset; | |
1475 if (source == SUB_SOURCE_VOBSUB) | |
1476 *(int *) arg = vobsub_get_id_by_index(vo_vobsub, *(int *) arg); | |
1477 } | |
1478 else | |
1479 *(int *) arg = -1; | |
1476 return M_PROPERTY_OK; | 1480 return M_PROPERTY_OK; |
1477 case M_PROPERTY_PRINT: | 1481 case M_PROPERTY_PRINT: |
1478 if (!arg) | 1482 if (!arg) |
1479 return M_PROPERTY_ERROR; | 1483 return M_PROPERTY_ERROR; |
1480 if (is_cur_source) | 1484 if (is_cur_source) |
1485 return M_PROPERTY_OK; | 1489 return M_PROPERTY_OK; |
1486 case M_PROPERTY_SET: | 1490 case M_PROPERTY_SET: |
1487 if (!arg) | 1491 if (!arg) |
1488 return M_PROPERTY_ERROR; | 1492 return M_PROPERTY_ERROR; |
1489 if (*(int *) arg >= 0) { | 1493 if (*(int *) arg >= 0) { |
1490 mpctx->global_sub_pos = offset + *(int *) arg; | 1494 int index = *(int *)arg; |
1491 if (mpctx->global_sub_pos >= mpctx->global_sub_size | 1495 if (source == SUB_SOURCE_VOBSUB) |
1496 index = vobsub_get_index_by_id(vo_vobsub, index); | |
1497 mpctx->global_sub_pos = offset + index; | |
1498 if (index < 0 || mpctx->global_sub_pos >= mpctx->global_sub_size | |
1492 || sub_source(mpctx) != source) { | 1499 || sub_source(mpctx) != source) { |
1493 mpctx->global_sub_pos = -1; | 1500 mpctx->global_sub_pos = -1; |
1494 *(int *) arg = -1; | 1501 *(int *) arg = -1; |
1495 } | 1502 } |
1496 } | 1503 } |