[ENG-828-FIX] Make trivial changes to the previous ENG-828 merge (#1032)

remove old error and cleanup
This commit is contained in:
jake 2023-06-27 11:05:47 +01:00 committed by GitHub
parent d5ddfcc667
commit 9e206b3cc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 10 deletions

View file

@ -38,8 +38,6 @@ pub enum ThumbnailerError {
BackgroundTaskFailed(#[from] JoinError),
#[error("The video is most likely corrupt and will be skipped")]
CorruptVideo,
#[error("The video file contains subtitles and will be skipped")]
Subtitles,
}
/// Enum to represent possible errors from FFmpeg library

View file

@ -14,8 +14,8 @@ use ffmpeg_sys_next::{
avfilter_graph_create_filter, avfilter_graph_free, avfilter_link, avformat_close_input,
avformat_find_stream_info, avformat_open_input, AVCodec, AVCodecContext, AVCodecID,
AVFilterContext, AVFilterGraph, AVFormatContext, AVFrame, AVMediaType, AVPacket,
AVPacketSideDataType, AVRational, AVStream, AVERROR, AVERROR_EOF, AV_DICT_IGNORE_SUFFIX,
AV_TIME_BASE, EAGAIN,
AVPacketSideDataType, AVRational, AVStream, AVERROR, AVERROR_EOF, AVPROBE_SCORE_MAX,
AV_DICT_IGNORE_SUFFIX, AV_TIME_BASE, EAGAIN,
};
use std::{
ffi::{c_int, CString},
@ -102,14 +102,11 @@ impl MovieDecoder {
}
unsafe {
if (*decoder.format_context).probe_score == 100 {
// This needs to remain at 100 or the app will force crash if it comes
// across a video with subtitles or any type of corruption.
if (*decoder.format_context).probe_score == AVPROBE_SCORE_MAX {
return Err(ThumbnailerError::CorruptVideo);
}
// TODO(brxken128): idk if this is needed but i think so
if (*decoder.format_context).subtitle_codec_id == AVCodecID::AV_CODEC_ID_NONE {
return Err(ThumbnailerError::Subtitles);
}
}
decoder.initialize_video(prefer_embedded_metadata)?;