ponchio / untrunc

Restore a damaged (truncated) mp4, m4v, mov, 3gp video. Provided you have a similar not broken video.
GNU General Public License v2.0
1.61k stars 227 forks source link

Building on macOS produces error #277

Open valeriyvan opened 6 months ago

valeriyvan commented 6 months ago

make ends with following:

...
CC  libavutil/display.o
CC  libavutil/downmix_info.o
CC  libavutil/error.o
CC  libavutil/eval.o
CC  libavutil/fifo.o
CC  libavutil/file.o
CC  libavutil/file_open.o
CC  libavutil/float_dsp.o
CC  libavutil/frame.o
CC  libavutil/hmac.o
libavutil/hmac.c:61:21: error: incompatible function pointer types assigning to 'void (*)(void *)' from 'void (struct AVMD5 *)' [-Wincompatible-function-pointer-types]
        c->init     = av_md5_init;
                    ^ ~~~~~~~~~~~
libavutil/hmac.c:62:21: error: incompatible function pointer types assigning to 'void (*)(void *, const uint8_t *, int)' (aka 'void (*)(void *, const unsigned char *, int)') from 'void (struct AVMD5 *, const uint8_t *, const int)' (aka 'void (struct AVMD5 *, const unsigned char *, const int)') [-Wincompatible-function-pointer-types]
        c->update   = av_md5_update;
                    ^ ~~~~~~~~~~~~~
libavutil/hmac.c:63:21: error: incompatible function pointer types assigning to 'void (*)(void *, uint8_t *)' (aka 'void (*)(void *, unsigned char *)') from 'void (struct AVMD5 *, uint8_t *)' (aka 'void (struct AVMD5 *, unsigned char *)') [-Wincompatible-function-pointer-types]
        c->final    = av_md5_final;
                    ^ ~~~~~~~~~~~~
libavutil/hmac.c:70:21: error: incompatible function pointer types assigning to 'void (*)(void *, const uint8_t *, int)' (aka 'void (*)(void *, const unsigned char *, int)') from 'void (struct AVSHA *, const uint8_t *, unsigned int)' (aka 'void (struct AVSHA *, const unsigned char *, unsigned int)') [-Wincompatible-function-pointer-types]
        c->update   = av_sha_update;
                    ^ ~~~~~~~~~~~~~
libavutil/hmac.c:71:21: error: incompatible function pointer types assigning to 'void (*)(void *, uint8_t *)' (aka 'void (*)(void *, unsigned char *)') from 'void (struct AVSHA *, uint8_t *)' (aka 'void (struct AVSHA *, unsigned char *)') [-Wincompatible-function-pointer-types]
        c->final    = av_sha_final;
                    ^ ~~~~~~~~~~~~
libavutil/hmac.c:78:21: error: incompatible function pointer types assigning to 'void (*)(void *, const uint8_t *, int)' (aka 'void (*)(void *, const unsigned char *, int)') from 'void (struct AVSHA *, const uint8_t *, unsigned int)' (aka 'void (struct AVSHA *, const unsigned char *, unsigned int)') [-Wincompatible-function-pointer-types]
        c->update   = av_sha_update;
                    ^ ~~~~~~~~~~~~~
libavutil/hmac.c:79:21: error: incompatible function pointer types assigning to 'void (*)(void *, uint8_t *)' (aka 'void (*)(void *, unsigned char *)') from 'void (struct AVSHA *, uint8_t *)' (aka 'void (struct AVSHA *, unsigned char *)') [-Wincompatible-function-pointer-types]
        c->final    = av_sha_final;
                    ^ ~~~~~~~~~~~~
libavutil/hmac.c:86:21: error: incompatible function pointer types assigning to 'void (*)(void *, const uint8_t *, int)' (aka 'void (*)(void *, const unsigned char *, int)') from 'void (struct AVSHA *, const uint8_t *, unsigned int)' (aka 'void (struct AVSHA *, const unsigned char *, unsigned int)') [-Wincompatible-function-pointer-types]
        c->update   = av_sha_update;
                    ^ ~~~~~~~~~~~~~
libavutil/hmac.c:87:21: error: incompatible function pointer types assigning to 'void (*)(void *, uint8_t *)' (aka 'void (*)(void *, unsigned char *)') from 'void (struct AVSHA *, uint8_t *)' (aka 'void (struct AVSHA *, unsigned char *)') [-Wincompatible-function-pointer-types]
        c->final    = av_sha_final;
                    ^ ~~~~~~~~~~~~
9 errors generated.
make: *** [libavutil/hmac.o] Error 1
rfpm commented 5 months ago

Exact same issue for me, find a fix?

eaditjhw commented 5 months ago

This seems to work for me:

brew install bzip2
git clone --recurse-submodules https://github.com/ponchio/untrunc
cd untrunc/libav
**./configure --extra-cflags=-Wno-error=incompatible-function-pointer-types**
make
cd ..
g++ -o untrunc -I./libav file.cpp main.cpp track.cpp atom.cpp codec_*.cpp codecstats.cpp codec.cpp mp4.cpp log.cpp -L./libav/libavformat -lavformat -L./libav/libavcodec -lavcodec -L./libav/libavresample -lavresample -L./libav/libavutil -lavutil -lpthread -lz -std=c++11 -framework CoreFoundation -framework CoreVideo -framework VideoDecodeAcceleration -lbz2

It's the additional cflags in the configure which seems to do the trick. At least I have a binary .. will see if it works :)