annotate libmpdemux/cdda.c @ 12614:d873777f0acf

Prefer libavcodec for cvid files
author rtognimp
date Sun, 20 Jun 2004 22:11:28 +0000
parents b846d0a788c1
children 83d101e1bedb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
1 #include "config.h"
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
2
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
3 #ifdef HAVE_CDDA
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
4
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
5 #include "stream.h"
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
6 #include "../m_option.h"
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
7 #include "../m_struct.h"
11652
b846d0a788c1 cdda: endianness fix
colin
parents: 10591
diff changeset
8 #include "../bswap.h"
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
9
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
10 #include <stdio.h>
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
11 #include <stdlib.h>
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
12 #include "demuxer.h"
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
13
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
14 #include "cdd.h"
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
15
10591
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
16 extern char *cdrom_device;
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
17
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
18 static struct cdda_params {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
19 int speed;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
20 int paranoia_mode;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
21 char* generic_dev;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
22 int sector_size;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
23 int search_overlap;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
24 int toc_bias;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
25 int toc_offset;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
26 int no_skip;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
27 char* device;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
28 m_span_t span;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
29 } cdda_dflts = {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
30 -1,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
31 1,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
32 NULL,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
33 0,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
34 -1,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
35 0,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
36 0,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
37 0,
10591
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
38 NULL,
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
39 { 0, 0 }
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
40 };
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
41
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
42 #define ST_OFF(f) M_ST_OFF(struct cdda_params,f)
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
43 m_option_t cdda_params_fields[] = {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
44 { "speed", ST_OFF(speed), CONF_TYPE_INT, M_OPT_RANGE,1,100, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
45 { "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
46 { "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
47 { "sector-size", ST_OFF(sector_size), CONF_TYPE_INT, M_OPT_RANGE,1,100, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
48 { "overlap", ST_OFF(search_overlap), CONF_TYPE_INT, M_OPT_RANGE,0,75, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
49 { "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
50 { "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
51 { "noskip", ST_OFF(no_skip), CONF_TYPE_FLAG, 0 , 0, 1, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
52 { "skip", ST_OFF(no_skip), CONF_TYPE_FLAG, 0 , 1, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
53 { "device", ST_OFF(device), CONF_TYPE_STRING, 0, 0, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
54 { "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
55 /// For url parsing
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
56 { "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
57 { "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
58 { "filename", ST_OFF(device), CONF_TYPE_STRING, 0, 0, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
59 {NULL, NULL, 0, 0, 0, 0, NULL}
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
60 };
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
61 static struct m_struct_st stream_opts = {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
62 "cdda",
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
63 sizeof(struct cdda_params),
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
64 &cdda_dflts,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
65 cdda_params_fields
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
66 };
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
67
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
68 /// We keep these options but now they set the defaults
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
69 m_option_t cdda_opts[] = {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
70 { "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
71 { "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
72 { "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
73 { "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
74 { "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
75 { "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
76 { "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
77 { "noskip", &cdda_dflts.no_skip, CONF_TYPE_FLAG, 0 , 0, 1, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
78 { "skip", &cdda_dflts.no_skip, CONF_TYPE_FLAG, 0 , 1, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
79 { "device", &cdda_dflts.device, CONF_TYPE_STRING, 0, 0, 0, NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
80 { "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
81 {NULL, NULL, 0, 0, 0, 0, NULL}
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
82 };
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
83
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
84 extern int cddb_resolve(const char *dev, char **xmcd_file);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
85 extern cd_info_t* cddb_parse_xmcd(char *xmcd_file);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
86
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
87 static int seek(stream_t* s,off_t pos);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
88 static int fill_buffer(stream_t* s, char* buffer, int max_len);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
89 static void close(stream_t* s);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
90
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
91 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
92 struct cdda_params* p = (struct cdda_params*)opts;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
93 int mode = p->paranoia_mode;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
94 int offset = p->toc_offset;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
95 cdrom_drive* cdd = NULL;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
96 cdda_priv* priv;
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
97 cd_info_t *cd_info,*cddb_info = NULL;
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
98 unsigned int audiolen=0;
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
99 int i;
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
100 char *xmcd_file = NULL;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
101
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
102 if(m != STREAM_READ) {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
103 m_struct_free(&stream_opts,opts);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
104 return STREAM_UNSUPORTED;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
105 }
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
106
10591
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
107 if(!p->device) {
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
108 if (cdrom_device)
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
109 p->device = strdup(cdrom_device);
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
110 else
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
111 p->device = strdup(DEFAULT_CDROM_DEVICE);
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
112 }
0d381b648b51 Fix -cdrom-device to work again with cdda and vcd.
albeu
parents: 10121
diff changeset
113
10121
d42177a0da2a Changed the STREAMING defines to MPLAYER_NETWORK to avoid name definition clash.
bertrand
parents: 9801
diff changeset
114 #ifdef MPLAYER_NETWORK
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
115 if(strncmp(st->url,"cddb",4) == 0) {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
116 i = cddb_resolve(p->device, &xmcd_file);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
117 if(i == 0) {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
118 cddb_info = cddb_parse_xmcd(xmcd_file);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
119 free(xmcd_file);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
120 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
121 }
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
122 #endif
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
123
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
124 if(p->generic_dev)
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
125 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
126 else
8958
56bf90cefb10 Removed the hardcoded /dev/cdrom for NetBSD and added an work around
bertrand
parents: 8609
diff changeset
127 #if defined(__NetBSD__)
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
128 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
129 #else
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
130 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
131 #endif
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
132
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
133 if(!cdd) {
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
134 mp_msg(MSGT_OPEN,MSGL_ERR,"Can't open cdda device\n");
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
135 m_struct_free(&stream_opts,opts);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
136 return STREAM_ERROR;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
137 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
138
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
139 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
140
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
141 if(p->sector_size) {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
142 cdd->nsectors = p->sector_size;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
143 cdd->bigbuff = p->sector_size * CD_FRAMESIZE_RAW;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
144 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
145
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
146 if(cdda_open(cdd) != 0) {
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
147 mp_msg(MSGT_OPEN,MSGL_ERR,"Can't open disc\n");
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
148 cdda_close(cdd);
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
149 m_struct_free(&stream_opts,opts);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
150 return STREAM_ERROR;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
151 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
152
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
153 cd_info = cd_info_new();
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
154 mp_msg(MSGT_OPEN,MSGL_INFO,"Found Audio CD with %d tracks\n",cdda_tracks(cdd));
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
155 for(i=0;i<cdd->tracks;i++) {
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
156 char track_name[80];
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
157 long sec=cdda_track_firstsector(cdd,i+1);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
158 long off=cdda_track_lastsector(cdd,i+1)-sec+1;
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
159
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
160 sprintf(track_name, "Track %d", i+1);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
161 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
162 audiolen += off;
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
163 }
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
164 cd_info->min = (unsigned int)(audiolen/(60*75));
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
165 cd_info->sec = (unsigned int)((audiolen/75)%60);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
166 cd_info->msec = (unsigned int)(audiolen%75);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
167
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
168 priv = (cdda_priv*)malloc(sizeof(cdda_priv));
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
169 memset(priv, 0, sizeof(cdda_priv));
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
170 priv->cd = cdd;
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
171 priv->cd_info = cd_info;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
172
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
173 if(p->toc_bias)
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
174 offset -= cdda_track_firstsector(cdd,1);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
175
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
176 if(offset) {
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
177 int i;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
178 for(i = 0 ; i < cdd->tracks + 1 ; i++)
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
179 cdd->disc_toc[i].dwStartSector += offset;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
180 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
181
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
182 if(p->speed)
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
183 cdda_speed_set(cdd,p->speed);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
184
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
185 if(p->span.start)
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
186 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
187 else
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
188 priv->start_sector = cdda_disc_firstsector(cdd);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
189
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
190 if(p->span.end) {
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
191 int last = cdda_tracks(cdd);
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
192 if(p->span.end > last) p->span.end = last;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
193 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
194 } else
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
195 priv->end_sector = cdda_disc_lastsector(cdd);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
196
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
197 priv->cdp = paranoia_init(cdd);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
198 if(priv->cdp == NULL) {
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
199 cdda_close(cdd);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
200 free(priv);
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
201 cd_info_free(cd_info);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
202 m_struct_free(&stream_opts,opts);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
203 return STREAM_ERROR;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
204 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
205
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
206 if(mode == 0)
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
207 mode = PARANOIA_MODE_DISABLE;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
208 else if(mode == 1)
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
209 mode = PARANOIA_MODE_OVERLAP;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
210 else
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
211 mode = PARANOIA_MODE_FULL;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
212
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
213 if(p->no_skip)
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
214 mode |= PARANOIA_MODE_NEVERSKIP;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
215
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
216 if(p->search_overlap >= 0)
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
217 paranoia_overlapset(cdd,p->search_overlap);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
218
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
219 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
220 priv->sector = priv->start_sector;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
221
10121
d42177a0da2a Changed the STREAMING defines to MPLAYER_NETWORK to avoid name definition clash.
bertrand
parents: 9801
diff changeset
222 #ifdef MPLAYER_NETWORK
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
223 if(cddb_info) {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
224 cd_info_free(cd_info);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
225 priv->cd_info = cddb_info;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
226 cd_info_debug( cddb_info );
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
227 }
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
228 #endif
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
229
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
230 st->priv = priv;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
231 st->start_pos = priv->start_sector*CD_FRAMESIZE_RAW;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
232 st->end_pos = priv->end_sector*CD_FRAMESIZE_RAW;
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
233 st->type = STREAMTYPE_CDDA;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
234 st->sector_size = CD_FRAMESIZE_RAW;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
235
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
236 st->fill_buffer = fill_buffer;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
237 st->seek = seek;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
238 st->close = close;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
239
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
240 *file_format = DEMUXER_TYPE_RAWAUDIO;
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
241
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
242 m_struct_free(&stream_opts,opts);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
243
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
244 return STREAM_OK;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
245 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
246
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
247 static void cdparanoia_callback(long inpos, int function) {
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
248 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
249
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
250 static int fill_buffer(stream_t* s, char* buffer, int max_len) {
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
251 cdda_priv* p = (cdda_priv*)s->priv;
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
252 cd_track_t *cd_track;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
253 int16_t * buf;
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
254 int i;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
255
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
256 buf = paranoia_read(p->cdp,cdparanoia_callback);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
257
11652
b846d0a788c1 cdda: endianness fix
colin
parents: 10591
diff changeset
258 #ifdef WORDS_BIGENDIAN
b846d0a788c1 cdda: endianness fix
colin
parents: 10591
diff changeset
259 for(i=0;i<CD_FRAMESIZE_RAW/2;i++)
b846d0a788c1 cdda: endianness fix
colin
parents: 10591
diff changeset
260 buf[i]=le2me_16(buf[i]);
b846d0a788c1 cdda: endianness fix
colin
parents: 10591
diff changeset
261 #endif
b846d0a788c1 cdda: endianness fix
colin
parents: 10591
diff changeset
262
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
263 p->sector++;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
264 s->pos = p->sector*CD_FRAMESIZE_RAW;
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
265 memcpy(buffer,buf,CD_FRAMESIZE_RAW);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
266
9656
ef5ae9f9c6e6 fixed trivial seeking bugs, patch by Krister Lagerstrom <krister@kmlager.com>
alex
parents: 8958
diff changeset
267 if((p->sector < p->start_sector) || (p->sector >= p->end_sector)) {
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
268 s->eof = 1;
9656
ef5ae9f9c6e6 fixed trivial seeking bugs, patch by Krister Lagerstrom <krister@kmlager.com>
alex
parents: 8958
diff changeset
269 return 0;
ef5ae9f9c6e6 fixed trivial seeking bugs, patch by Krister Lagerstrom <krister@kmlager.com>
alex
parents: 8958
diff changeset
270 }
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
271
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
272 for(i=0;i<p->cd->tracks;i++){
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
273 if(p->cd->disc_toc[i].dwStartSector==p->sector-1) {
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
274 cd_track = cd_info_get_track(p->cd_info, i+1);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
275 //printf("Track %d, sector=%d\n", i, p->sector-1);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
276 if( cd_track!=NULL ) {
8558
c40e862a7dc2 print track title in new line
arpi
parents: 8524
diff changeset
277 printf("\n%s\n", cd_track->name );
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
278 }
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
279 break;
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
280 }
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
281 }
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
282
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
283
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
284 return CD_FRAMESIZE_RAW;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
285 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
286
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
287 static int seek(stream_t* s,off_t newpos) {
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
288 cdda_priv* p = (cdda_priv*)s->priv;
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
289 cd_track_t *cd_track;
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
290 int sec;
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
291 int current_track=0, seeked_track=0;
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
292 int i;
9656
ef5ae9f9c6e6 fixed trivial seeking bugs, patch by Krister Lagerstrom <krister@kmlager.com>
alex
parents: 8958
diff changeset
293
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
294 s->pos = newpos;
9656
ef5ae9f9c6e6 fixed trivial seeking bugs, patch by Krister Lagerstrom <krister@kmlager.com>
alex
parents: 8958
diff changeset
295 if(s->pos < 0) {
ef5ae9f9c6e6 fixed trivial seeking bugs, patch by Krister Lagerstrom <krister@kmlager.com>
alex
parents: 8958
diff changeset
296 s->eof = 1;
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
297 return 0;
9656
ef5ae9f9c6e6 fixed trivial seeking bugs, patch by Krister Lagerstrom <krister@kmlager.com>
alex
parents: 8958
diff changeset
298 }
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
299
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
300 sec = s->pos/CD_FRAMESIZE_RAW;
8524
fe542f0201ea CDDA seeking fixed
arpi
parents: 7867
diff changeset
301 //printf("pos: %d, sec: %d ## %d\n", (int)s->pos, (int)sec, CD_FRAMESIZE_RAW);
fe542f0201ea CDDA seeking fixed
arpi
parents: 7867
diff changeset
302 //printf("sector: %d new: %d\n", p->sector, sec );
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
303
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
304 for(i=0;i<p->cd->tracks;i++){
8559
arpi
parents: 8558
diff changeset
305 // printf("trk #%d: %d .. %d\n",i,p->cd->disc_toc[i].dwStartSector,p->cd->disc_toc[i+1].dwStartSector);
8524
fe542f0201ea CDDA seeking fixed
arpi
parents: 7867
diff changeset
306 if( p->sector>=p->cd->disc_toc[i].dwStartSector && p->sector<p->cd->disc_toc[i+1].dwStartSector ) {
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
307 current_track = i;
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
308 }
8524
fe542f0201ea CDDA seeking fixed
arpi
parents: 7867
diff changeset
309 if( sec>=p->cd->disc_toc[i].dwStartSector && sec<p->cd->disc_toc[i+1].dwStartSector ) {
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
310 seeked_track = i;
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
311 }
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
312 }
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
313 //printf("current: %d, seeked: %d\n", current_track, seeked_track);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
314 if( current_track!=seeked_track ) {
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
315 //printf("Track %d, sector=%d\n", seeked_track, sec);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
316 cd_track = cd_info_get_track(p->cd_info, seeked_track+1);
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
317 if( cd_track!=NULL ) {
8558
c40e862a7dc2 print track title in new line
arpi
parents: 8524
diff changeset
318 printf("\n%s\n", cd_track->name );
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
319 }
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
320
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
321 }
8524
fe542f0201ea CDDA seeking fixed
arpi
parents: 7867
diff changeset
322 #if 0
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
323 if(sec < p->start_sector)
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
324 sec = p->start_sector;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
325 else if(sec > p->end_sector)
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
326 sec = p->end_sector;
8524
fe542f0201ea CDDA seeking fixed
arpi
parents: 7867
diff changeset
327 #endif
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
328
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
329 p->sector = sec;
6696
030e3fa9cf4a Build a fake list of track name.
bertrand
parents: 6384
diff changeset
330 // s->pos = sec*CD_FRAMESIZE_RAW;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
331
8524
fe542f0201ea CDDA seeking fixed
arpi
parents: 7867
diff changeset
332 //printf("seek: %d, sec: %d\n", (int)s->pos, sec);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
333 paranoia_seek(p->cdp,sec,SEEK_SET);
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
334 return 1;
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
335 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
336
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
337 static void close(stream_t* s) {
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
338 cdda_priv* p = (cdda_priv*)s->priv;
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
339 paranoia_free(p->cdp);
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
340 cdda_close(p->cd);
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
341 cd_info_free(p->cd_info);
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
342 free(p);
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
343 }
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
344
9801
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
345 stream_info_t stream_info_cdda = {
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
346 "CDDA",
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
347 "cdda",
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
348 "Albeu",
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
349 "",
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
350 open_cdda,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
351 { "cdda", "cddb", NULL },
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
352 &stream_opts,
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
353 1 // Urls are an option string
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
354 };
2f02809d32a8 URL is cdda://tracks[:speed][/device]
albeu
parents: 9656
diff changeset
355
6384
f0b933918a22 Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
diff changeset
356 #endif