File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ pub use rate::{RateControlConfig, RateControlSummary};
25
25
mod speedsettings;
26
26
pub use speedsettings:: * ;
27
27
28
+ mod progress;
29
+ pub use progress:: * ;
30
+
28
31
pub use crate :: tiling:: TilingInfo ;
29
32
30
33
/// Enumeration of possible invalid configuration errors.
@@ -131,6 +134,8 @@ pub struct Config {
131
134
#[ cfg( feature = "unstable" ) ]
132
135
/// Number of parallel encoding slots
133
136
pub ( crate ) slots : usize ,
137
+ /// Granular progress callback called when a macroblock is processed.
138
+ pub ( crate ) progress : Option < Arc < dyn GranularProgress > > ,
134
139
}
135
140
136
141
impl Config {
@@ -185,6 +190,14 @@ impl Config {
185
190
self . slots = slots;
186
191
self
187
192
}
193
+
194
+ /// Set a granular progress callback
195
+ pub fn with_granular_progress (
196
+ mut self , progress : Arc < dyn GranularProgress > ,
197
+ ) -> Self {
198
+ self . progress = Some ( progress) ;
199
+ self
200
+ }
188
201
}
189
202
190
203
fn check_tile_log2 ( n : usize ) -> bool {
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2020, The rav1e contributors. All rights reserved
2
+ //
3
+ // This source code is subject to the terms of the BSD 2 Clause License and
4
+ // the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
5
+ // was not distributed with this source code in the LICENSE file, you can
6
+ // obtain it at www.aomedia.org/license/software. If the Alliance for Open
7
+ // Media Patent License 1.0 was not distributed with this source code in the
8
+ // PATENTS file, you can obtain it at www.aomedia.org/license/patent.
9
+
10
+ /// Information provided to the progress callback
11
+ #[ derive( Debug , Clone ) ]
12
+ pub struct ProgressData { }
13
+
14
+ /// Progress callback
15
+ pub trait GranularProgress : std:: fmt:: Debug + Sync + Send {
16
+ /// Return if the encoding process should continue or not
17
+ fn progress ( & self , info : & ProgressData ) -> bool ;
18
+ }
19
+
20
+ #[ derive( Debug ) ]
21
+ pub ( crate ) struct DefaultProgress { }
22
+
23
+ impl GranularProgress for DefaultProgress {
24
+ fn progress ( & self , _info : & ProgressData ) -> bool {
25
+ true
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments