Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Stefano Sabatini <stefasab@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/asrc_flite: fixes and improvements
Date: Tue, 5 Dec 2023 00:27:22 +0100
Message-ID: <ZW5gWhki3toIszX4@mariano> (raw)
In-Reply-To: <CAPYw7P4xTFRBbGO3ubP6kfKCN7FLSXE+z=3-+KqfMJ6KQ3+Drw@mail.gmail.com>

On date Sunday 2023-12-03 23:23:48 +0100, Paul B Mahol wrote:
> Attached.

> From fe1ece70c0ecbe6fb24e0823fe46db57242396e4 Mon Sep 17 00:00:00 2001
> From: Paul B Mahol <onemda@gmail.com>
> Date: Sun, 3 Dec 2023 21:38:08 +0100
> Subject: [PATCH 1/2] avfilter/asrc_flite: switch to activate
> 
> Allows to set EOF timestamp.
> 
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavfilter/asrc_flite.c | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)

Cannot really comment, but should be good if tested.

> From e8aad4411ee0f8bc4bd50d5e3a10b7f712687f60 Mon Sep 17 00:00:00 2001
> From: Paul B Mahol <onemda@gmail.com>
> Date: Sun, 3 Dec 2023 22:50:11 +0100
> Subject: [PATCH 2/2] avfilter/asrc_flite: use streaming function
> 
> Fix continuous accumulation of audio samples for big txt inputs.
> 
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavfilter/asrc_flite.c | 84 ++++++++++++++++++++++++++++++----------
>  1 file changed, 64 insertions(+), 20 deletions(-)
> 
> diff --git a/libavfilter/asrc_flite.c b/libavfilter/asrc_flite.c
> index 74c8414b5c..70a2fd3e40 100644
> --- a/libavfilter/asrc_flite.c
> +++ b/libavfilter/asrc_flite.c
> @@ -24,6 +24,8 @@
>   */
>  
>  #include <flite/flite.h>
> +#include "libavutil/audio_fifo.h"
> +#include "libavutil/avstring.h"
>  #include "libavutil/channel_layout.h"
>  #include "libavutil/file.h"
>  #include "libavutil/opt.h"
> @@ -39,11 +41,14 @@ typedef struct FliteContext {
>      char *voice_str;
>      char *textfile;
>      char *text;
> -    cst_wave *wave;
> -    int16_t *wave_samples;
> -    int      wave_nb_samples;
> +    char *text_p;
> +    char *text_saveptr;
> +    int nb_channels;
> +    int sample_rate;
> +    AVAudioFifo *fifo;
>      int list_voices;
>      cst_voice *voice;
> +    cst_audio_streaming_info *asi;
>      struct voice_entry *voice_entry;
>      int64_t pts;
>      int frame_nb_samples; ///< number of samples per frame
> @@ -140,10 +145,30 @@ static int select_voice(struct voice_entry **entry_ret, const char *voice_name,
>      return AVERROR(EINVAL);
>  }
>  
> +static int audio_stream_chunk_by_word(const cst_wave *w, int start, int size,

nit+: w -> wave to simplify reading

> +                                      int last, cst_audio_streaming_info *asi)
> +{
> +    FliteContext *flite = asi->userdata;
> +    void *const ptr[8] = { &w->samples[start] };
> +
> +    flite->nb_channels = w->num_channels;
> +    flite->sample_rate = w->sample_rate;

> +    if (!flite->fifo) {
> +        flite->fifo = av_audio_fifo_alloc(AV_SAMPLE_FMT_S16, flite->nb_channels, size);

any reason to initialize it here rather than in init?

> +        if (!flite->fifo)
> +            return CST_AUDIO_STREAM_STOP;

[...]

LGTM otherwise, thanks.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2023-12-04 23:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03 22:23 Paul B Mahol
2023-12-04 23:27 ` Stefano Sabatini [this message]
2023-12-04 23:30   ` Paul B Mahol

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZW5gWhki3toIszX4@mariano \
    --to=stefasab@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git