From c0067c4d103b41d1f80b83170719d4afa999be54 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 4 Mar 2007 21:35:44 +0100 Subject: [PATCH 1/1] kill the reposition handler in struct audio_format_handler All three audio format handlers provided only a dummy function. Kill these as well. --- NEWS | 9 +++++++++ aac_afh.c | 9 --------- afh.h | 8 -------- mp3_afh.c | 6 ------ ogg_afh.c | 6 ------ vss.c | 2 -- 6 files changed, 9 insertions(+), 31 deletions(-) diff --git a/NEWS b/NEWS index 429cd34a..2980a559 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,15 @@ NEWS 0.?.? (to be announced) "neural discharge" ------------------------------------------ +The main change in this release is the major audio format handler +cleanup which removes some similar/duplicate code and makes it easier +to implement plugins for other audio formats. Of course, the usual mix +of other improvements/changes/bugfixes also made it into the release. + + - simplified audio format handlers (some of the handling functions + were moved one layer up to the virtual streaming system). + - repositioning of mp3 streams is much faster, in particular for + - jumping near the end of large mp3 files. - permission flags DB_READ,DB_WRITE have been renamed to AFS_READ and AFS_WRITE. - fix a bug in para_filter that caused decoding of aac files diff --git a/aac_afh.c b/aac_afh.c index 338b7827..e5ee2eef 100644 --- a/aac_afh.c +++ b/aac_afh.c @@ -193,14 +193,6 @@ static int aac_get_file_info(FILE *file, char *info_str, long unsigned *frames, return 1; } -/* - * nothing to do as we'll seek to the correct offset in aac read_chunk() anyway - */ -static int aac_reposition_stream(__a_unused long unsigned request) -{ - return 1; -} - static char *aac_read_chunk(long unsigned current_chunk, ssize_t *len) { int ret; @@ -238,7 +230,6 @@ static const char* aac_suffixes[] = {"m4a", "mp4", NULL}; void aac_afh_init(struct audio_format_handler *p) { af = p; - af->reposition_stream = aac_reposition_stream; af->get_file_info = aac_get_file_info, af->read_chunk = aac_read_chunk; af->close_audio_file = aac_close_audio_file; diff --git a/afh.h b/afh.h index 403b7a55..0ead11e0 100644 --- a/afh.h +++ b/afh.h @@ -102,14 +102,6 @@ struct audio_format_handler { * for closing the file handle. It is assumed to succeed. */ void (*close_audio_file)(void); - /** - * jump to another position in the current audio file - * - * This is called if a client issued the ff or jmp command with \a request - * being the number of the next chunk that should be sent out. Must return a - * positive value on success and a negative value on errors. - */ - int (*reposition_stream)(long unsigned request); /** * function responsible for reading one data chunk. * diff --git a/mp3_afh.c b/mp3_afh.c index 4ed134fa..6850cbd8 100644 --- a/mp3_afh.c +++ b/mp3_afh.c @@ -461,11 +461,6 @@ static int mp3_get_file_info(FILE *audio_file, char *info_str, return 1; } -static int mp3_reposition_stream(__a_unused long unsigned new_frame) -{ - return 1; -} - static char *mp3_read_chunk(long unsigned current_chunk, ssize_t *len) { int ret; @@ -518,7 +513,6 @@ void mp3_init(struct audio_format_handler *p) { af = p; af->get_file_info = mp3_get_file_info; - af->reposition_stream = mp3_reposition_stream; af->read_chunk = mp3_read_chunk; af->close_audio_file = mp3_close_audio_file; af->get_header_info = NULL; diff --git a/ogg_afh.c b/ogg_afh.c index 81f5ac1a..b5ecc4b0 100644 --- a/ogg_afh.c +++ b/ogg_afh.c @@ -272,11 +272,6 @@ err: return ret; } -static int ogg_reposition_stream(__a_unused long unsigned new_frame) -{ - return 1; -} - static char *ogg_read_chunk(long unsigned current_chunk, ssize_t *len) { int ret; @@ -324,7 +319,6 @@ static const char* ogg_suffixes[] = {"ogg", NULL}; void ogg_init(struct audio_format_handler *p) { af = p; - af->reposition_stream = ogg_reposition_stream; af->get_file_info = ogg_get_file_info, af->read_chunk = ogg_read_chunk; af->close_audio_file = ogg_close_audio_file; diff --git a/vss.c b/vss.c index b34703de..133ed19f 100644 --- a/vss.c +++ b/vss.c @@ -482,8 +482,6 @@ again: } mmd->chunks_sent = 0; } - if (af && vss_repos() && mmd->current_chunk != mmd->repos_request) - af->reposition_stream(mmd->repos_request); if (vss_repos()) { mmd->new_vss_status_flags &= ~(VSS_REPOS); mmd->current_chunk = mmd->repos_request; -- 2.39.2