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.
https://www.ffmpeg.org/doxygen/2.6/frame_8c.html).
In "ffsox" the following function in "libffsox-2/ffsox_frame.c"
implements frame buffer allocation:
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;
}
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.
On 24.06.2015 07:23, Peter Belkner wrote:
The first build of bs1770gain on the autobuilders showed an error on at
least the mipsel architecture, that look like this:
ffsox_frame_convert.c: In function 'convert_s16i_s8i':
ffsox_frame_convert.c:143:6: error: cast increases required alignment
of target type [-Werror=cast-align]
rp=(R *)p->fr->frame->data[0]; \
^
ffsox_frame_convert.c:157:1: note: in expansion of macro 'CONVERT_II'
CONVERT_II(s16,s8,int16_t,int8_t,CONVERT_INT_INT_II)
^
ffsox_frame_convert.c: In function 'convert_s32i_s8i':
ffsox_frame_convert.c:143:6: error: cast increases required alignment
of target type [-Werror=cast-align]
rp=(R *)p->fr->frame->data[0]; \
^
ffsox_frame_convert.c:158:1: note: in expansion of macro 'CONVERT_II'
I'm not quite sure how to fix it.
"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 https://www.ffmpeg.org/doxygen/2.3/structAVFrame.html) but may
point to data of an arbitrary type. The code triggering the error cast
the (generic) pointer back to it's real type.
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.
To fix the error drop "-Wcast-align" from "CFLAGS" in the respective
"Makefile.am".
The fix is available with version 0.4.4 available from
http://sourceforge.net/projects/bs1770gain/files/bs1770gain/0.4.4/.
_______________________________________________
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers