On Mar 31, 2014 11:28 AM, "Katerina Barone-Adesi" <kateri...@gmail.com>
wrote:
> Subject: Added asettb support - setting timebases for audio

Use this as title: libavfilter: Add asettb filter for setting timebase for
audio

>
> Ported asettb (including the sr option for audio sample rate),
> and documentation from ffmpeg.
> ---
>  doc/filters.texi         | 43 +++++++++++++++++++++++++++++-
>  libavfilter/Makefile     |  1 +
>  libavfilter/allfilters.c |  1 +
>  libavfilter/settb.c      | 68
++++++++++++++++++++++++++++++++++++++++--------
>  4 files changed, 101 insertions(+), 12 deletions(-)

As this was ported from FFmpeg, please preserve its original authorship,
Nicolas George <geo...@nsup.org>. Use

git commit -s --amend --author='Name <email>'

The -s option will add a "Signed-off-by" which gives you credit.

> diff --git a/doc/filters.texi b/doc/filters.texi
> index 93625c6..027bbfd 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -260,6 +260,47 @@ asetpts=expr=N/SR/TB
>  asetpts='(RTCTIME - RTCSTART) / (TB * 1000000)"
>  @end example
>
> +@section asettb
> +
> +Set the timebase to use for the output frames timestamps.
> +It is mainly useful for testing timebase configuration.
> +
> +This filter accepts the following options:
> +
> +@table @option
> +
> +@item expr
> +The expression which is evaluated into the output timebase.
> +
> +@end table
> +

> +The expression can contain the constants "PI", "E", "PHI", "AVTB" (the
> +default timebase), "intb" (the input timebase), and "sr" (the sample
rate,
> +audio only).
> +
> +The default value for the input is "intb".

Use either @var{} or @code{} instead of the "".

> +
> +Some examples:
> +
> +@example
> +# set the timebase to 1/25
> +settb=1/25
> +
> +# set the timebase to 1/10
> +settb=0.1
> +
> +#set the timebase to 1001/1000
> +settb=1+0.001
> +
> +#set the timebase to 2*intb
> +settb=2*intb
> +
> +#set the default timebase value
> +settb=AVTB
> +
> +#set the timebase to twice the sample rate
> +asettb=sr*2
> +@end example
>
>  @section ashowinfo
>
> @@ -2392,7 +2433,7 @@ default timebase), and "intb" (the input timebase).
>
>  The default value for the input is "intb".
>
> -Follow some examples.
> +Some examples:

I wouldn't mind, but some people might complain about that being a stray
change.
>
>  @example
>  # set the timebase to 1/25

[...]

> diff --git a/libavfilter/settb.c b/libavfilter/settb.c
> index 87b60a7..83405f8 100644
> --- a/libavfilter/settb.c
> +++ b/libavfilter/settb.c
> @@ -32,6 +32,7 @@
>  #include "libavutil/mathematics.h"
>  #include "libavutil/opt.h"
>  #include "libavutil/rational.h"
> +#include "audio.h"
>  #include "avfilter.h"
>  #include "internal.h"
>  #include "video.h"
> @@ -42,6 +43,7 @@ static const char *const var_names[] = {
>      "PI",
>      "AVTB",   /* default timebase 1/AV_TIME_BASE */
>      "intb",   /* input timebase */
> +    "sr",     /* sample rate */
>      NULL
>  };
>
> @@ -51,6 +53,7 @@ enum var_name {
>      VAR_PI,
>      VAR_AVTB,
>      VAR_INTB,
> +    VAR_SR,
>      VAR_VARS_NB
>  };
>
> @@ -60,6 +63,15 @@ typedef struct {
>      double var_values[VAR_VARS_NB];
>  } SetTBContext;
>
> +#define OFFSET(x) offsetof(SetTBContext, x)
> +#define DEFINE_OPTIONS(filt_name, filt_type)
                  \
> +static const AVOption filt_name##_options[] = {
                   \
> +    { "expr", "set expression determining the output timebase",
OFFSET(tb_expr), AV_OPT_TYPE_STRING, {.str="intb"}, \
> +           .flags=AV_OPT_FLAG_##filt_type##_PARAM },
                  \
> +    { NULL }
                  \
> +}
> +
> +

Diego would complain about extra newline.

[...]

Rest looks OK for me.

Timothy
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to