• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2025 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 use std::cell::RefCell;
6 use std::rc::Rc;
7 
8 use crate::backend::v4l2::decoder::stateless::V4l2Picture;
9 use crate::backend::v4l2::decoder::stateless::V4l2StatelessDecoderBackend;
10 use crate::codec::h265::dpb::Dpb;
11 use crate::codec::h265::parser::Pps;
12 use crate::codec::h265::parser::Slice;
13 use crate::codec::h265::parser::Sps;
14 use crate::codec::h265::picture::PictureData;
15 use crate::decoder::stateless::h265::RefPicListEntry;
16 use crate::decoder::stateless::h265::RefPicSet;
17 use crate::decoder::stateless::h265::StatelessH265DecoderBackend;
18 use crate::decoder::stateless::h265::H265;
19 use crate::decoder::stateless::NewPictureResult;
20 use crate::decoder::stateless::NewStatelessDecoderError;
21 use crate::decoder::stateless::StatelessBackendResult;
22 use crate::decoder::stateless::StatelessDecoder;
23 use crate::decoder::stateless::StatelessDecoderBackend;
24 use crate::decoder::stateless::StatelessDecoderBackendPicture;
25 use crate::decoder::BlockingMode;
26 use crate::decoder::DecodedHandle;
27 use crate::video_frame::VideoFrame;
28 
29 impl<V: VideoFrame> StatelessDecoderBackendPicture<H265> for V4l2StatelessDecoderBackend<V> {
30     type Picture = Rc<RefCell<V4l2Picture<V>>>;
31 }
32 
33 impl<V: VideoFrame> StatelessH265DecoderBackend for V4l2StatelessDecoderBackend<V> {
new_sequence(&mut self, _sps: &Sps) -> StatelessBackendResult<()>34     fn new_sequence(&mut self, _sps: &Sps) -> StatelessBackendResult<()> {
35         todo!()
36     }
37 
new_picture( &mut self, _timestamp: u64, _alloc_cb: &mut dyn FnMut() -> Option< <<Self as StatelessDecoderBackend>::Handle as DecodedHandle>::Frame, >, ) -> NewPictureResult<Self::Picture>38     fn new_picture(
39         &mut self,
40         _timestamp: u64,
41         _alloc_cb: &mut dyn FnMut() -> Option<
42             <<Self as StatelessDecoderBackend>::Handle as DecodedHandle>::Frame,
43         >,
44     ) -> NewPictureResult<Self::Picture> {
45         todo!()
46     }
47 
begin_picture( &mut self, _picture: &mut Self::Picture, _picture_data: &PictureData, _sps: &Sps, _pps: &Pps, _dpb: &Dpb<Self::Handle>, _rps: &RefPicSet<Self::Handle>, _slice: &Slice, ) -> crate::decoder::stateless::StatelessBackendResult<()>48     fn begin_picture(
49         &mut self,
50         _picture: &mut Self::Picture,
51         _picture_data: &PictureData,
52         _sps: &Sps,
53         _pps: &Pps,
54         _dpb: &Dpb<Self::Handle>,
55         _rps: &RefPicSet<Self::Handle>,
56         _slice: &Slice,
57     ) -> crate::decoder::stateless::StatelessBackendResult<()> {
58         todo!()
59     }
60 
decode_slice( &mut self, _picture: &mut Self::Picture, _slice: &Slice, _sps: &Sps, _: &Pps, _ref_pic_list0: &[Option<RefPicListEntry<Self::Handle>>; 16], _ref_pic_list1: &[Option<RefPicListEntry<Self::Handle>>; 16], ) -> crate::decoder::stateless::StatelessBackendResult<()>61     fn decode_slice(
62         &mut self,
63         _picture: &mut Self::Picture,
64         _slice: &Slice,
65         _sps: &Sps,
66         _: &Pps,
67         _ref_pic_list0: &[Option<RefPicListEntry<Self::Handle>>; 16],
68         _ref_pic_list1: &[Option<RefPicListEntry<Self::Handle>>; 16],
69     ) -> crate::decoder::stateless::StatelessBackendResult<()> {
70         todo!()
71     }
72 
submit_picture( &mut self, mut _picture: Self::Picture, ) -> StatelessBackendResult<Self::Handle>73     fn submit_picture(
74         &mut self,
75         mut _picture: Self::Picture,
76     ) -> StatelessBackendResult<Self::Handle> {
77         todo!()
78     }
79 }
80 
81 impl<V: VideoFrame> StatelessDecoder<H265, V4l2StatelessDecoderBackend<V>> {
new_v4l2(blocking_mode: BlockingMode) -> Result<Self, NewStatelessDecoderError>82     pub fn new_v4l2(blocking_mode: BlockingMode) -> Result<Self, NewStatelessDecoderError> {
83         Self::new(V4l2StatelessDecoderBackend::new()?, blocking_mode)
84     }
85 }
86