OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_FORMATS_MP4_BITSTREAM_CONVERTER_H_ | 5 #ifndef MEDIA_FORMATS_MP4_BITSTREAM_CONVERTER_H_ |
6 #define MEDIA_FORMATS_MP4_BITSTREAM_CONVERTER_H_ | 6 #define MEDIA_FORMATS_MP4_BITSTREAM_CONVERTER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | |
11 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
12 | 11 |
13 namespace media { | 12 namespace media { |
14 | 13 |
15 struct SubsampleEntry; | 14 struct SubsampleEntry; |
16 | 15 |
17 namespace mp4 { | 16 namespace mp4 { |
18 | 17 |
19 // BitstreamConverter provides a unified interface for performing some common | 18 // BitstreamConverter provides a unified interface for performing some common |
20 // bitstream conversions (e.g. H.264 MP4 bitstream to Annex B, and elementary | 19 // bitstream conversions (e.g. H.264 MP4 bitstream to Annex B, and elementary |
21 // AAC stream to ADTS). | 20 // AAC stream to ADTS). |
22 class BitstreamConverter | 21 class BitstreamConverter |
23 : public base::RefCountedThreadSafe<BitstreamConverter> { | 22 : public base::RefCountedThreadSafe<BitstreamConverter> { |
24 public: | 23 public: |
25 // Converts a single frame/buffer |frame_buf| into the output format. | 24 // Converts a single frame/buffer |frame_buf| into the output format. |
26 // Returns true iff the conversion was successful. | 25 // Returns true iff the conversion was successful. |
27 // |frame_buf| is an input/output parameter, it contains input frame data and | 26 // |frame_buf| is an input/output parameter, it contains input frame data and |
28 // contains converted output data if conversion was successful. | 27 // contains converted output data if conversion was successful. |
29 // |is_keyframe| indicates whether it's a key frame or not. | 28 // |is_keyframe| indicates whether it's a key frame or not. |
30 // |subsamples| is an input/output parameter that contains CENC subsample | 29 // |subsamples| is an input/output parameter that contains CENC subsample |
31 // information. The conversion code should |subsamples| to determine if parts | 30 // information. The conversion code should |subsamples| to determine if parts |
32 // of input frame are encrypted and should update |subsamples| if necessary, | 31 // of input frame are encrypted and should update |subsamples| if necessary, |
33 // to make sure it correctly describes the converted output frame. See | 32 // to make sure it correctly describes the converted output frame. See |
34 // SubsampleEntry definition in media/base/decrypt_config.h for more info. | 33 // SubsampleEntry definition in media/base/decrypt_config.h for more info. |
35 virtual bool ConvertFrame(std::vector<uint8>* frame_buf, | 34 virtual bool ConvertFrame(std::vector<uint8_t>* frame_buf, |
36 bool is_keyframe, | 35 bool is_keyframe, |
37 std::vector<SubsampleEntry>* subsamples) const = 0; | 36 std::vector<SubsampleEntry>* subsamples) const = 0; |
| 37 |
38 protected: | 38 protected: |
39 friend class base::RefCountedThreadSafe<BitstreamConverter>; | 39 friend class base::RefCountedThreadSafe<BitstreamConverter>; |
40 virtual ~BitstreamConverter(); | 40 virtual ~BitstreamConverter(); |
41 }; | 41 }; |
42 | 42 |
43 } // namespace mp4 | 43 } // namespace mp4 |
44 } // namespace media | 44 } // namespace media |
45 | 45 |
46 #endif // MEDIA_FORMATS_MP4_AVC_H_ | 46 #endif // MEDIA_FORMATS_MP4_AVC_H_ |
OLD | NEW |