int ffmpeglib_open(ffmpeglib_t *lib) { int result; result = load_avformat(lib); if (result != 0) { free_avformat(lib); return result; } result = load_avcodec(lib); if (result != 0) { free_avformat(lib); free_avcodec(lib); return result; } result = load_avutil(lib); if (result != 0) { free_avformat(lib); free_avcodec(lib); free_avutil(lib); return result; } result = load_swscale(lib); if (result != 0) { free_avformat(lib); free_avcodec(lib); free_avutil(lib); free_swscale(lib); return result; } #ifndef HAVE_FFMPEG_AVRESAMPLE result = load_swresample(lib); if (result != 0) { free_avformat(lib); free_avcodec(lib); free_avutil(lib); free_swscale(lib); free_swresample(lib); return result; } #else result = load_avresample(lib); if (result != 0) { free_avformat(lib); free_avcodec(lib); free_avutil(lib); free_swscale(lib); free_avresample(lib); return result; } #endif return 0; }
int ffmpeglib_open(ffmpeglib_t *lib) { int result; result = load_avformat(lib); if (result != 0) { free_avformat(lib); return result; } result = load_avcodec(lib); if (result != 0) { free_avformat(lib); free_avcodec(lib); return result; } result = load_avutil(lib); if (result != 0) { free_avformat(lib); free_avcodec(lib); free_avutil(lib); return result; } #ifdef HAVE_FFMPEG_SWSCALE result = load_swscale(lib); if (result != 0) { free_avformat(lib); free_avcodec(lib); free_avutil(lib); free_swscale(lib); return result; } #endif return 0; }