1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-28 23:06:24 +02:00

fix error message

This commit is contained in:
Laserlicht 2023-10-08 02:37:54 +02:00
parent 3c647334b0
commit 39e06ea5e1

View File

@ -541,15 +541,22 @@ std::pair<std::unique_ptr<ui8 []>, si64> CVideoPlayer::getAudio(const VideoPath
while (av_read_frame(formatAudio, &packet) >= 0)
{
avcodec_send_packet(codecContextAudio, &packet);
avcodec_receive_frame(codecContextAudio, frameAudio);
for (int s = 0; s < frameAudio->linesize[0]; s+=sizeof(ui8))
if(packet.stream_index == streamAudio)
{
ui8 value;
memcpy(&value, &frameAudio->data[0][s], sizeof(ui8));
samples.push_back(value);
int rc = avcodec_send_packet(codecContextAudio, &packet);
if (rc >= 0)
packet.size = 0;
rc = avcodec_receive_frame(codecContextAudio, frameAudio);
if (rc >= 0)
for (int s = 0; s < frameAudio->linesize[0]; s+=sizeof(ui8))
{
ui8 value;
memcpy(&value, &frameAudio->data[0][s], sizeof(ui8));
samples.push_back(value);
}
}
av_packet_unref(&packet);
}
typedef struct WAV_HEADER {