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 
12 namespace mozilla {
13 
14 class FFmpegRuntimeLinker {
15  public:
16   static bool Init();
17   static already_AddRefed<PlatformDecoderModule> CreateDecoderModule();
18   enum LinkStatus {
19     LinkStatus_INIT = 0,   // Never been linked.
20     LinkStatus_SUCCEEDED,  // Found a usable library.
21     // The following error statuses are sorted from most to least preferred
22     // (i.e., if more than one happens, the top one is chosen.)
23     LinkStatus_INVALID_FFMPEG_CANDIDATE,  // Found ffmpeg with unexpected
24                                           // contents.
25     LinkStatus_UNUSABLE_LIBAV57,         // Found LibAV 57, which we cannot use.
26     LinkStatus_INVALID_LIBAV_CANDIDATE,  // Found libav with unexpected
27                                          // contents.
28     LinkStatus_OBSOLETE_FFMPEG,
29     LinkStatus_OBSOLETE_LIBAV,
30     LinkStatus_INVALID_CANDIDATE,  // Found some lib with unexpected contents.
31     LinkStatus_NOT_FOUND,  // Haven't found any library with an expected name.
32   };
LinkStatusCode()33   static LinkStatus LinkStatusCode() { return sLinkStatus; }
34   static const char* LinkStatusString();
35   // Library name to which the sLinkStatus applies, or "" if not applicable.
LinkStatusLibraryName()36   static const char* LinkStatusLibraryName() { return sLinkStatusLibraryName; }
37 
38  private:
39   static LinkStatus sLinkStatus;
40   static const char* sLinkStatusLibraryName;
41 };
42 
43 }  // namespace mozilla
44 
45 #endif  // __FFmpegRuntimeLinker_h__
46