OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_FORMATS_MP2T_DESCRIPTORS_H_ |
| 6 #define MEDIA_FORMATS_MP2T_DESCRIPTORS_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <map> |
| 11 #include <string> |
| 12 |
| 13 namespace media { |
| 14 |
| 15 class BitReader; |
| 16 |
| 17 namespace mp2t { |
| 18 |
| 19 // Representation of a list of descriptors, used in the MPEG-2 Systems standard |
| 20 // to extend the definitions of programs or program elements. While the standard |
| 21 // appears to permit multiple descriptors in such a list to have the same tag |
| 22 // value, the implementation herein will not support this. |
| 23 class Descriptors { |
| 24 public: |
| 25 Descriptors(); |
| 26 Descriptors(const Descriptors& other); |
| 27 ~Descriptors(); |
| 28 |
| 29 // Attempts to read a (possibly empty) list of descriptors from the |reader|. |
| 30 // If |size| > 0, the descriptors must occupy exactly |size| bytes, Otherwise, |
| 31 // the descriptors should use all available bits from the reader. |
| 32 bool Read(BitReader* reader, int size); |
| 33 |
| 34 // Indicates whether a Registration descriptor is present. If so, the |
| 35 // |format_identifier| and |additional_info| values are populated with the |
| 36 // contents of the descriptor. |
| 37 bool HasRegistrationDescriptor(int64_t* format_identifier, |
| 38 std::string* additional_info) const; |
| 39 |
| 40 // Indicates whether a CA descriptor is present. If so, the |system_id|, |
| 41 // |pid|, and |private_data| values are populated with the contents of the |
| 42 // descriptor. |
| 43 bool HasCADescriptor(int* system_id, |
| 44 int* pid, |
| 45 std::string* private_data) const; |
| 46 |
| 47 // Indicates whether a CA descriptor is present, and if so, whether it is |
| 48 // of the type defined by ISO/IEC 23001-9:2014 (i.e. with a specific |
| 49 // system_id value and layout of the private_data). If so, the |ca_pid| and |
| 50 // |pssh_pid| are populated with the contents of the descriptor. |
| 51 bool HasCADescriptorCenc(int* ca_pid, int* pssh_pid) const; |
| 52 |
| 53 // Indicates whether a Private Data Indicator descriptor is present with a |
| 54 // particular |value|. |
| 55 bool HasPrivateDataIndicator(int64_t value) const; |
| 56 |
| 57 private: |
| 58 using Descriptor = std::pair<int, std::string>; |
| 59 std::map<int, std::string> descriptors_; |
| 60 |
| 61 // Allow copy and assign so that it can be used in a std C++ container. |
| 62 }; |
| 63 |
| 64 } // namespace mp2t |
| 65 } // namespace media |
| 66 |
| 67 #endif // MEDIA_FORMATS_MP2T_DESCRIPTOR_LIST_H_ |
OLD | NEW |