}
}
+fn format_stream_tag(streamno: u32, arg: &str) -> Result<String, ()> {
+ let mut dst = format!("stream{streamno}tag");
+
+ let src = arg.as_bytes();
+ let mut idx = 0;
+ while idx < src.len() {
+ match src[idx] {
+ b'\\' => {
+ idx += 1;
+
+ if idx >= src.len() {
+ return Err(());
+ }
+ match src[idx] {
+ b'0' => {
+ dst += "00";
+ idx += 1;
+ },
+ b'x' => {
+ idx += 1;
+ if idx + 1 >= src.len() {
+ return Err(());
+ }
+ let c0 = src[idx];
+ let c1 = src[idx + 1];
+ idx += 2;
+ if c0.is_ascii_hexdigit() && c1.is_ascii_hexdigit() {
+ dst.push(c0.to_ascii_uppercase() as char);
+ dst.push(c1.to_ascii_uppercase() as char);
+ } else {
+ return Err(());
+ }
+ },
+ _ => return Err(()),
+ }
+ },
+ b' '..=0x7E => {
+ dst += format!("{:02X}", src[idx]).as_str();
+ idx += 1;
+ },
+ _ => return Err(()),
+ }
+ }
+
+ Ok(dst)
+}
+
#[derive(Default)]
pub struct QuirkSupport {
pub calc_len: bool,
println!("invalid volume");
}
},
+ "stream_tag" => {
+ if let Ok(tag) = format_stream_tag(streamno, oval[1]) {
+ self.mux_opts.push(OptionArgs{ name: "stream_tag".to_string(), value: Some(tag) });
+ } else {
+ println!("invalid stream tag");
+ }
+ },
_ => {
ostr.enc_opts.push(OptionArgs{ name: oval[0].to_string(), value: Some(oval[1].to_string()) });
},