Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGES.TXT
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.95 (2025-09-15)
-----------------
- New: Added --list-tracks (-L) option to list all tracks in media files without processing
- Fix: Garbled captions from HDHomeRun and I/P-only H.264 streams (#1109)
- Fix: Enable stdout output for CEA-708 captions on Windows (#1693)
- Fix: McPoodle DVD raw format read/write - properly handle loop markers (#1524)
Expand Down
3 changes: 3 additions & 0 deletions src/rust/lib_ccxr/src/common/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ pub struct Options {
pub mp4vidtrack: bool,
/// If true, extracts chapters (if present), from MP4 files.
pub extract_chapters: bool,
/// If true, only list tracks in the input file without processing
pub list_tracks_only: bool,
/* General settings */
/// Force the use of pic_order_cnt_lsb in AVC/H.264 data streams
pub usepicorder: bool,
Expand Down Expand Up @@ -562,6 +564,7 @@ impl Default for Options {
auto_myth: None,
mp4vidtrack: Default::default(),
extract_chapters: Default::default(),
list_tracks_only: Default::default(),
usepicorder: Default::default(),
xmltv: Default::default(),
xmltvliveinterval: Timestamp::from_millis(10000),
Expand Down
4 changes: 4 additions & 0 deletions src/rust/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ pub struct Args {
/// Uses multiple programs from the same input stream.
#[arg(long, verbatim_doc_comment, help_heading=OPTIONS_AFFECTING_INPUT_FILES)]
pub multiprogram: bool,
/// List all tracks found in the input file and exit without
/// processing. Useful for exploring media files before extraction.
#[arg(long = "list-tracks", short = 'L', verbatim_doc_comment, help_heading=OPTIONS_AFFECTING_INPUT_FILES)]
pub list_tracks: bool,
/// Don't try to find out the stream for caption/teletext
/// data, just use this one instead.
#[arg(long, verbatim_doc_comment, help_heading=OPTIONS_AFFECTING_INPUT_FILES)]
Expand Down
31 changes: 31 additions & 0 deletions src/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub mod hardsubx;
pub mod hlist;
pub mod libccxr_exports;
pub mod parser;
pub mod track_lister;
pub mod utils;

#[cfg(windows)]
Expand Down Expand Up @@ -420,6 +421,36 @@ pub unsafe extern "C" fn ccxr_parse_parameters(argc: c_int, argv: *mut *mut c_ch
&mut _capitalization_list,
&mut _profane,
);

// Handle --list-tracks mode: list tracks and exit early
if opt.list_tracks_only {
use std::path::Path;
use track_lister::list_tracks;

let files = match &opt.inputfile {
Some(f) if !f.is_empty() => f,
_ => {
eprintln!("Error: No input files specified for --list-tracks");
return ExitCause::NoInputFiles.exit_code();
}
};

let mut had_errors = false;
for file in files {
if let Err(e) = list_tracks(Path::new(file)) {
eprintln!("Error listing tracks for '{}': {}", file, e);
had_errors = true;
}
}

// Exit with appropriate code - we don't want to continue to C processing
return if had_errors {
ExitCause::Failure.exit_code()
} else {
ExitCause::WithHelp.exit_code() // Reuse this code to indicate successful early exit
};
}

tlt_config = _tlt_config.to_ctype(&opt);

// Convert the rust struct (CcxOptions) to C struct (ccx_s_options), so that it can be used by the C code
Expand Down
4 changes: 4 additions & 0 deletions src/rust/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,10 @@ impl OptionsExt for Options {
self.demux_cfg.ts_allprogram = true;
}

if args.list_tracks {
self.list_tracks_only = true;
}

if let Some(ref stream) = args.stream {
self.live_stream = Some(Timestamp::from_millis(
1000 * get_atoi_hex::<i64>(stream.as_str()),
Expand Down
Loading
Loading