qboolean pcmhack;
quint8_t bytebuffer[32768];
qint64_t asavepts;
+ struct SwsContext *sws;
}
capturevideostate_lavc_formatspecific_t;
#define LOAD_FORMATSPECIFIC_LAVC() capturevideostate_lavc_formatspecific_t *format = (capturevideostate_lavc_formatspecific_t *) cls.capturevideo.formatspecific
do
{
qavcodec_get_frame_defaults(&frame);
+ if(num > 0)
+ {
+ SCR_CaptureVideo_Lavc_ConvertFrame_BGRA_to_YUV(&frame);
+ frame.pts = format->vpts;
+ }
if(format->avf->oformat->flags & AVFMT_RAWPICTURE)
{
if(num > 0)
{
- SCR_CaptureVideo_Lavc_ConvertFrame_BGRA_to_YUV(&frame);
memcpy(format->buffer, &frame, sizeof(AVPicture));
size = sizeof(AVPicture);
}
else
{
if(num > 0)
- {
- SCR_CaptureVideo_Lavc_ConvertFrame_BGRA_to_YUV(&frame);
- frame.pts = format->vpts;
size = qavcodec_encode_video(avc, format->buffer, format->bufsize, &frame);
- }
else
- {
size = qavcodec_encode_video(avc, format->buffer, format->bufsize, NULL);
- }
}
if(size < 0)
}
if(format->aframe)
Mem_Free(format->aframe);
+ if(format->sws)
+ qsws_freeContext(format->sws);
Mem_Free(format);
+ cls.capturevideo.formatspecific = NULL;
FS_Close(cls.capturevideo.videofile);
cls.capturevideo.videofile = NULL;
-
- cls.capturevideo.formatspecific = NULL;
}
static int lavc_write(void *f, quint8_t *buf, int bufsize)
else
video_str->codec->pix_fmt = PIX_FMT_YUV420P;
}
+ if(video_str->codec->pix_fmt != PIX_FMT_BGRA)
+ format->sws = qsws_getCachedContext(NULL, cls.capturevideo.width, cls.capturevideo.height, PIX_FMT_BGRA, cls.capturevideo.width, cls.capturevideo.height, video_str->codec->pix_fmt, 0, NULL, NULL, NULL);
FindFraction(1 / vid_pixelheight.value, &num, &denom, 1000);
video_str->sample_aspect_ratio.num = num;
video_str->sample_aspect_ratio.den = denom;