annotate libmpdemux/cdda.c @ 11530:6d4ffbc33238

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