int aframesize;
int aframepos;
size_t aframetypesize;
- qboolean pcmhack;
+ size_t pcmhack;
quint8_t bytebuffer[32768];
qint64_t asavepts;
struct SwsContext *sws;
AVCodecContext *avc = format->avf->streams[1]->codec;
if(format->pcmhack)
- size = qavcodec_encode_audio(avc, format->buffer, format->aframesize * format->pcmhack, format->aframe);
+ {
+ //Con_DPrintf("encoding %d bytes\n", (int)(format->aframesize * cls.capturevideo.soundchannels * format->pcmhack));
+ size = qavcodec_encode_audio(avc, format->buffer, format->aframesize * cls.capturevideo.soundchannels * format->pcmhack, format->aframe);
+ }
else
size = qavcodec_encode_audio(avc, format->buffer, format->bufsize, format->aframe);
Con_Printf("error writing\n");
}
- format->apts += avc->frame_size;
+ format->apts += format->aframesize;
format->aframepos = 0;
}
static void SCR_CaptureVideo_Lavc_SoundFrame_EncodeEnd(void)
break;
}
- if(format->aframepos >= avc->frame_size)
+ if(format->aframepos >= format->aframesize)
{
SCR_CaptureVideo_Lavc_SoundFrame_Encode();
}
}
else
{
- memset(format->aframe + format->aframepos*cls.capturevideo.soundchannels, 0, sizeof(format->aframe[0]) * (format->aframesize - format->aframepos));
+ memset((char *)format->aframe + format->aframetypesize*format->aframepos*cls.capturevideo.soundchannels, 0, format->aframetypesize * (format->aframesize - format->aframepos));
SCR_CaptureVideo_Lavc_SoundFrame_Encode();
SCR_CaptureVideo_Lavc_SoundFrame_EncodeEnd();
}