2016-10-07 09:38:44 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2017-01-18 03:59:03 +03:00
|
|
|
#ifndef MediaContainerType_h_
|
|
|
|
#define MediaContainerType_h_
|
2016-10-07 09:38:44 +03:00
|
|
|
|
2016-12-01 05:05:45 +03:00
|
|
|
#include "MediaMIMETypes.h"
|
2016-10-07 09:38:44 +03:00
|
|
|
#include "mozilla/Maybe.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2016-12-01 05:05:45 +03:00
|
|
|
// Class containing media type information for containers.
|
2017-01-18 03:59:03 +03:00
|
|
|
class MediaContainerType {
|
2016-10-07 09:38:44 +03:00
|
|
|
public:
|
2017-01-18 03:59:03 +03:00
|
|
|
explicit MediaContainerType(const MediaMIMEType& aType)
|
2016-12-01 08:57:31 +03:00
|
|
|
: mExtendedMIMEType(aType) {}
|
2017-01-18 03:59:03 +03:00
|
|
|
explicit MediaContainerType(MediaMIMEType&& aType)
|
2018-05-30 22:15:35 +03:00
|
|
|
: mExtendedMIMEType(std::move(aType)) {}
|
2017-01-18 03:59:03 +03:00
|
|
|
explicit MediaContainerType(const MediaExtendedMIMEType& aType)
|
2016-12-01 05:05:45 +03:00
|
|
|
: mExtendedMIMEType(aType) {}
|
2017-01-18 03:59:03 +03:00
|
|
|
explicit MediaContainerType(MediaExtendedMIMEType&& aType)
|
2018-05-30 22:15:35 +03:00
|
|
|
: mExtendedMIMEType(std::move(aType)) {}
|
2016-12-01 05:05:45 +03:00
|
|
|
|
2016-12-01 08:57:31 +03:00
|
|
|
const MediaMIMEType& Type() const { return mExtendedMIMEType.Type(); }
|
2016-12-01 05:05:45 +03:00
|
|
|
const MediaExtendedMIMEType& ExtendedType() const {
|
|
|
|
return mExtendedMIMEType;
|
|
|
|
}
|
|
|
|
|
2016-12-28 10:56:22 +03:00
|
|
|
// Original string. Note that "type/subtype" may not be lowercase,
|
|
|
|
// use Type().AsString() instead to get the normalized "type/subtype".
|
2017-09-04 23:43:12 +03:00
|
|
|
const nsCString& OriginalString() const {
|
|
|
|
return mExtendedMIMEType.OriginalString();
|
|
|
|
}
|
2016-12-28 10:56:22 +03:00
|
|
|
|
2016-12-22 03:54:56 +03:00
|
|
|
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
|
|
|
|
2016-10-07 09:38:44 +03:00
|
|
|
private:
|
2016-12-01 05:05:45 +03:00
|
|
|
MediaExtendedMIMEType mExtendedMIMEType;
|
2016-10-07 09:38:44 +03:00
|
|
|
};
|
|
|
|
|
2017-01-18 03:59:03 +03:00
|
|
|
Maybe<MediaContainerType> MakeMediaContainerType(const nsAString& aType);
|
|
|
|
Maybe<MediaContainerType> MakeMediaContainerType(const nsACString& aType);
|
|
|
|
Maybe<MediaContainerType> MakeMediaContainerType(const char* aType);
|
2016-12-01 04:56:11 +03:00
|
|
|
|
2016-10-07 09:38:44 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2017-01-18 03:59:03 +03:00
|
|
|
#endif // MediaContainerType_h_
|