Video: Fix FFmpeg encoder support for 15- and 16-bit video pixel formats

This commit is contained in:
Jeffrey Pfau 2015-03-08 19:49:48 -07:00
parent 2a6ff14a3b
commit 5feec0317f
1 changed files with 9 additions and 1 deletions

View File

@ -288,10 +288,18 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) {
encoder->videoFrame->height = encoder->video->height; encoder->videoFrame->height = encoder->video->height;
encoder->videoFrame->pts = 0; encoder->videoFrame->pts = 0;
encoder->scaleContext = sws_getContext(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, encoder->scaleContext = sws_getContext(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS,
#ifdef COLOR_16_BIT
#ifdef COLOR_5_6_5
AV_PIX_FMT_RGB565,
#else
AV_PIX_FMT_BGR555,
#endif
#else
#ifndef USE_LIBAV #ifndef USE_LIBAV
AV_PIX_FMT_0BGR32, AV_PIX_FMT_0BGR32,
#else #else
AV_PIX_FMT_BGR32, AV_PIX_FMT_BGR32,
#endif
#endif #endif
encoder->videoFrame->width, encoder->videoFrame->height, encoder->video->pix_fmt, encoder->videoFrame->width, encoder->videoFrame->height, encoder->video->pix_fmt,
SWS_POINT, 0, 0, 0); SWS_POINT, 0, 0, 0);
@ -416,7 +424,7 @@ void _ffmpegPostVideoFrame(struct GBAAVStream* stream, struct GBAVideoRenderer*
uint8_t* pixels; uint8_t* pixels;
unsigned stride; unsigned stride;
renderer->getPixels(renderer, &stride, (void**) &pixels); renderer->getPixels(renderer, &stride, (void**) &pixels);
stride *= 4; stride *= BYTES_PER_PIXEL;
AVPacket packet; AVPacket packet;