annotate stream/stream_dvdnav.c @ 22368:8e9f3809b4be

new policy draft
author michael
date Thu, 01 Mar 2007 03:43:38 +0000
parents 8547ae79e74b
children a6486d2975d2
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>
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
7 #include "mp_msg.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
8 #include "osdep/timer.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
9 #include "input/input.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
10 #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
11 #include "libmpdemux/demuxer.h"
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
12 #include "stream_dvdnav.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
13 #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
14 #include "libavutil/common.h"
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
15 #include "spudec.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
16 #include "m_option.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
17 #include "m_struct.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
18 #include "help_mp.h"
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
19
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
20 extern char *dvd_device;
20409
8cd1b72aa488 support for -chapter option (same semanthics as for dvd://)
nicodvb
parents: 20407
diff changeset
21 extern int dvd_chapter;
8cd1b72aa488 support for -chapter option (same semanthics as for dvd://)
nicodvb
parents: 20407
diff changeset
22 extern int dvd_last_chapter;
20754
da4c2344a97c support for -dvdangle
nicodvb
parents: 20409
diff changeset
23 extern int dvd_angle;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
24 extern char *audio_lang, *dvdsub_lang;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
25
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
26 static struct stream_priv_s {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
27 int track;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
28 char* device;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
29 } 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
30 0,
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
31 NULL
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
32 };
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
33
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
34 #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
35 /// URL definition
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
36 static m_option_t stream_opts_fields[] = {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
37 {"filename", ST_OFF(device), CONF_TYPE_STRING, 0, 0, 0, NULL },
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
38 {"hostname", ST_OFF(track), CONF_TYPE_INT, 0, 0, 0, NULL},
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
39 { NULL, NULL, 0, 0, 0, 0, NULL }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
40 };
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
41 static struct m_struct_st stream_opts = {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
42 "dvd",
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
43 sizeof(struct stream_priv_s),
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
44 &stream_priv_dflts,
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
45 stream_opts_fields
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
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
48 int dvd_nav_still=0; /* are we on a still picture? */
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
49
19892
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
50 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
51
19914
dfd1bb3fc7c0 made file-static new_dvdnav_stream() and dvdnav_stream_read()
nicodvb
parents: 19912
diff changeset
52 static dvdnav_priv_t * new_dvdnav_stream(char * filename) {
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
53 char * title_str;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
54 dvdnav_priv_t *priv;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
55
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
56 if (!filename)
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
57 return NULL;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
58
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
59 if (!(priv=calloc(1,sizeof(dvdnav_priv_t))))
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
60 return NULL;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
61
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
62 if (!(priv->filename=strdup(filename))) {
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
63 free(priv);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
64 return NULL;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
65 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
66
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
67 if(dvdnav_open(&(priv->dvdnav),priv->filename)!=DVDNAV_STATUS_OK)
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
68 {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
69 free(priv->filename);
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
70 free(priv);
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 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
73
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
74 if (!priv->dvdnav) {
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
75 free(priv);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
76 return NULL;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
77 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
78
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
79 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
80 {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
81 int len, event;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
82 char buf[2048];
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
83
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
84 dvdnav_get_next_block(priv->dvdnav,buf,&event,&len);
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
85 dvdnav_sector_search(priv->dvdnav, 0, SEEK_SET);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
86 }
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
87
19454
b9a62caeb61b corrected _very_ misleading comment
nicodvb
parents: 19453
diff changeset
88 /* turn off dvdnav caching */
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
89 dvdnav_set_readahead_flag(priv->dvdnav, 0);
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
90 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
91 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
92 #if 1
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
93 /* report the title?! */
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
94 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
95 mp_msg(MSGT_IDENTIFY, MSGL_INFO,"Title: '%s'\n",title_str);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
96 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
97 #endif
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
98
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
99 //dvdnav_event_clear(priv);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
100
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
101 return priv;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
102 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
103
21219
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
104 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
105 pci_t *pnavpci = NULL;
21219
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
106 dvdnav_highlight_event_t *hlev = &(priv->hlev);
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
107 int btnum;
21198
fbe50a67612a COSMETICS: consistently reformatted after ben's mess
nicodvb
parents: 21197
diff changeset
108
21219
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
109 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
110 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
111
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
112 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
113 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
114 return;
21198
fbe50a67612a COSMETICS: consistently reformatted after ben's mess
nicodvb
parents: 21197
diff changeset
115
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 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
117 hlev->display = display_mode; /* show */
21198
fbe50a67612a COSMETICS: consistently reformatted after ben's mess
nicodvb
parents: 21197
diff changeset
118
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
119 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
120 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
121 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
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 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
124 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
125 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
126 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
127 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
128
a067e7e18b50 support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents: 20851
diff changeset
129 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
130 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
131 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
132 }
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 } 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
135 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
136 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
137 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
138 }
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
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
141 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
142 int event = DVDNAV_NOP;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
143
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
144 if (!len) return -1;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
145 *len=-1;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
146 if (!priv) return -1;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
147 if (!buf) return -1;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
148
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
149 if (dvd_nav_still) {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
150 mp_msg(MSGT_OPEN,MSGL_V, "%s: got a stream_read while I should be asleep!\n",__FUNCTION__);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
151 *len=0;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
152 return -1;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
153 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
154
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
155 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
156 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
157 *len=-1;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
158 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
159 else if (event!=DVDNAV_BLOCK_OK) {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
160 // need to handle certain events internally (like skipping stills)
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
161 switch (event) {
21332
7f53c807d593 feed the content of NAV_PACKET to the demuxer
nicodvb
parents: 21219
diff changeset
162 case DVDNAV_NAV_PACKET:
7f53c807d593 feed the content of NAV_PACKET to the demuxer
nicodvb
parents: 21219
diff changeset
163 return event;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
164 case DVDNAV_STILL_FRAME: {
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
165 dvdnav_still_event_t *still_event = (dvdnav_still_event_t*)(buf);
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
166 //if (priv->started) dvd_nav_still=1;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
167 //else
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
168 dvdnav_still_skip(priv->dvdnav); // don't let dvdnav stall on this image
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
169
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
170 break;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
171 }
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
172 case DVDNAV_HIGHLIGHT: {
21219
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
173 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
174 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
175 }
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
176 case DVDNAV_CELL_CHANGE: {
19453
087d4a916ea3 implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents: 19452
diff changeset
177 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
178 if(ev->pgc_length)
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
179 priv->duration = ev->pgc_length/90;
19453
087d4a916ea3 implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents: 19452
diff changeset
180 break;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
181 }
21538
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
182 case DVDNAV_SPU_CLUT_CHANGE: {
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
183 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
184 priv->spu_set = 1;
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
185 break;
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
186 }
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
187 case DVDNAV_WAIT:
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
188 dvdnav_wait_skip(priv->dvdnav);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
189 break;
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
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
192 *len=0;
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 return event;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
195 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
196
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
197 static void update_title_len(stream_t *stream) {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
198 dvdnav_priv_t *priv = stream->priv;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
199 dvdnav_status_t status;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
200 uint32_t pos = 0, len = 0;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
201
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
202 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
203 if(status == DVDNAV_STATUS_OK && len) {
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
204 stream->end_pos = (off_t) len * 2048;
19892
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
205 stream->seek = seek;
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
206 } else {
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
207 stream->seek = NULL;
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
208 stream->end_pos = 0;
2c361743ce69 don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents: 19851
diff changeset
209 }
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
210 }
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
211
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
212
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
213 static int seek(stream_t *s, off_t newpos) {
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
214 uint32_t pos = 0, len = 0, sector = 0;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
215 dvdnav_priv_t *priv = s->priv;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
216
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
217 if(s->end_pos && newpos > s->end_pos)
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
218 newpos = s->end_pos;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
219 sector = newpos / 2048ULL;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
220 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
221 goto fail;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
222
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
223 s->pos = newpos;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
224
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
225 return 1;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
226
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
227 fail:
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
228 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
229
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
230 return 1;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
231 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
232
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
233 static void stream_dvdnav_close(stream_t *s) {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
234 dvdnav_priv_t *priv = s->priv;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
235 dvdnav_close(priv->dvdnav);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
236 priv->dvdnav = NULL;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
237 free(priv);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
238 }
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
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
241 static int fill_buffer(stream_t *s, char *but, int len)
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
242 {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
243 int event;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
244
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
245 dvdnav_priv_t* priv=s->priv;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
246 len=0;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
247 if(!s->end_pos)
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
248 update_title_len(s);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
249 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
250 {
20810
4d2c03da592c one more deuglification
nicodvb
parents: 20809
diff changeset
251 event=dvdnav_stream_read(priv, s->buffer, &len);
4d2c03da592c one more deuglification
nicodvb
parents: 20809
diff changeset
252 if(event==-1 || len==-1)
20786
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 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
255 return 0;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
256 }
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
257 switch (event) {
21333
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
258 case DVDNAV_STOP:
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
259 case DVDNAV_BLOCK_OK:
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
260 case DVDNAV_NAV_PACKET:
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
261 return len;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
262 case DVDNAV_VTS_CHANGE: {
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
263 int tit = 0, part = 0;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
264 s->end_pos = 0;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
265 update_title_len(s);
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
266 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
267 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
268 dvdnav_get_highlight (priv, 0);
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
269 if(priv->title > 0 && tit != priv->title)
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
270 return 0;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
271 }
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
272 break;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
273 }
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
274 case DVDNAV_CELL_CHANGE: {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
275 if(priv->title > 0 && dvd_last_chapter > 0) {
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
276 int tit=0, part=0;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
277 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
278 return 0;
19893
9440915a76f1 at titleset change call update_title_len() to reset stream->end_pos
nicodvb
parents: 19892
diff changeset
279 }
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
280 }
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
281 break;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
282 }
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
283 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
284 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
285 return len;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
286 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
287
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
288 static int control(stream_t *stream, int cmd, void* arg) {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
289 dvdnav_priv_t* priv=stream->priv;
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
290 int tit, part;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
291
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
292 switch(cmd)
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
293 {
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
294 case STREAM_CTRL_SEEK_TO_CHAPTER:
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
295 {
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
296 int chap = *((unsigned int *)arg)+1;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
297
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
298 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
299 break;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
300 if(dvdnav_part_play(priv->dvdnav, tit, chap) != DVDNAV_STATUS_OK)
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
301 break;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
302 return 1;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
303 }
19477
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
304 case STREAM_CTRL_GET_NUM_CHAPTERS:
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
305 {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
306 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
307 break;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
308 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
309 break;
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
310 if(!part)
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
311 break;
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
312 *((unsigned int *)arg) = part;
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
313 return 1;
2a6520a36e96 implemented STREAM_CTRL_GET_NUM_CHAPTERS
nicodvb
parents: 19454
diff changeset
314 }
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
315 case STREAM_CTRL_GET_CURRENT_CHAPTER:
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
316 {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
317 if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK)
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
318 break;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
319 *((unsigned int *)arg) = part - 1;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
320 return 1;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
321 }
19453
087d4a916ea3 implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents: 19452
diff changeset
322 case STREAM_CTRL_GET_TIME_LENGTH:
087d4a916ea3 implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents: 19452
diff changeset
323 {
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
324 if(priv->duration)
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
325 {
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
326 *((double *)arg) = (double)priv->duration / 1000.0;
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
327 return 1;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
328 }
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
329 break;
19453
087d4a916ea3 implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents: 19452
diff changeset
330 }
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
331 }
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
332
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
333 return STREAM_UNSUPORTED;
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
334 }
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
335
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
336 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
337 struct stream_priv_s* p = (struct stream_priv_s*)opts;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
338 char *filename;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
339 int event,len,tmplen=0;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
340 uint32_t pos, l2;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
341 dvdnav_priv_t *priv;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
342 dvdnav_status_t status;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
343
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
344 if(p->device) filename = p->device;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
345 else if(dvd_device) filename= dvd_device;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
346 else filename = DEFAULT_DVD_DEVICE;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
347 if(!(priv=new_dvdnav_stream(filename))) {
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
348 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,filename);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
349 return STREAM_UNSUPORTED;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
350 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
351
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
352 if(p->track > 0) {
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
353 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
354 mp_msg(MSGT_OPEN,MSGL_FATAL,"dvdnav_stream, invalid chapter range: %d > %d\n", dvd_chapter, dvd_last_chapter);
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
355 return STREAM_UNSUPORTED;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
356 }
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
357 priv->title = p->track;
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
358 if(dvdnav_title_play(priv->dvdnav, p->track) != DVDNAV_STATUS_OK) {
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
359 mp_msg(MSGT_OPEN,MSGL_FATAL,"dvdnav_stream, couldn't select title %d, error '%s'\n", p->track, dvdnav_err_to_string(priv->dvdnav));
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
360 return STREAM_UNSUPORTED;
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
361 }
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
362 if(dvd_chapter > 0)
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
363 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
364 } else if(p->track == -1)
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
365 dvdnav_menu_call(priv->dvdnav, DVD_MENU_Root);
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
366 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
367 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
368 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
369 }
20754
da4c2344a97c support for -dvdangle
nicodvb
parents: 20409
diff changeset
370 if(dvd_angle > 1)
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
371 dvdnav_angle_change(priv->dvdnav, dvd_angle);
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
372
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
373 stream->sector_size = 2048;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
374 stream->flags = STREAM_READ | STREAM_SEEK;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
375 stream->fill_buffer = fill_buffer;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
376 stream->seek = seek;
19443
6e618d1fbb23 implemented seeking to chapter
nicodvb
parents: 19312
diff changeset
377 stream->control = control;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
378 stream->close = stream_dvdnav_close;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
379 stream->type = STREAMTYPE_DVDNAV;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
380 stream->priv=(void*)priv;
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
381 *file_format = DEMUXER_TYPE_MPEG_PS;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
382
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
383 update_title_len(stream);
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
384 if(!stream->pos)
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
385 mp_msg(MSGT_OPEN,MSGL_ERR, "INIT ERROR: %d, couldn't get init pos %s\r\n", status, dvdnav_err_to_string(priv->dvdnav));
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
386
20406
831cd8cbf58a spell fix
nicodvb
parents: 20405
diff changeset
387 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
388
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
389 return STREAM_OK;
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
390 }
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
391
19768
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
392
19774
109e241c0cca in mp_dvdnav_handle_input() assign the currently selected button, shown in the OSD by main()
nicodvb
parents: 19768
diff changeset
393 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
394 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
395 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
396 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
397 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
398 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
399
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
400 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
401 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
402
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
403 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
404 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
405 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
406 break;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
407 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
408 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
409 break;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
410 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
411 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
412 break;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
413 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
414 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
415 break;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
416 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
417 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
418 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
419 break;
19777
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
420 case MP_CMD_DVDNAV_PREVMENU: {
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
421 int title=0, part=0;
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
422
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
423 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
424 if(title) {
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
425 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
426 || 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
427 reset = 1;
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
428 break;
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
429 }
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
430 }
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
431 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
432 reset = 1;
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
433 }
bb1b570ac7c1 permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents: 19774
diff changeset
434 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
435 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
436 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
437 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
438 break;
19912
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
439 case MP_CMD_DVDNAV_MOUSECLICK:
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
440 /*
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
441 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
442 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
443 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
444 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
445 This last call always works well
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
446 */
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
447 status = dvdnav_mouse_activate(nav, pci, priv->mousex, priv->mousey);
19912
3fdb44285fe7 introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents: 19909
diff changeset
448 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
449 default:
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
450 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
451 break;
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
452 }
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
453
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
454 if(status == DVDNAV_STATUS_OK)
20786
50b5a9e01009 COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents: 20754
diff changeset
455 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
456
19768
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
457 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
458 }
1069a634fc92 added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents: 19764
diff changeset
459
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
460 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
461 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
462 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
463 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
464 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
465
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
466 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
467
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
468 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
469 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
470 else *button = -1;
20809
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
471 priv->mousex = x;
ab7e5eb57d52 COSMETICS: renamed dvdnav_priv to priv
nicodvb
parents: 20788
diff changeset
472 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
473 }
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
474
21424
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
475 /**
21600
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
476 * \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
477 * \param stream: - stream pointer
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
478 * \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
479 * \return -1 on error, current subtitle id if successful
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
480 */
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
481 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
482 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
483 int k;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
484 uint8_t format, lg;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
485 uint16_t lang, lcode;;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
486
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
487 #ifdef DVDNAV_FORMAT_AC3
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
488 //this macro is defined only in libdvdnav-cvs
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
489 while(language && strlen(language)>=2) {
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
490 lcode = (language[0] << 8) | (language[1]);
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
491 for(k=0; k<32; k++) {
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
492 lg = dvdnav_get_audio_logical_stream(priv->dvdnav, k);
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
493 if(lg == 0xff) continue;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
494 lang = dvdnav_audio_stream_to_lang(priv->dvdnav, lg);
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
495 if(lang != 0xFFFF && lang == lcode) {
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
496 format = dvdnav_audio_stream_format(priv->dvdnav, lg);
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
497 switch(format) {
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
498 case DVDNAV_FORMAT_AC3:
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
499 return k+128;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
500 case DVDNAV_FORMAT_DTS:
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
501 return k+136;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
502 case DVDNAV_FORMAT_LPCM:
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
503 return k+160;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
504 case DVDNAV_FORMAT_MPEGAUDIO:
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
505 return k;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
506 default:
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
507 return -1;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
508 }
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
509 }
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
510 }
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
511 language += 2;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
512 while(language[0]==',' || language[0]==' ') ++language;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
513 }
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
514 #endif
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
515 return -1;
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
516 }
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
517
21603
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
518 /**
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
519 * \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
520 * \param stream: - stream pointer
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
521 * \param sid: physical subtitle id
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
522 * \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
523 * \return 0 on error, 1 if successful
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
524 */
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
525 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
526 uint8_t lg;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
527 uint16_t lang;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
528 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
529
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
530 if(aid < 0)
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
531 return 0;
21613
8547ae79e74b simplified aid management in dvdnav_lang_from_aid(); patch by Joakim Patte
nicodvb
parents: 21603
diff changeset
532 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
533 if(lg == 0xff) return 0;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
534 lang = dvdnav_audio_stream_to_lang(priv->dvdnav, lg);
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
535 if(lang == 0xffff) return 0;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
536 buf[0] = lang >> 8;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
537 buf[1] = lang & 0xFF;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
538 buf[2] = 0;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
539 return 1;
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
540 }
4bfdaf8bcae5 implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents: 21600
diff changeset
541
21600
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
542
ca8327c8d1fb added dvdnav_aid_from_lang() to support -alang
nicodvb
parents: 21560
diff changeset
543 /**
21424
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
544 * \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
545 * \param stream: - stream pointer
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
546 * \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
547 * \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
548 */
21197
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
549 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
550 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
551 uint8_t format, lg, k;
21204
1ddb1a86e419 support for comma-separated language codes in -slang
nicodvb
parents: 21200
diff changeset
552 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
553
21204
1ddb1a86e419 support for comma-separated language codes in -slang
nicodvb
parents: 21200
diff changeset
554 while(language && strlen(language)>=2) {
21333
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
555 lcode = (language[0] << 8) | (language[1]);
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
556 for(k=0; k<32; k++) {
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
557 lg = dvdnav_get_spu_logical_stream(priv->dvdnav, k);
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
558 if(lg == 0xff) continue;
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
559 lang = dvdnav_spu_stream_to_lang(priv->dvdnav, lg);
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
560 if(lang != 0xFFFF && lang == lcode) {
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
561 return k;
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
562 }
21197
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
563 }
21333
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
564 language += 2;
9e3860c22d99 cosmetical reformatting
nicodvb
parents: 21332
diff changeset
565 while(language[0]==',' || language[0]==' ') ++language;
21204
1ddb1a86e419 support for comma-separated language codes in -slang
nicodvb
parents: 21200
diff changeset
566 }
21197
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
567 return -1;
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
568 }
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
569
21424
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
570 /**
21560
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
571 * \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
572 * \param stream: - stream pointer
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
573 * \param sid: physical subtitle id
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
574 * \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
575 * \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
576 */
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
577 int dvdnav_lang_from_sid(stream_t *stream, int sid, unsigned char *buf) {
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
578 uint8_t lg, k;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
579 uint16_t lang;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
580 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
581 if(sid < 0) return 0;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
582 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
583 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
584 if(lang == 0xffff) return 0;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
585 buf[0] = lang >> 8;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
586 buf[1] = lang & 0xFF;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
587 buf[2] = 0;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
588 return 1;
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
589 }
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
590
a16219e6d656 added function to return the language of the specified subtitle id. Patch by
nicodvb
parents: 21538
diff changeset
591 /**
21424
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
592 * \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
593 * \param stream: - stream pointer
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
594 * \return 0 on error, something meaningful otherwise
3504737c4e96 doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents: 21333
diff changeset
595 */
21197
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
596 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
597 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
598 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
599
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
600 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
601 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
602 if(lg == 0xff) continue;
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
603 n++;
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
604 }
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
605 return n;
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
606 }
7ecd9de03435 added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents: 21193
diff changeset
607
21538
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
608 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
609 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
610 if(!priv->spu_set) return NULL;
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
611 return priv->spu_clut;
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
612 }
c9b6588932b5 export spu palette; part of a patch by Otvos Attila
nicodvb
parents: 21424
diff changeset
613
21219
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
614 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
615 dvdnav_priv_t *priv = (dvdnav_priv_t *) stream->priv;
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
616 dvdnav_highlight_event_t hlev = priv->hlev;
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
617
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
618 hl->sx = hlev.sx;
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
619 hl->sy = hlev.sy;
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
620 hl->ex = hlev.ex;
8258747951d7 keep nav highlight event in dvdnav priv structure
ben
parents: 21204
diff changeset
621 hl->ey = hlev.ey;
21200
c7b5dd2b2291 better nav highlight handling
ben
parents: 21199
diff changeset
622 }
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
623
19302
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
624 stream_info_t stream_info_dvdnav = {
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
625 "DVDNAV stream",
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
626 "null",
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
627 "",
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
628 "",
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
629 open_s,
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
630 { "dvdnav", NULL },
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
631 &stream_opts,
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
632 1 // Urls are an option string
cc4774869fbc renamed dvdnav_stream to stream_dvdnav for consistency
ben
parents:
diff changeset
633 };