我想为Http Live Stream制作m3u8-segmenter:https://github.com/johnf/m3u8-segmenter
我制作时出错,错误是:
gcc -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings -Werror m3u8-segmenter.c -o m3u8-segmenter -lavformat -lavcodec -lavutil
m3u8-segmenter.c: In function ‘add_output_stream’:
m3u8-segmenter.c:82:14: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
m3u8-segmenter.c:82:14: note: each undeclared identifier is reported only once for each function it appears in
m3u8-segmenter.c:94:14: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
m3u8-segmenter.c: In function ‘main’:
m3u8-segmenter.c:338:5: error: ‘av_open_input_file’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1090) [-Werror=deprecated-declarations]
m3u8-segmenter.c:352:5: error: implicit declaration of function ‘guess_format’ [-Werror=implicit-function-declaration]
m3u8-segmenter.c:352:5: error: nested extern declaration of ‘guess_format’ [-Werror=nested-externs]
m3u8-segmenter.c:352:10: error: assignment makes pointer from integer without a cast [-Werror]
m3u8-segmenter.c:371:18: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
m3u8-segmenter.c:376:18: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
m3u8-segmenter.c:387:5: error: ‘av_set_parameters’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1434) [-Werror=deprecated-declarations]
m3u8-segmenter.c:392:5: error: ‘dump_format’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1559) [-Werror=deprecated-declarations]
m3u8-segmenter.c:406:5: error: ‘url_fopen’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279) [-Werror=deprecated-declarations]
m3u8-segmenter.c:411:5: error: ‘av_write_header’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1492) [-Werror=deprecated-declarations]
m3u8-segmenter.c:444:67: error: ‘PKT_FLAG_KEY’ undeclared (first use in this function)
m3u8-segmenter.c:455:13: error: ‘put_flush_packet’ is deprecated (declared at /usr/local/include/libavformat/avio.h:293) [-Werror=deprecated-declarations]
m3u8-segmenter.c:456:13: error: ‘url_fclose’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280) [-Werror=deprecated-declarations]
m3u8-segmenter.c:476:13: error: ‘url_fopen’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279) [-Werror=deprecated-declarations]
m3u8-segmenter.c:482:13: error: ‘av_write_header’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1492) [-Werror=deprecated-declarations]
m3u8-segmenter.c:514:5: error: ‘url_fclose’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280) [-Werror=deprecated-declarations]
cc1: all warnings being treated as errors
make: *** [all] Error 1
答案 0 :(得分:3)
您收到这些错误是因为某些原因导致libav_compat.h
中的此块生效:
/* Support older versions of ffmpeg and libav */
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 64, 0)
#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
#define AV_PKT_FLAG_KEY PKT_FLAG_KEY
#endif
但是应该定义哪个标头CODEC_TYPE_AUDIO
和CODEC_TYPE_VIDEO
没有。从那里的评论看起来你可能应该更新你的其他软件(ffmpeg和/或libav),然后再试一次。