forge
Explore
Log in

Don't you dare go Hollow

edith

Clone
★ 0

0 watching0 forksRust18.3 MiB8c7bf80Tahinli3 months ago114 commits

dummy.rs74 lines, 2.4 KiBHistoryRawDownload
1// Copyright 2023 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//! This file contains a dummy backend whose only purpose is to let the decoder
6//! run so we can test it in isolation.
7
8use std::cell::RefCell;
9use std::rc::Rc;
10
11use crate::backend::dummy::decoder::Backend;
12use crate::backend::dummy::decoder::Handle;
13use crate::decoder::stateless::h265::H265;
14use crate::decoder::stateless::NewStatelessDecoderError;
15use crate::decoder::stateless::StatelessDecoder;
16use crate::decoder::BlockingMode;
17
18use crate::decoder::stateless::h265::StatelessH265DecoderBackend;
19use crate::Resolution;
20
21impl StatelessH265DecoderBackend for Backend {
22 fn new_sequence(
23 &mut self,
24 _: &crate::codec::h265::parser::Sps,
25 ) -> crate::decoder::stateless::StatelessBackendResult<()> {
26 Ok(())
27 }
28
29 fn new_picture(
30 &mut self,
31 _: Resolution,
32 _: u64,
33 ) -> crate::decoder::stateless::NewPictureResult<Self::Picture> {
34 Ok(())
35 }
36
37 fn begin_picture(
38 &mut self,
39 _: &mut Self::Picture,
40 _: &crate::codec::h265::picture::PictureData,
41 _: &crate::codec::h265::parser::Sps,
42 _: &crate::codec::h265::parser::Pps,
43 _: &crate::codec::h265::dpb::Dpb<Self::Handle>,
44 _: &crate::decoder::stateless::h265::RefPicSet<Self::Handle>,
45 _: &crate::codec::h265::parser::Slice,
46 ) -> crate::decoder::stateless::StatelessBackendResult<()> {
47 Ok(())
48 }
49
50 fn decode_slice(
51 &mut self,
52 _: &mut Self::Picture,
53 _: &crate::codec::h265::parser::Slice,
54 _: &crate::codec::h265::parser::Sps,
55 _: &crate::codec::h265::parser::Pps,
56 _: &[Option<super::RefPicListEntry<Self::Handle>>; 16],
57 _: &[Option<super::RefPicListEntry<Self::Handle>>; 16],
58 ) -> crate::decoder::stateless::StatelessBackendResult<()> {
59 Ok(())
60 }
61
62 fn submit_picture(
63 &mut self,
64 _: Self::Picture,
65 ) -> crate::decoder::stateless::StatelessBackendResult<Self::Handle> {
66 Ok(Handle { handle: Rc::new(RefCell::new(Default::default())) })
67 }
68}
69impl StatelessDecoder<H265, Backend> {
70 // Creates a new instance of the decoder using the dummy backend.
71 pub fn new_dummy(blocking_mode: BlockingMode) -> Result<Self, NewStatelessDecoderError> {
72 Self::new(Backend::new(), blocking_mode)
73 }
74}