MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / ApplyDurationStrategy

Method ApplyDurationStrategy

src/FFmpegReader.cpp:893–915  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

891}
892
893void FFmpegReader::ApplyDurationStrategy() {
894 const double fps_value = info.fps.ToDouble();
895 const double chosen_seconds = PickDurationSeconds();
896
897 if (chosen_seconds <= 0.0 || fps_value <= 0.0) {
898 info.duration = 0.0f;
899 info.video_length = 0;
900 is_duration_known = false;
901 return;
902 }
903
904 const int64_t frames = static_cast<int64_t>(std::llround(chosen_seconds * fps_value));
905 if (frames <= 0) {
906 info.duration = 0.0f;
907 info.video_length = 0;
908 is_duration_known = false;
909 return;
910 }
911
912 info.video_length = frames;
913 info.duration = static_cast<float>(static_cast<double>(frames) / fps_value);
914 is_duration_known = true;
915}
916
917void FFmpegReader::UpdateAudioInfo() {
918 int codec_channels =

Callers

nothing calls this directly

Calls 1

ToDoubleMethod · 0.80

Tested by

no test coverage detected