1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.android.exoplayer2;
17 
18 import java.util.HashSet;
19 
20 /**
21  * Information about the ExoPlayer library.
22  */
23 public final class ExoPlayerLibraryInfo {
24 
25   /**
26    * A tag to use when logging library information.
27    */
28   public static final String TAG = "ExoPlayer";
29 
30   /** The version of the library expressed as a string, for example "1.2.3". */
31   // Intentionally hardcoded. Do not derive from other constants (e.g. VERSION_INT) or vice versa.
32   public static final String VERSION = "2.11.4";
33 
34   /** The version of the library expressed as {@code "ExoPlayerLib/" + VERSION}. */
35   // Intentionally hardcoded. Do not derive from other constants (e.g. VERSION) or vice versa.
36   public static final String VERSION_SLASHY = "ExoPlayerLib/2.11.4";
37 
38   /**
39    * The version of the library expressed as an integer, for example 1002003.
40    *
41    * <p>Three digits are used for each component of {@link #VERSION}. For example "1.2.3" has the
42    * corresponding integer version 1002003 (001-002-003), and "123.45.6" has the corresponding
43    * integer version 123045006 (123-045-006).
44    */
45   // Intentionally hardcoded. Do not derive from other constants (e.g. VERSION) or vice versa.
46   public static final int VERSION_INT = 2011004;
47 
48   /**
49    * Whether the library was compiled with {@link com.google.android.exoplayer2.util.Assertions}
50    * checks enabled.
51    */
52   public static final boolean ASSERTIONS_ENABLED = true;
53 
54   /** Whether an exception should be thrown in case of an OpenGl error. */
55   public static final boolean GL_ASSERTIONS_ENABLED = false;
56 
57   /**
58    * Whether the library was compiled with {@link com.google.android.exoplayer2.util.TraceUtil}
59    * trace enabled.
60    */
61   public static final boolean TRACE_ENABLED = true;
62 
63   private static final HashSet<String> registeredModules = new HashSet<>();
64   private static String registeredModulesString = "goog.exo.core";
65 
ExoPlayerLibraryInfo()66   private ExoPlayerLibraryInfo() {} // Prevents instantiation.
67 
68   /**
69    * Returns a string consisting of registered module names separated by ", ".
70    */
registeredModules()71   public static synchronized String registeredModules() {
72     return registeredModulesString;
73   }
74 
75   /**
76    * Registers a module to be returned in the {@link #registeredModules()} string.
77    *
78    * @param name The name of the module being registered.
79    */
registerModule(String name)80   public static synchronized void registerModule(String name) {
81     if (registeredModules.add(name)) {
82       registeredModulesString = registeredModulesString + ", " + name;
83     }
84   }
85 
86 }
87