[FFmpeg-devel] [PATCHv2 1/2] ffplay: add support for interactive volume control

Ganesh Ajjanagadde gajjanag at mit.edu
Sun Sep 27 17:06:53 CEST 2015


On Sun, Sep 27, 2015 at 10:40 AM, Ganesh Ajjanagadde <gajjanag at mit.edu> wrote:
> On Sun, Sep 27, 2015 at 10:12 AM, Ganesh Ajjanagadde <gajjanag at mit.edu> wrote:
>> On Sun, Sep 27, 2015 at 9:57 AM, Clément Bœsch <u at pkh.me> wrote:
>>> On Sat, Sep 26, 2015 at 11:36:42AM -0400, Ganesh Ajjanagadde wrote:
>>> [...]
>>>> -        memcpy(stream, (uint8_t *)is->audio_buf + is->audio_buf_index, len1);
>>>> +        if (is->muted)
>>>> +            memset(stream, 0, len1);
>>>
>>> This doesn't work with u8 sampling.
>>
>> Do you know of any clean alternative? For instance, is it possible to
>> obtain the zero point of the stream from some stream field?
>
> Found one myself, see updated patch. I tested against u8 sample file
> tests/data/fate/acodec-pcm-u8.wav.

I can clarify this further: actually patchv4 (the latest) and the v3
and below to which the comment refers to are both correct, and in fact
silence_buf[0] = 0 currently. I still like v4 more since it is more
explicit in intent.

Here is why the code is correct. Lines 2511 or so set the
SDL_AudioSpec: https://wiki.libsdl.org/SDL_AudioSpec to signed 16
bits. It is irrelevant what the actual audio format is, I assume
something takes care of internal conversions to the desired format. 0
indeed represents silence.

That being said, I don't know where the wanted_spec.silence and really
spec.silence are being used to set the silence_buf uniformly to the
silence value. I will look into this and post a separate patch if it
is not being done.

>
>>
>>>
>>> Would it make sense to insert + reconfigure a volume filter instead or
>>> it's too complicated?
>>
>> Yes, I consider the current usage terrible unless I am missing
>> something. volume filter is static, so once set, I can't adjust the
>> volume until I reinsert a new volume filter, etc. I can't simply
>> adjust the volume like I can with vlc/mpv with a simple keybinding.
>>
>>>
>>> [...]
>>>
>>> --
>>> Clément B.
>>>
>>> _______________________________________________
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>


More information about the ffmpeg-devel mailing list