Backed out 15 changesets (bug 1852806) for causing mda failures on test_video_low_pow...
[gecko.git] / dom / media / MediaContainerType.h
blob3b4d50f0beddf01fca733e20270d67adbb73ccab
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/. */
7 #ifndef MediaContainerType_h_
8 #define MediaContainerType_h_
10 #include "MediaMIMETypes.h"
11 #include "mozilla/Maybe.h"
12 #include "nsString.h"
14 namespace mozilla {
16 // Class containing media type information for containers.
17 class MediaContainerType {
18 public:
19 explicit MediaContainerType(const MediaMIMEType& aType)
20 : mExtendedMIMEType(aType) {}
21 explicit MediaContainerType(MediaMIMEType&& aType)
22 : mExtendedMIMEType(std::move(aType)) {}
23 explicit MediaContainerType(const MediaExtendedMIMEType& aType)
24 : mExtendedMIMEType(aType) {}
25 explicit MediaContainerType(MediaExtendedMIMEType&& aType)
26 : mExtendedMIMEType(std::move(aType)) {}
28 const MediaMIMEType& Type() const { return mExtendedMIMEType.Type(); }
29 const MediaExtendedMIMEType& ExtendedType() const {
30 return mExtendedMIMEType;
33 // Original string. Note that "type/subtype" may not be lowercase,
34 // use Type().AsString() instead to get the normalized "type/subtype".
35 const nsCString& OriginalString() const {
36 return mExtendedMIMEType.OriginalString();
39 size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
41 private:
42 MediaExtendedMIMEType mExtendedMIMEType;
45 Maybe<MediaContainerType> MakeMediaContainerType(const nsAString& aType);
46 Maybe<MediaContainerType> MakeMediaContainerType(const nsACString& aType);
47 Maybe<MediaContainerType> MakeMediaContainerType(const char* aType);
49 } // namespace mozilla
51 #endif // MediaContainerType_h_