annotate libmpdemux/cdda.c @ 10007:b2d257e35577

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