Shaka Player Embedded
media_utils.h
Go to the documentation of this file.
1 // Copyright 2017 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SHAKA_EMBEDDED_MEDIA_MEDIA_UTILS_H_
16 #define SHAKA_EMBEDDED_MEDIA_MEDIA_UTILS_H_
17 
18 #include <iostream>
19 #include <string>
20 #include <unordered_map>
21 #include <utility>
22 #include <vector>
23 
25 #include "src/js/js_error.h"
26 #include "src/media/types.h"
27 #include "src/util/utils.h"
28 
29 namespace shaka {
30 namespace media {
31 
33 constexpr const char* kCodecMimeParam = "codecs";
34 
45 bool ParseMimeType(const std::string& source, std::string* type,
46  std::string* subtype,
47  std::unordered_map<std::string, std::string>* params);
48 
50 std::string NormalizeContainer(const std::string& container);
51 
53 std::string NormalizeCodec(const std::string& codec);
54 
63  const std::vector<BufferedRanges>& sources);
64 
70  const std::string& mime_type, MediaDecodingType type);
71 
73 std::pair<uint32_t, uint32_t> GetScreenResolution();
74 
75 } // namespace media
76 } // namespace shaka
77 
78 #endif // SHAKA_EMBEDDED_MEDIA_MEDIA_UTILS_H_
bool ParseMimeType(const std::string &source, std::string *type, std::string *subtype, std::unordered_map< std::string, std::string > *params)
Definition: media_utils.cc:62
std::string NormalizeCodec(const std::string &codec)
Definition: media_utils.cc:135
const char * source
Definition: media_utils.cc:30
std::string NormalizeContainer(const std::string &container)
Definition: media_utils.cc:128
ExceptionCode type
MediaDecodingConfiguration ConvertMimeToDecodingConfiguration(const std::string &mime_type, MediaDecodingType type)
Definition: media_utils.cc:173
std::vector< BufferedRange > BufferedRanges
Definition: types.h:26
constexpr const char * kCodecMimeParam
Definition: media_utils.h:33
BufferedRanges IntersectionOfBufferedRanges(const std::vector< BufferedRanges > &sources)
Definition: media_utils.cc:144
std::pair< uint32_t, uint32_t > GetScreenResolution()
Definition: media_utils.cc:196