1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-27 19:01:07 +00:00

Fix compilation with Libav

Doesn't define AVPROBE_SCORE_RETRY for some reason. They use
AVPROBE_SCORE_MAX/4 directly internally. AV_DISPOSITION_ATTACHED_PIC
is not defined with the most recent Libav release.

AVIOContext.av_class exists in Libav, but is apparently disabled in
old releases. Disable it for now until people stop torturing me with
old crap releases.
This commit is contained in:
wm4 2012-12-11 14:35:52 +01:00
parent c6fbf91a89
commit 0fba387f72
2 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include <libavutil/avutil.h>
#include <libavutil/cpu.h>
#include <libavcodec/version.h>
#include <libavformat/version.h>
#ifndef AV_CPU_FLAG_MMX2
#define AV_CPU_FLAG_MMX2 AV_CPU_FLAG_MMXEXT
@ -39,4 +40,13 @@
#define avcodec_free_frame av_freep
#endif
#if LIBAVFORMAT_VERSION_MICRO < 100
#define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4)
#endif
// For Libav 0.9
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54, 2, 100)
#define AV_DISPOSITION_ATTACHED_PIC 0x0400
#endif
#endif /* MPV_LIBAV_COMPAT_H */

View File

@ -140,11 +140,13 @@ static int open_f(stream_t *stream, int mode, void *opts, int *file_format)
if (avio_open(&avio, filename, flags) < 0)
goto out;
#if LIBAVFORMAT_VERSION_MICRO >= 100
if (avio->av_class) {
uint8_t *mt = NULL;
if (av_opt_get(avio, "mime_type", AV_OPT_SEARCH_CHILDREN, &mt) >= 0)
stream->mime_type = talloc_strdup(stream, mt);
}
#endif
char *rtmp[] = {"rtmp:", "rtmpt:", "rtmpe:", "rtmpte:", "rtmps:"};
for (int i = 0; i < FF_ARRAY_ELEMS(rtmp); i++)