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 #include <fcntl.h> | 5 #include <fcntl.h> |
6 #include <linux/videodev2.h> | 6 #include <linux/videodev2.h> |
7 #include <poll.h> | 7 #include <poll.h> |
8 #include <sys/eventfd.h> | 8 #include <sys/eventfd.h> |
9 #include <sys/ioctl.h> | 9 #include <sys/ioctl.h> |
10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1770 void V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::H264DPBToV4L2DPB( | 1770 void V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::H264DPBToV4L2DPB( |
1771 const H264DPB& dpb, | 1771 const H264DPB& dpb, |
1772 std::vector<scoped_refptr<V4L2DecodeSurface>>* ref_surfaces) { | 1772 std::vector<scoped_refptr<V4L2DecodeSurface>>* ref_surfaces) { |
1773 memset(v4l2_decode_param_.dpb, 0, sizeof(v4l2_decode_param_.dpb)); | 1773 memset(v4l2_decode_param_.dpb, 0, sizeof(v4l2_decode_param_.dpb)); |
1774 size_t i = 0; | 1774 size_t i = 0; |
1775 for (const auto& pic : dpb) { | 1775 for (const auto& pic : dpb) { |
1776 if (i >= arraysize(v4l2_decode_param_.dpb)) { | 1776 if (i >= arraysize(v4l2_decode_param_.dpb)) { |
1777 DVLOG(1) << "Invalid DPB size"; | 1777 DVLOG(1) << "Invalid DPB size"; |
1778 break; | 1778 break; |
1779 } | 1779 } |
1780 | |
1781 int index = VIDEO_MAX_FRAME; | |
kcwu
2015/10/02 13:06:04
Why it is okay to set buf_idx=VIDEO_MAX_FRAME for
Pawel Osciak
2015/10/09 06:39:25
VIDEO_MAX_FRAME is used to indicate an unused entr
| |
1782 if (!pic->nonexisting) { | |
1783 scoped_refptr<V4L2DecodeSurface> dec_surface = | |
1784 H264PictureToV4L2DecodeSurface(pic); | |
1785 index = dec_surface->output_record(); | |
1786 ref_surfaces->push_back(dec_surface); | |
1787 } | |
1788 | |
1780 struct v4l2_h264_dpb_entry& entry = v4l2_decode_param_.dpb[i++]; | 1789 struct v4l2_h264_dpb_entry& entry = v4l2_decode_param_.dpb[i++]; |
1781 scoped_refptr<V4L2DecodeSurface> dec_surface = | 1790 entry.buf_index = index; |
1782 H264PictureToV4L2DecodeSurface(pic); | |
1783 entry.buf_index = dec_surface->output_record(); | |
1784 entry.frame_num = pic->frame_num; | 1791 entry.frame_num = pic->frame_num; |
1785 entry.pic_num = pic->pic_num; | 1792 entry.pic_num = pic->pic_num; |
1786 entry.top_field_order_cnt = pic->top_field_order_cnt; | 1793 entry.top_field_order_cnt = pic->top_field_order_cnt; |
1787 entry.bottom_field_order_cnt = pic->bottom_field_order_cnt; | 1794 entry.bottom_field_order_cnt = pic->bottom_field_order_cnt; |
1788 entry.flags = (pic->ref ? V4L2_H264_DPB_ENTRY_FLAG_ACTIVE : 0) | | 1795 entry.flags = (pic->ref ? V4L2_H264_DPB_ENTRY_FLAG_ACTIVE : 0) | |
1789 (pic->long_term ? V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM : 0); | 1796 (pic->long_term ? V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM : 0); |
1790 | |
1791 ref_surfaces->push_back(dec_surface); | |
1792 } | 1797 } |
1793 } | 1798 } |
1794 | 1799 |
1795 bool V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::SubmitFrameMetadata( | 1800 bool V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::SubmitFrameMetadata( |
1796 const media::H264SPS* sps, | 1801 const media::H264SPS* sps, |
1797 const media::H264PPS* pps, | 1802 const media::H264PPS* pps, |
1798 const H264DPB& dpb, | 1803 const H264DPB& dpb, |
1799 const H264Picture::Vector& ref_pic_listp0, | 1804 const H264Picture::Vector& ref_pic_listp0, |
1800 const H264Picture::Vector& ref_pic_listb0, | 1805 const H264Picture::Vector& ref_pic_listb0, |
1801 const H264Picture::Vector& ref_pic_listb1, | 1806 const H264Picture::Vector& ref_pic_listb1, |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2533 if (!device) | 2538 if (!device) |
2534 return SupportedProfiles(); | 2539 return SupportedProfiles(); |
2535 | 2540 |
2536 const uint32_t supported_formats[] = { | 2541 const uint32_t supported_formats[] = { |
2537 V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME}; | 2542 V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME}; |
2538 return device->GetSupportedDecodeProfiles(arraysize(supported_formats), | 2543 return device->GetSupportedDecodeProfiles(arraysize(supported_formats), |
2539 supported_formats); | 2544 supported_formats); |
2540 } | 2545 } |
2541 | 2546 |
2542 } // namespace content | 2547 } // namespace content |
OLD | NEW |