if test "$ac_cv_header_avformat_h" = "yes" -o \
"$ac_cv_header_ffmpeg_avformat_h" = "yes" -o \
"$ac_cv_header_libavformat_avformat_h" = "yes"; then
- sxe_cv_feat_ffmpeg_headers="yes"
+ if test "$ac_cv_header_avcodec_h" = "yes" -o \
+ "$ac_cv_header_ffmpeg_avcodec_h" = "yes" -o \
+ "$ac_cv_header_libavcodec_avcodec_h" = "yes"; then
+ if test "$ac_cv_header_ffmpeg_dict_h" = "yes" -o \
+ "$ac_cv_header_libavutil_dict_h" = "yes"; then
+ sxe_cv_feat_ffmpeg_headers="yes"
+ fi
+ fi
fi
+
## make sure either decode_audio is there
if test "$ac_cv_lib_avcodec_avcodec_decode_audio4" = "yes"; then
sxe_cv_feat_ffmpeg_decoders="yes"
if test "$sxe_cv_feat_ffmpeg_headers" = "yes" -a \
"$sxe_cv_feat_ffmpeg_decoders" = "yes" -a \
"$sxe_cv_feat_ffmpeg_avformat_alloc" = "yes" -a \
+ "$ac_cv_lib_avformat_avio_alloc_context" = "yes" -a \
+ "$ac_cv_lib_avformat_avio_size" = "yes" -a \
+ "$ac_cv_lib_avformat_avformat_open_input" = "yes" -a \
"$ac_cv_lib_avformat_avformat_close_input" = "yes" -a \
"$ac_cv_lib_avformat_avformat_find_stream_info" = "yes" -a \
- "$ac_cv_lib_avformat_avformat_open_input" = "yes" -a \
"$ac_cv_lib_avformat_av_probe_input_format" = "yes" -a \
"$ac_cv_lib_avformat_av_read_frame" = "yes" -a \
- "$ac_cv_lib_avformat_av_register_all" = "yes" -a \
"$ac_cv_lib_avformat_av_seek_frame" = "yes" -a \
+ "$ac_cv_lib_avformat_av_register_all" = "yes" -a \
+ "$ac_cv_lib_avformat_av_dump_format" = "yes" -a \
"$ac_cv_lib_avcodec_avcodec_find_decoder" = "yes" -a \
"$ac_cv_lib_avcodec_avcodec_open2" = "yes" -a \
"$ac_cv_lib_avutil_av_dict_get" = "yes"; then
## backup current configuration
SXE_DUMP_LIBS
CPPFLAGS="${CPPFLAGS} ${FFMPEG_CPPFLAGS}"
+ AC_CHECK_HEADERS([avformat.h avcodec.h])
+ AC_CHECK_HEADERS([ffmpeg/avformat.h ffmpeg/avcodec.h ffmpeg/dict.h])
AC_CHECK_HEADERS([libavformat/avformat.h libavcodec/avcodec.h libavutil/dict.h])
## restore configuration
AC_CHECK_LIB([avformat], [av_read_frame], [:], [:], [${FFMPEG_LIBS}])
AC_CHECK_LIB([avformat], [av_seek_frame], [:], [:], [${FFMPEG_LIBS}])
AC_CHECK_LIB([avformat], [av_register_all], [:], [:], [${FFMPEG_LIBS}])
+ AC_CHECK_LIB([avformat], [av_dump_format], [:], [:], [${FFMPEG_LIBS}])
AC_CHECK_LIB([avformat], [avformat_alloc_context], [:], [:], [${FFMPEG_LIBS}])
+ AC_CHECK_LIB([avformat], [avio_alloc_context], [:], [:], [${FFMPEG_LIBS}])
+ AC_CHECK_LIB([avformat], [avio_size], [:], [:], [${FFMPEG_LIBS}])
AC_CHECK_LIB([avutil], [av_dict_get], [:], [:], [${FFMPEG_LIBS}])
static AVFormatContext*
media_ffmpeg_open_file(const char *file)
{
-#if defined HAVE_AVFORMAT_ALLOC_CONTEXT
- AVFormatContext *avfc = avformat_alloc_context();
-#elif defined HAVE_AV_ALLOC_FORMAT_CONTEXT
- /* deprecated already, but `people' like Horst still use this */
- AVFormatContext *avfc = av_alloc_format_context();
-#else
-# error "Your ffmpeg library is too old. Adopt a new one."
-#endif /* HAVE_AVFORMAT_ALLOC_CONTEXT */
+ AVFormatContext *avfc = NULL;
/* open the file */
- if (av_open_input_file(&avfc, file, NULL, 0, NULL) < 0) {
+ if (avformat_open_input(&avfc, file, NULL, NULL) < 0) {
FFMPEG_DEBUG_AVF("opening file failed.\n");
- if (avfc)
- xfree(avfc);
return NULL;
}
/* Retrieve stream information */
- if (av_find_stream_info(avfc) < 0) {
+ if (avformat_find_stream_info(avfc, NULL) < 0) {
FFMPEG_DEBUG_AVS("opening stream inside file failed.\n");
- av_close_input_file(avfc);
- if (avfc)
- xfree(avfc);
+ avformat_close_input(&avfc);
return NULL;
}
FFMPEG_DEBUG_AVF("closing AVFormatContext: 0x%lx\n",
(long unsigned int)avfc);
if (avfc && avfc->iformat)
- av_close_input_file(avfc);
+ avformat_close_input(&avfc);
}
static void
mkfp = media_stream_kind_properties(ms).fprops;
TO_EXTERNAL_FORMAT(LISP_STRING, mkfp->filename,
ALLOCA, (file, file_len), Qnil);
+ SXE_SET_UNUSED(file_len);
+
avfc = media_ffmpeg_open_file(file);
if (!avfc) {
media_stream_set_meths(ms, NULL);
}
/* store the filesize */
- mkfp->filesize = avfc->file_size;
+ mkfp->filesize = avio_size(avfc->pb);
break;
}
case MKIND_STRING: {
ap->time_base= (AVRational){1, 25};
ap->pix_fmt = PIX_FMT_NONE; /* frame_pix_fmt; */
- err = av_open_input_file(&is->ic, is->filename, is->iformat, 0, ap);
+ err = avformat_open_input(&is->ic, is->filename, is->iformat, NULL /*ap*/);
if (UNLIKELY(err < 0)) {
FFMPEG_DEBUG_AVF("Could not open \"%s\" (errno %d)\n",
is->filename, err);
}
if (!use_play) {
- err = av_find_stream_info(vs->ic);
+ err = avformat_find_stream_info(vs->ic, NULL);
if (err < 0) {
FFMPEG_DEBUG_AVF("\"%s\": "
"could not find codec parameters\n",
av_read_play(vs->ic);
if (use_play) {
- err = av_find_stream_info(vs->ic);
+ err = avformat_find_stream_info(vs->ic, NULL);
if (err < 0) {
FFMPEG_DEBUG_AVF("\"%s\": "
"could not find codec parameters\n",
}
}
if (1 /* show_status */) {
- dump_format(vs->ic, 0, vs->filename, 0);
+ av_dump_format(vs->ic, 0, vs->filename, 0);
dump_stream_info(vs->ic);
}
if (is->subtitle_stream >= 0)
stream_component_close(is, is->subtitle_stream);
if (is->ic) {
- av_close_input_file(is->ic);
+ avformat_close_input(&is->ic);
is->ic = NULL; /* safety */
}
url_set_interrupt_cb(NULL);