[Libav-user] Filtering audio example : filtering_audio.c - Why do we use uint16_t
Matthieu Corbeau
matthieu.corbeau at gmail.com
Wed Dec 3 12:58:48 CET 2014
Hi all,
I am reading a lot this example lately and I have a question that I cannot
quite answer myself. Here is the deal (
https://www.ffmpeg.org/doxygen/2.4/filtering__audio_8c_source.html#l00182),
in print_frame there is a cast to uint16_t:
const uint16_t *p = (uint16_t*)frame->data
<https://www.ffmpeg.org/doxygen/2.4/structAVFrame.html#a1d0f65014a8d1bf78cec8cbed2304992>
[0];
however the filtering description is set with s16:
static const char *filter_descr
<https://www.ffmpeg.org/doxygen/2.4/filtering__audio_8c.html#a84b31b94c024a45c4bcebd875a54e73d>
= "aresample=8000,aformat=sample_fmts=s16:channel_layouts=mono";
Now I tried to change the cast to int16_t instead of uint16_t and I have no
audible change in the filtered stream when played back by ffplay (ffplay -f
s16le -ar 8000 -ac 1 -).
My question is, when casting signed to unsigned, is there any possibility
that the signal gets modified due to the 2-complementation (or are the
samples always positive somehow) ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20141203/79dfa6fc/attachment.html>
More information about the Libav-user
mailing list