From fbea39e5154485c963993f0419729b53ec068cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophane=20Mayaud?= Date: Sat, 14 Sep 2024 19:04:16 +0200 Subject: [PATCH] chore(video): code style --- QtProject/app/video.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/QtProject/app/video.cpp b/QtProject/app/video.cpp index badd6ec..a5c68ce 100644 --- a/QtProject/app/video.cpp +++ b/QtProject/app/video.cpp @@ -381,8 +381,8 @@ QImage Video::ffmpegLib_captureAt(const int percent, const int ofDuration) #ifdef DEBUG_VIDEO_READING // NB Here a lot of debug elements are kept as is, because they quickly enable diagnstics of new or problematic // video codecs/files/... - qDebug() << "Library will try to capture at "< should find a way to report it #ifdef DEBUG_VIDEO_READING if(abs(ms_stream_duration-duration)>100){ - qDebug() << "Stream duration ms(" << ms_stream_duration << ") is more than 100ms different to file reported duration("<FAIL_ON_FRAME_DECODE_NB_FAIL){ qDebug() << "Failed to read frames too many("<< failedFrames << ") times, will stop, for file " << _filePathName; @@ -612,10 +612,10 @@ QImage Video::ffmpegLib_captureAt(const int percent, const int ofDuration) " best effort ts "<best_effort_timestamp; #endif // try to find estimate of frame rate TODO : find another way to do this, with frame ts maybe... ? - if(framerate==0){ + if(this->framerate==0){ ffmpeg::AVRational est_fps = ffmpeg::av_guess_frame_rate(fmt_ctx, vs,vFrame); if(est_fps.num!=0 && est_fps.den!=0){ - framerate = round(ffmpeg::av_q2d(est_fps) * 10) / 10; + this->framerate = round(ffmpeg::av_q2d(est_fps) * 10) / 10; } } // try to find estimate stream duration from frame size and file size @@ -623,10 +623,10 @@ QImage Video::ffmpegLib_captureAt(const int percent, const int ofDuration) && vs->time_base.num!=0 /*avoid 0 divisions*/){ avg_frame_bytes_size = (frames_estimated*avg_frame_bytes_size + vFrame->pkt_size)/(1+frames_estimated); frames_estimated++; - ms_stream_duration = (double)ESTIMATE_DURATION_FROM_FRAME_RESCALE*1000*size*vs->avg_frame_rate.den/(avg_frame_bytes_size*vs->avg_frame_rate.num+1); // rescale to avoid over estimating, add 1 because avg_frame_rate can be 0 ! + ms_stream_duration = (double)ESTIMATE_DURATION_FROM_FRAME_RESCALE*1000*this->size*vs->avg_frame_rate.den/(avg_frame_bytes_size*vs->avg_frame_rate.num+1); // rescale to avoid over estimating, add 1 because avg_frame_rate can be 0 ! wanted_ms_place = (double) ms_stream_duration * percent * ofDuration / (100 * 100 /*percents*/) ; wanted_ts = vs->time_base.den * wanted_ms_place / (vs->time_base.num * 1000 /*we have ms duration*/); - duration = ms_stream_duration; + this->duration = ms_stream_duration; #ifdef DEBUG_VIDEO_READING qDebug() <<"No video duration : trying to estimate from file size and frame size : "<< " frame pkt size "<pkt_size<< @@ -661,13 +661,13 @@ QImage Video::ffmpegLib_captureAt(const int percent, const int ofDuration) } else{ #ifdef DEBUG_VIDEO_READING - qDebug() << "Failed to receive frame for "<