annotate libmpdemux/dvdnav_stream.c @ 15533:ddf15d233d58

Do not switch to audio tracks whose codec private data differs from the main audio track's as this will most likely result in messed up audio output. Patch by Michael Behrisch <list () behrisch ! de>
author mosu
date Sat, 21 May 2005 06:50:08 +0000
parents 9391bf60ccdf
children 6ff3379a0862
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5471
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
1 #include "config.h"
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
2
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
3 #ifdef USE_DVDNAV
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
4 #include <dvdnav_internal.h>
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
5 #include <stdlib.h>
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
6 #include <stdio.h>
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
7 #include <unistd.h>
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
8 #include <string.h>
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
9 #include "mp_msg.h"
9380
edfe34c5405d linux->osdep
arpi
parents: 6133
diff changeset
10 #include "../osdep/timer.h"
5471
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
11 #include "../input/input.h"
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
12 #include "stream.h"
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
13 #include "dvdnav_stream.h"
6133
6c4eafe5b079 new spudec.h requires libvo headers, patch by Daniel Hottinger <TheHotti@gmx.ch>
arpi
parents: 5471
diff changeset
14 #include "../libvo/video_out.h"
5471
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
15 #include "../spudec.h"
15518
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
16 #include "../m_option.h"
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
17 #include "../m_struct.h"
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
18
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
19 static struct stream_priv_s {
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
20 int track;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
21 char* device;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
22 } stream_priv_dflts = {
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
23 1,
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
24 NULL
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
25 };
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
26
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
27 #define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f)
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
28 /// URL definition
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
29 static m_option_t stream_opts_fields[] = {
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
30 { NULL, NULL, 0, 0, 0, 0, NULL }
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
31 };
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
32 static struct m_struct_st stream_opts = {
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
33 "dvd",
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
34 sizeof(struct stream_priv_s),
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
35 &stream_priv_dflts,
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
36 stream_opts_fields
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
37 };
5471
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
38
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
39 int dvd_nav_skip_opening=0; /* skip opening stalls? */
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
40 int osd_show_dvd_nav_delay=0; /* count down for dvd nav text on OSD */
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
41 char dvd_nav_text[50]; /* for reporting stuff to OSD */
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
42 int osd_show_dvd_nav_highlight; /* show highlight area */
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
43 int osd_show_dvd_nav_sx; /* start x .... */
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
44 int osd_show_dvd_nav_ex;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
45 int osd_show_dvd_nav_sy;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
46 int osd_show_dvd_nav_ey;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
47 int dvd_nav_still=0; /* are we on a still picture? */
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
48
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
49 dvdnav_priv_t * new_dvdnav_stream(char * filename) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
50 char * title_str;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
51 dvdnav_priv_t *dvdnav_priv;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
52
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
53 if (!filename)
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
54 return NULL;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
55
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
56 if (!(dvdnav_priv=(dvdnav_priv_t*)calloc(1,sizeof(*dvdnav_priv))))
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
57 return NULL;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
58
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
59 if (!(dvdnav_priv->filename=strdup(filename))) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
60 free(dvdnav_priv);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
61 return NULL;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
62 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
63
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
64 if(dvdnav_open(&(dvdnav_priv->dvdnav),dvdnav_priv->filename)!=DVDNAV_STATUS_OK)
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
65 {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
66 free(dvdnav_priv->filename);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
67 free(dvdnav_priv);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
68 return NULL;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
69 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
70
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
71 if (!dvdnav_priv->dvdnav) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
72 free(dvdnav_priv);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
73 return NULL;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
74 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
75
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
76 dvdnav_stream_ignore_timers(dvdnav_priv,dvd_nav_skip_opening);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
77
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
78 /* turn on dvdnav caching */
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
79 dvdnav_set_readahead_flag(dvdnav_priv->dvdnav,1);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
80
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
81 /* report the title?! */
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
82 if (dvdnav_get_title_string(dvdnav_priv->dvdnav,&title_str)==DVDNAV_STATUS_OK) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
83 mp_msg(MSGT_OPEN,MSGL_INFO,"Title: '%s'\n",title_str);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
84 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
85
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
86 return dvdnav_priv;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
87 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
88
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
89 int dvdnav_stream_reset(dvdnav_priv_t * dvdnav_priv) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
90 if (!dvdnav_priv) return 0;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
91
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
92 // if (dvdnav_reset(dvdnav_priv->dvdnav)!=DVDNAV_STATUS_OK)
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
93 return 0;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
94
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
95 dvdnav_priv->started=0;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
96
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
97 return 1;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
98 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
99
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
100 void free_dvdnav_stream(dvdnav_priv_t * dvdnav_priv) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
101 if (!dvdnav_priv) return;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
102
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
103 dvdnav_close(dvdnav_priv->dvdnav);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
104 dvdnav_priv->dvdnav=NULL;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
105 free(dvdnav_priv);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
106 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
107
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
108 void dvdnav_stream_ignore_timers(dvdnav_priv_t * dvdnav_priv, int ignore) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
109 if (!dvdnav_priv) return;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
110
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
111 dvdnav_priv->ignore_timers=ignore;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
112 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
113
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
114 int dvdnav_stream_sleeping(dvdnav_priv_t * dvdnav_priv) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
115 unsigned int now;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
116
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
117 if (!dvdnav_priv) return 0;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
118
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
119 if(dvdnav_priv->sleeping)
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
120 {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
121 now=GetTimer();
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
122 while(dvdnav_priv->sleeping>1 || now<dvdnav_priv->sleep_until) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
123 // printf("%s %u<%u\n",__FUNCTION__,now,dvdnav_priv->sleep_until);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
124 // usec_sleep(1000); /* 1ms granularity */
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
125 return 1;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
126 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
127 dvdnav_still_skip(dvdnav_priv->dvdnav); // continue past...
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
128 dvdnav_priv->sleeping=0;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
129 printf("%s: woke up!\n",__FUNCTION__);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
130 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
131 dvd_nav_still=0;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
132 printf("%s: active\n",__FUNCTION__);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
133 return 0;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
134 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
135
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
136 void dvdnav_stream_sleep(dvdnav_priv_t * dvdnav_priv, int seconds) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
137 if (!dvdnav_priv) return;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
138
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
139 if (!dvdnav_priv->started) return;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
140
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
141 dvdnav_priv->sleeping=0;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
142 switch (seconds) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
143 case 0:
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
144 return;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
145 case 0xff:
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
146 printf( "Sleeping indefinately\n" );
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
147 dvdnav_priv->sleeping=2;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
148 break;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
149 default:
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
150 printf( "Sleeping %d sec(s)\n", seconds );
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
151 dvdnav_priv->sleep_until = GetTimer();// + seconds*1000000;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
152 dvdnav_priv->sleeping=1;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
153 break;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
154 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
155 //if (dvdnav_priv->started) dvd_nav_still=1;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
156 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
157
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
158 void dvdnav_stream_add_event(dvdnav_priv_t* dvdnav_priv, int event, unsigned char *buf, int len) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
159 //printf("%s: %d\n",__FUNCTION__,event);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
160
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
161 dvdnav_event_t * dvdnav_event;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
162 mp_cmd_t * cmd;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
163
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
164 if (!dvdnav_priv->started) return;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
165
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
166 if (!(dvdnav_event=(dvdnav_event_t*)calloc(1,sizeof(*dvdnav_event)))) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
167 printf("%s: dvdnav_event: out of memory!\n",__FUNCTION__);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
168 return;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
169 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
170 dvdnav_event->event=event;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
171 dvdnav_event->details=calloc(1,len);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
172 memcpy(dvdnav_event->details,buf,len);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
173 dvdnav_event->len=len;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
174
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
175 if (!(cmd = (mp_cmd_t*)calloc(1,sizeof(*cmd)))) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
176 printf("%s: mp_cmd_t: out of memory!\n",__FUNCTION__);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
177 free(dvdnav_event->details);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
178 free(dvdnav_event);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
179 return;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
180 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
181 cmd->id=MP_CMD_DVDNAV_EVENT; // S+event;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
182 cmd->name=strdup("dvdnav_event"); // FIXME: do I really need a 'name'?
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
183 cmd->nargs=1;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
184 cmd->args[0].v.v=dvdnav_event;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
185
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
186 mp_input_queue_cmd(cmd);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
187 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
188
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
189 void dvdnav_stream_read(dvdnav_priv_t * dvdnav_priv, unsigned char *buf, int *len) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
190 int event = DVDNAV_NOP;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
191
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
192 if (!len) return;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
193 *len=-1;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
194 if (!dvdnav_priv) return;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
195 if (!buf) return;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
196
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
197 if (dvd_nav_still) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
198 printf("%s: got a stream_read while I should be asleep!\n",__FUNCTION__);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
199 *len=0;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
200 return;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
201 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
202
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
203 if (dvdnav_get_next_block(dvdnav_priv->dvdnav,buf,&event,len)!=DVDNAV_STATUS_OK) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
204 printf( "Error getting next block from DVD (%s)\n",dvdnav_err_to_string(dvdnav_priv->dvdnav) );
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
205 *len=-1;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
206 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
207 else if (event!=DVDNAV_BLOCK_OK) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
208
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
209 // need to handle certain events internally (like skipping stills)
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
210 switch (event) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
211 case DVDNAV_STILL_FRAME: {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
212 dvdnav_still_event_t *still_event = (dvdnav_still_event_t*)(buf);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
213
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
214 printf("************************************************************ STILL \n");
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
215
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
216 //if (dvdnav_priv->started) dvd_nav_still=1;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
217 //else
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
218 dvdnav_still_skip(dvdnav_priv->dvdnav); // don't let dvdnav stall on this image
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
219
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
220 break;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
221 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
222 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
223
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
224 // got an event, repeat the read
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
225 dvdnav_stream_add_event(dvdnav_priv,event,buf,*len);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
226 *len=0;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
227 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
228 // printf("%s: got %d\n",__FUNCTION__,*len);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
229 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
230
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
231 void dvdnav_stream_fullstart(dvdnav_priv_t * dvdnav_priv) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
232 if (dvdnav_priv && !dvdnav_priv->started) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
233 dvdnav_stream_reset(dvdnav_priv);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
234 dvdnav_priv->started=1;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
235 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
236 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
237
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
238 unsigned int * dvdnav_stream_get_palette(dvdnav_priv_t * dvdnav_priv) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
239 if (!dvdnav_priv) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
240 printf("%s: NULL dvdnav_priv\n",__FUNCTION__);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
241 return NULL;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
242 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
243 if (!dvdnav_priv->dvdnav) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
244 printf("%s: NULL dvdnav_priv->dvdnav\n",__FUNCTION__);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
245 return NULL;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
246 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
247 if (!dvdnav_priv->dvdnav->vm) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
248 printf("%s: NULL dvdnav_priv->dvdnav->vm\n",__FUNCTION__);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
249 return NULL;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
250 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
251 if (!dvdnav_priv->dvdnav->vm->state.pgc) {
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
252 printf("%s: NULL dvdnav_priv->dvdnav->vm->state.pgc\n",__FUNCTION__);
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
253 return NULL;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
254 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
255 return dvdnav_priv->dvdnav->vm->state.pgc->palette;
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
256 }
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
257
15518
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
258
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
259 static int seek(stream_t *s, off_t newpos) {
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
260 if(newpos==0) {
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
261 if(dvdnav_stream_reset((dvdnav_priv_t*)s->priv))
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
262 s->pos=0;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
263 }
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
264 if(newpos!=s->pos)
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
265 mp_msg(MSGT_STREAM,MSGL_INFO,"Cannot seek in DVDNAV streams yet!\n");
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
266
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
267 return 1;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
268 }
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
269
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
270 static void stream_dvd_close(stream_t *s) {
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
271 dvd_close(s->priv);
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
272 }
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
273
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
274 static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
275 struct stream_priv_s* p = (struct stream_priv_s*)opts;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
276 char *filename, *name;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
277 int event,len,tmplen=0;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
278 dvdnav_priv_t *dvdnav_priv;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
279
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
280 mp_msg(MSGT_OPEN,MSGL_INFO,"URL: %s\n", filename);
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
281 filename = strdup(stream->url);
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
282 name = (filename[9] == '\0') ? NULL : filename + 9;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
283 if(!name) name=DEFAULT_DVD_DEVICE;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
284 if(!(dvdnav_priv=new_dvdnav_stream(name))) {
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
285 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,name);
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
286 return STREAM_UNSUPORTED;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
287 }
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
288
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
289 stream->sector_size = 2048;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
290 stream->flags = STREAM_READ | STREAM_SEEK;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
291 stream->fill_buffer = fill_buffer;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
292 stream->seek = seek;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
293 stream->close = stream_dvd_close;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
294 stream->type = STREAMTYPE_DVDNAV;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
295 stream->priv=(void*)dvdnav_priv;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
296
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
297 return STREAM_OK;
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
298 }
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
299
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
300 stream_info_t stream_info_dvdnav = {
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
301 "DVDNAV stream",
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
302 "null",
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
303 "",
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
304 "",
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
305 open_s,
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
306 { "dvdnav", NULL },
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
307 &stream_opts,
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
308 1 // Urls are an option string
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
309 };
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents: 9380
diff changeset
310
5471
348c7d83e710 dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents:
diff changeset
311 #endif /* USE_DVDNAV */