simgear/screen/video-encoder*: build fixes for ffmpeg code on Windows.
simgear/screen/video-encoder-internal.hxx: Fixed initialisation of AVRational instance to work on Windows. simgear/screen/video-encoder.cxx: av_log(): vasprintf() is not available on Windows so use fixed buffer on Windows.
This commit is contained in:
parent
20898923e0
commit
13ca3cec56
@ -279,7 +279,7 @@ struct FfmpegEncoder
|
||||
/* Resolution must be a multiple of two. */
|
||||
m_codec_context->width = width / 2 * 2;
|
||||
m_codec_context->height = height / 2 * 2;
|
||||
m_codec_context->time_base = (AVRational){ 1, 60 };
|
||||
m_codec_context->time_base = AVRational{ 1, 60 };
|
||||
//m_codec_context->gop_size = 12; /* emit one intra m_frame every twelve frames at most */
|
||||
m_codec_context->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
/* Some formats want m_stream headers to be separate. */
|
||||
|
@ -170,10 +170,18 @@ static void av_log(void* /*avcl*/, int level, const char* format, va_list va)
|
||||
if (level < 44) sglevel = SG_DEBUG;
|
||||
if (level < 54) sglevel = SG_BULK;
|
||||
else sglevel = SG_BULK;
|
||||
#ifdef _WIN32
|
||||
/* Windows does not have vasprintf(). */
|
||||
char message[200];
|
||||
vsnprintf(message, sizeof(message), format, va);
|
||||
#else
|
||||
char* message = nullptr;
|
||||
vasprintf(&message, format, va);
|
||||
#endif
|
||||
SG_LOG(SG_VIEW, sglevel, "level=" << level << ": " << message);
|
||||
#ifndef _WIN32
|
||||
free(message);
|
||||
#endif
|
||||
}
|
||||
|
||||
VideoEncoder::VideoEncoder(
|
||||
|
Loading…
Reference in New Issue
Block a user