Esempio n. 1
0
// LibAvW_Init
DLL_EXPORT int LibAvW_Init(avwCallbackPrint *printfunction)
{
	if (libav_initialized)
		return LIBAVW_ERROR_NONE;

	libav_codec_version  = avcodec_version();
	libav_format_version = avformat_version();
	libav_util_version   = avutil_version();
	libav_swscale_version  = swscale_version();

	// only can use version we were linked against
	if (libav_codec_version != LIBAVCODEC_VERSION_INT)
		return LIBAVW_ERROR_DLL_VERSION_AVCODEC;
	if (libav_format_version != LIBAVFORMAT_VERSION_INT)
		return LIBAVW_ERROR_DLL_VERSION_AVFORMAT;
	if (libav_util_version != LIBAVUTIL_VERSION_INT)
		return LIBAVW_ERROR_DLL_VERSION_AVUTIL;
	if (libav_swscale_version != LIBSWSCALE_VERSION_INT)
		return LIBAVW_ERROR_DLL_VERSION_SWSCALE;

	// allright, init libavcodec
	avcodec_register_all();
	av_register_all();
	av_log_set_callback(LibAvW_ErrorCallback);
	libav_initialized = true;
	libav_print = printfunction;
	return LIBAVW_ERROR_NONE;
}
Esempio n. 2
0
File: av_log.c Progetto: kax4/mpv
void print_libav_versions(void)
{
    print_version("libavutil", LIBAVUTIL_VERSION_INT, avutil_version());
    print_version("libavcodec", LIBAVCODEC_VERSION_INT, avcodec_version());
    print_version("libavformat", LIBAVFORMAT_VERSION_INT, avformat_version());
    print_version("libswscale", LIBSWSCALE_VERSION_INT, swscale_version());
}
Esempio n. 3
0
File: av_log.c Progetto: wiiaboo/mpv
bool print_libav_versions(struct mp_log *log, int v)
{
    const struct lib libs[] = {
        {"libavutil",     LIBAVUTIL_VERSION_INT,     avutil_version()},
        {"libavcodec",    LIBAVCODEC_VERSION_INT,    avcodec_version()},
        {"libavformat",   LIBAVFORMAT_VERSION_INT,   avformat_version()},
        {"libswscale",    LIBSWSCALE_VERSION_INT,    swscale_version()},
        {"libavfilter",   LIBAVFILTER_VERSION_INT,   avfilter_version()},
#if HAVE_LIBAV
        {"libavresample", LIBAVRESAMPLE_VERSION_INT, avresample_version()},
#else
        {"libswresample", LIBSWRESAMPLE_VERSION_INT, swresample_version()},
#endif
    };

    mp_msg(log, v, "%s library versions:\n", LIB_PREFIX);

    bool mismatch = false;
    for (int n = 0; n < MP_ARRAY_SIZE(libs); n++) {
        const struct lib *l = &libs[n];
        mp_msg(log, v, "   %-15s %d.%d.%d", l->name, V(l->buildv));
        if (l->buildv != l->runv) {
            mp_msg(log, v, " (runtime %d.%d.%d)", V(l->runv));
            mismatch = true;
        }
        mp_msg(log, v, "\n");
    }

    mp_msg(log, v, "%s version: %s\n", LIB_PREFIX, av_version_info());

    return !mismatch;
}
Esempio n. 4
0
File: av_log.c Progetto: Bl4Cc4t/mpv
void print_libav_versions(struct mp_log *log, int v)
{
    const struct lib libs[] = {
        {"libavutil",     LIBAVUTIL_VERSION_INT,     avutil_version()},
        {"libavcodec",    LIBAVCODEC_VERSION_INT,    avcodec_version()},
        {"libavformat",   LIBAVFORMAT_VERSION_INT,   avformat_version()},
        {"libswscale",    LIBSWSCALE_VERSION_INT,    swscale_version()},
#if HAVE_LIBAVFILTER
        {"libavfilter",   LIBAVFILTER_VERSION_INT,   avfilter_version()},
#endif
#if HAVE_LIBAVRESAMPLE
        {"libavresample", LIBAVRESAMPLE_VERSION_INT, avresample_version()},
#endif
#if HAVE_LIBSWRESAMPLE
        {"libswresample", LIBSWRESAMPLE_VERSION_INT, swresample_version()},
#endif
    };

    mp_msg(log, v, "%s library versions:\n", LIB_PREFIX);

    bool mismatch = false;
    bool broken = false;
    for (int n = 0; n < MP_ARRAY_SIZE(libs); n++) {
        const struct lib *l = &libs[n];
        mp_msg(log, v, "   %-15s %d.%d.%d", l->name, V(l->buildv));
        if (l->buildv != l->runv) {
            mp_msg(log, v, " (runtime %d.%d.%d)", V(l->runv));
            mismatch = true;
            broken |= ((l->buildv & 255) >= 100) != ((l->runv & 255) >= 100);
        }
        mp_msg(log, v, "\n");
    }
    // This just won't work. It's 100% broken.
    if (broken) {
        mp_fatal(log, "mpv was compiled and linked against a mixture of Libav "
                 "and FFmpeg versions. This won't work and will most likely "
                 "crash at some point. Exiting.\n");
        exit(42);
    }
    // We don't "really" support mismatched libraries, but if you like to
    // suffer, you're free to enjoy the terrible aspects of dynamic linking.
    // In particular, we don't use all these crazy accessors ffmpeg wants us
    // to use in order to be ABI compatible after Libav merges - because that
    // would make our code incompatible to Libav. It's madness.
    if (mismatch) {
        mp_warn(log, "Warning: mpv was compiled against a different version of "
                "%s than the shared\nlibrary it is linked against. This can "
                "expose subtle ABI compatibility issues\nand can lead to "
                "misbehavior and crashes.\n", LIB_PREFIX);
    }
}
Esempio n. 5
0
jstring Java_org_libsdl_app_SDLActivity_stringFromJNI( JNIEnv* env, jobject thiz)
{
	SDL_version linked;
	unsigned ver = avutil_version();
	char buf[512] = "", *ptr = buf;
	ptr += sprintf(ptr, "avutil %d.%d.%d ", ver>>16, (ver>>8)&0xff, ver&0xff); 

	SDL_GetVersion(&linked);
    ptr += sprintf(ptr, "sdl: %d.%d.%d.%d (%s)",
           linked.major, linked.minor, linked.patch,
           SDL_GetRevisionNumber(), SDL_GetRevision());

    return (*env)->NewStringUTF(env, buf);
}
Esempio n. 6
0
/*
static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output)
{
	char buf[256];
	int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
	AVStream *st = ic->streams[i];
	int g = av_gcd(st->time_base.num, st->time_base.den);
	AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
	avcodec_string(buf, sizeof(buf), st->codec, is_output);
	av_log(NULL, AV_LOG_INFO, "    Stream #%d.%d", index, i);
	// the pid is an important information, so we display it
	// XXX: add a generic system
	if (flags & AVFMT_SHOW_IDS)
		av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id);
	if (lang)
		av_log(NULL, AV_LOG_INFO, "(%s)", lang->value);
	av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames, st->time_base.num/g, st->time_base.den/g);
	av_log(NULL, AV_LOG_INFO, ": %s", buf);
	if (st->sample_aspect_ratio.num && // default
		av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) {
		AVRational display_aspect_ratio;
		av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
				  st->codec->width*st->sample_aspect_ratio.num,
				  st->codec->height*st->sample_aspect_ratio.den,
				  1024*1024);
		av_log(NULL, AV_LOG_INFO, ", PAR %d:%d DAR %d:%d",
				 st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
				 display_aspect_ratio.num, display_aspect_ratio.den);
	}
	if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
		if(st->avg_frame_rate.den && st->avg_frame_rate.num)
			print_fps(av_q2d(st->avg_frame_rate), "fps");
		if(st->r_frame_rate.den && st->r_frame_rate.num)
			print_fps(av_q2d(st->r_frame_rate), "tbr");
		if(st->time_base.den && st->time_base.num)
			print_fps(1/av_q2d(st->time_base), "tbn");
		if(st->codec->time_base.den && st->codec->time_base.num)
			print_fps(1/av_q2d(st->codec->time_base), "tbc");
	}
	if (st->disposition & AV_DISPOSITION_DEFAULT)
		av_log(NULL, AV_LOG_INFO, " (default)");
	if (st->disposition & AV_DISPOSITION_DUB)
		av_log(NULL, AV_LOG_INFO, " (dub)");
	if (st->disposition & AV_DISPOSITION_ORIGINAL)
		av_log(NULL, AV_LOG_INFO, " (original)");
	if (st->disposition & AV_DISPOSITION_COMMENT)
		av_log(NULL, AV_LOG_INFO, " (comment)");
	if (st->disposition & AV_DISPOSITION_LYRICS)
		av_log(NULL, AV_LOG_INFO, " (lyrics)");
	if (st->disposition & AV_DISPOSITION_KARAOKE)
		av_log(NULL, AV_LOG_INFO, " (karaoke)");
	if (st->disposition & AV_DISPOSITION_FORCED)
		av_log(NULL, AV_LOG_INFO, " (forced)");
	if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED)
		av_log(NULL, AV_LOG_INFO, " (hearing impaired)");
	if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED)
		av_log(NULL, AV_LOG_INFO, " (visual impaired)");
	if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS)
		av_log(NULL, AV_LOG_INFO, " (clean effects)");
	av_log(NULL, AV_LOG_INFO, "\n");
	dump_metadata(NULL, st->metadata, "    ");
}*/
void AVInfo::dump()
{
	qDebug("Version\n"
		   "libavcodec: %#x\n"
		   "libavformat: %#x\n"
//	       "libavdevice: %#x\n"
		   "libavutil: %#x"
		   ,avcodec_version()
		   ,avformat_version()
//	       ,avdevice_version()
		   ,avutil_version());
	av_dump_format(_format_context, 0, qPrintable(_file_name), false);
	qDebug("video format: %s [%s]", qPrintable(videoFormatName()), qPrintable(videoFormatLongName()));
	qDebug("Audio: %s [%s]", qPrintable(audioCodecName()), qPrintable(audioCodecLongName()));
	qDebug("sample rate: %d, channels: %d", a_codec_context->sample_rate, a_codec_context->channels);
}
Esempio n. 7
0
FFMS_Index::FFMS_Index(const char *IndexFile)
: RefCount(1)
{
	ZipFile zf(IndexFile, "rb");

	// Read the index file header
	if (zf.Read<uint32_t>() != INDEXID)
		throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,
			std::string("'") + IndexFile + "' is not a valid index file");

	if (zf.Read<uint32_t>() != FFMS_VERSION)
		throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,
			std::string("'") + IndexFile + "' is not the expected index version");

	uint32_t Tracks = zf.Read<uint32_t>();
	Decoder = zf.Read<uint32_t>();
	ErrorHandling = zf.Read<uint32_t>();

	if (!(Decoder & FFMS_GetEnabledSources()))
		throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_NOT_AVAILABLE,
			"The source which this index was created with is not available");

	if (zf.Read<uint32_t>() != avutil_version() ||
		zf.Read<uint32_t>() != avformat_version() ||
		zf.Read<uint32_t>() != avcodec_version() ||
		zf.Read<uint32_t>() != swscale_version())
		throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,
			std::string("A different FFmpeg build was used to create '") + IndexFile + "'");

	Filesize = zf.Read<int64_t>();
	zf.Read(Digest, sizeof(Digest));

	reserve(Tracks);
	try {
		for (size_t i = 0; i < Tracks; ++i)
			push_back(FFMS_Track(zf));
	}
	catch (FFMS_Exception const&) {
		throw;
	}
	catch (...) {
		throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,
			std::string("Unknown error while reading index information in '") + IndexFile + "'");
	}
}
Esempio n. 8
0
void ffmpeg_version_print()
{
    struct _component {
        const char* lib;
        unsigned build_version;
        unsigned rt_version;
    } components[] = {
        { "avcodec", LIBAVCODEC_VERSION_INT, avcodec_version()},
        { "avformat", LIBAVFORMAT_VERSION_INT, avformat_version()},
        { "avutil", LIBAVUTIL_VERSION_INT, avutil_version()},
        { "swscale", LIBSWSCALE_VERSION_INT, swscale_version()},
#if QTAV_HAVE(SWRESAMPLE)
        { "swresample", LIBSWRESAMPLE_VERSION_INT, swresample_version()}, //swresample_version not declared in 0.9
#endif //QTAV_HAVE(SWRESAMPLE)
#if QTAV_HAVE(AVRESAMPLE)
        { "avresample", LIBAVRESAMPLE_VERSION_INT, avresample_version()},
#endif //QTAV_HAVE(AVRESAMPLE)
#if QTAV_HAVE(AVFILTER)
        { "avfilter", LIBAVFILTER_VERSION_INT, avfilter_version() },
#endif //QTAV_HAVE(AVFILTER)
        { 0, 0, 0}
    };
    for (int i = 0; components[i].lib != 0; ++i) {
        printf("Build with lib%s-%u.%u.%u\n"
               , components[i].lib
               , QTAV_VERSION_MAJOR(components[i].build_version)
               , QTAV_VERSION_MINOR(components[i].build_version)
               , QTAV_VERSION_PATCH(components[i].build_version)
               );
        unsigned rt_version = components[i].rt_version;
        if (components[i].build_version != rt_version) {
            fprintf(stderr, "Warning: %s runtime version %u.%u.%u mismatch!\n"
                    , components[i].lib
                    , QTAV_VERSION_MAJOR(rt_version)
                    , QTAV_VERSION_MINOR(rt_version)
                    , QTAV_VERSION_PATCH(rt_version)
                    );
        }
    }
    fflush(0);
}
Esempio n. 9
0
void FFMS_Index::WriteIndex(const char *IndexFile) {
	ZipFile zf(IndexFile, "wb");

	// Write the index file header
	zf.Write<uint32_t>(INDEXID);
	zf.Write<uint32_t>(FFMS_VERSION);
	zf.Write<uint32_t>(size());
	zf.Write<uint32_t>(Decoder);
	zf.Write<uint32_t>(ErrorHandling);
	zf.Write<uint32_t>(avutil_version());
	zf.Write<uint32_t>(avformat_version());
	zf.Write<uint32_t>(avcodec_version());
	zf.Write<uint32_t>(swscale_version());
	zf.Write<int64_t>(Filesize);
	zf.Write(Digest);

	for (size_t i = 0; i < size(); ++i)
		at(i).Write(zf);

	zf.Finish();
}