[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[51] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2009-12-19 19:15:33
|
Revision: 51 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=51&view=rev Author: nickols_k Date: 2009-12-19 19:15:24 +0000 (Sat, 19 Dec 2009) Log Message: ----------- use libcdio instead of Xiph's paranoia and fix cdda related lacks Modified Paths: -------------- codecs/configure functions loader/configure mplayerxp/configure mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/cdd.h mplayerxp/libmpdemux/cdda.c mplayerxp/libmpdemux/cddb.c mplayerxp/libmpdemux/s_cdd.c mplayerxp/libmpdemux/stream.c Modified: codecs/configure =================================================================== --- codecs/configure 2009-12-19 11:08:56 UTC (rev 50) +++ codecs/configure 2009-12-19 19:15:24 UTC (rev 51) @@ -292,11 +292,6 @@ test -n "$profile" && disable fastcall print_config __USE config.h config.mak fastcall -# Checking for LDFLAGS -if test "$profile" || test "$debug" ; then - LDFLAGS="$debug $profile" -fi - test_optimizations config.mak config.h test -n "$ld_extra" && add_extralibs $ld_extra Modified: functions =================================================================== --- functions 2009-12-19 11:08:56 UTC (rev 50) +++ functions 2009-12-19 19:15:24 UTC (rev 51) @@ -1109,9 +1109,23 @@ add_asflags --32 fi +if test -z $CFLAGS ; then add_cflags $locarch +fi if enabled profile || test "$debug" || enabled gcov; then - add_cflags "-O2 -fno-builtin $debug $profile" + add_cflags "-O2 -fno-builtin" +if enabled profile ; then + add_cflags "-pg" + add_ldflags "-pg" +fi +if test -n $debug ; then + add_cflags $debug + add_ldflags $debug +fi +if enabled gcov ; then +add_cflags "-fprofile-arcs -ftest-coverage" +add_extralibs "-lgcov" +fi else add_cflags "-O3" # -ffast-math produces incorrect output in 64-bit mode on x86_64 cpus. Tested with many gcc-4.x series Modified: loader/configure =================================================================== --- loader/configure 2009-12-19 11:08:56 UTC (rev 50) +++ loader/configure 2009-12-19 19:15:24 UTC (rev 51) @@ -169,14 +169,6 @@ esac done -enabled profile && add_ldflags "-pg" -test -n $debug && add_ldflags $debug - -if enabled gcov ; then -add_cflags "-fprofile-arcs -ftest-coverage" -add_extralibs "-lgcov" -fi - guess_target config.mak config.h test_optimizations config.mak config.h Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/configure 2009-12-19 19:15:24 UTC (rev 51) @@ -76,7 +76,7 @@ --disable-vidix disable VIDIX stuff [autodetect] --enable-joystick enable joystick support [autodetect] --disable-sdl-image build with SDL_image support [autodetect] - --disable-cdparanoia Disable cdparanoia support [autodetect] + --disable-libcdio Disable libcdio support [autodetect] --disable-libcss Disable libcss support [autodetect] --disable-libdvdread Disable libdvdread support [autodetect] --disable-libdvdnav Disable libdvdnav support [autodetect] @@ -171,7 +171,7 @@ openal nas jack - cdparanoia + libcdio fbdev jpg lirc @@ -414,14 +414,6 @@ test -n "$profile" && disable fastcall print_config __USE mp_config.h mp_config.mak fastcall -enabled profile && add_ldflags "-pg" -test -n $debug && add_ldflags $debug - -if enabled gcov ; then -add_cflags "-fprofile-arcs -ftest-coverage" -add_extralibs "-lgcov" -fi - test_optimizations mp_config.mak mp_config.h # Checking for GOMP @@ -707,10 +699,9 @@ enabled sdl && aomodules="sdl $aomodules" || noaomodules="sdl $noaomodules" enabled sdl && vomodules="sdl $vomodules" || novomodules="sdl $novomodules" -enabled cdparanoia && require2 cdparanoia "cdda_interface.h cdda_paranoia.h" cdda_open -lcdda_interface -lcdda_paranoia -cdda=$cdparanoia -print_config HAVE_ mp_config.h mp_config.mak cdda -enabled cdparanoia && inputmodules="cdda $inputmodules" || noinputmodules="cdda $noinputmodules" +enabled libcdio && require2 libcdio "cdio/paranoia.h" cdio_paranoia_read -lcdio_paranoia +print_config HAVE_ mp_config.h mp_config.mak libcdio +enabled libcdio && inputmodules="cdda $inputmodules" || noinputmodules="cdda $noinputmodules" ######### # AUDIO # Modified: mplayerxp/libmpdemux/Makefile =================================================================== --- mplayerxp/libmpdemux/Makefile 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/libmpdemux/Makefile 2009-12-19 19:15:24 UTC (rev 51) @@ -7,9 +7,12 @@ DO_ALL = @ for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit; done SRCS = s_file.c s_ffmpeg.c -ifeq ($(HAVE_CDDA),yes) -SRCS += s_cdd.c +ifeq ($(HAVE_LIBCDIO),yes) +SRCS += s_cdd.c cdda.c +ifeq ($(HAVE_STREAMING),yes) +SRCS += cddb.c endif +endif ifeq ($(USE_DVDNAV),yes) SRCS += s_dvdnav.c endif @@ -27,7 +30,7 @@ SRCS += s_vcd.c endif SRCS += cache2.c dvdauth.c stream.c tvi_dummy.c tvi_v4l.c -SRCS += tvi_bsdbt848.c frequencies.c cdda.c cddb.c mrl.c +SRCS += tvi_bsdbt848.c frequencies.c mrl.c SRCS += demuxer_r.c mp3_hdr.c video.c mpeg_hdr.c aviprint.c demux_asf.c SRCS += demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_viv.c demuxer.c Modified: mplayerxp/libmpdemux/cdd.h =================================================================== --- mplayerxp/libmpdemux/cdd.h 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/libmpdemux/cdd.h 2009-12-19 19:15:24 UTC (rev 51) @@ -1,8 +1,8 @@ #ifndef __CDD_H__ #define __CDD_H__ -#include <cdda_interface.h> -#include <cdda_paranoia.h> +#include <cdio/cdda.h> +#include <cdio/paranoia.h> typedef struct { char cddb_hello[1024]; @@ -47,13 +47,22 @@ cd_track_t *current; } cd_info_t; +typedef struct my_track_s { + int play; + unsigned long start_sector; + unsigned long end_sector; +}my_track_t; + typedef struct { - cdrom_drive* cd; - cdrom_paranoia* cdp; - int sector; - int start_sector; - int end_sector; - cd_info_t *cd_info; + cdrom_drive_t* cd; + cdrom_paranoia_t* cdp; + my_track_t tracks[256]; /* hope that's enough */ + unsigned min; + unsigned sec; + unsigned msec; + unsigned long sector; + unsigned long start_sector; + unsigned long end_sector; } cdda_priv; cd_info_t* __FASTCALL__ cd_info_new(); @@ -63,8 +72,8 @@ int __FASTCALL__ open_cdda(stream_t*,const char* dev,const char* track); int __FASTCALL__ open_cddb(stream_t*,const char* dev,const char* track); -int __FASTCALL__ read_cdda(stream_t* s,char *buf,int* trackidx); -void __FASTCALL__ seek_cdda(stream_t* s,off_t pos); +int __FASTCALL__ read_cdda(stream_t* s,char *buf,track_t* trackidx); +void __FASTCALL__ seek_cdda(stream_t* s,off_t pos,track_t *trackidx); off_t __FASTCALL__ tell_cdda(stream_t* s); void __FASTCALL__ close_cdda(stream_t* s); void cdda_register_options(m_config_t* cfg); Modified: mplayerxp/libmpdemux/cdda.c =================================================================== --- mplayerxp/libmpdemux/cdda.c 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/libmpdemux/cdda.c 2009-12-19 19:15:24 UTC (rev 51) @@ -1,6 +1,6 @@ #include "../mp_config.h" -#ifdef HAVE_CDDA +#ifdef HAVE_LIBCDIO #include "stream.h" #include "../cfgparser.h" @@ -12,21 +12,13 @@ #include "demux_msg.h" static int speed = -1; static int paranoia_mode = 1; -static char* generic_dev = NULL; -static int sector_size = 0; static int search_overlap = -1; -static int toc_bias = 0; -static int toc_offset = 0; static int no_skip = 0; static const config_t cdda_opts[] = { { "speed", &speed, CONF_TYPE_INT, CONF_RANGE,1,100, NULL }, { "paranoia", ¶noia_mode, CONF_TYPE_INT,CONF_RANGE, 0, 2, NULL }, - { "generic-dev", &generic_dev, CONF_TYPE_STRING, 0, 0, 0, NULL }, - { "sector-size", §or_size, CONF_TYPE_INT, CONF_RANGE,1,100, NULL }, { "overlap", &search_overlap, CONF_TYPE_INT, CONF_RANGE,0,75, NULL }, - { "toc-bias", &toc_bias, CONF_TYPE_INT, 0, 0, 0, NULL }, - { "toc-offset", &toc_offset, CONF_TYPE_INT, 0, 0, 0, NULL }, { "noskip", &no_skip, CONF_TYPE_FLAG, 0 , 0, 1, NULL }, { "skip", &no_skip, CONF_TYPE_FLAG, 0 , 1, 0, NULL }, {NULL, NULL, 0, 0, 0, 0, NULL} @@ -41,127 +33,123 @@ m_config_register_options(cfg,cdda_conf); } -int __FASTCALL__ open_cdda(stream_t *st,const char* dev,const char* track) { - int start_track = 0; - int end_track = 0; +static unsigned cdda_parse_tracks(unsigned char *arr,unsigned nelem,const char *arg) +{ + const char *st,*end; + unsigned rval=0; + unsigned slen=strlen(arg); + st=arg; + memset(arr,0,sizeof(unsigned char)*nelem); + do { + size_t datalen,value,evalue,i; + char data[100],*range; + end=strchr(st,','); + if(!end) end = &st[strlen(st)]; + datalen=end-st; + memcpy(data,st,datalen); + data[datalen]='\0'; + range=strchr(data,'-'); + if(range) { + *range='\0'; + value=atoi(data); + evalue=atoi(&range[1]); + if(evalue>value && evalue<nelem) { + for(i=value;i<=evalue;i++) arr[i]=1; + rval=evalue; + } + else break; + } + else { + value=atoi(data); + if(value>nelem) break; + arr[value]=1; + rval=value; + } + st=end+1; + if(st>arg+slen) break; + }while(end); + return rval; +} + +int __FASTCALL__ open_cdda(stream_t *st,const char* dev,const char* arg) { + lsn_t lsn; int mode = paranoia_mode; - int offset = toc_offset; unsigned cd_tracks; - cdrom_drive* cdd = NULL; cdda_priv* priv; - char* end = strchr(track,'-'); - cd_info_t *cd_info; unsigned int audiolen=0; - int i; + unsigned i; + unsigned char arr[256]; - if(!end) - start_track = end_track = atoi(track); - else { - int st_len = end - track; - int ed_len = strlen(track) - 1 - st_len; + priv = (cdda_priv*)malloc(sizeof(cdda_priv)); + memset(priv, 0, sizeof(cdda_priv)); - if(st_len) { - char st[st_len + 1]; - strncpy(st,track,st_len); - st[st_len] = '\0'; - start_track = atoi(st); - } - if(ed_len) { - char ed[ed_len + 1]; - strncpy(ed,end+1,ed_len); - ed[ed_len] = '\0'; - end_track = atoi(ed); - } - } + priv->cd = cdio_cddap_identify(dev,verbose?1:0,NULL); - if(generic_dev) - cdd = cdda_identify_scsi(generic_dev,dev,verbose?1:0,NULL); - else - cdd = cdda_identify(dev,verbose?1:0,NULL); - - if(!cdd) { + if(!priv->cd) { MSG_ERR("Can't open cdda device: %s\n",dev); + free(priv); return 0; } - cdda_verbose_set(cdd, verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT, verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT); + cdio_cddap_verbose_set(priv->cd, verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT, verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT); - if(sector_size) { - cdd->nsectors = sector_size; - cdd->bigbuff = sector_size * CD_FRAMESIZE_RAW; - } - - if(cdda_open(cdd) != 0) { + if(cdio_cddap_open(priv->cd) != 0) { MSG_ERR("Can't open disc\n"); - cdda_close(cdd); + cdda_close(priv->cd); + free(priv); return 0; } - cd_info = cd_info_new(); - cd_tracks=cdda_tracks(cdd); - for(i=0;i<cdd->tracks;i++) { - char track_name[80]; - long sec=cdda_track_firstsector(cdd,i+1); - long off=cdda_track_lastsector(cdd,i+1)-sec+1; + cd_tracks=cdio_cddap_tracks(priv->cd); + MSG_V("Found %d tracks on disc\n",cd_tracks); + if(!arg[0]) + for(i=1;i<=cd_tracks;i++) priv->tracks[i-1].play=1; + cdda_parse_tracks(arr,sizeof(arr)/sizeof(unsigned),arg); + for(i=1;i<=256;i++) if (arr[i]) priv->tracks[i-1].play=1; - sprintf(track_name, "Track %d/%d", i+1,cd_tracks); - 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 ); - audiolen += off; + MSG_V("[CDDA] Queued tracks:"); + for(i=0;i<cd_tracks;i++) { + int st_inited=0; + if(priv->tracks[i].play) { + priv->tracks[i].start_sector=cdio_cddap_track_firstsector(priv->cd,i+1); + priv->tracks[i].end_sector=cdio_cddap_track_lastsector(priv->cd,i+1); + MSG_V(" %d[%ld-%ld]",i+1,priv->tracks[i].start_sector,priv->tracks[i].end_sector); + if(!st_inited) { priv->start_sector=priv->tracks[i].start_sector; st_inited=1; } + priv->end_sector=priv->tracks[i].end_sector; + audiolen += priv->tracks[i].end_sector-priv->tracks[i].start_sector+1; + } } - cd_info->min = (unsigned int)(audiolen/(60*75)); - cd_info->sec = (unsigned int)((audiolen/75)%60); - cd_info->msec = (unsigned int)(audiolen%75); + for(;i<256;i++) priv->tracks[i].play=0; + MSG_V("\n"); + priv->min = (unsigned int)(audiolen/(60*75)); + priv->sec = (unsigned int)((audiolen/75)%60); + priv->msec = (unsigned int)(audiolen%75); - priv = (cdda_priv*)malloc(sizeof(cdda_priv)); - memset(priv, 0, sizeof(cdda_priv)); - priv->cd = cdd; - priv->cd_info = cd_info; - - if(toc_bias) - offset -= cdda_track_firstsector(cdd,1); - - if(offset) { - int i; - for(i = 0 ; i < cdd->tracks + 1 ; i++) - cdd->disc_toc[i].dwStartSector += offset; - } - if(speed) - cdda_speed_set(cdd,speed); + cdio_cddap_speed_set(priv->cd,speed); - if(start_track) - priv->start_sector = cdda_track_firstsector(cdd,start_track); - else - priv->start_sector = cdda_disc_firstsector(cdd); - - if(end_track) { - int last = cdda_tracks(cdd); - if(end_track > last) end_track = last; - priv->end_sector = cdda_track_lastsector(cdd,end_track); - } else - priv->end_sector = cdda_disc_lastsector(cdd); - - priv->cdp = paranoia_init(cdd); + priv->cdp = cdio_paranoia_init(priv->cd); if(priv->cdp == NULL) { - cdda_close(cdd); + cdio_cddap_close(priv->cd); free(priv); return 0; } + mode = PARANOIA_MODE_FULL; if(mode == 0) mode = PARANOIA_MODE_DISABLE; else if(mode == 1) mode = PARANOIA_MODE_OVERLAP; - else - mode = PARANOIA_MODE_FULL; if(no_skip) mode |= PARANOIA_MODE_NEVERSKIP; + cdio_paranoia_modeset(priv->cdp,mode); if(search_overlap >= 0) - paranoia_overlapset(cdd,search_overlap); + cdio_paranoia_overlapset(priv->cdp,search_overlap); - paranoia_seek(priv->cdp,priv->start_sector,SEEK_SET); + lsn=cdio_paranoia_seek(priv->cdp,priv->start_sector,SEEK_SET); + MSG_DBG2("[CDDA] %ld=cdio_paranoia_seek(%p,%ld,SEEK_SET)\n",lsn,priv->cdp,priv->start_sector); priv->sector = priv->start_sector; st->type = STREAMTYPE_SEEKABLE|STREAMTYPE_RAWAUDIO; @@ -172,74 +160,84 @@ return 1; } -static void cdparanoia_callback(long inpos, int function) { +static void cdparanoia_callback(long int inpos, paranoia_cb_mode_t function) { + UNUSED(inpos); + UNUSED(function); } -int __FASTCALL__ read_cdda(stream_t* s,char *buf,int *tr) { +static unsigned long map_sector(cdda_priv*p,unsigned long sector,track_t *tr) +{ + unsigned i,j; + unsigned long cd_track=sector; + for(i=0;i<256;i++){ + if(p->tracks[i].play && p->tracks[i].end_sector==sector-1) { + cd_track=0; + for(j=i+1;j<256;j++) { + if(p->tracks[j].play) cd_track=p->tracks[j].start_sector; + if(tr) *tr=j; + } + } + } + return cd_track; +} + +/* return physical sector address */ +static unsigned long psa(cdda_priv*p,unsigned long sector) +{ + unsigned i,j; + unsigned long got_sectors=0,track_len; + for(i=0;i<256;i++){ + if(p->tracks[i].play) { + track_len=p->tracks[i].end_sector-p->tracks[i].start_sector; + if(sector>=got_sectors && sector <= track_len) return sector+p->tracks[i].start_sector; + got_sectors+=track_len; + } + } + return 0; +} + +int __FASTCALL__ read_cdda(stream_t* s,char *buf,track_t *tr) { cdda_priv* p = (cdda_priv*)s->priv; - cd_track_t *cd_track; + unsigned long cd_track; int16_t * _buf; - unsigned int i; + track_t i=255; - *tr=-1; - _buf = paranoia_read(p->cdp,cdparanoia_callback); + *tr=255; + _buf = cdio_paranoia_read(p->cdp,cdparanoia_callback); p->sector++; memcpy(buf,_buf,CD_FRAMESIZE_RAW); if(p->sector == p->end_sector) return -1; - for(i=0;i<p->cd->tracks;i++){ - if(p->cd->disc_toc[i].dwStartSector==p->sector-1) { - cd_track = cd_info_get_track(p->cd_info, i+1); -//printf("Track %d, sector=%d\n", i, p->sector-1); - *tr=i+1; - if( cd_track!=NULL ) { - MSG_V("%s\n", cd_track->name ); - } - break; - } - } - - + cd_track=map_sector(p,p->sector,&i); + if(!cd_track) return -1; + *tr=i+1; + MSG_V("Track %d, sector=%d\n", *tr, cd_track); + if(cd_track!=p->sector) { cdio_paranoia_seek(p->cdp,cd_track,SEEK_SET); p->sector=cd_track; } return CD_FRAMESIZE_RAW; } -void __FASTCALL__ seek_cdda(stream_t* s,off_t pos) { - cdda_priv* p = (cdda_priv*)s->priv; - cd_track_t *cd_track; - int sec; - int current_track=0, seeked_track=0; - int i; +void __FASTCALL__ seek_cdda(stream_t* s,off_t pos,track_t *tr) { + cdda_priv* p = (cdda_priv*)s->priv; + long sec; + long current_track=0, seeked_track=0; + unsigned i; + lsn_t lsn; + track_t j=255; - sec = pos/CD_FRAMESIZE_RAW; - - for(i=0;i<p->cd->tracks;i++){ - if( p->sector>p->cd->disc_toc[i].dwStartSector && p->sector<p->cd->disc_toc[i+1].dwStartSector ) { - current_track = i; - } - if( sec>p->cd->disc_toc[i].dwStartSector && sec<p->cd->disc_toc[i+1].dwStartSector ) { - seeked_track = i; - } - } -//printf("current: %d, seeked: %d\n", current_track, seeked_track); - if( current_track!=seeked_track ) { -//printf("Track %d, sector=%d\n", seeked_track, sec); - cd_track = cd_info_get_track(p->cd_info, seeked_track+1); - if( cd_track!=NULL ) { - MSG_V("%s\n", cd_track->name ); - } + sec = pos/CD_FRAMESIZE_RAW; + MSG_DBG2("[CDDA] prepare seek to %ld\n",sec); + seeked_track=sec; + *tr=255; + if( p->sector!=seeked_track ) { + seeked_track = map_sector(p,seeked_track,&j); + if(seeked_track) *tr=j+1; + } - } - - if(sec < p->start_sector) - sec = p->start_sector; - else if(sec > p->end_sector) - sec = p->end_sector; - - p->sector = sec; - - paranoia_seek(p->cdp,sec,SEEK_SET); + lsn=cdio_paranoia_seek(p->cdp,seeked_track,SEEK_SET); + MSG_DBG2("[CDDA] %ld=cdio_paranoia_seek(%p,%ld,SEEK_SET)\n",lsn,p->cdp,seeked_track); + p->sector=seeked_track; } off_t __FASTCALL__ tell_cdda(stream_t* s) { @@ -249,8 +247,9 @@ void __FASTCALL__ close_cdda(stream_t* s) { cdda_priv* p = (cdda_priv*)s->priv; - paranoia_free(p->cdp); - cdda_close(p->cd); + cdio_paranoia_free(p->cdp); + cdio_cddap_close(p->cd); + free(p); } #endif Modified: mplayerxp/libmpdemux/cddb.c =================================================================== --- mplayerxp/libmpdemux/cddb.c 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/libmpdemux/cddb.c 2009-12-19 19:15:24 UTC (rev 51) @@ -14,7 +14,7 @@ #include "../mp_config.h" -#if defined(HAVE_CDDA) && defined(HAVE_STREAMING) +#if defined(HAVE_LIBCDIO) && defined(HAVE_STREAMING) #include <stdio.h> #include <stdlib.h> @@ -127,7 +127,7 @@ unsigned int i, t = 0, n = 0; i = 0; - while (i < tot_trks) { + while (i < (unsigned)tot_trks) { n = n + cddb_sum((cdtoc[i].min * 60) + cdtoc[i].sec); i++; } @@ -251,7 +251,7 @@ close(file_fd); return -1; } - if( wrote!=cddb_data->xmcd_file_size ) { + if( (unsigned)wrote!=cddb_data->xmcd_file_size ) { MSG_FATAL("Not all the xmcd file has been written\n"); close(file_fd); return -1; @@ -301,7 +301,7 @@ } // Ok found the end // do a sanity check - if( http_hdr->body_size<(ptr2-ptr) ) { + if( http_hdr->body_size<(unsigned long)(ptr2-ptr) ) { MSG_ERR("Unexpected fix me\n"); return -1; } @@ -446,7 +446,7 @@ static int cddb_freedb_sites_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) { int ret, status; - + UNUSED(cddb_data); ret = sscanf( http_hdr->body, "%d ", &status); if( ret!=1 ) { MSG_ERR("Parse error\n"); @@ -494,11 +494,12 @@ int __FASTCALL__ cddb_retrieve(cddb_data_t *cddb_data) { char offsets[1024], command[1024]; char *ptr; + unsigned idx; int i, time_len; ptr = offsets; - for( i=0; i<cddb_data->tracks ; i++ ) { - ptr += sprintf(ptr, "%d+", cdtoc[i].frame ); + for( idx=0; idx<cddb_data->tracks ; idx++ ) { + ptr += sprintf(ptr, "%d+", cdtoc[idx].frame ); } time_len = (cdtoc[cddb_data->tracks].frame)/75; @@ -584,7 +585,6 @@ void __FASTCALL__ cd_info_free(cd_info_t *cd_info) { cd_track_t *cd_track, *cd_track_next; - int i; if( cd_info==NULL ) return; if( cd_info->artist!=NULL ) free(cd_info->artist); if( cd_info->album!=NULL ) free(cd_info->album); @@ -600,7 +600,7 @@ } cd_track_t* __FASTCALL__ cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, unsigned int min, unsigned int sec, unsigned int msec, unsigned long frame_begin, unsigned long frame_length) { - cd_track_t *cd_track, current_track; + cd_track_t *cd_track; if( cd_info==NULL || track_name==NULL ) return NULL; @@ -769,14 +769,14 @@ // Search for the genre else if( xmcd_parse_dgenre(cd_info, ptr) ); // Search for a track title - else if( xmcd_parse_ttitle(cd_info, ptr) ); + else if( xmcd_parse_ttitle(cd_info, ptr) ){} } if( ptr2[1]=='\n' ) ptr2++; pos = (ptr2+1)-ptr; ptr = ptr2+1; } - audiolen = cdtoc[cd_info->nb_tracks].frame-cdtoc[0].frame; + audiolen = cdtoc[cd_info->nb_tracks].frame-cdtoc[0].frame; cd_info->min = (unsigned int)(audiolen/(60*75)); cd_info->sec = (unsigned int)((audiolen/75)%60); cd_info->msec = (unsigned int)(audiolen%75); @@ -786,7 +786,6 @@ int __FASTCALL__ open_cddb(stream_t *stream,const char *dev, const char *track) { cd_info_t *cd_info = NULL; - cdda_priv *priv; char *xmcd_file = NULL; int ret; @@ -794,19 +793,10 @@ if( ret==0 ) { cd_info = cddb_parse_xmcd(xmcd_file); free(xmcd_file); - cd_info_debug( cd_info ); + cd_info_debug( cd_info ); } ret = open_cdda(stream, dev, track); - priv = ((cdda_priv*)(stream->priv)); - if(priv) - { - cd_info_debug(priv->cd_info); - if( cd_info!=NULL ) { - cd_info_free(priv->cd_info); - priv->cd_info = cd_info; - } - } return ret; } #endif Modified: mplayerxp/libmpdemux/s_cdd.c =================================================================== --- mplayerxp/libmpdemux/s_cdd.c 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/libmpdemux/s_cdd.c 2009-12-19 19:15:24 UTC (rev 51) @@ -2,15 +2,16 @@ s_cdd - cdda & cddb streams interface */ #include "../mp_config.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> #include "stream.h" -#ifdef HAVE_CDDA +#ifdef HAVE_LIBCDIO #include "cdd.h" #include "mrl.h" -static int track_idx=-1; +static track_t track_idx=255; static int __FASTCALL__ _cdda_open(stream_t *stream,const char *filename,unsigned flags) { const char *param; @@ -58,7 +59,7 @@ static off_t __FASTCALL__ cdd_seek(stream_t*stream,off_t pos) { - seek_cdda(stream,pos); + seek_cdda(stream,pos,&track_idx); return pos; } @@ -74,23 +75,20 @@ static int __FASTCALL__ cdd_ctrl(stream_t *s,unsigned cmd,void *args) { - cdda_priv *priv=s->priv; - cd_track_t*tr=NULL; + cdda_priv *p=s->priv; switch(cmd) { case SCTRL_TXT_GET_STREAM_NAME: { - if(track_idx!=-1) tr=cd_info_get_track(priv->cd_info,track_idx); - if(tr) - { - strncpy(args,tr->name,256); - ((char *)args)[255]=0; - } + if(track_idx!=255) + sprintf((char *)args,"Track %d",track_idx); return SCTRL_OK; } break; case SCTRL_AUD_GET_CHANNELS: - *(int *)args=2; + *(int *)args=cdio_cddap_track_channels(p->cd, track_idx); + if(*(int *)args<=0) *(int *)args=2; + MSG_V("cdda channels: %u\n",*(int *)args); return SCTRL_OK; case SCTRL_AUD_GET_SAMPLERATE: *(int *)args = 44100; Modified: mplayerxp/libmpdemux/stream.c =================================================================== --- mplayerxp/libmpdemux/stream.c 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/libmpdemux/stream.c 2009-12-19 19:15:24 UTC (rev 51) @@ -22,7 +22,7 @@ #define min(a,b) ((a)<(b)?(a):(b)) #endif -#ifdef HAVE_CDDA +#ifdef HAVE_LIBCDIO extern const stream_driver_t cdda_stream; extern const stream_driver_t cddb_stream; #endif @@ -54,10 +54,12 @@ static const stream_driver_t *sdrivers[] = { -#ifdef HAVE_CDDA +#ifdef HAVE_LIBCDIO &cdda_stream, +#ifdef HAVE_STREAMING &cddb_stream, #endif +#endif #ifdef USE_DVDNAV &dvdnav_stream, #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |