]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'refs/heads/t/mp4ff'
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 3 Sep 2022 14:29:10 +0000 (16:29 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 3 Sep 2022 14:30:06 +0000 (16:30 +0200)
This 140 patch behemoth adds a stripped down copy of libmp4ff to the
repo. This has become necessary because the library was dropped from
the faad project.

The series starts with a patch which adds an unmodified copy of the
relevant parts of libmp4ff to the repo. All code is combined in a
single file, mp4.c, which contains approximately 2K lines of code. The
public API is defined in the new mp4.h.

The remaining patches clean up the two new files, simplifying and
removing large parts of it. Some of the patches modify the API,
and those require small changes to the aac audio format handler,
which also becomes simpler due to these changes. The aac decoder,
however, is not touched in this series.

* refs/heads/t/mp4ff: (140 commits)
  mp4: Don't abort on truncated files.
  mp4: Document the purpose of each atom.
  mp4: Doxify the public API.
  mp4: Check for missing metadata also for regular opens.
  mp4: Rename mp4_open_read() to mp4_open().
  mp4: Rename mp4_meta_update() to mp4_update_meta().
  mp4: Simplify mp4_num_samples().
  mp4: Reject files with zero time scale.
  mp4: Assorted trivial cleanups.
  mp4: Remove ->len member of struct mp4_tag.
  mp4: Fix possible memory leak on errors.
  mp4: Return proper types for sample rate and count.
  mp4: Fail early on invalid sample rate or sample count.
  mp4: Remove E_MP4_BAD_CHANNEL_COUNT.
  mp4: Improve mp4_get_sample_size().
  mp4: Make sample number be an unsigned parameter.
  mp4: Check the return value of ->truncate().
  mp4: Make most loop variables unsigned.
  mp4: Replace the five tag value functions by a single one.
  mp4: Provide proper error codes for all errors.
  ...

.gitignore
NEWS.md
aft.c
audiod.c
autogen.sh
interactive.c
play.c
string.c
string.h

index bd5e04801c4bec2714dd515810296f1bc89cbab0..8f8d0af736cee205b638502171eea526d613cc22 100644 (file)
@@ -24,3 +24,4 @@ confdefs.h
 conftest
 conftest.c
 git-version.h
+*-local*
diff --git a/NEWS.md b/NEWS.md
index e9713d9826ff74e25aa01ceaad9a9db13f3113a5..e56aace3e37bbf67801808e2d26dfa878e9de27b 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -5,6 +5,14 @@ NEWS
 0.7.1 (to be announced) "digital spindrift"
 -------------------------------------------
 
+- The autogen.sh script now only creates the autoconf specific files
+  but no longer runs configure, make and the test suite.
+
+- A stripped down copy of the discontinued libmp4ff library has become
+  part of the paraslash code base. As a result it is no longer necessary
+  to install faad from source to get support for aac/m4a files. The
+  faad decoder package must still be installed.
+
 [tarball](./releases/paraslash-git.tar.xz)
 
 ----------------------------------
diff --git a/aft.c b/aft.c
index 5f9098aa458955d1338bec6183c67493ce798cad..e0bde7fc78c8365f33aa8e5aae9f751a3dabb751 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -779,18 +779,17 @@ static void write_image_items(struct para_buffer *b, struct afs_info *afsi)
 static void write_filename_items(struct para_buffer *b, const char *path,
                bool basename)
 {
-       char *val;
+       const char *slash;
 
        if (basename) {
                WRITE_STATUS_ITEM(b, SI_basename, "%s\n", path);
                return;
        }
        WRITE_STATUS_ITEM(b, SI_path, "%s\n", path);
-       val = para_basename(path);
-       WRITE_STATUS_ITEM(b, SI_basename, "%s\n", val? val : "");
-       val = para_dirname(path);
-       WRITE_STATUS_ITEM(b, SI_directory, "%s\n", val? val : "");
-       free(val);
+       slash = strrchr(path, '/');
+       WRITE_STATUS_ITEM(b, SI_basename, "%s\n", slash? slash + 1 : path);
+       WRITE_STATUS_ITEM(b, SI_directory, "%.*s\n",
+               slash? (int)(slash - path) : (int)strlen(path), path);
 }
 
 static int print_chunk_table(struct ls_data *d, struct para_buffer *b)
@@ -897,13 +896,13 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                goto out;
        }
        if (opts->mode == LS_MODE_MBOX) {
-               const char *bn = para_basename(d->path);
+               const char *slash = strrchr(d->path, '/');
                para_printf(b,
                        "From foo@localhost %s\n"
                        "Received: from\nTo: bar\nFrom: a\n"
                        "Subject: %s\n\n",
                        last_played_time,
-                       bn? bn : "?");
+                       slash? slash + 1 : "?");
        }
        write_filename_items(b, d->path, lls_opt_given(r_b));
        if (lls_opt_given(r_a))
index 113f1132e96c92f5045c4acdc72211728230137b..119adbc0be2ddbf24a7d06de4b77a5a3d88bd230 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -749,8 +749,8 @@ static void compute_time_diff(const struct timeval *status_time)
        if (count > 5) {
                int s = tv_diff(&diff, &stat_task->sa_time_diff, &tmp);
                if (tv_diff(&max_deviation, &tmp, NULL) < 0)
-                       PARA_WARNING_LOG("time diff jump: %lums\n",
-                               s * tv2ms(&tmp));
+                       PARA_WARNING_LOG("time diff jump: %c%lums\n",
+                               s < 0? '-' : '+', tv2ms(&tmp));
        }
        count++;
        sa_time_diff_sign = tv_convex_combination(
@@ -1094,7 +1094,7 @@ static int command_post_select(struct sched *s, void *context)
                return ret;
        ret = handle_connect(ct->fd, &s->rfds);
        if (ret < 0) {
-               PARA_ERROR_LOG("%s\n", para_strerror(-ret));
+               PARA_NOTICE_LOG("%s\n", para_strerror(-ret));
                if (ret == -E_AUDIOD_TERM) {
                        task_notify_all(s, -ret);
                        return ret;
index caf1401d8bf02e2d299bdcdf58ae902cfb260092..cbfea7fdfb2ea5e2b8ad84c8faba815b67b8a966 100755 (executable)
@@ -1,28 +1,8 @@
 #!/bin/sh
-# check if we have multiple processors/cores
-n=$(nproc 2>/dev/null)
-if [ -z "$n" ]; then
-       n=$(grep ^processor /proc/cpuinfo 2>/dev/null | wc -l)
-       [ $n -eq 0 ] && n=1
-fi
-# If we are compiling with distcc, try to guess a reasonable number
-# based on (a) the number of cores on this machine and (b) the number
-# of words in the DISTCC_HOSTS variable.
-d="$(echo $DISTCC_HOSTS | wc -w)"
-n=$(($n + 2 * $n * $d))
-echo preparing, parallel=$n...
-if test -f Makefile; then
-       make maintainer-clean > /dev/null 2>&1
-fi
 autom4te \
        --language=autoconf \
        --output=configure \
        --no-cache \
        --warnings=all \
-       configure.ac
+       configure.ac &&
 autoheader
-echo configuring...
-./configure $@ > /dev/null
-echo compiling...
-make clean > /dev/null 2>&1
-make -j $n > /dev/null && make check
index 8c4545b476e8f792ea7bba6f88b4e83fb952e540..041376a1057bcf2e98a4c23c2b23c42d73a68345 100644 (file)
@@ -312,22 +312,27 @@ static int i9e_post_select(__a_unused struct sched *s, __a_unused void *context)
                goto rm_btrn;
        while (input_available()) {
                if (i9ep->stdout_btrn) {
-                       unsigned len = i9ep->key_sequence_length;
-                       assert(len < sizeof(i9ep->key_sequence) - 1);
-                       buf = i9ep->key_sequence + len;
-                       ret = read(i9ep->ici->fds[0], buf, 1);
-                       if (ret < 0) {
-                               ret = -ERRNO_TO_PARA_ERROR(errno);
-                               goto rm_btrn;
+                       while (i9ep->key_sequence_length < sizeof(i9ep->key_sequence) - 1) {
+                               buf = i9ep->key_sequence + i9ep->key_sequence_length;
+                               ret = read(i9ep->ici->fds[0], buf, 1);
+                               if (ret < 0) {
+                                       ret = -ERRNO_TO_PARA_ERROR(errno);
+                                       goto rm_btrn;
+                               }
+                               if (ret == 0) {
+                                       ret = -E_I9E_EOF;
+                                       goto rm_btrn;
+                               }
+                               buf[1] = '\0';
+                               i9ep->key_sequence_length++;
+                               rl_stuff_char((int)(unsigned char)*buf);
+                               rl_callback_read_char();
+                               if (!input_available())
+                                       break;
                        }
-                       ret = -E_I9E_EOF;
-                       if (ret == 0)
-                               goto rm_btrn;
-                       buf[1] = '\0';
-                       i9ep->key_sequence_length++;
-                       rl_stuff_char((int)(unsigned char)*buf);
-               }
-               rl_callback_read_char();
+                       i9ep->key_sequence_length = 0;
+               } else
+                       rl_callback_read_char();
                ret = 0;
        }
        if (!i9ep->stdout_btrn)
diff --git a/play.c b/play.c
index 14fac42fd7b6e92566815d4c56b1f4b6b23c88e2..ba9fff70190c7e150b136e15eb5375015897b2d0 100644 (file)
--- a/play.c
+++ b/play.c
@@ -854,6 +854,7 @@ static int com_pause(__a_unused struct lls_parse_result *lpr)
        ss = PARA_MAX(ss, 0UL);
        ss = PARA_MIN(ss, pt->num_chunks);
        pt->start_chunk = ss;
+       pt->rq = CRT_REPOS;
        kill_stream();
        return 0;
 }
index 198e9f1d286ee2228638a2a7994fe9e65f41ccac..f80331900de09fccf573c18666c3fa007f8ca6bf 100644 (file)
--- a/string.c
+++ b/string.c
@@ -245,56 +245,6 @@ __must_check __malloc char *para_strcat(char *a, const char *b)
        return tmp;
 }
 
-/**
- * Paraslash's version of dirname().
- *
- * \param name Pointer to the full path.
- *
- * Compute the directory component of \p name.
- *
- * \return If \a name is \p NULL or the empty string, return \p NULL.
- * Otherwise, Make a copy of \a name and return its directory component. Caller
- * is responsible to free the result.
- */
-__must_check __malloc char *para_dirname(const char *name)
-{
-       char *p, *ret;
-
-       if (!name || !*name)
-               return NULL;
-       ret = para_strdup(name);
-       p = strrchr(ret, '/');
-       if (!p)
-               *ret = '\0';
-       else
-               *p = '\0';
-       return ret;
-}
-
-/**
- * Paraslash's version of basename().
- *
- * \param name Pointer to the full path.
- *
- * Compute the filename component of \a name.
- *
- * \return \p NULL if (a) \a name is the empty string or \p NULL, or (b) name
- * ends with a slash.  Otherwise, a pointer within \a name is returned.  Caller
- * must not free the result.
- */
-__must_check char *para_basename(const char *name)
-{
-       char *ret;
-
-       if (!name || !*name)
-               return NULL;
-       ret = strrchr(name, '/');
-       if (!ret)
-               return (char *)name;
-       ret++;
-       return ret;
-}
-
 /**
  * Get the logname of the current user.
  *
index 10379a0e83098f392e8653467b826925376eda15..08b9965f57d94b52a19dd231c38b2d53aabb824a 100644 (file)
--- a/string.h
+++ b/string.h
@@ -76,8 +76,6 @@ __printf_2_0 unsigned xvasprintf(char **result, const char *fmt, va_list ap);
 __printf_2_3 unsigned xasprintf(char **result, const char *fmt, ...);
 __must_check __malloc __printf_1_2 char *make_message(const char *fmt, ...);
 __must_check __malloc char *para_strcat(char *a, const char *b);
-__must_check __malloc char *para_dirname(const char *name);
-__must_check char *para_basename(const char *name);
 __must_check __malloc char *para_logname(void);
 __must_check __malloc char *para_homedir(void);
 __malloc char *para_hostname(void);