fix: get_frame_duration
This commit is contained in:
parent
d783291f74
commit
94658cd808
4
build.rs
4
build.rs
@ -8,10 +8,6 @@ fn main() {
|
|||||||
let feature_name = name["DEP_FFMPEG_".len()..name.len()].to_lowercase();
|
let feature_name = name["DEP_FFMPEG_".len()..name.len()].to_lowercase();
|
||||||
println!(r#"cargo::rustc-check-cfg=cfg(feature, values("{feature_name}"))"#);
|
println!(r#"cargo::rustc-check-cfg=cfg(feature, values("{feature_name}"))"#);
|
||||||
println!(r#"cargo::rustc-cfg=feature="{feature_name}""#);
|
println!(r#"cargo::rustc-cfg=feature="{feature_name}""#);
|
||||||
println!(
|
|
||||||
r#"cargo::rustc-env=DEP_FFMPEG_{}=1"#,
|
|
||||||
feature_name.to_uppercase()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
src/lib.rs
13
src/lib.rs
@ -62,6 +62,19 @@ macro_rules! rstr {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Version dependant [AVFrame].duration
|
||||||
|
pub unsafe fn get_frame_duration(frame: *mut AVFrame) -> i64 {
|
||||||
|
#[cfg(feature = "avutil_version_greater_than_57_30")]
|
||||||
|
return (*frame).duration;
|
||||||
|
#[cfg(feature = "avcodec_version_greater_than_54_24")]
|
||||||
|
return (*frame).pkt_duration;
|
||||||
|
#[cfg(all(
|
||||||
|
not(feature = "avcodec_version_greater_than_54_24"),
|
||||||
|
not(feature = "avutil_version_greater_than_57_30")
|
||||||
|
))]
|
||||||
|
compile_error!("no frame duration support");
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
type VaList = ffmpeg_sys_the_third::va_list;
|
type VaList = ffmpeg_sys_the_third::va_list;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user