From: Andre Noll Date: Sun, 1 Sep 2019 11:18:41 +0000 (+0200) Subject: Merge branch 'refs/heads/t/afh' X-Git-Tag: v0.6.3~41 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=05a15e80c5dae4f94c417210549d07a94a0acc16;hp=-c Merge branch 'refs/heads/t/afh' A couple of patches which remove ->init of struct audio_format_handler and struct receiver. Cooking for 9 months. * refs/heads/t/afh: Remove ->init() of struct receiver. afh: Constify definition of audio format handlers. afh: Introduce audio_format_names[]. afh: Get rid of dummy entry at the end of afl[]. afh: Minor simplification for afh_get_chunk(). afh: Move audio_format_name() up. --- 05a15e80c5dae4f94c417210549d07a94a0acc16 diff --combined NEWS.md index 50ec0a3a,55ef3be9..7ed78027 --- a/NEWS.md +++ b/NEWS.md @@@ -1,21 -1,6 +1,22 @@@ NEWS ==== +---------------------------------------------- +0.6.3 (to be announced) "generalized activity" +---------------------------------------------- + +- The ff command now accepts a negative argument to instruct the + virtual streaming system to jump backwards in the current audio + stream. The old syntax (e.g., "ff 30-") is still supported but it + is deprecated and no longer documented. The compatibility code is + sheduled for removal after 0.7.0. +- para_afh: New option: --preserve to reset the modification time to + the value of the original file after meta data modification. +- Overhaul of the compress filter code. The refined algorithm should + reduce clipping. The meaning of --aggressiveness has changed, see the + updated and extended documentation of the compress filter for details. ++- Cleanup of the audio format handler code. + -------------------------------------- 0.6.2 (2018-06-30) "elastic diversity" -------------------------------------- diff --combined afh.c index ffb4315b,69b834d2..567b560a --- a/afh.c +++ b/afh.c @@@ -113,24 -113,6 +113,24 @@@ static int rewrite_tags(const char *nam goto out; } ret = xrename(tmp_name, name); + if (ret < 0) + goto out; + if (OPT_GIVEN(PRESERVE)) { + struct timespec times[2]; /* [0]: atime, [1]: mtime */ + times[0].tv_nsec = UTIME_OMIT; + times[1] = sb.st_mtim; + /* + * We might well have written a file of identical size. If we + * keep the mtime as well, we might fool backup applications + * like rsync which skip files whose size and mtime haven't + * changed. So we change the mtime slightly. + */ + times[1].tv_sec++; + if (futimens(output_fd, times) < 0) { + ret = -ERRNO_TO_PARA_ERROR(errno); + goto out; + } + } out: if (ret < 0 && output_fd >= 0) unlink(tmp_name); /* ignore errors */ @@@ -221,7 -203,6 +221,6 @@@ int main(int argc, char **argv loglevel = OPT_UINT32_VAL(LOGLEVEL); version_handle_flag("afh", OPT_GIVEN(VERSION)); handle_help_flags(); - afh_init(); for (i = 0; i < lls_num_inputs(lpr); i++) { int ret2; const char *path = lls_input(i, lpr); diff --combined mp3_afh.c index 471efd99,e5027a0b..6ed73c2a --- a/mp3_afh.c +++ b/mp3_afh.c @@@ -63,6 -63,8 +63,6 @@@ static const int mp3info_bitrate[2][3][ }; static const int frame_size_index[] = {24000, 72000, 72000}; -static const char *mode_text[] = {"stereo", "joint stereo", "dual channel", "mono", "invalid"}; - #ifdef HAVE_ID3TAG #include @@@ -431,13 -433,10 +431,13 @@@ static int header_frequency(struct mp3h return frequencies[h->version][h->freq]; } -static const char *header_mode(struct mp3header *h) +static const char *header_mode(const struct mp3header *h) { - if (h->mode > 4) - h->mode = 4; /* invalid */ + const char * const mode_text[] = {"stereo", "joint stereo", + "dual channel", "mono"}; + + if (h->mode >= ARRAY_SIZE(mode_text)) + return "invalid"; return mode_text[h->mode]; } @@@ -683,15 -682,14 +683,14 @@@ static int mp3_get_file_info(char *map static const char * const mp3_suffixes[] = {"mp3", NULL}; /** - * the init function of the mp3 audio format handler + * The mp3 audio format handler. * - * \param afh pointer to the struct to initialize + * It does not depend on any libraries and is hence always compiled in. */ - void mp3_afh_init(struct audio_format_handler *afh) - { - afh->get_file_info = mp3_get_file_info; - afh->suffixes = mp3_suffixes; + const struct audio_format_handler mp3_afh = { + .get_file_info = mp3_get_file_info, + .suffixes = mp3_suffixes, #ifdef HAVE_LIBID3TAG - afh->rewrite_tags = mp3_rewrite_tags; + .rewrite_tags = mp3_rewrite_tags, #endif /* HAVE_LIBID3TAG */ - } + };