Mercurial > mplayer.hg
comparison command.c @ 23510:a6c619ee9d30
Teletext support for tv:// (v4l and v4l2 only)
modified patch from Otvos Attila oattila at chello dot hu
Module uses zvbi library for all low-level VBI operations (like I/O with vbi
device, converting vbi pages into usefull vbi_page stuctures, rendering them
into RGB32 images).
All teletext related stuff (except properties, slave commands and rendering
osd in text mode or RGB32 rendered teletext pages in spu mode) is implemented
in tvi_vbi.c
New properties:
teletext_page - switching between pages
teletext_mode - switch between on/off/opaque/transparent modes
teletext_format - (currently read-only) allows to get format info
(black/white,gray,text)
teletext_half_page - trivial zooming (displaying top/bottom half of teletext
page)
New slave commands:
teletext_add_dec - user interface for jumping to any page by editing page number
interactively
teletext_go_link - goes though links, specified on current page
author | voroshil |
---|---|
date | Sun, 10 Jun 2007 00:06:12 +0000 |
parents | f6055798121d |
children | ac72a4e46c45 |
comparison
equal
deleted
inserted
replaced
23509:53d57a0ebe13 | 23510:a6c619ee9d30 |
---|---|
1412 } | 1412 } |
1413 return M_PROPERTY_NOT_IMPLEMENTED; | 1413 return M_PROPERTY_NOT_IMPLEMENTED; |
1414 } | 1414 } |
1415 | 1415 |
1416 #endif | 1416 #endif |
1417 | |
1418 #ifdef HAVE_TV_TELETEXT | |
1419 /// teletext page (RW) | |
1420 static int mp_property_teletext_page(m_option_t * prop, int action, void *arg, | |
1421 MPContext * mpctx) | |
1422 { | |
1423 int val,result; | |
1424 tvi_handle_t *tvh = mpctx->demuxer->priv; | |
1425 if (mpctx->demuxer->type != DEMUXER_TYPE_TV || !tvh || !tvh->priv_vbi) | |
1426 return M_PROPERTY_UNAVAILABLE; | |
1427 | |
1428 switch (action) { | |
1429 case M_PROPERTY_SET: | |
1430 if (!arg) | |
1431 return M_PROPERTY_ERROR; | |
1432 M_PROPERTY_CLAMP(prop, *(int *) arg); | |
1433 result=tv_teletext_control(tvh, TVI_CONTROL_VBI_SET_PAGE, arg); | |
1434 break; | |
1435 case M_PROPERTY_GET: | |
1436 if (!arg) | |
1437 return M_PROPERTY_ERROR; | |
1438 result=tv_teletext_control(tvh, TVI_CONTROL_VBI_GET_PAGE, arg); | |
1439 break; | |
1440 case M_PROPERTY_STEP_UP: | |
1441 case M_PROPERTY_STEP_DOWN: | |
1442 val = (arg ? *(int *) arg : 1) * (action == M_PROPERTY_STEP_DOWN ? -1 : 1); | |
1443 result=tv_teletext_control(tvh, TVI_CONTROL_VBI_STEP_PAGE, &val); | |
1444 break; | |
1445 default: | |
1446 return M_PROPERTY_NOT_IMPLEMENTED; | |
1447 } | |
1448 return (result==TVI_CONTROL_TRUE?M_PROPERTY_OK:M_PROPERTY_ERROR); | |
1449 } | |
1450 /// VBI teletext mode (RW) | |
1451 static int mp_property_teletext_mode(m_option_t * prop, int action, void *arg, | |
1452 MPContext * mpctx) | |
1453 { | |
1454 int val,result; | |
1455 tvi_handle_t *tvh = mpctx->demuxer->priv; | |
1456 if (mpctx->demuxer->type != DEMUXER_TYPE_TV || !tvh || !tvh->priv_vbi) | |
1457 return M_PROPERTY_UNAVAILABLE; | |
1458 | |
1459 switch (action) { | |
1460 case M_PROPERTY_SET: | |
1461 if (!arg) | |
1462 return M_PROPERTY_ERROR; | |
1463 M_PROPERTY_CLAMP(prop, *(int *) arg); | |
1464 result=tv_teletext_control(tvh, TVI_CONTROL_VBI_SET_MODE, arg); | |
1465 break; | |
1466 case M_PROPERTY_GET: | |
1467 if (!arg) | |
1468 return M_PROPERTY_ERROR; | |
1469 result=tv_teletext_control(tvh, TVI_CONTROL_VBI_GET_MODE, arg); | |
1470 break; | |
1471 case M_PROPERTY_STEP_UP: | |
1472 case M_PROPERTY_STEP_DOWN: | |
1473 val = (arg ? *(int *) arg : 1) * (action == M_PROPERTY_STEP_DOWN ? -1 : 1); | |
1474 result=tv_teletext_control(tvh, TVI_CONTROL_VBI_STEP_MODE, &val); | |
1475 break; | |
1476 default: | |
1477 return M_PROPERTY_NOT_IMPLEMENTED; | |
1478 } | |
1479 return (result==TVI_CONTROL_TRUE?M_PROPERTY_OK:M_PROPERTY_ERROR); | |
1480 } | |
1481 /// VBI teletext format (R) | |
1482 static int mp_property_teletext_format(m_option_t * prop, int action, void *arg, | |
1483 MPContext * mpctx) | |
1484 { | |
1485 int val,result; | |
1486 tvi_handle_t *tvh = mpctx->demuxer->priv; | |
1487 if (mpctx->demuxer->type != DEMUXER_TYPE_TV || !tvh || !tvh->priv_vbi) | |
1488 return M_PROPERTY_UNAVAILABLE; | |
1489 | |
1490 switch (action) { | |
1491 case M_PROPERTY_GET: | |
1492 if (!arg) | |
1493 return M_PROPERTY_ERROR; | |
1494 result=tv_teletext_control(tvh, TVI_CONTROL_VBI_GET_FORMAT, arg); | |
1495 break; | |
1496 case M_PROPERTY_SET: | |
1497 if (!arg) | |
1498 return M_PROPERTY_ERROR; | |
1499 M_PROPERTY_CLAMP(prop, *(int *) arg); | |
1500 result=tv_teletext_control(tvh, TVI_CONTROL_VBI_SET_FORMAT, arg); | |
1501 break; | |
1502 case M_PROPERTY_STEP_UP: | |
1503 case M_PROPERTY_STEP_DOWN: | |
1504 val = (arg ? *(int *) arg : 1) * (action == M_PROPERTY_STEP_DOWN ? -1 : 1); | |
1505 result=tv_teletext_control(tvh, TVI_CONTROL_VBI_STEP_FORMAT, &val); | |
1506 break; | |
1507 default: | |
1508 return M_PROPERTY_NOT_IMPLEMENTED; | |
1509 } | |
1510 return (result==TVI_CONTROL_TRUE?M_PROPERTY_OK:M_PROPERTY_ERROR); | |
1511 } | |
1512 | |
1513 /// VBI teletext half-page mode (RW) | |
1514 static int mp_property_teletext_half_page(m_option_t * prop, int action, void *arg, | |
1515 MPContext * mpctx) | |
1516 { | |
1517 int val,result; | |
1518 tvi_handle_t *tvh = mpctx->demuxer->priv; | |
1519 if (mpctx->demuxer->type != DEMUXER_TYPE_TV || !tvh || !tvh->priv_vbi) | |
1520 return M_PROPERTY_UNAVAILABLE; | |
1521 | |
1522 switch (action) { | |
1523 case M_PROPERTY_GET: | |
1524 if (!arg) | |
1525 return M_PROPERTY_ERROR; | |
1526 result=tv_teletext_control(tvh, TVI_CONTROL_VBI_GET_HALF_PAGE, arg); | |
1527 break; | |
1528 case M_PROPERTY_SET: | |
1529 if (!arg) | |
1530 return M_PROPERTY_ERROR; | |
1531 M_PROPERTY_CLAMP(prop, *(int *) arg); | |
1532 result=tv_teletext_control(tvh, TVI_CONTROL_VBI_SET_HALF_PAGE, arg); | |
1533 break; | |
1534 case M_PROPERTY_STEP_UP: | |
1535 case M_PROPERTY_STEP_DOWN: | |
1536 val = (arg ? *(int *) arg : 1) * (action == M_PROPERTY_STEP_DOWN ? -1 : 1); | |
1537 result=tv_teletext_control(tvh, TVI_CONTROL_VBI_STEP_HALF_PAGE, &val); | |
1538 break; | |
1539 default: | |
1540 return M_PROPERTY_NOT_IMPLEMENTED; | |
1541 } | |
1542 return (result==TVI_CONTROL_TRUE?M_PROPERTY_OK:M_PROPERTY_ERROR); | |
1543 } | |
1544 #endif /* HAVE_TV_TELETEXT */ | |
1417 | 1545 |
1418 ///@} | 1546 ///@} |
1419 | 1547 |
1420 /// All properties available in MPlayer. | 1548 /// All properties available in MPlayer. |
1421 /** \ingroup Properties | 1549 /** \ingroup Properties |
1538 M_OPT_RANGE, -100, 100, (void *) TV_COLOR_SATURATION }, | 1666 M_OPT_RANGE, -100, 100, (void *) TV_COLOR_SATURATION }, |
1539 { "tv_hue", mp_property_tv_color, CONF_TYPE_INT, | 1667 { "tv_hue", mp_property_tv_color, CONF_TYPE_INT, |
1540 M_OPT_RANGE, -100, 100, (void *) TV_COLOR_HUE }, | 1668 M_OPT_RANGE, -100, 100, (void *) TV_COLOR_HUE }, |
1541 #endif | 1669 #endif |
1542 | 1670 |
1671 #ifdef HAVE_TV_TELETEXT | |
1672 { "teletext_page", mp_property_teletext_page, CONF_TYPE_INT, | |
1673 M_OPT_RANGE, -999, 999, NULL }, | |
1674 { "teletext_mode", mp_property_teletext_mode, CONF_TYPE_INT, | |
1675 M_OPT_RANGE, 0, 3, NULL }, | |
1676 { "teletext_format", mp_property_teletext_format, CONF_TYPE_INT, | |
1677 M_OPT_RANGE, 0, 3, NULL }, | |
1678 { "teletext_half_page", mp_property_teletext_half_page, CONF_TYPE_INT, | |
1679 M_OPT_RANGE, 0, 2, NULL }, | |
1680 #endif | |
1681 | |
1543 { NULL, NULL, NULL, 0, 0, 0, NULL } | 1682 { NULL, NULL, NULL, 0, 0, 0, NULL } |
1544 }; | 1683 }; |
1545 | 1684 |
1546 | 1685 |
1547 int mp_property_do(const char *name, int action, void *val, void *ctx) | 1686 int mp_property_do(const char *name, int action, void *val, void *ctx) |
2231 | 2370 |
2232 case MP_CMD_TV_STEP_CHANNEL_LIST: | 2371 case MP_CMD_TV_STEP_CHANNEL_LIST: |
2233 if (mpctx->file_format == DEMUXER_TYPE_TV) | 2372 if (mpctx->file_format == DEMUXER_TYPE_TV) |
2234 tv_step_chanlist((tvi_handle_t *) (mpctx->demuxer->priv)); | 2373 tv_step_chanlist((tvi_handle_t *) (mpctx->demuxer->priv)); |
2235 break; | 2374 break; |
2375 #ifdef HAVE_TV_TELETEXT | |
2376 case MP_CMD_TV_TELETEXT_ADD_DEC: | |
2377 if (mpctx->file_format == DEMUXER_TYPE_TV) | |
2378 tv_teletext_add_dec((tvi_handle_t *) (mpctx->demuxer->priv),cmd->args[0].v.s); | |
2379 break; | |
2380 case MP_CMD_TV_TELETEXT_GO_LINK: | |
2381 if (mpctx->file_format == DEMUXER_TYPE_TV) | |
2382 tv_teletext_go_link((tvi_handle_t *) (mpctx->demuxer->priv),cmd->args[0].v.i); | |
2383 break; | |
2384 #endif /* HAVE_TV_TELETEXT */ | |
2236 #endif /* USE_TV */ | 2385 #endif /* USE_TV */ |
2237 | 2386 |
2238 case MP_CMD_SUB_LOAD: | 2387 case MP_CMD_SUB_LOAD: |
2239 if (sh_video) { | 2388 if (sh_video) { |
2240 int n = mpctx->set_of_sub_size; | 2389 int n = mpctx->set_of_sub_size; |