On Sun, Dec 06, 2020 at 04:09:34AM +0100, Andreas Rheinhardt wrote: > Do this by converting big-endian side data to little endian for > checksumming. Fixes the ts-demux FATE test. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com> > --- > a) When commenting the #if HAVE_BIGENDIAN out, I get the same checksum > for the test in [1] as Andriy got on a real BE system; I have not done > more testing, lacking actual BE hardware. In particular, the claim about > the ts-demux FATE test is untested.
fate-ts-demux passes with this set on qemu mips > b) If side data doesn't have the expected size, then LE and BE might > still produce different results (but then there must be a bigger problem > elsewhere). > c) This code here is designed to work even after the next major version > bump when the size of some members of AVCPBProperties change. (Of course, > some FATE checksums will need to be adapted then, but for both LE and BE > in the same manner.) > > libavformat/framecrcenc.c | 61 +++++++++++++++++++++++++++++++++++---- > 1 file changed, 56 insertions(+), 5 deletions(-) > > diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c > index f7c48779a0..390024dbe8 100644 > --- a/libavformat/framecrcenc.c > +++ b/libavformat/framecrcenc.c > @@ -21,9 +21,11 @@ > > #include <inttypes.h> > > +#include "config.h" > #include "libavutil/adler32.h" > #include "libavutil/avstring.h" > #include "libavutil/intreadwrite.h" > +#include "libavcodec/avcodec.h" > #include "avformat.h" > #include "internal.h" > > @@ -43,6 +45,19 @@ static int framecrc_write_header(struct AVFormatContext *s) > return ff_framehash_write_header(s); > } > > +#if HAVE_BIGENDIAN > +static void inline bswap(char *buf, int offset, int size) > +{ > + if (size == 8) { > + uint64_t val = AV_RN64(buf + offset); > + AV_WN64(buf + offset, av_bswap64(val)); > + } else if (size == 4) { > + uint32_t val = AV_RN32(buf + offset); > + AV_WN32(buf + offset, av_bswap32(val)); > + } > +} > +#endif instead of the #if a av_unused could be used that way the code is compile tested on LE and its a bit cleaner thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Never trust a computer, one day, it may think you are the virus. -- Compn
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".