annotate stream/stream_dvdnav.c @ 25687:054162e3608b

Remove useless ifdefs
author reimar
date Sun, 13 Jan 2008 11:54:13 +0000
parents bef7f820d179
children 68015115f63a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
1 #include "config.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
2
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
3 #include <stdlib.h>
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
4 #include <stdio.h>
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
5 #include <unistd.h>
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
6 #include <string.h>
25031
5e1e61012a05 report why the dvd couldn't be opened. Patch by Jan Knutar jknutar+nic+fi
nicodvb
parents: 25025
diff changeset
7 #include <errno.h>
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
8 #include "mp_msg.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
9 #include "osdep/timer.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
10 #include "input/input.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
11 #include "stream.h"
19312
ab8d6b6deb63 proper inclusion of demuxer.h (including libmpdemux in Makefile only was to make previous split easier)
ben
parents: 19302
diff changeset
12 #include "libmpdemux/demuxer.h"
25539
47f2a9304623 include dvdnav.h from its installation directory rather than appending
nicodvb
parents: 25536
diff changeset
13 #include <dvdnav/dvdnav.h>
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
14 #include "stream_dvdnav.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
15 #include "libvo/video_out.h"
21193
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
16 #include "libavutil/common.h"
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
17 #include "spudec.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
18 #include "m_option.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
19 #include "m_struct.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
20 #include "help_mp.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
21
25536
a7eec00ebb9c private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents: 25296
diff changeset
22 typedef struct {
a7eec00ebb9c private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents: 25296
diff changeset
23 dvdnav_t * dvdnav; /* handle to libdvdnav stuff */
a7eec00ebb9c private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents: 25296
diff changeset
24 char * filename; /* path */
a7eec00ebb9c private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents: 25296
diff changeset
25 unsigned int duration; /* in milliseconds */
a7eec00ebb9c private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents: 25296
diff changeset
26 int mousex, mousey;
a7eec00ebb9c private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents: 25296
diff changeset
27 int title;
a7eec00ebb9c private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents: 25296
diff changeset
28 unsigned int spu_clut[16], spu_set;
a7eec00ebb9c private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents: 25296
diff changeset
29 dvdnav_highlight_event_t hlev;
a7eec00ebb9c private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents: 25296
diff changeset
30 } dvdnav_priv_t;
a7eec00ebb9c private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents: 25296
diff changeset
31
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
32 extern char *dvd_device;
20409
8cd1b72aa488 support for -chapter option (same semanthics as for dvd://)
nicodvb
parents: 20407
diff changeset
33 extern int dvd_chapter;
8cd1b72aa488 support for -chapter option (same semanthics as for dvd://)
nicodvb
parents: 20407
diff changeset
34 extern int dvd_last_chapter;
20754
da4c2344a97c support for -dvdangle
nicodvb
parents: 20409
diff changeset
35 extern int dvd_angle;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
36 extern char *audio_lang, *dvdsub_lang;
25196
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
37 extern char *dvd_audio_stream_channels[6], *dvd_audio_stream_types[8];
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
38
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
39 static struct stream_priv_s {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
40 int track;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
41 char* device;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
42 } stream_priv_dflts = {
19764
499e5525d706 if no track number specified play the whole disc, or the menus can't be shown at start
nicodvb
parents: 19477
diff changeset
43 0,
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
44 NULL
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
45 };
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
46
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
47 #define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f)
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
48 /// URL definition
25242
371a40dcc1cc stream_opts arrays should be const
reimar
parents: 25211
diff changeset
49 static const m_option_t stream_opts_fields[] = {
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
50 {"filename", ST_OFF(device), CONF_TYPE_STRING, 0, 0, 0, NULL },
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
51 {"hostname", ST_OFF(track), CONF_TYPE_INT, 0, 0, 0, NULL},
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
52 { NULL, NULL, 0, 0, 0, 0, NULL }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
53 };
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
54 static struct m_struct_st stream_opts = {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
55 "dvd",
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
56 sizeof(struct stream_priv_s),
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
57 &stream_priv_dflts,
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
58 stream_opts_fields
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
59 };
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
60
19892
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
61 static int seek(stream_t *s, off_t newpos);
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
62
19914
dfd1bb3fc7c0 made file-static new_dvdnav_stream() and dvdnav_stream_read()
nicodvb
parents: 19912
diff changeset
63 static dvdnav_priv_t * new_dvdnav_stream(char * filename) {
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
64 char * title_str;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
65 dvdnav_priv_t *priv;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
66
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
67 if (!filename)
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
68 return NULL;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
69
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
70 if (!(priv=calloc(1,sizeof(dvdnav_priv_t))))
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
71 return NULL;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
72
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
73 if (!(priv->filename=strdup(filename))) {
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
74 free(priv);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
75 return NULL;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
76 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
77
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
78 if(dvdnav_open(&(priv->dvdnav),priv->filename)!=DVDNAV_STATUS_OK)
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
79 {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
80 free(priv->filename);
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
81 free(priv);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
82 return NULL;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
83 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
84
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
85 if (!priv->dvdnav) {
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
86 free(priv);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
87 return NULL;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
88 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
89
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
90 if(1) //from vlc: if not used dvdnav from cvs will fail
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
91 {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
92 int len, event;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
93 char buf[2048];
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
94
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
95 dvdnav_get_next_block(priv->dvdnav,buf,&event,&len);
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
96 dvdnav_sector_search(priv->dvdnav, 0, SEEK_SET);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
97 }
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
98
19454
b9a62caeb61b corrected _very_ misleading comment
nicodvb
parents: 19453
diff changeset
99 /* turn off dvdnav caching */
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
100 dvdnav_set_readahead_flag(priv->dvdnav, 0);
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
101 if(dvdnav_set_PGC_positioning_flag(priv->dvdnav, 1) != DVDNAV_STATUS_OK)
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
102 mp_msg(MSGT_OPEN,MSGL_ERR,"stream_dvdnav, failed to set PGC positioning\n");
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
103 #if 1
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
104 /* report the title?! */
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
105 if (dvdnav_get_title_string(priv->dvdnav,&title_str)==DVDNAV_STATUS_OK) {
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
106 mp_msg(MSGT_IDENTIFY, MSGL_INFO,"Title: '%s'\n",title_str);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
107 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
108 #endif
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
109
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
110 //dvdnav_event_clear(priv);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
111
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
112 return priv;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
113 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
114
21219
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
115 static void dvdnav_get_highlight (dvdnav_priv_t *priv, int display_mode) {
21193
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
116 pci_t *pnavpci = NULL;
21219
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
117 dvdnav_highlight_event_t *hlev = &(priv->hlev);
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
118 int btnum;
21198
fbe50a67612a COSMETICS: consistently reformatted after ben's mess
nicodvb
parents: 21197
diff changeset
119
21219
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
120 if (!priv || !priv->dvdnav)
21193
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
121 return;
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
122
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
123 pnavpci = dvdnav_get_current_nav_pci (priv->dvdnav);
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
124 if (!pnavpci)
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
125 return;
21198
fbe50a67612a COSMETICS: consistently reformatted after ben's mess
nicodvb
parents: 21197
diff changeset
126
21193
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
127 dvdnav_get_current_highlight (priv->dvdnav, &(hlev->buttonN));
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
128 hlev->display = display_mode; /* show */
21198
fbe50a67612a COSMETICS: consistently reformatted after ben's mess
nicodvb
parents: 21197
diff changeset
129
21193
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
130 if (hlev->buttonN > 0 && pnavpci->hli.hl_gi.btn_ns > 0 && hlev->display) {
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
131 for (btnum = 0; btnum < pnavpci->hli.hl_gi.btn_ns; btnum++) {
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
132 btni_t *btni = &(pnavpci->hli.btnit[btnum]);
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
133
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
134 if (hlev->buttonN == btnum + 1) {
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
135 hlev->sx = FFMIN (btni->x_start, btni->x_end);
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
136 hlev->ex = FFMAX (btni->x_start, btni->x_end);
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
137 hlev->sy = FFMIN (btni->y_start, btni->y_end);
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
138 hlev->ey = FFMAX (btni->y_start, btni->y_end);
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
139
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
140 hlev->palette = (btni->btn_coln == 0) ? 0 :
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
141 pnavpci->hli.btn_colit.btn_coli[btni->btn_coln - 1][0];
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
142 break;
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
143 }
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
144 }
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
145 } else { /* hide button or no button */
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
146 hlev->sx = hlev->ex = 0;
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
147 hlev->sy = hlev->ey = 0;
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
148 hlev->palette = hlev->buttonN = 0;
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
149 }
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
150 }
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
151
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
152 static int dvdnav_stream_read(dvdnav_priv_t * priv, unsigned char *buf, int *len) {
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
153 int event = DVDNAV_NOP;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
154
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
155 *len=-1;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
156 if (dvdnav_get_next_block(priv->dvdnav,buf,&event,len)!=DVDNAV_STATUS_OK) {
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
157 mp_msg(MSGT_OPEN,MSGL_V, "Error getting next block from DVD %d (%s)\n",event, dvdnav_err_to_string(priv->dvdnav) );
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
158 *len=-1;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
159 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
160 else if (event!=DVDNAV_BLOCK_OK) {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
161 // need to handle certain events internally (like skipping stills)
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
162 switch (event) {
21332
7f53c807d593 feed the content of NAV_PACKET to the demuxer
nicodvb
parents: 21219
diff changeset
163 case DVDNAV_NAV_PACKET:
7f53c807d593 feed the content of NAV_PACKET to the demuxer
nicodvb
parents: 21219
diff changeset
164 return event;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
165 case DVDNAV_STILL_FRAME: {
23991
6b5d9e7e4b17 cosmetics: removed commented code and small reindentation
nicodvb
parents: 23990
diff changeset
166 dvdnav_still_skip(priv->dvdnav); // don't let dvdnav stall on this image
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
167 break;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
168 }
21193
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
169 case DVDNAV_HIGHLIGHT: {
21219
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
170 dvdnav_get_highlight (priv, 1);
21193
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
171 break;
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
172 }
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
173 case DVDNAV_CELL_CHANGE: {
19453
087d4a916ea3 implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents: 19452
diff changeset
174 dvdnav_cell_change_event_t *ev = (dvdnav_cell_change_event_t*)buf;
087d4a916ea3 implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents: 19452
diff changeset
175 if(ev->pgc_length)
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
176 priv->duration = ev->pgc_length/90;
19453
087d4a916ea3 implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents: 19452
diff changeset
177 break;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
178 }
21538
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
179 case DVDNAV_SPU_CLUT_CHANGE: {
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
180 memcpy(priv->spu_clut, buf, 16*sizeof(unsigned int));
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
181 priv->spu_set = 1;
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
182 break;
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
183 }
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
184 case DVDNAV_WAIT:
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
185 dvdnav_wait_skip(priv->dvdnav);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
186 break;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
187 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
188
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
189 *len=0;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
190 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
191 return event;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
192 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
193
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
194 static void update_title_len(stream_t *stream) {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
195 dvdnav_priv_t *priv = stream->priv;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
196 dvdnav_status_t status;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
197 uint32_t pos = 0, len = 0;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
198
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
199 status = dvdnav_get_position(priv->dvdnav, &pos, &len);
19892
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
200 if(status == DVDNAV_STATUS_OK && len) {
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
201 stream->end_pos = (off_t) len * 2048;
19892
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
202 stream->seek = seek;
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
203 } else {
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
204 stream->seek = NULL;
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
205 stream->end_pos = 0;
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
206 }
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
207 }
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
208
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
209
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
210 static int seek(stream_t *s, off_t newpos) {
23990
f57dacd8c419 removed unused variables
nicodvb
parents: 23902
diff changeset
211 uint32_t sector = 0;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
212 dvdnav_priv_t *priv = s->priv;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
213
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
214 if(s->end_pos && newpos > s->end_pos)
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
215 newpos = s->end_pos;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
216 sector = newpos / 2048ULL;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
217 if(dvdnav_sector_search(priv->dvdnav, (uint64_t) sector, SEEK_SET) != DVDNAV_STATUS_OK)
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
218 goto fail;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
219
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
220 s->pos = newpos;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
221
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
222 return 1;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
223
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
224 fail:
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
225 mp_msg(MSGT_STREAM,MSGL_INFO,"dvdnav_stream, seeking to %"PRIu64" failed: %s\n", newpos, dvdnav_err_to_string(priv->dvdnav));
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
226
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
227 return 1;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
228 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
229
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
230 static void stream_dvdnav_close(stream_t *s) {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
231 dvdnav_priv_t *priv = s->priv;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
232 dvdnav_close(priv->dvdnav);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
233 priv->dvdnav = NULL;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
234 free(priv);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
235 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
236
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
237
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
238 static int fill_buffer(stream_t *s, char *but, int len)
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
239 {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
240 int event;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
241
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
242 dvdnav_priv_t* priv=s->priv;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
243 len=0;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
244 if(!s->end_pos)
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
245 update_title_len(s);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
246 while(!len) /* grab all event until DVDNAV_BLOCK_OK (len=2048), DVDNAV_STOP or DVDNAV_STILL_FRAME */
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
247 {
20810
4d2c03da592c one more deuglification
nicodvb
parents: 20809
diff changeset
248 event=dvdnav_stream_read(priv, s->buffer, &len);
4d2c03da592c one more deuglification
nicodvb
parents: 20809
diff changeset
249 if(event==-1 || len==-1)
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
250 {
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
251 mp_msg(MSGT_CPLAYER,MSGL_ERR, "DVDNAV stream read error!\n");
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
252 return 0;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
253 }
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
254 switch (event) {
21333
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
255 case DVDNAV_STOP:
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
256 case DVDNAV_BLOCK_OK:
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
257 case DVDNAV_NAV_PACKET:
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
258 return len;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
259 case DVDNAV_VTS_CHANGE: {
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
260 int tit = 0, part = 0;
23043
4038852b041e after a DVDNAV_VTS_CHANGE event report the title being played
nicodvb
parents: 22936
diff changeset
261 dvdnav_vts_change_event_t *vts_event = (dvdnav_vts_change_event_t *)s->buffer;
4038852b041e after a DVDNAV_VTS_CHANGE event report the title being played
nicodvb
parents: 22936
diff changeset
262 mp_msg(MSGT_CPLAYER,MSGL_INFO, "DVDNAV, switched to title: %d\r\n", vts_event->new_vtsN);
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
263 s->end_pos = 0;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
264 update_title_len(s);
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
265 if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) == DVDNAV_STATUS_OK) {
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
266 mp_msg(MSGT_CPLAYER,MSGL_V, "\r\nDVDNAV, NEW TITLE %d\r\n", tit);
21219
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
267 dvdnav_get_highlight (priv, 0);
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
268 if(priv->title > 0 && tit != priv->title)
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
269 return 0;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
270 }
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
271 break;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
272 }
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
273 case DVDNAV_CELL_CHANGE: {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
274 if(priv->title > 0 && dvd_last_chapter > 0) {
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
275 int tit=0, part=0;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
276 if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) == DVDNAV_STATUS_OK && part > dvd_last_chapter)
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
277 return 0;
19893
9440915a76f1 at titleset change call update_title_len() to reset stream->end_pos
nicodvb
parents: 19892
diff changeset
278 }
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
279 }
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
280 break;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
281 }
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
282 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
283 mp_msg(MSGT_STREAM,MSGL_DBG2,"DVDNAV fill_buffer len: %d\n",len);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
284 return len;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
285 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
286
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
287 static int control(stream_t *stream, int cmd, void* arg) {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
288 dvdnav_priv_t* priv=stream->priv;
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
289 int tit, part;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
290
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
291 switch(cmd)
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
292 {
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
293 case STREAM_CTRL_SEEK_TO_CHAPTER:
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
294 {
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
295 int chap = *((unsigned int *)arg)+1;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
296
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
297 if(chap < 1 || dvdnav_current_title_info(priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK)
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
298 break;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
299 if(dvdnav_part_play(priv->dvdnav, tit, chap) != DVDNAV_STATUS_OK)
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
300 break;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
301 return 1;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
302 }
19477
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
303 case STREAM_CTRL_GET_NUM_CHAPTERS:
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
304 {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
305 if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK)
19477
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
306 break;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
307 if(dvdnav_get_number_of_parts(priv->dvdnav, tit, &part) != DVDNAV_STATUS_OK)
19477
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
308 break;
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
309 if(!part)
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
310 break;
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
311 *((unsigned int *)arg) = part;
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
312 return 1;
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
313 }
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
314 case STREAM_CTRL_GET_CURRENT_CHAPTER:
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
315 {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
316 if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK)
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
317 break;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
318 *((unsigned int *)arg) = part - 1;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
319 return 1;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
320 }
19453
087d4a916ea3 implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents: 19452
diff changeset
321 case STREAM_CTRL_GET_TIME_LENGTH:
087d4a916ea3 implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents: 19452
diff changeset
322 {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
323 if(priv->duration)
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
324 {
20851
6602a90a06ec consistency fix: STREAM_CTRL_GET_TIME_LENGTH and STREAM_CTRL_GET_CURRENT_TIME now return time in (double) seconds
nicodvb
parents: 20810
diff changeset
325 *((double *)arg) = (double)priv->duration / 1000.0;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
326 return 1;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
327 }
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
328 break;
19453
087d4a916ea3 implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents: 19452
diff changeset
329 }
24303
21d181441aa4 implemented STREAM_CTRL_GET_ASPECT_RATIO
nicodvb
parents: 24257
diff changeset
330 case STREAM_CTRL_GET_ASPECT_RATIO:
21d181441aa4 implemented STREAM_CTRL_GET_ASPECT_RATIO
nicodvb
parents: 24257
diff changeset
331 {
21d181441aa4 implemented STREAM_CTRL_GET_ASPECT_RATIO
nicodvb
parents: 24257
diff changeset
332 uint8_t ar = dvdnav_get_video_aspect(priv->dvdnav);
21d181441aa4 implemented STREAM_CTRL_GET_ASPECT_RATIO
nicodvb
parents: 24257
diff changeset
333 *((double *)arg) = !ar ? 4.0/3.0 : 16.0/9.0;
21d181441aa4 implemented STREAM_CTRL_GET_ASPECT_RATIO
nicodvb
parents: 24257
diff changeset
334 return 1;
21d181441aa4 implemented STREAM_CTRL_GET_ASPECT_RATIO
nicodvb
parents: 24257
diff changeset
335 }
22936
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
336 case STREAM_CTRL_GET_CURRENT_TIME:
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
337 {
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
338 double tm;
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
339 tm = dvdnav_get_current_time(priv->dvdnav)/90000.0f;
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
340 if(tm != -1)
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
341 {
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
342 *((double *)arg) = tm;
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
343 return 1;
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
344 }
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
345 break;
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
346 }
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
347 case STREAM_CTRL_SEEK_TO_TIME:
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
348 {
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
349 uint64_t tm = (uint64_t) (*((double*)arg) * 90000);
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
350 if(dvdnav_time_search(priv->dvdnav, tm) == DVDNAV_STATUS_OK)
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
351 return 1;
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
352 break;
a6486d2975d2 implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents: 21613
diff changeset
353 }
25574
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
354 case STREAM_CTRL_GET_NUM_ANGLES:
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
355 {
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
356 uint32_t curr, angles;
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
357 if(dvdnav_get_angle_info(priv->dvdnav, &curr, &angles) != DVDNAV_STATUS_OK)
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
358 break;
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
359 *((int *)arg) = angles;
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
360 return 1;
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
361 }
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
362 case STREAM_CTRL_GET_ANGLE:
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
363 {
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
364 uint32_t curr, angles;
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
365 if(dvdnav_get_angle_info(priv->dvdnav, &curr, &angles) != DVDNAV_STATUS_OK)
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
366 break;
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
367 *((int *)arg) = curr;
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
368 return 1;
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
369 }
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
370 case STREAM_CTRL_SET_ANGLE:
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
371 {
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
372 uint32_t curr, angles;
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
373 int new_angle = *((int *)arg);
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
374 if(dvdnav_get_angle_info(priv->dvdnav, &curr, &angles) != DVDNAV_STATUS_OK)
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
375 break;
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
376 if(new_angle>angles || new_angle<1)
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
377 break;
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
378 if(dvdnav_angle_change(priv->dvdnav, new_angle) != DVDNAV_STATUS_OK)
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
379 return 1;
bef7f820d179 implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents: 25539
diff changeset
380 }
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
381 }
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
382
24257
d261f5109660 cosmetics: typo fix UNSUPORTED --> UNSUPPORTED
diego
parents: 24109
diff changeset
383 return STREAM_UNSUPPORTED;
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
384 }
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
385
25165
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
386 static void identify_chapters(dvdnav_t *nav, uint32_t title)
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
387 {
25177
a43d99a80f4a -identify also shows the duration(s) of the title(s)
nicodvb
parents: 25176
diff changeset
388 uint64_t *parts=NULL, duration=0;
25165
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
389 uint32_t n, i, t;
25177
a43d99a80f4a -identify also shows the duration(s) of the title(s)
nicodvb
parents: 25176
diff changeset
390 n = dvdnav_describe_title_chapters(nav, title, &parts, &duration);
25165
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
391 if(parts) {
25177
a43d99a80f4a -identify also shows the duration(s) of the title(s)
nicodvb
parents: 25176
diff changeset
392 t = duration / 90;
a43d99a80f4a -identify also shows the duration(s) of the title(s)
nicodvb
parents: 25176
diff changeset
393 mp_msg(MSGT_IDENTIFY, MSGL_V, "ID_DVD_TITLE_%d_LENGTH=%d.%03d\n", title, t / 1000, t % 1000);
25167
89b5a20fc346 with -identify show the title being described
nicodvb
parents: 25165
diff changeset
394 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "TITLE %u, CHAPTERS: ", title);
25165
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
395 for(i=0; i<n; i++) {
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
396 t = parts[i] / 90000;
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
397 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "%02d:%02d:%02d,", t/3600, (t/60)%60, t%60);
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
398 }
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
399 free(parts);
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
400 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "\n");
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
401 }
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
402 }
4e57fd666c56 -identify chapters of chosen title
nicodvb
parents: 25031
diff changeset
403
25176
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
404 static void identify(dvdnav_priv_t *priv, struct stream_priv_s *p)
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
405 {
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
406 uint32_t titles=0, i;
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
407 if(p->track <= 0) {
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
408 dvdnav_get_number_of_titles(priv->dvdnav, &titles);
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
409 for(i=0; i<titles; i++)
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
410 identify_chapters(priv->dvdnav, i);
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
411 }
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
412 else
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
413 identify_chapters(priv->dvdnav, p->track);
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
414 }
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
415
25196
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
416 static void show_audio_subs_languages(dvdnav_t *nav)
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
417 {
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
418 uint8_t lg;
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
419 uint16_t i, lang, format, id, channels;
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
420 int base[6] = {128, 0, 0, 0, 160, 136, 0};
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
421 char tmp[3];
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
422 for(i=0; i<8; i++)
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
423 {
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
424 lg = dvdnav_get_audio_logical_stream(nav, i);
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
425 if(lg == 0xff) continue;
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
426 channels = dvdnav_audio_stream_channels(nav, lg);
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
427 if(channels == 0xFFFF)
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
428 channels = 2; //unknown
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
429 else
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
430 channels--;
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
431 lang = dvdnav_audio_stream_to_lang(nav, lg);
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
432 if(lang == 0xFFFF)
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
433 tmp[0] = tmp[1] = '?';
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
434 else
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
435 {
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
436 tmp[0] = lang >> 8;
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
437 tmp[1] = lang & 0xFF;
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
438 }
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
439 tmp[2] = 0;
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
440 format = dvdnav_audio_stream_format(nav, lg);
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
441 if(format == 0xFFFF || format > 6)
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
442 format = 1; //unknown
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
443 id = i + base[format];
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
444 mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDaudioStreamInfo, i,
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
445 dvd_audio_stream_types[format], dvd_audio_stream_channels[channels], tmp, id);
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
446 }
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
447
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
448 for(i=0; i<32; i++)
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
449 {
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
450 lg = dvdnav_get_spu_logical_stream(nav, i);
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
451 if(lg == 0xff) continue;
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
452 lang = dvdnav_spu_stream_to_lang(nav, lg);
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
453 if(lang == 0xFFFF)
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
454 tmp[0] = tmp[1] = '?';
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
455 else
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
456 {
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
457 tmp[0] = lang >> 8;
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
458 tmp[1] = lang & 0xFF;
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
459 }
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
460 tmp[2] = 0;
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
461 mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDsubtitleLanguage, i+0x20, tmp);
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
462 }
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
463 }
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
464
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
465 static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
466 struct stream_priv_s* p = (struct stream_priv_s*)opts;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
467 char *filename;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
468 dvdnav_priv_t *priv;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
469
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
470 if(p->device) filename = p->device;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
471 else if(dvd_device) filename= dvd_device;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
472 else filename = DEFAULT_DVD_DEVICE;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
473 if(!(priv=new_dvdnav_stream(filename))) {
25031
5e1e61012a05 report why the dvd couldn't be opened. Patch by Jan Knutar jknutar+nic+fi
nicodvb
parents: 25025
diff changeset
474 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,filename, strerror(errno));
24257
d261f5109660 cosmetics: typo fix UNSUPORTED --> UNSUPPORTED
diego
parents: 24109
diff changeset
475 return STREAM_UNSUPPORTED;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
476 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
477
19764
499e5525d706 if no track number specified play the whole disc, or the menus can't be shown at start
nicodvb
parents: 19477
diff changeset
478 if(p->track > 0) {
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
479 if(dvd_chapter > 0 && dvd_last_chapter > 0 && dvd_chapter > dvd_last_chapter) {
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
480 mp_msg(MSGT_OPEN,MSGL_FATAL,"dvdnav_stream, invalid chapter range: %d > %d\n", dvd_chapter, dvd_last_chapter);
24257
d261f5109660 cosmetics: typo fix UNSUPORTED --> UNSUPPORTED
diego
parents: 24109
diff changeset
481 return STREAM_UNSUPPORTED;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
482 }
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
483 priv->title = p->track;
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
484 if(dvdnav_title_play(priv->dvdnav, p->track) != DVDNAV_STATUS_OK) {
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
485 mp_msg(MSGT_OPEN,MSGL_FATAL,"dvdnav_stream, couldn't select title %d, error '%s'\n", p->track, dvdnav_err_to_string(priv->dvdnav));
24257
d261f5109660 cosmetics: typo fix UNSUPORTED --> UNSUPPORTED
diego
parents: 24109
diff changeset
486 return STREAM_UNSUPPORTED;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
487 }
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
488 if(dvd_chapter > 0)
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
489 dvdnav_part_play(priv->dvdnav, p->track, dvd_chapter);
19780
49d6e27228bc try to start from the root menu skipping all intros when playing dvdnav://-1; it's not guaranteed to work
nicodvb
parents: 19777
diff changeset
490 } else if(p->track == -1)
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
491 dvdnav_menu_call(priv->dvdnav, DVD_MENU_Root);
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
492 else {
19764
499e5525d706 if no track number specified play the whole disc, or the menus can't be shown at start
nicodvb
parents: 19477
diff changeset
493 mp_msg(MSGT_OPEN,MSGL_INFO,"dvdnav_stream, you didn't specify a track number (as in dvdnav://1), playing whole disc\n");
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
494 dvdnav_menu_call(priv->dvdnav, DVD_MENU_Title);
19842
a43fa4ad378e at start, when not playing a specific titleset, try to call the Title menu (as is common practice among players)
nicodvb
parents: 19840
diff changeset
495 }
25176
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
496 if(mp_msg_test(MSGT_IDENTIFY, MSGL_INFO))
6d9212e61af8 cosmetics: moved identification code to a separate function
nicodvb
parents: 25168
diff changeset
497 identify(priv, p);
25196
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
498 if(p->track > 0)
5487d363a9ac at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents: 25177
diff changeset
499 show_audio_subs_languages(priv->dvdnav);
20754
da4c2344a97c support for -dvdangle
nicodvb
parents: 20409
diff changeset
500 if(dvd_angle > 1)
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
501 dvdnav_angle_change(priv->dvdnav, dvd_angle);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
502
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
503 stream->sector_size = 2048;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
504 stream->flags = STREAM_READ | STREAM_SEEK;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
505 stream->fill_buffer = fill_buffer;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
506 stream->seek = seek;
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
507 stream->control = control;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
508 stream->close = stream_dvdnav_close;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
509 stream->type = STREAMTYPE_DVDNAV;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
510 stream->priv=(void*)priv;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
511 *file_format = DEMUXER_TYPE_MPEG_PS;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
512
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
513 update_title_len(stream);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
514 if(!stream->pos)
24109
4565ffb49fda Removed uninitialized variable.
cehoyos
parents: 23991
diff changeset
515 mp_msg(MSGT_OPEN,MSGL_ERR, "INIT ERROR: couldn't get init pos %s\r\n", dvdnav_err_to_string(priv->dvdnav));
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
516
20406
831cd8cbf58a spell fix
nicodvb
parents: 20405
diff changeset
517 mp_msg(MSGT_OPEN,MSGL_INFO, "Remember to disable MPlayer's cache when playing dvdnav:// streams (adding -nocache to your command line)\r\n");
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
518
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
519 return STREAM_OK;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
520 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
521
19768
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
522
19774
109e241c0cca in mp_dvdnav_handle_input() assign the currently selected button, shown in the OSD by main()
nicodvb
parents: 19768
diff changeset
523 int mp_dvdnav_handle_input(stream_t *stream, int cmd, int *button) {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
524 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
525 dvdnav_t *nav = priv->dvdnav;
19908
b6aa47caeb72 §Ænitial button value is -1. Only (button>0) is a correct button selection.
jonas
parents: 19895
diff changeset
526 dvdnav_status_t status=DVDNAV_STATUS_ERR;
19768
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
527 pci_t *pci = dvdnav_get_current_nav_pci(nav);
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
528 int reset = 0;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
529
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
530 if(cmd != MP_CMD_DVDNAV_SELECT && !pci)
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
531 return 0;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
532
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
533 switch(cmd) {
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
534 case MP_CMD_DVDNAV_UP:
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
535 status = dvdnav_upper_button_select(nav, pci);
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
536 break;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
537 case MP_CMD_DVDNAV_DOWN:
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
538 status = dvdnav_lower_button_select(nav, pci);
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
539 break;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
540 case MP_CMD_DVDNAV_LEFT:
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
541 status = dvdnav_left_button_select(nav, pci);
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
542 break;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
543 case MP_CMD_DVDNAV_RIGHT:
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
544 status = dvdnav_right_button_select(nav, pci);
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
545 break;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
546 case MP_CMD_DVDNAV_MENU:
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
547 status = dvdnav_menu_call(nav,DVD_MENU_Root);
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
548 reset = 1;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
549 break;
19777
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
550 case MP_CMD_DVDNAV_PREVMENU: {
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
551 int title=0, part=0;
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
552
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
553 dvdnav_current_title_info(nav, &title, &part);
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
554 if(title) {
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
555 if(dvdnav_menu_call(nav, DVD_MENU_Part) == DVDNAV_STATUS_OK
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
556 || dvdnav_menu_call(nav, DVD_MENU_Title) == DVDNAV_STATUS_OK) {
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
557 reset = 1;
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
558 break;
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
559 }
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
560 }
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
561 if(dvdnav_menu_call(nav, DVD_MENU_Root) == DVDNAV_STATUS_OK)
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
562 reset = 1;
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
563 }
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
564 break;
19768
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
565 case MP_CMD_DVDNAV_SELECT:
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
566 status = dvdnav_button_activate(nav, pci);
19836
9470f7630ee4 when cmd == MP_CMD_DVDNAV_SELECT set reset=1 only if dvdnav_button_activate() succeeds, to avoid unneeded resets in main()
nicodvb
parents: 19781
diff changeset
567 if(status == DVDNAV_STATUS_OK) reset = 1;
19768
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
568 break;
19912
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
569 case MP_CMD_DVDNAV_MOUSECLICK:
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
570 /*
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
571 this is a workaround: in theory the simple dvdnav_lower_button_select()+dvdnav_button_activate()
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
572 should be enough (and generally it is), but there are cases when the calls to dvdnav_lower_button_select()
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
573 and friends fail! Hence we have to call dvdnav_mouse_activate(priv->mousex, priv->mousey) with
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
574 the coodinates saved by mp_dvdnav_update_mouse_pos().
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
575 This last call always works well
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
576 */
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
577 status = dvdnav_mouse_activate(nav, pci, priv->mousex, priv->mousey);
24304
032c82a7a053 a mouse selection may require at least a video codec reinit
nicodvb
parents: 24303
diff changeset
578 if(status == DVDNAV_STATUS_OK) reset = 1;
19912
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
579 break;
19768
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
580 default:
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
581 mp_msg(MSGT_CPLAYER, MSGL_V, "Unknown DVDNAV cmd %d\n", cmd);
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
582 break;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
583 }
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
584
19840
ba3b77867047 in mp_dvdnav_handle_input() update current button only if the status of the previous operation succeeded; patch by Jonas Jermann
nicodvb
parents: 19839
diff changeset
585 if(status == DVDNAV_STATUS_OK)
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
586 dvdnav_get_current_highlight(nav, button);
19774
109e241c0cca in mp_dvdnav_handle_input() assign the currently selected button, shown in the OSD by main()
nicodvb
parents: 19768
diff changeset
587
19768
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
588 return reset;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
589 }
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
590
19851
adfd08588514 report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents: 19842
diff changeset
591 void mp_dvdnav_update_mouse_pos(stream_t *stream, int32_t x, int32_t y, int* button) {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
592 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
593 dvdnav_t *nav = priv->dvdnav;
19851
adfd08588514 report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents: 19842
diff changeset
594 dvdnav_status_t status;
adfd08588514 report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents: 19842
diff changeset
595 pci_t *pci = dvdnav_get_current_nav_pci(nav);
adfd08588514 report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents: 19842
diff changeset
596
adfd08588514 report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents: 19842
diff changeset
597 if(!pci) return;
adfd08588514 report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents: 19842
diff changeset
598
adfd08588514 report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents: 19842
diff changeset
599 status = dvdnav_mouse_select(nav, pci, x, y);
adfd08588514 report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents: 19842
diff changeset
600 if(status == DVDNAV_STATUS_OK) dvdnav_get_current_highlight(nav, button);
adfd08588514 report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents: 19842
diff changeset
601 else *button = -1;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
602 priv->mousex = x;
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
603 priv->mousey = y;
19851
adfd08588514 report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents: 19842
diff changeset
604 }
adfd08588514 report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents: 19842
diff changeset
605
21424
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
606 /**
21600
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
607 * \brief dvdnav_aid_from_lang() returns the audio id corresponding to the language code 'lang'
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
608 * \param stream: - stream pointer
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
609 * \param lang: 2-characters language code[s], eventually separated by spaces of commas
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
610 * \return -1 on error, current subtitle id if successful
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
611 */
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
612 int dvdnav_aid_from_lang(stream_t *stream, unsigned char *language) {
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
613 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
614 int k;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
615 uint8_t format, lg;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
616 uint16_t lang, lcode;;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
617
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
618 while(language && strlen(language)>=2) {
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
619 lcode = (language[0] << 8) | (language[1]);
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
620 for(k=0; k<32; k++) {
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
621 lg = dvdnav_get_audio_logical_stream(priv->dvdnav, k);
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
622 if(lg == 0xff) continue;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
623 lang = dvdnav_audio_stream_to_lang(priv->dvdnav, lg);
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
624 if(lang != 0xFFFF && lang == lcode) {
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
625 format = dvdnav_audio_stream_format(priv->dvdnav, lg);
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
626 switch(format) {
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
627 case DVDNAV_FORMAT_AC3:
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
628 return k+128;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
629 case DVDNAV_FORMAT_DTS:
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
630 return k+136;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
631 case DVDNAV_FORMAT_LPCM:
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
632 return k+160;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
633 case DVDNAV_FORMAT_MPEGAUDIO:
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
634 return k;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
635 default:
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
636 return -1;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
637 }
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
638 }
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
639 }
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
640 language += 2;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
641 while(language[0]==',' || language[0]==' ') ++language;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
642 }
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
643 return -1;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
644 }
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
645
21603
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
646 /**
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
647 * \brief dvdnav_lang_from_aid() assigns to buf the language corresponding to audio id 'aid'
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
648 * \param stream: - stream pointer
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
649 * \param sid: physical subtitle id
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
650 * \param buf: buffer to contain the 2-chars language string
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
651 * \return 0 on error, 1 if successful
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
652 */
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
653 int dvdnav_lang_from_aid(stream_t *stream, int aid, unsigned char *buf) {
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
654 uint8_t lg;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
655 uint16_t lang;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
656 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
657
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
658 if(aid < 0)
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
659 return 0;
21613
8547ae79e74b simplified aid management in dvdnav_lang_from_aid(); patch by Joakim Patte
nicodvb
parents: 21603
diff changeset
660 lg = dvdnav_get_audio_logical_stream(priv->dvdnav, aid & 0x7);
21603
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
661 if(lg == 0xff) return 0;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
662 lang = dvdnav_audio_stream_to_lang(priv->dvdnav, lg);
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
663 if(lang == 0xffff) return 0;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
664 buf[0] = lang >> 8;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
665 buf[1] = lang & 0xFF;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
666 buf[2] = 0;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
667 return 1;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
668 }
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
669
21600
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
670
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
671 /**
21424
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
672 * \brief dvdnav_sid_from_lang() returns the subtitle id corresponding to the language code 'lang'
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
673 * \param stream: - stream pointer
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
674 * \param lang: 2-characters language code[s], eventually separated by spaces of commas
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
675 * \return -1 on error, current subtitle id if successful
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
676 */
21197
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
677 int dvdnav_sid_from_lang(stream_t *stream, unsigned char *language) {
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
678 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
23990
f57dacd8c419 removed unused variables
nicodvb
parents: 23902
diff changeset
679 uint8_t lg, k;
21204
1ddb1a86e419 support for comma-separated language codes in -slang
nicodvb
parents: 21200
diff changeset
680 uint16_t lang, lcode;
21197
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
681
21204
1ddb1a86e419 support for comma-separated language codes in -slang
nicodvb
parents: 21200
diff changeset
682 while(language && strlen(language)>=2) {
21333
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
683 lcode = (language[0] << 8) | (language[1]);
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
684 for(k=0; k<32; k++) {
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
685 lg = dvdnav_get_spu_logical_stream(priv->dvdnav, k);
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
686 if(lg == 0xff) continue;
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
687 lang = dvdnav_spu_stream_to_lang(priv->dvdnav, lg);
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
688 if(lang != 0xFFFF && lang == lcode) {
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
689 return k;
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
690 }
21197
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
691 }
21333
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
692 language += 2;
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
693 while(language[0]==',' || language[0]==' ') ++language;
21204
1ddb1a86e419 support for comma-separated language codes in -slang
nicodvb
parents: 21200
diff changeset
694 }
21197
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
695 return -1;
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
696 }
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
697
21424
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
698 /**
21560
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
699 * \brief dvdnav_lang_from_sid() assigns to buf the language corresponding to subtitle id 'sid'
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
700 * \param stream: - stream pointer
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
701 * \param sid: physical subtitle id
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
702 * \param buf: buffer to contain the 2-chars language string
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
703 * \return 0 on error, 1 if successful
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
704 */
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
705 int dvdnav_lang_from_sid(stream_t *stream, int sid, unsigned char *buf) {
23990
f57dacd8c419 removed unused variables
nicodvb
parents: 23902
diff changeset
706 uint8_t lg;
21560
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
707 uint16_t lang;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
708 dvdnav_priv_t *priv=(dvdnav_priv_t*)stream->priv;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
709 if(sid < 0) return 0;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
710 lg = dvdnav_get_spu_logical_stream(priv->dvdnav, sid);
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
711 lang = dvdnav_spu_stream_to_lang(priv->dvdnav, lg);
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
712 if(lang == 0xffff) return 0;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
713 buf[0] = lang >> 8;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
714 buf[1] = lang & 0xFF;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
715 buf[2] = 0;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
716 return 1;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
717 }
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
718
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
719 /**
21424
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
720 * \brief dvdnav_number_of_subs() returns the count of available subtitles
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
721 * \param stream: - stream pointer
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
722 * \return 0 on error, something meaningful otherwise
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
723 */
21197
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
724 int dvdnav_number_of_subs(stream_t *stream) {
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
725 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
726 uint8_t lg, k, n=0;
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
727
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
728 for(k=0; k<32; k++) {
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
729 lg = dvdnav_get_spu_logical_stream(priv->dvdnav, k);
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
730 if(lg == 0xff) continue;
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
731 n++;
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
732 }
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
733 return n;
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
734 }
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
735
23902
29f612207c95 More doxygen comments
reimar
parents: 23043
diff changeset
736 /**
29f612207c95 More doxygen comments
reimar
parents: 23043
diff changeset
737 * \brief mp_dvdnav_get_spu_clut() returns the spu clut
29f612207c95 More doxygen comments
reimar
parents: 23043
diff changeset
738 * \param stream: - stream pointer
29f612207c95 More doxygen comments
reimar
parents: 23043
diff changeset
739 * \return spu clut pointer
29f612207c95 More doxygen comments
reimar
parents: 23043
diff changeset
740 */
21538
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
741 unsigned int *mp_dvdnav_get_spu_clut(stream_t *stream) {
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
742 dvdnav_priv_t *priv=(dvdnav_priv_t*)stream->priv;
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
743 if(!priv->spu_set) return NULL;
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
744 return priv->spu_clut;
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
745 }
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
746
23902
29f612207c95 More doxygen comments
reimar
parents: 23043
diff changeset
747 /**
29f612207c95 More doxygen comments
reimar
parents: 23043
diff changeset
748 * \brief mp_dvdnav_get_highlight() get dvdnav highlight struct
29f612207c95 More doxygen comments
reimar
parents: 23043
diff changeset
749 * \param stream: - stream pointer
29f612207c95 More doxygen comments
reimar
parents: 23043
diff changeset
750 * \param hl : - highlight struct pointer
29f612207c95 More doxygen comments
reimar
parents: 23043
diff changeset
751 */
21219
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
752 void mp_dvdnav_get_highlight (stream_t *stream, nav_highlight_t *hl) {
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
753 dvdnav_priv_t *priv = (dvdnav_priv_t *) stream->priv;
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
754 dvdnav_highlight_event_t hlev = priv->hlev;
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
755
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
756 hl->sx = hlev.sx;
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
757 hl->sy = hlev.sy;
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
758 hl->ex = hlev.ex;
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
759 hl->ey = hlev.ey;
21200
c7b5dd2b2291 better nav highlight handling
ben
parents: 21199
diff changeset
760 }
19851
adfd08588514 report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents: 19842
diff changeset
761
25211
c1d17bd6683c Mark all stream_info_t as const
reimar
parents: 25196
diff changeset
762 const stream_info_t stream_info_dvdnav = {
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
763 "DVDNAV stream",
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
764 "null",
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
765 "",
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
766 "",
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
767 open_s,
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
768 { "dvdnav", NULL },
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
769 &stream_opts,
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
770 1 // Urls are an option string
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
771 };