修复test_player没声音和windows控制台日志不输出bug (#4484)

(cherry picked from commit 73d348ea96)
This commit is contained in:
mtdxc
2025-09-30 11:05:01 +08:00
committed by xia-chu
parent 797d8bf00f
commit 7828c03d16
5 changed files with 34 additions and 14 deletions

View File

@@ -247,6 +247,15 @@ void FFmpegFrame::fillPicture(AVPixelFormat target_format, int target_width, int
av_image_fill_arrays(_frame->data, _frame->linesize, (uint8_t *) _data, target_format, target_width, target_height, 32);
}
int FFmpegFrame::getChannels() const {
if (!_frame) return 0;
#if LIBAVCODEC_VERSION_INT >= FF_CODEC_VER_7_1
return _frame->ch_layout.nb_channels;
#else
return _frame->channels;
#endif
}
///////////////////////////////////////////////////////////////////////////
template<bool decoder = true>

View File

@@ -44,6 +44,7 @@ public:
AVFrame *get() const;
void fillPicture(AVPixelFormat target_format, int target_width, int target_height);
int getChannels() const;
private:
char *_data = nullptr;