annotate stream/stream_cdda.c @ 35429:3a9048421524

Create new header file gui.h. This is for declarations and definitions used throughout the GUI which are internal ones and thus shall not appear in interface.h.
author ib
date Fri, 30 Nov 2012 11:14:30 +0000
parents bdc9f135ac26
children b5abdfe9bc61
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30426
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
1 /*
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
2 * This file is part of MPlayer.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
3 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
5 * it under the terms of the GNU General Public License as published by
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
7 * (at your option) any later version.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
8 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
12 * GNU General Public License for more details.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
13 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
14 * You should have received a copy of the GNU General Public License along
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
17 */
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29401
diff changeset
18
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
19 #include "config.h"
31440
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
20 #ifndef CONFIG_LIBCDIO
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
21 #include <cdda_interface.h>
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
22 #include <cdda_paranoia.h>
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
23 #else
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
24 #include <cdio/cdda.h>
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
25 #include <cdio/paranoia.h>
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
26 #endif
21418
cc5b0c53b263 Move system headers before libavutil headers to work around build issues on
diego
parents: 21372
diff changeset
27 #include <stdio.h>
cc5b0c53b263 Move system headers before libavutil headers to work around build issues on
diego
parents: 21372
diff changeset
28 #include <stdlib.h>
cc5b0c53b263 Move system headers before libavutil headers to work around build issues on
diego
parents: 21372
diff changeset
29
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
30 #include "stream.h"
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16967
diff changeset
31 #include "m_option.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16967
diff changeset
32 #include "m_struct.h"
21372
1767c271d710 Remove bswap.h, use libavutil/bswap.h instead.
diego
parents: 20195
diff changeset
33 #include "libavutil/common.h"
21507
fa99b3d31d13 Hack around libavutil/bswap.h compilation problems due to always_inline undefined.
reimar
parents: 21479
diff changeset
34 #include "mpbswap.h"
19312
ab8d6b6deb63 proper inclusion of demuxer.h (including libmpdemux in Makefile only was to make previous split easier)
ben
parents: 19272
diff changeset
35 #include "libmpdemux/demuxer.h"
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
36
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
37 #include "cdd.h"
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
38
16967
32e2c59c8e86 [TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents: 16940
diff changeset
39 #include "mp_msg.h"
32e2c59c8e86 [TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents: 16940
diff changeset
40 #include "help_mp.h"
32e2c59c8e86 [TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents: 16940
diff changeset
41
16940
7eb9b500dd7f save us from #ifndef hell
faust3
parents: 16935
diff changeset
42 #ifndef CD_FRAMESIZE_RAW
7eb9b500dd7f save us from #ifndef hell
faust3
parents: 16935
diff changeset
43 #define CD_FRAMESIZE_RAW CDIO_CD_FRAMESIZE_RAW
7eb9b500dd7f save us from #ifndef hell
faust3
parents: 16935
diff changeset
44 #endif
7eb9b500dd7f save us from #ifndef hell
faust3
parents: 16935
diff changeset
45
7eb9b500dd7f save us from #ifndef hell
faust3
parents: 16935
diff changeset
46
31440
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
47 typedef struct {
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
48 #ifndef CONFIG_LIBCDIO
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
49 cdrom_drive* cd;
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
50 cdrom_paranoia* cdp;
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
51 #else
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
52 cdrom_drive_t* cd;
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
53 cdrom_paranoia_t* cdp;
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
54 #endif
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
55 int sector;
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
56 int start_sector;
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
57 int end_sector;
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
58 cd_info_t *cd_info;
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
59 } cdda_priv;
01340407202e Move cdda_priv structure to the only place it is used.
diego
parents: 31433
diff changeset
60
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
61 static struct cdda_params {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
62 int speed;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
63 int paranoia_mode;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
64 char* generic_dev;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
65 int sector_size;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
66 int search_overlap;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
67 int toc_bias;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
68 int toc_offset;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
69 int no_skip;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
70 char* device;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
71 m_span_t span;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
72 } cdda_dflts = {
34370
a958ea863ee1 Fix cdda speed default value, range and use more robust condition.
reimar
parents: 33469
diff changeset
73 0,
16914
701af802aee7 set cdda paranoia default to 0 since e.g. cdda://2 breaks otherwise.
reimar
parents: 16635
diff changeset
74 0,
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
75 NULL,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
76 0,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
77 -1,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
78 0,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
79 0,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
80 0,
10591
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
81 NULL,
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
82 { 0, 0 }
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
83 };
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
84
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
85 #define ST_OFF(f) M_ST_OFF(struct cdda_params,f)
25242
371a40dcc1cc stream_opts arrays should be const
reimar
parents: 25241
diff changeset
86 static const m_option_t cdda_params_fields[] = {
34370
a958ea863ee1 Fix cdda speed default value, range and use more robust condition.
reimar
parents: 33469
diff changeset
87 { "speed", ST_OFF(speed), CONF_TYPE_INT, M_OPT_RANGE,0,100, NULL },
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
88 { "paranoia", ST_OFF(paranoia_mode), CONF_TYPE_INT,M_OPT_RANGE, 0, 2, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
89 { "generic-dev", ST_OFF(generic_dev), CONF_TYPE_STRING, 0, 0, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
90 { "sector-size", ST_OFF(sector_size), CONF_TYPE_INT, M_OPT_RANGE,1,100, NULL },
34371
a4dd7151526b Do not call paranoia_overlapset with 0, it actually causes cdparanoia to just hang.
reimar
parents: 34370
diff changeset
91 { "overlap", ST_OFF(search_overlap), CONF_TYPE_INT, M_OPT_RANGE,-1,75, NULL },
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
92 { "toc-bias", ST_OFF(toc_bias), CONF_TYPE_INT, 0, 0, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
93 { "toc-offset", ST_OFF(toc_offset), CONF_TYPE_INT, 0, 0, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
94 { "noskip", ST_OFF(no_skip), CONF_TYPE_FLAG, 0 , 0, 1, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
95 { "skip", ST_OFF(no_skip), CONF_TYPE_FLAG, 0 , 1, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
96 { "device", ST_OFF(device), CONF_TYPE_STRING, 0, 0, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
97 { "span", ST_OFF(span), CONF_TYPE_OBJ_PARAMS, 0, 0, 0, &m_span_params_def },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
98 /// For url parsing
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
99 { "hostname", ST_OFF(span), CONF_TYPE_OBJ_PARAMS, 0, 0, 0, &m_span_params_def },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
100 { "port", ST_OFF(speed), CONF_TYPE_INT, M_OPT_RANGE,1,100, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
101 { "filename", ST_OFF(device), CONF_TYPE_STRING, 0, 0, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
102 {NULL, NULL, 0, 0, 0, 0, NULL}
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
103 };
25691
68015115f63a stream_opts should be const
reimar
parents: 25410
diff changeset
104 static const struct m_struct_st stream_opts = {
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
105 "cdda",
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
106 sizeof(struct cdda_params),
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
107 &cdda_dflts,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
108 cdda_params_fields
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
109 };
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
110
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
111 /// We keep these options but now they set the defaults
25241
bb7c65f2a289 Make m_option_t arrays referenced by cfg-common.h const
reimar
parents: 25211
diff changeset
112 const m_option_t cdda_opts[] = {
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
113 { "speed", &cdda_dflts.speed, CONF_TYPE_INT, M_OPT_RANGE,1,100, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
114 { "paranoia", &cdda_dflts.paranoia_mode, CONF_TYPE_INT,M_OPT_RANGE, 0, 2, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
115 { "generic-dev", &cdda_dflts.generic_dev, CONF_TYPE_STRING, 0, 0, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
116 { "sector-size", &cdda_dflts.sector_size, CONF_TYPE_INT, M_OPT_RANGE,1,100, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
117 { "overlap", &cdda_dflts.search_overlap, CONF_TYPE_INT, M_OPT_RANGE,0,75, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
118 { "toc-bias", &cdda_dflts.toc_bias, CONF_TYPE_INT, 0, 0, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
119 { "toc-offset", &cdda_dflts.toc_offset, CONF_TYPE_INT, 0, 0, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
120 { "noskip", &cdda_dflts.no_skip, CONF_TYPE_FLAG, 0 , 0, 1, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
121 { "skip", &cdda_dflts.no_skip, CONF_TYPE_FLAG, 0 , 1, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
122 { "device", &cdda_dflts.device, CONF_TYPE_STRING, 0, 0, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
123 { "span", &cdda_dflts.span, CONF_TYPE_OBJ_PARAMS, 0, 0, 0, &m_span_params_def },
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
124 {NULL, NULL, 0, 0, 0, 0, NULL}
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
125 };
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
126
31445
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
127 #ifndef CONFIG_LIBCDIO
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
128 static void cdparanoia_callback(long inpos, int function) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
129 #else
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
130 static void cdparanoia_callback(long int inpos, paranoia_cb_mode_t function) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
131 #endif
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
132 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
133
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
134 static int fill_buffer(stream_t* s, char* buffer, int max_len) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
135 cdda_priv* p = (cdda_priv*)s->priv;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
136 cd_track_t *cd_track;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
137 int16_t * buf;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
138 int i;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
139
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
140 if((p->sector < p->start_sector) || (p->sector > p->end_sector)) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
141 s->eof = 1;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
142 return 0;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
143 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
144
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
145 buf = paranoia_read(p->cdp,cdparanoia_callback);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
146 if (!buf)
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
147 return 0;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
148
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
149 #if HAVE_BIGENDIAN
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
150 for(i=0;i<CD_FRAMESIZE_RAW/2;i++)
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
151 buf[i]=le2me_16(buf[i]);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
152 #endif
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
153
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
154 p->sector++;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
155 memcpy(buffer,buf,CD_FRAMESIZE_RAW);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
156
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
157 for(i=0;i<p->cd->tracks;i++){
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
158 if(p->cd->disc_toc[i].dwStartSector==p->sector-1) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
159 cd_track = cd_info_get_track(p->cd_info, i+1);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
160 //printf("Track %d, sector=%d\n", i, p->sector-1);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
161 if( cd_track!=NULL ) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
162 mp_msg(MSGT_SEEK, MSGL_INFO, "\n%s\n", cd_track->name);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
163 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDA_TRACK=%d\n", cd_track->track_nb);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
164 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
165 break;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
166 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
167 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
168
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
169
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
170 return CD_FRAMESIZE_RAW;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
171 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
172
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
173 static int seek(stream_t* s,off_t newpos) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
174 cdda_priv* p = (cdda_priv*)s->priv;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
175 cd_track_t *cd_track;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
176 int sec;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
177 int current_track=0, seeked_track=0;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
178 int seek_to_track = 0;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
179 int i;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
180
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
181 s->pos = newpos;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
182 sec = s->pos/CD_FRAMESIZE_RAW;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
183 if (s->pos < 0 || sec > p->end_sector) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
184 s->eof = 1;
34374
09f2662d11cb cdda: set position to an actual EOF position when we set EOF.
reimar
parents: 34372
diff changeset
185 p->sector = p->end_sector + 1;
31445
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
186 return 0;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
187 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
188
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
189 //printf("pos: %d, sec: %d ## %d\n", (int)s->pos, (int)sec, CD_FRAMESIZE_RAW);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
190 //printf("sector: %d new: %d\n", p->sector, sec );
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
191
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
192 for(i=0;i<p->cd->tracks;i++){
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
193 // printf("trk #%d: %d .. %d\n",i,p->cd->disc_toc[i].dwStartSector,p->cd->disc_toc[i+1].dwStartSector);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
194 if( p->sector>=p->cd->disc_toc[i].dwStartSector && p->sector<p->cd->disc_toc[i+1].dwStartSector ) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
195 current_track = i;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
196 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
197 if( sec>=p->cd->disc_toc[i].dwStartSector && sec<p->cd->disc_toc[i+1].dwStartSector ) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
198 seeked_track = i;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
199 seek_to_track = sec == p->cd->disc_toc[i].dwStartSector;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
200 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
201 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
202 //printf("current: %d, seeked: %d\n", current_track, seeked_track);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
203 if (current_track != seeked_track && !seek_to_track) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
204 //printf("Track %d, sector=%d\n", seeked_track, sec);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
205 cd_track = cd_info_get_track(p->cd_info, seeked_track+1);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
206 if( cd_track!=NULL ) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
207 mp_msg(MSGT_SEEK, MSGL_INFO, "\n%s\n", cd_track->name);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
208 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDA_TRACK=%d\n", cd_track->track_nb);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
209 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
210
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
211 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
212 #if 0
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
213 if(sec < p->start_sector)
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
214 sec = p->start_sector;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
215 else if(sec > p->end_sector)
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
216 sec = p->end_sector;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
217 #endif
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
218
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
219 p->sector = sec;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
220 // s->pos = sec*CD_FRAMESIZE_RAW;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
221
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
222 //printf("seek: %d, sec: %d\n", (int)s->pos, sec);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
223 paranoia_seek(p->cdp,sec,SEEK_SET);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
224 return 1;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
225 }
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
226
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
227 static void close_cdda(stream_t* s) {
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
228 cdda_priv* p = (cdda_priv*)s->priv;
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
229 paranoia_free(p->cdp);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
230 cdda_close(p->cd);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
231 cd_info_free(p->cd_info);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
232 free(p);
872a1ef8b43b cosmetics: Reorder functions to avoid forward declarations.
diego
parents: 31443
diff changeset
233 }
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
234
25410
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
235 static int get_track_by_sector(cdda_priv *p, unsigned int sector) {
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
236 int i;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
237 for (i = p->cd->tracks; i >= 0 ; --i)
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
238 if (p->cd->disc_toc[i].dwStartSector <= sector)
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
239 break;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
240 return i;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
241 }
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
242
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
243 static int control(stream_t *stream, int cmd, void *arg) {
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
244 cdda_priv* p = stream->priv;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
245 switch(cmd) {
34386
206264c532f5 Add new stream control command STREAM_CTRL_GET_NUM_TITLES.
ib
parents: 34384
diff changeset
246 case STREAM_CTRL_GET_NUM_TITLES:
206264c532f5 Add new stream control command STREAM_CTRL_GET_NUM_TITLES.
ib
parents: 34384
diff changeset
247 {
206264c532f5 Add new stream control command STREAM_CTRL_GET_NUM_TITLES.
ib
parents: 34384
diff changeset
248 *(unsigned int *)arg = p->cd->tracks;
206264c532f5 Add new stream control command STREAM_CTRL_GET_NUM_TITLES.
ib
parents: 34384
diff changeset
249 return STREAM_OK;
206264c532f5 Add new stream control command STREAM_CTRL_GET_NUM_TITLES.
ib
parents: 34384
diff changeset
250 }
25410
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
251 case STREAM_CTRL_GET_NUM_CHAPTERS:
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
252 {
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
253 int start_track = get_track_by_sector(p, p->start_sector);
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
254 int end_track = get_track_by_sector(p, p->end_sector);
34407
614c99d4cbbf Add checks for errors in stream_cdda's get_track_by_sector().
ib
parents: 34386
diff changeset
255 if (start_track == -1 || end_track == -1) return STREAM_ERROR;
25410
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
256 *(unsigned int *)arg = end_track + 1 - start_track;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
257 return STREAM_OK;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
258 }
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
259 case STREAM_CTRL_SEEK_TO_CHAPTER:
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
260 {
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
261 int r;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
262 unsigned int track = *(unsigned int *)arg;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
263 int start_track = get_track_by_sector(p, p->start_sector);
34372
622b7e95695a Fail if trying to seek beyond the last chapter, not just if it is beyond the end of the disc.
reimar
parents: 34371
diff changeset
264 int end_track = get_track_by_sector(p, p->end_sector);
25410
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
265 int seek_sector;
34407
614c99d4cbbf Add checks for errors in stream_cdda's get_track_by_sector().
ib
parents: 34386
diff changeset
266 if (start_track == -1 || end_track == -1) return STREAM_ERROR;
25410
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
267 track += start_track;
34372
622b7e95695a Fail if trying to seek beyond the last chapter, not just if it is beyond the end of the disc.
reimar
parents: 34371
diff changeset
268 if (track > end_track) {
34374
09f2662d11cb cdda: set position to an actual EOF position when we set EOF.
reimar
parents: 34372
diff changeset
269 seek(stream, (p->end_sector + 1) * CD_FRAMESIZE_RAW);
34489
bdc9f135ac26 Fix seeking beyond EOF in stream_cdda to work with cache.
reimar
parents: 34407
diff changeset
270 // seeking beyond EOF should not be an error,
bdc9f135ac26 Fix seeking beyond EOF in stream_cdda to work with cache.
reimar
parents: 34407
diff changeset
271 // the cache cannot handle changing stream pos and
bdc9f135ac26 Fix seeking beyond EOF in stream_cdda to work with cache.
reimar
parents: 34407
diff changeset
272 // returning error.
bdc9f135ac26 Fix seeking beyond EOF in stream_cdda to work with cache.
reimar
parents: 34407
diff changeset
273 return STREAM_OK;
25410
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
274 }
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
275 seek_sector = track <= 0 ? p->start_sector
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
276 : p->cd->disc_toc[track].dwStartSector;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
277 r = seek(stream, seek_sector * CD_FRAMESIZE_RAW);
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
278 if (r)
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
279 return STREAM_OK;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
280 break;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
281 }
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
282 case STREAM_CTRL_GET_CURRENT_CHAPTER:
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
283 {
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
284 int start_track = get_track_by_sector(p, p->start_sector);
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
285 int cur_track = get_track_by_sector(p, p->sector);
34407
614c99d4cbbf Add checks for errors in stream_cdda's get_track_by_sector().
ib
parents: 34386
diff changeset
286 if (start_track == -1 || cur_track == -1) return STREAM_ERROR;
25410
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
287 *(unsigned int *)arg = cur_track - start_track;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
288 return STREAM_OK;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
289 }
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
290 }
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
291 return STREAM_UNSUPPORTED;
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
292 }
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
293
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
294 static int open_cdda(stream_t *st,int m, void* opts, int* file_format) {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
295 struct cdda_params* p = (struct cdda_params*)opts;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
296 int mode = p->paranoia_mode;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
297 int offset = p->toc_offset;
27391
1d2faa1020fb Rename a bunch of miscellaneous preprocessor directives.
diego
parents: 25691
diff changeset
298 #ifndef CONFIG_LIBCDIO
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
299 cdrom_drive* cdd = NULL;
16935
60bd6aeed405 make it optionally possible to compile MPlayer with libcdio instead of libcdparanoia
faust3
parents: 16926
diff changeset
300 #else
60bd6aeed405 make it optionally possible to compile MPlayer with libcdio instead of libcdparanoia
faust3
parents: 16926
diff changeset
301 cdrom_drive_t* cdd = NULL;
60bd6aeed405 make it optionally possible to compile MPlayer with libcdio instead of libcdparanoia
faust3
parents: 16926
diff changeset
302 #endif
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
303 cdda_priv* priv;
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
304 cd_info_t *cd_info,*cddb_info = NULL;
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
305 unsigned int audiolen=0;
16926
24c52f2c3aa9 fix cdda://n syntax: do not hang when n > nr_tracks and play only track n,
reimar
parents: 16914
diff changeset
306 int last_track;
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
307 int i;
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
308 char *xmcd_file = NULL;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
309
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
310 if(m != STREAM_READ) {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
311 m_struct_free(&stream_opts,opts);
24257
d261f5109660 cosmetics: typo fix UNSUPORTED --> UNSUPPORTED
diego
parents: 21507
diff changeset
312 return STREAM_UNSUPPORTED;
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
313 }
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
314
10591
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
315 if(!p->device) {
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
316 if (cdrom_device)
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
317 p->device = strdup(cdrom_device);
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
318 else
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
319 p->device = strdup(DEFAULT_CDROM_DEVICE);
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
320 }
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
321
27391
1d2faa1020fb Rename a bunch of miscellaneous preprocessor directives.
diego
parents: 25691
diff changeset
322 #ifdef CONFIG_CDDB
16524
83d101e1bedb Prints the number of tracks and MSF length for each track of an audio CD,
gpoirier
parents: 11652
diff changeset
323 // cdd_identify returns -1 if it cannot read the TOC,
83d101e1bedb Prints the number of tracks and MSF length for each track of an audio CD,
gpoirier
parents: 11652
diff changeset
324 // in which case there is no point in calling cddb_resolve
83d101e1bedb Prints the number of tracks and MSF length for each track of an audio CD,
gpoirier
parents: 11652
diff changeset
325 if(cdd_identify(p->device) >= 0 && strncmp(st->url,"cddb",4) == 0) {
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
326 i = cddb_resolve(p->device, &xmcd_file);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
327 if(i == 0) {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
328 cddb_info = cddb_parse_xmcd(xmcd_file);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
329 free(xmcd_file);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
330 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
331 }
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
332 #endif
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
333
27391
1d2faa1020fb Rename a bunch of miscellaneous preprocessor directives.
diego
parents: 25691
diff changeset
334 #ifndef CONFIG_LIBCDIO
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
335 if(p->generic_dev)
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
336 cdd = cdda_identify_scsi(p->generic_dev,p->device,0,NULL);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
337 else
16935
60bd6aeed405 make it optionally possible to compile MPlayer with libcdio instead of libcdparanoia
faust3
parents: 16926
diff changeset
338 #endif
8958
56bf90cefb10 Removed the hardcoded /dev/cdrom for NetBSD and added an work around
bertrand
parents: 8609
diff changeset
339 #if defined(__NetBSD__)
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
340 cdd = cdda_identify_scsi(p->device,p->device,0,NULL);
8958
56bf90cefb10 Removed the hardcoded /dev/cdrom for NetBSD and added an work around
bertrand
parents: 8609
diff changeset
341 #else
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
342 cdd = cdda_identify(p->device,0,NULL);
8958
56bf90cefb10 Removed the hardcoded /dev/cdrom for NetBSD and added an work around
bertrand
parents: 8609
diff changeset
343 #endif
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
344
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
345 if(!cdd) {
16967
32e2c59c8e86 [TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents: 16940
diff changeset
346 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_MPDEMUX_CDDA_CantOpenCDDADevice);
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
347 m_struct_free(&stream_opts,opts);
18225
1e1398e6bdf9 resource leak fix.
gpoirier
parents: 17012
diff changeset
348 free(cddb_info);
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
349 return STREAM_ERROR;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
350 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
351
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
352 cdda_verbose_set(cdd, CDDA_MESSAGE_FORGETIT, CDDA_MESSAGE_FORGETIT);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
353
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
354 if(p->sector_size) {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
355 cdd->nsectors = p->sector_size;
27391
1d2faa1020fb Rename a bunch of miscellaneous preprocessor directives.
diego
parents: 25691
diff changeset
356 #ifndef CONFIG_LIBCDIO
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
357 cdd->bigbuff = p->sector_size * CD_FRAMESIZE_RAW;
16935
60bd6aeed405 make it optionally possible to compile MPlayer with libcdio instead of libcdparanoia
faust3
parents: 16926
diff changeset
358 #endif
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
359 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
360
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
361 if(cdda_open(cdd) != 0) {
16967
32e2c59c8e86 [TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents: 16940
diff changeset
362 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_MPDEMUX_CDDA_CantOpenDisc);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
363 cdda_close(cdd);
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
364 m_struct_free(&stream_opts,opts);
18225
1e1398e6bdf9 resource leak fix.
gpoirier
parents: 17012
diff changeset
365 free(cddb_info);
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
366 return STREAM_ERROR;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
367 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
368
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
369 cd_info = cd_info_new();
16967
32e2c59c8e86 [TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents: 16940
diff changeset
370 mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_MPDEMUX_CDDA_AudioCDFoundWithNTracks,cdda_tracks(cdd));
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
371 for(i=0;i<cdd->tracks;i++) {
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
372 char track_name[80];
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
373 long sec=cdda_track_firstsector(cdd,i+1);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
374 long off=cdda_track_lastsector(cdd,i+1)-sec+1;
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
375
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
376 sprintf(track_name, "Track %d", i+1);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
377 cd_info_add_track(cd_info, track_name, i+1, (unsigned int)(off/(60*75)), (unsigned int)((off/75)%60), (unsigned int)(off%75), sec, off );
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
378 audiolen += off;
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
379 }
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
380 cd_info->min = (unsigned int)(audiolen/(60*75));
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
381 cd_info->sec = (unsigned int)((audiolen/75)%60);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
382 cd_info->msec = (unsigned int)(audiolen%75);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
383
19062
83c3afeab35d drops casts from void * on malloc/calloc from libmpdemux code
reynaldo
parents: 18922
diff changeset
384 priv = malloc(sizeof(cdda_priv));
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
385 memset(priv, 0, sizeof(cdda_priv));
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
386 priv->cd = cdd;
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
387 priv->cd_info = cd_info;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
388
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
389 if(p->toc_bias)
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
390 offset -= cdda_track_firstsector(cdd,1);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
391
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
392 if(offset) {
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
393 int i;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
394 for(i = 0 ; i < cdd->tracks + 1 ; i++)
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
395 cdd->disc_toc[i].dwStartSector += offset;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
396 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
397
34370
a958ea863ee1 Fix cdda speed default value, range and use more robust condition.
reimar
parents: 33469
diff changeset
398 if(p->speed > 0)
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
399 cdda_speed_set(cdd,p->speed);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
400
16926
24c52f2c3aa9 fix cdda://n syntax: do not hang when n > nr_tracks and play only track n,
reimar
parents: 16914
diff changeset
401 last_track = cdda_tracks(cdd);
24c52f2c3aa9 fix cdda://n syntax: do not hang when n > nr_tracks and play only track n,
reimar
parents: 16914
diff changeset
402 if (p->span.start > last_track) p->span.start = last_track;
24c52f2c3aa9 fix cdda://n syntax: do not hang when n > nr_tracks and play only track n,
reimar
parents: 16914
diff changeset
403 if (p->span.end < p->span.start) p->span.end = p->span.start;
24c52f2c3aa9 fix cdda://n syntax: do not hang when n > nr_tracks and play only track n,
reimar
parents: 16914
diff changeset
404 if (p->span.end > last_track) p->span.end = last_track;
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
405 if(p->span.start)
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
406 priv->start_sector = cdda_track_firstsector(cdd,p->span.start);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
407 else
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
408 priv->start_sector = cdda_disc_firstsector(cdd);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
409
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
410 if(p->span.end) {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
411 priv->end_sector = cdda_track_lastsector(cdd,p->span.end);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
412 } else
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
413 priv->end_sector = cdda_disc_lastsector(cdd);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
414
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
415 priv->cdp = paranoia_init(cdd);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
416 if(priv->cdp == NULL) {
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
417 cdda_close(cdd);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
418 free(priv);
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
419 cd_info_free(cd_info);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
420 m_struct_free(&stream_opts,opts);
18225
1e1398e6bdf9 resource leak fix.
gpoirier
parents: 17012
diff changeset
421 free(cddb_info);
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
422 return STREAM_ERROR;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
423 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
424
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
425 if(mode == 0)
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
426 mode = PARANOIA_MODE_DISABLE;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
427 else if(mode == 1)
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
428 mode = PARANOIA_MODE_OVERLAP;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
429 else
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
430 mode = PARANOIA_MODE_FULL;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
431
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
432 if(p->no_skip)
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
433 mode |= PARANOIA_MODE_NEVERSKIP;
34379
010725c3b6c8 Allow PARANOIA_MODE_FULL with skipping.
ib
parents: 34374
diff changeset
434 else
010725c3b6c8 Allow PARANOIA_MODE_FULL with skipping.
ib
parents: 34374
diff changeset
435 mode &= ~PARANOIA_MODE_NEVERSKIP;
010725c3b6c8 Allow PARANOIA_MODE_FULL with skipping.
ib
parents: 34374
diff changeset
436
34371
a4dd7151526b Do not call paranoia_overlapset with 0, it actually causes cdparanoia to just hang.
reimar
parents: 34370
diff changeset
437 if(p->search_overlap > 0)
a4dd7151526b Do not call paranoia_overlapset with 0, it actually causes cdparanoia to just hang.
reimar
parents: 34370
diff changeset
438 mode |= PARANOIA_MODE_OVERLAP;
a4dd7151526b Do not call paranoia_overlapset with 0, it actually causes cdparanoia to just hang.
reimar
parents: 34370
diff changeset
439 else if(p->search_overlap == 0)
a4dd7151526b Do not call paranoia_overlapset with 0, it actually causes cdparanoia to just hang.
reimar
parents: 34370
diff changeset
440 mode &= ~PARANOIA_MODE_OVERLAP;
27391
1d2faa1020fb Rename a bunch of miscellaneous preprocessor directives.
diego
parents: 25691
diff changeset
441 #ifndef CONFIG_LIBCDIO
33469
17519ae1f249 Constrain libcdparanoia's caching which badly breaks playback with -nocache.
reimar
parents: 31445
diff changeset
442 // HACK against libcdparanoia's stupid caching model that
17519ae1f249 Constrain libcdparanoia's caching which badly breaks playback with -nocache.
reimar
parents: 31445
diff changeset
443 // queues up a huge number of requests leading to stuttering
17519ae1f249 Constrain libcdparanoia's caching which badly breaks playback with -nocache.
reimar
parents: 31445
diff changeset
444 paranoia_cachemodel_size(priv->cdp, 24);
34384
475b95b38f59 Add comment to a condition that is just a hack around a cdparanoia bug.
reimar
parents: 34380
diff changeset
445 // For some incomprehensible reason cdparanoia breaks the
475b95b38f59 Add comment to a condition that is just a hack around a cdparanoia bug.
reimar
parents: 34380
diff changeset
446 // track->sector lookup of calling paranoia_modeset with
475b95b38f59 Add comment to a condition that is just a hack around a cdparanoia bug.
reimar
parents: 34380
diff changeset
447 // PARANOIA_MODE_DISABLE
34380
9b11eb048fca Don't call paranoia_modeset() for PARANOIA_MODE_DISABLE.
ib
parents: 34379
diff changeset
448 if (mode != PARANOIA_MODE_DISABLE) paranoia_modeset(cdd, mode);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
449
34371
a4dd7151526b Do not call paranoia_overlapset with 0, it actually causes cdparanoia to just hang.
reimar
parents: 34370
diff changeset
450 if(p->search_overlap > 0)
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
451 paranoia_overlapset(cdd,p->search_overlap);
16935
60bd6aeed405 make it optionally possible to compile MPlayer with libcdio instead of libcdparanoia
faust3
parents: 16926
diff changeset
452 #else
60bd6aeed405 make it optionally possible to compile MPlayer with libcdio instead of libcdparanoia
faust3
parents: 16926
diff changeset
453 paranoia_modeset(priv->cdp, mode);
60bd6aeed405 make it optionally possible to compile MPlayer with libcdio instead of libcdparanoia
faust3
parents: 16926
diff changeset
454
34371
a4dd7151526b Do not call paranoia_overlapset with 0, it actually causes cdparanoia to just hang.
reimar
parents: 34370
diff changeset
455 if(p->search_overlap > 0)
16935
60bd6aeed405 make it optionally possible to compile MPlayer with libcdio instead of libcdparanoia
faust3
parents: 16926
diff changeset
456 paranoia_overlapset(priv->cdp,p->search_overlap);
60bd6aeed405 make it optionally possible to compile MPlayer with libcdio instead of libcdparanoia
faust3
parents: 16926
diff changeset
457 #endif
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
458
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
459 paranoia_seek(priv->cdp,priv->start_sector,SEEK_SET);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
460 priv->sector = priv->start_sector;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
461
27391
1d2faa1020fb Rename a bunch of miscellaneous preprocessor directives.
diego
parents: 25691
diff changeset
462 #ifdef CONFIG_CDDB
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
463 if(cddb_info) {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
464 cd_info_free(cd_info);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
465 priv->cd_info = cddb_info;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
466 cd_info_debug( cddb_info );
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
467 }
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
468 #endif
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
469
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
470 st->priv = priv;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
471 st->start_pos = priv->start_sector*CD_FRAMESIZE_RAW;
25382
25b27cf5bbeb Make the end_sector accessable (it should be).
ulion
parents: 25365
diff changeset
472 st->end_pos = (priv->end_sector + 1) * CD_FRAMESIZE_RAW;
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
473 st->type = STREAMTYPE_CDDA;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
474 st->sector_size = CD_FRAMESIZE_RAW;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
475
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
476 st->fill_buffer = fill_buffer;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
477 st->seek = seek;
25410
38ef388859a9 Add cdda stream control for chapter commmands.
ulion
parents: 25396
diff changeset
478 st->control = control;
16935
60bd6aeed405 make it optionally possible to compile MPlayer with libcdio instead of libcdparanoia
faust3
parents: 16926
diff changeset
479 st->close = close_cdda;
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
480
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
481 *file_format = DEMUXER_TYPE_RAWAUDIO;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
482
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
483 m_struct_free(&stream_opts,opts);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
484
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
485 return STREAM_OK;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
486 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
487
25211
c1d17bd6683c Mark all stream_info_t as const
reimar
parents: 24257
diff changeset
488 const stream_info_t stream_info_cdda = {
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
489 "CDDA",
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
490 "cdda",
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
491 "Albeu",
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
492 "",
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
493 open_cdda,
21479
edfd292bbf9e Add full support for en-/disabling cddb support
reimar
parents: 21418
diff changeset
494 { "cdda",
27391
1d2faa1020fb Rename a bunch of miscellaneous preprocessor directives.
diego
parents: 25691
diff changeset
495 #ifdef CONFIG_CDDB
21479
edfd292bbf9e Add full support for en-/disabling cddb support
reimar
parents: 21418
diff changeset
496 "cddb",
edfd292bbf9e Add full support for en-/disabling cddb support
reimar
parents: 21418
diff changeset
497 #endif
edfd292bbf9e Add full support for en-/disabling cddb support
reimar
parents: 21418
diff changeset
498 NULL },
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
499 &stream_opts,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
500 1 // Urls are an option string
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
501 };