FFmpegRuntimeLinker.h (1988B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim:set ts=2 sw=2 sts=2 et cindent: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef __FFmpegRuntimeLinker_h__ 8 #define __FFmpegRuntimeLinker_h__ 9 10 #include "PlatformDecoderModule.h" 11 #include "PlatformEncoderModule.h" 12 13 namespace mozilla { 14 15 class FFmpegRuntimeLinker { 16 public: 17 static bool Init(); 18 static already_AddRefed<PlatformDecoderModule> CreateDecoder(); 19 static already_AddRefed<PlatformEncoderModule> CreateEncoder(); 20 enum LinkStatus { 21 LinkStatus_INIT = 0, // Never been linked. 22 LinkStatus_SUCCEEDED, // Found a usable library. 23 // The following error statuses are sorted from most to least preferred 24 // (i.e., if more than one happens, the top one is chosen.) 25 LinkStatus_INVALID_FFMPEG_CANDIDATE, // Found ffmpeg with unexpected 26 // contents. 27 LinkStatus_UNUSABLE_LIBAV57, // Found LibAV 57, which we cannot use. 28 LinkStatus_INVALID_LIBAV_CANDIDATE, // Found libav with unexpected 29 // contents. 30 LinkStatus_OBSOLETE_FFMPEG, 31 LinkStatus_OBSOLETE_LIBAV, 32 LinkStatus_INVALID_CANDIDATE, // Found some lib with unexpected contents. 33 LinkStatus_NOT_FOUND, // Haven't found any library with an expected name. 34 }; 35 static LinkStatus LinkStatusCode() { return sLinkStatus; } 36 static const char* LinkStatusString(); 37 // Library name to which the sLinkStatus applies, or "" if not applicable. 38 static const char* LinkStatusLibraryName() { return sLinkStatusLibraryName; } 39 40 private: 41 static void PrefCallbackLogLevel(const char* aPref, void* aData); 42 43 static LinkStatus sLinkStatus; 44 static const char* sLinkStatusLibraryName; 45 }; 46 47 } // namespace mozilla 48 49 #endif // __FFmpegRuntimeLinker_h__