From c8c0af300dde117a839f2d5d6b777694d7f118e9 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Mon, 28 Apr 2025 14:11:28 -0400 Subject: Minor restructure and dependency updates Signed-off-by: Andrew Opalach --- src/codec/ffmpeg/decoder.c | 2 +- src/codec/ffmpeg/demuxer.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/codec') diff --git a/src/codec/ffmpeg/decoder.c b/src/codec/ffmpeg/decoder.c index cae56d1..80b1d12 100644 --- a/src/codec/ffmpeg/decoder.c +++ b/src/codec/ffmpeg/decoder.c @@ -262,7 +262,7 @@ static bool ff_decoder_init(struct camu_decoder *dec, struct camu_renderer *rend av->codec_context->thread_count = cpus; // FF_THREAD_FRAME or FF_THREAD_SLICE. // SLICE seems to work better based on videos that got completely choked - // in THREAD_FRAME mode (4k60 hevc, FFMpeg 7.1.1, AMD 3900x). + // in THREAD_FRAME mode (4k60 HEVC, FFmpeg 7.1.1, AMD 3900x). av->codec_context->thread_type = FF_THREAD_SLICE; log_info("Using %i threads for decoder.", cpus); } diff --git a/src/codec/ffmpeg/demuxer.c b/src/codec/ffmpeg/demuxer.c index cb2ed91..d45a970 100644 --- a/src/codec/ffmpeg/demuxer.c +++ b/src/codec/ffmpeg/demuxer.c @@ -75,12 +75,14 @@ static bool ff_demuxer_init(struct camu_demuxer *demux, struct cch_handle *handl goto err; } -#define GUESS_STREAM_IS_IMAGE(stream) \ - (stream->duration >= 0 && stream->nb_frames <= 1 && (stream->avg_frame_rate.den == 0 && stream->r_frame_rate.den > 0)) - s64 default_duration = (av->format_context->duration < 0) ? 0 : av->format_context->duration; av->duration = 0; +#define GUESS_STREAM_IS_IMAGE(stream) \ + ((stream->duration >= 0 && stream->nb_frames <= 1 && \ + (stream->avg_frame_rate.den == 0 && stream->r_frame_rate.den > 0)) || \ + (stream->duration < 0 && default_duration == 0)) + for (u32 i = 0; i < av->format_context->nb_streams; i++) { AVStream *stream = av->format_context->streams[i]; enum AVMediaType type = stream->codecpar->codec_type; @@ -88,12 +90,12 @@ static bool ff_demuxer_init(struct camu_demuxer *demux, struct cch_handle *handl if (type == AVMEDIA_TYPE_AUDIO || type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_SUBTITLE) { // Try to detect attached images. if (type == AVMEDIA_TYPE_VIDEO && GUESS_STREAM_IS_IMAGE(stream)) { - log_info("Assuming stream #%u is an image.", i); + log_debug("Assuming stream #%u is an image.", i); } else { if (stream->duration < 0) { stream->duration = av_rescale_q(default_duration, AV_TIME_BASE_Q, stream->time_base); al_assert(stream->duration >= 0); - log_info("Stream #%u has an invalid duration, defaulting to %.3fs.", + log_warn("Stream #%u has an invalid duration, defaulting to %.3fs.", i, stream->duration * av_q2d(stream->time_base)); } duration = (u64)av_rescale_q(stream->duration, stream->time_base, AV_TIME_BASE_Q); -- cgit v1.2.3-101-g0448