OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 * | 9 * |
10 */ | 10 */ |
(...skipping 26 matching lines...) Expand all Loading... |
37 // VideoToolbox decoder. The RTP buffer is in annex b format whereas the sample | 37 // VideoToolbox decoder. The RTP buffer is in annex b format whereas the sample |
38 // buffer is in avcc format. | 38 // buffer is in avcc format. |
39 // If |is_keyframe| is true then |video_format| is ignored since the format will | 39 // If |is_keyframe| is true then |video_format| is ignored since the format will |
40 // be read from the buffer. Otherwise |video_format| must be provided. | 40 // be read from the buffer. Otherwise |video_format| must be provided. |
41 // Caller is responsible for releasing the created sample buffer. | 41 // Caller is responsible for releasing the created sample buffer. |
42 bool H264AnnexBBufferToCMSampleBuffer(const uint8_t* annexb_buffer, | 42 bool H264AnnexBBufferToCMSampleBuffer(const uint8_t* annexb_buffer, |
43 size_t annexb_buffer_size, | 43 size_t annexb_buffer_size, |
44 CMVideoFormatDescriptionRef video_format, | 44 CMVideoFormatDescriptionRef video_format, |
45 CMSampleBufferRef* out_sample_buffer); | 45 CMSampleBufferRef* out_sample_buffer); |
46 | 46 |
| 47 // Returns true if the type of the first NALU in the supplied Annex B buffer is |
| 48 // the SPS type. |
| 49 bool H264AnnexBBufferHasVideoFormatDescription(const uint8_t* annexb_buffer, |
| 50 size_t annexb_buffer_size); |
| 51 |
| 52 // Returns a video format description created from the sps/pps information in |
| 53 // the Annex B buffer. If there is no such information, nullptr is returned. |
| 54 // The caller is responsible for releasing the description. |
| 55 CMVideoFormatDescriptionRef CreateVideoFormatDescription( |
| 56 const uint8_t* annexb_buffer, |
| 57 size_t annexb_buffer_size); |
| 58 |
47 // Helper class for reading NALUs from an RTP Annex B buffer. | 59 // Helper class for reading NALUs from an RTP Annex B buffer. |
48 class AnnexBBufferReader final { | 60 class AnnexBBufferReader final { |
49 public: | 61 public: |
50 AnnexBBufferReader(const uint8_t* annexb_buffer, size_t length); | 62 AnnexBBufferReader(const uint8_t* annexb_buffer, size_t length); |
51 ~AnnexBBufferReader() {} | 63 ~AnnexBBufferReader() {} |
52 AnnexBBufferReader(const AnnexBBufferReader& other) = delete; | 64 AnnexBBufferReader(const AnnexBBufferReader& other) = delete; |
53 void operator=(const AnnexBBufferReader& other) = delete; | 65 void operator=(const AnnexBBufferReader& other) = delete; |
54 | 66 |
55 // Returns a pointer to the beginning of the next NALU slice without the | 67 // Returns a pointer to the beginning of the next NALU slice without the |
56 // header bytes and its length. Returns false if no more slices remain. | 68 // header bytes and its length. Returns false if no more slices remain. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 private: | 102 private: |
91 uint8_t* const start_; | 103 uint8_t* const start_; |
92 size_t offset_; | 104 size_t offset_; |
93 const size_t length_; | 105 const size_t length_; |
94 }; | 106 }; |
95 | 107 |
96 } // namespace webrtc | 108 } // namespace webrtc |
97 | 109 |
98 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) | 110 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
99 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_VIDEO_TOOLBOX_NALU_H_ | 111 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_VIDEO_TOOLBOX_NALU_H_ |
OLD | NEW |