Skip to content

Commit

Permalink
fix: issue with ts_forced_program default value
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekmedia committed Aug 19, 2024
1 parent e89dd74 commit ba026e2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
22 changes: 20 additions & 2 deletions src/rust/lib_ccxr/src/common/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub enum DtvccServiceCharset {
}

#[allow(dead_code)]
#[derive(Default, Debug, Clone)]
#[derive(Debug, Clone)]
pub struct DemuxerConfig {
/// Regular TS or M2TS
pub m2ts: bool,
Expand All @@ -175,13 +175,31 @@ pub struct DemuxerConfig {
/// If 1, never mess with the selected PID
pub ts_forced_cappid: bool,
/// Specific program to process in TS files, if a forced program is given
pub ts_forced_program: Option<u32>,
pub ts_forced_program: Option<i32>,
/// User WANTED stream type (i.e. use the stream that has this type)
pub ts_datastreamtype: StreamType,
/// User selected (forced) stream type
pub ts_forced_streamtype: StreamType,
}

impl Default for DemuxerConfig {
fn default() -> Self {
Self {
m2ts: false,
auto_stream: StreamMode::default(),
codec: SelectCodec::Some(super::Codec::Any),
nocodec: SelectCodec::None,
ts_autoprogram: false,
ts_allprogram: false,
ts_cappids: Vec::new(),
ts_forced_cappid: false,
ts_forced_program: None,
ts_datastreamtype: StreamType::default(),
ts_forced_streamtype: StreamType::default(),
}
}
}

impl Default for EncoderConfig {
fn default() -> Self {
Self {
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ impl CType<demuxer_cfg> for DemuxerConfig {
ts_cappids: self.ts_cappids.to_ctype(),
nb_ts_cappid: self.ts_cappids.len() as _,
ts_forced_cappid: self.ts_forced_cappid as _,
ts_forced_program: self.ts_forced_program.unwrap_or_default() as _,
ts_forced_program: self.ts_forced_program.unwrap_or(-1) as _,
ts_forced_program_selected: self.ts_forced_program.is_some() as _,
ts_datastreamtype: self.ts_datastreamtype.to_ctype() as _,
ts_forced_streamtype: self.ts_forced_streamtype.to_ctype() as _,
Expand Down

0 comments on commit ba026e2

Please sign in to comment.