diff options
author | wm4 <wm4@nowhere> | 2014-03-26 16:55:27 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-03-26 16:55:27 +0100 |
commit | 6fa2c52589254d7c43901acbcbb9bc837bcb2043 (patch) | |
tree | 3599361d91b5159ab95b4e99ce396679c1693cec | |
parent | 32d818f02b4ed471c0d9f1d23fff784294d83c44 (diff) |
stream_cdda: remove unused stuff
This cd_info_t struct was practically unused. The only thing it did was
storing the track name of the form "Track %d" in a very roundabout way.
Remove it. (It made more sense when there was still CDDB support.)
-rw-r--r-- | old-makefile | 3 | ||||
-rw-r--r-- | stream/cdd.h | 58 | ||||
-rw-r--r-- | stream/cdinfo.c | 154 | ||||
-rw-r--r-- | stream/stream_cdda.c | 41 | ||||
-rw-r--r-- | wscript_build.py | 1 |
5 files changed, 3 insertions, 254 deletions
diff --git a/old-makefile b/old-makefile index 644fe5bcad..5d5e72410b 100644 --- a/old-makefile +++ b/old-makefile @@ -27,8 +27,7 @@ SOURCES_AUDIO_INPUT-$(ALSA) += stream/ai_alsa1x.c SOURCES_AUDIO_INPUT-$(OSS) += stream/ai_oss.c SOURCES_AUDIO_INPUT-$(SNDIO) += stream/ai_sndio.c SOURCES-$(AUDIO_INPUT) += $(SOURCES_AUDIO_INPUT-yes) -SOURCES-$(CDDA) += stream/stream_cdda.c \ - stream/cdinfo.c +SOURCES-$(CDDA) += stream/stream_cdda.c SOURCES-$(DVBIN) += stream/dvb_tune.c \ stream/stream_dvb.c SOURCES-$(DVDREAD) += stream/stream_dvd.c \ diff --git a/stream/cdd.h b/stream/cdd.h deleted file mode 100644 index 93b3dfb2b2..0000000000 --- a/stream/cdd.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_CDD_H -#define MPLAYER_CDD_H - -#include <sys/types.h> - -struct mp_log; - -typedef struct cd_track { - char *name; - unsigned int track_nb; - unsigned int min; - unsigned int sec; - unsigned int msec; - unsigned long frame_begin; - unsigned long frame_length; - struct cd_track *prev; - struct cd_track *next; -} cd_track_t; - -typedef struct { - char *artist; - char *album; - char *genre; - unsigned int nb_tracks; - unsigned int min; - unsigned int sec; - unsigned msec; - cd_track_t *first; - cd_track_t *last; - cd_track_t *current; -} cd_info_t; - -cd_info_t* cd_info_new(void); -void cd_info_free(cd_info_t *cd_info); -cd_track_t* 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_info_get_track(cd_info_t *cd_info, unsigned int track_nb); - -void cd_info_debug(cd_info_t *cd_info, struct mp_log *log); - -#endif /* MPLAYER_CDD_H */ diff --git a/stream/cdinfo.c b/stream/cdinfo.c deleted file mode 100644 index 2e6e34b1be..0000000000 --- a/stream/cdinfo.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * CD Info - * - * Copyright (C) 2002 Bertrand Baudet <bertrand_baudet@yahoo.com> - * - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "common/msg.h" -#include "cdd.h" - -/******************************************************************************************************************* - * - * xmcd parser, cd info list - * - *******************************************************************************************************************/ - -cd_info_t* -cd_info_new(void) { - cd_info_t *cd_info = NULL; - - cd_info = malloc(sizeof(cd_info_t)); - if( cd_info==NULL ) { - return NULL; - } - - memset(cd_info, 0, sizeof(cd_info_t)); - - return cd_info; -} - -void -cd_info_free(cd_info_t *cd_info) { - cd_track_t *cd_track, *cd_track_next; - if( cd_info==NULL ) return; - free(cd_info->artist); - free(cd_info->album); - free(cd_info->genre); - - cd_track_next = cd_info->first; - while( cd_track_next!=NULL ) { - cd_track = cd_track_next; - cd_track_next = cd_track->next; - free(cd_track->name); - free(cd_track); - } -} - -cd_track_t* -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; - - if( cd_info==NULL || track_name==NULL ) return NULL; - - cd_track = malloc(sizeof(cd_track_t)); - if( cd_track==NULL ) { - return NULL; - } - memset(cd_track, 0, sizeof(cd_track_t)); - - cd_track->name = malloc(strlen(track_name)+1); - if( cd_track->name==NULL ) { - free(cd_track); - return NULL; - } - strcpy(cd_track->name, track_name); - cd_track->track_nb = track_nb; - cd_track->min = min; - cd_track->sec = sec; - cd_track->msec = msec; - cd_track->frame_begin = frame_begin; - cd_track->frame_length = frame_length; - - if( cd_info->first==NULL ) { - cd_info->first = cd_track; - } - if( cd_info->last!=NULL ) { - cd_info->last->next = cd_track; - } - - cd_track->prev = cd_info->last; - - cd_info->last = cd_track; - cd_info->current = cd_track; - - cd_info->nb_tracks++; - - return cd_track; -} - -cd_track_t* -cd_info_get_track(cd_info_t *cd_info, unsigned int track_nb) { - cd_track_t *cd_track=NULL; - - if( cd_info==NULL ) return NULL; - - cd_track = cd_info->first; - while( cd_track!=NULL ) { - if( cd_track->track_nb==track_nb ) { - return cd_track; - } - cd_track = cd_track->next; - } - return NULL; -} - -void cd_info_debug(cd_info_t *cd_info, struct mp_log *log) -{ - cd_track_t *current_track; - mp_info(log, "================ CD INFO === start =========\n"); - if( cd_info==NULL ) { - mp_info(log, "cd_info is NULL\n"); - return; - } - mp_info(log, " artist=[%s]\n", cd_info->artist); - mp_info(log, " album=[%s]\n", cd_info->album); - mp_info(log, " genre=[%s]\n", cd_info->genre); - mp_info(log, " nb_tracks=%d\n", cd_info->nb_tracks); - mp_info(log, " length= %2d:%02d.%02d\n", cd_info->min, cd_info->sec, cd_info->msec); - - mp_info(log, "ID_CDDB_INFO_ARTIST=%s\n", cd_info->artist); - mp_info(log, "ID_CDDB_INFO_ALBUM=%s\n", cd_info->album); - mp_info(log, "ID_CDDB_INFO_GENRE=%s\n", cd_info->genre); - mp_info(log, "ID_CDDB_INFO_LENGTH_MSF=%02d:%02d.%02d\n", cd_info->min, cd_info->sec, cd_info->msec); - mp_info(log, "ID_CDDB_INFO_TRACKS=%d\n", cd_info->nb_tracks); - - current_track = cd_info->first; - while( current_track!=NULL ) { - mp_info(log, " #%2d %2d:%02d.%02d @ %7ld\t[%s] \n", current_track->track_nb, current_track->min, current_track->sec, current_track->msec, current_track->frame_begin, current_track->name); - mp_info(log, "ID_CDDB_INFO_TRACK_%d_NAME=%s\n", current_track->track_nb, current_track->name); - mp_info(log, "ID_CDDB_INFO_TRACK_%d_MSF=%02d:%02d.%02d\n", current_track->track_nb, current_track->min, current_track->sec, current_track->msec); - current_track = current_track->next; - } - mp_info(log, "================ CD INFO === end =========\n"); -} diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c index 347d6f993d..3d13dd0f59 100644 --- a/stream/stream_cdda.c +++ b/stream/stream_cdda.c @@ -46,8 +46,6 @@ #include "libavutil/common.h" #include "compat/mpbswap.h" -#include "cdd.h" - #include "common/msg.h" typedef struct { @@ -56,7 +54,6 @@ typedef struct { int sector; int start_sector; int end_sector; - cd_info_t *cd_info; // options int speed; @@ -151,17 +148,8 @@ static bool print_cdtext(stream_t *s, int track) static void print_track_info(stream_t *s, int track) { - cdda_priv* p = (cdda_priv*)s->priv; - cd_track_t *cd_track = cd_info_get_track(p->cd_info, track); - if( cd_track!=NULL ) { - MP_INFO(s, "\n%s\n", cd_track->name); - MP_INFO(s, "ID_CDDA_TRACK=%d\n", - cd_track->track_nb); - } - if (print_cdtext(s, track)) { - // hack for term OSD overwriting the last line of CDTEXT - MP_INFO(s, "\n"); - } + MP_INFO(s, "Switched to track %d\n", track); + print_cdtext(s, track); } static void cdparanoia_callback(long int inpos, paranoia_cb_mode_t function) @@ -242,7 +230,6 @@ static void close_cdda(stream_t *s) cdda_priv *p = (cdda_priv *)s->priv; paranoia_free(p->cdp); cdda_close(p->cd); - cd_info_free(p->cd_info); free(p); } @@ -298,10 +285,7 @@ static int open_cdda(stream_t *st, int m) int mode = p->paranoia_mode; int offset = p->toc_offset; cdrom_drive_t *cdd = NULL; - cd_info_t *cd_info; - unsigned int audiolen = 0; int last_track; - int i; if (m != STREAM_READ) { return STREAM_UNSUPPORTED; @@ -336,29 +320,9 @@ static int open_cdda(stream_t *st, int m) return STREAM_ERROR; } - cd_info = cd_info_new(); - MP_INFO(st, "Found audio CD with %d tracks.\n", - (int)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; - - sprintf(track_name, "Track %d", i + 1); - 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; - } - cd_info->min = (unsigned int)(audiolen / (60 * 75)); - cd_info->sec = (unsigned int)((audiolen / 75) % 60); - cd_info->msec = (unsigned int)(audiolen % 75); - priv = malloc(sizeof(cdda_priv)); memset(priv, 0, sizeof(cdda_priv)); priv->cd = cdd; - priv->cd_info = cd_info; if (p->toc_bias) offset -= cdda_track_firstsector(cdd, 1); @@ -392,7 +356,6 @@ static int open_cdda(stream_t *st, int m) if (priv->cdp == NULL) { cdda_close(cdd); free(priv); - cd_info_free(cd_info); return STREAM_ERROR; } diff --git a/wscript_build.py b/wscript_build.py index 117180ca7c..f2135fee1c 100644 --- a/wscript_build.py +++ b/wscript_build.py @@ -229,7 +229,6 @@ def build(ctx): ( "stream/ai_sndio.c", "sndio" ), ( "stream/audio_in.c", "audio-input" ), ( "stream/cache.c" ), - ( "stream/cdinfo.c", "cdda"), ( "stream/cookies.c" ), ( "stream/dvb_tune.c", "dvbin" ), ( "stream/frequencies.c", "tv" ), |