OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIDEO_H264_POC_H_ | 5 #ifndef MEDIA_VIDEO_H264_POC_H_ |
6 #define MEDIA_VIDEO_H264_POC_H_ | 6 #define MEDIA_VIDEO_H264_POC_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 struct H264SPS; | 14 struct H264SPS; |
15 struct H264SliceHeader; | 15 struct H264SliceHeader; |
16 | 16 |
17 class MEDIA_EXPORT H264POC { | 17 class MEDIA_EXPORT H264POC { |
18 public: | 18 public: |
19 H264POC(); | 19 H264POC(); |
20 ~H264POC(); | 20 ~H264POC(); |
21 | 21 |
22 // Compute the picture order count for a slice, storing the result into | 22 // Compute the picture order count for a slice, storing the result into |
23 // |*pic_order_cnt|. | 23 // |*pic_order_cnt|. |
| 24 // TODO(sandersd): Switch to a base::Optional<int32_t> return type. |
24 bool ComputePicOrderCnt( | 25 bool ComputePicOrderCnt( |
25 const H264SPS* sps, | 26 const H264SPS* sps, |
26 const H264SliceHeader& slice_hdr, | 27 const H264SliceHeader& slice_hdr, |
27 int32_t* pic_order_cnt); | 28 int32_t* pic_order_cnt); |
28 | 29 |
| 30 // As specified, the POC of a frame with MMCO5 changes (to zero) after |
| 31 // decoding. We instead return 0 immediately, and flag that this has occurred |
| 32 // by returning true here until ComputePicOrderCnt() is called again. |
| 33 // |
| 34 // Frames with MMCO5 do not reorder relative to frames earlier in decode |
| 35 // order, but may reorder relative to frames later in decode order (just like |
| 36 // IDRs). |
| 37 bool IsPendingMMCO5() { return pending_mmco5_; } |
| 38 |
29 // Reset computation state. It's best (although not strictly required) to call | 39 // Reset computation state. It's best (although not strictly required) to call |
30 // this after a seek. | 40 // this after a seek. |
31 void Reset(); | 41 void Reset(); |
32 | 42 |
33 private: | 43 private: |
34 int32_t ref_pic_order_cnt_msb_; | 44 int32_t ref_pic_order_cnt_msb_; |
35 int32_t ref_pic_order_cnt_lsb_; | 45 int32_t ref_pic_order_cnt_lsb_; |
36 int32_t prev_frame_num_; | 46 int32_t prev_frame_num_; |
37 int32_t prev_frame_num_offset_; | 47 int32_t prev_frame_num_offset_; |
| 48 bool pending_mmco5_; |
38 | 49 |
39 DISALLOW_COPY_AND_ASSIGN(H264POC); | 50 DISALLOW_COPY_AND_ASSIGN(H264POC); |
40 }; | 51 }; |
41 | 52 |
42 } // namespace media | 53 } // namespace media |
43 | 54 |
44 #endif // MEDIA_VIDEO_H264_POC_H_ | 55 #endif // MEDIA_VIDEO_H264_POC_H_ |
OLD | NEW |