<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
If you have any doubts whether the alignment of the pointer to the
frame buffer is given you should note that the buffer is allocated
using the respective FFmpeg API function "av_frame_get_buffer()"
(cf. <a href="https://www.ffmpeg.org/doxygen/2.6/frame_8c.html">https://www.ffmpeg.org/doxygen/2.6/frame_8c.html</a>).<br>
<br>
In "ffsox" the following function in "libffsox-2/ffsox_frame.c"
implements frame buffer allocation:<br>
<blockquote>
<pre>int ffsox_frame_create_cc(frame_t *f, AVCodecContext *cc)
{
const AVCodec *codec=cc->codec;
AVFrame *frame;
int nb_samples;
if (ffsox_frame_create(f)<0) {
DMESSAGE("creating frame");
goto frame;
}
if (NULL!=codec&&(codec->capabilities&CODEC_CAP_VARIABLE_FRAME_SIZE))
nb_samples=10000;
else
nb_samples=cc->frame_size;
frame=f->frame;
frame->format=cc->sample_fmt;
frame->channel_layout=cc->channel_layout;
frame->channels=cc->channels;
frame->sample_rate=cc->sample_rate;
frame->nb_samples=nb_samples;
if (0<nb_samples&&av_frame_get_buffer(frame,0)<0) {
DMESSAGE("allocating frame buffer");
goto buffer;
}
return 0;
// cleanup:
buffer:
ffsox_frame_cleanup(f);
frame:
return -1;
}</pre>
</blockquote>
This code is reminiscent to the FFmpeg example
"ffmpeg/doc/examples/transcode_aac.c". It's up to the FFmpeg API
function "av_frame_get_buffer()" to set the "data" field of an
"AVFrame" to the right alignment and it's not the aim of FFmpeg API
client code.<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 24.06.2015 07:23, Peter Belkner
wrote:<br>
</div>
<blockquote cite="mid:558A3EE7.6070509@snafu.de" type="cite">
<blockquote type="cite">The first build of bs1770gain on the
autobuilders showed an error on at
<br>
least the mipsel architecture, that look like this:
<br>
<br>
ffsox_frame_convert.c: In function 'convert_s16i_s8i':
<br>
ffsox_frame_convert.c:143:6: error: cast increases required
alignment of target type [-Werror=cast-align]
<br>
rp=(R *)p->fr->frame->data[0]; \
<br>
^
<br>
ffsox_frame_convert.c:157:1: note: in expansion of macro
'CONVERT_II'
<br>
CONVERT_II(s16,s8,int16_t,int8_t,CONVERT_INT_INT_II)
<br>
^
<br>
ffsox_frame_convert.c: In function 'convert_s32i_s8i':
<br>
ffsox_frame_convert.c:143:6: error: cast increases required
alignment of target type [-Werror=cast-align]
<br>
rp=(R *)p->fr->frame->data[0]; \
<br>
^
<br>
ffsox_frame_convert.c:158:1: note: in expansion of macro
'CONVERT_II'
<br>
<br>
I'm not quite sure how to fix it.
<br>
</blockquote>
<br>
"p->fr->frame->data[0]" is a generic pointer defined in
the "AVFrame" structure from the FFmpeg API. It is of type
"uint8_t" (cf. e.g. top of
<a class="moz-txt-link-freetext" href="https://www.ffmpeg.org/doxygen/2.3/structAVFrame.html">https://www.ffmpeg.org/doxygen/2.3/structAVFrame.html</a>) but may
point to data of an arbitrary type. The code triggering the error
cast the (generic) pointer back to it's real type.
<br>
<br>
Those kinds of interfaces utilizing generic pointers which has to
be cast back their real type are a common C technique and not an
error.
<br>
<br>
To fix the error drop "-Wcast-align" from "CFLAGS" in the
respective "Makefile.am".
<br>
<br>
The fix is available with version 0.4.4 available from
<a class="moz-txt-link-freetext" href="http://sourceforge.net/projects/bs1770gain/files/bs1770gain/0.4.4/">http://sourceforge.net/projects/bs1770gain/files/bs1770gain/0.4.4/</a>.
<br>
</blockquote>
<br>
</body>
</html>