all repos — mgba @ 5feec0317fea4e258be0b8fcdd7b4bc2b5bb54d3

mGBA Game Boy Advance Emulator

Video: Fix FFmpeg encoder support for 15- and 16-bit video pixel formats
Jeffrey Pfau jeffrey@endrift.com
Sun, 08 Mar 2015 19:49:48 -0700
commit

5feec0317fea4e258be0b8fcdd7b4bc2b5bb54d3

parent

2a6ff14a3b646492ca371c76ed715aba0a4c2647

1 files changed, 9 insertions(+), 1 deletions(-)

jump to
M src/platform/ffmpeg/ffmpeg-encoder.csrc/platform/ffmpeg/ffmpeg-encoder.c

@@ -288,10 +288,18 @@ encoder->videoFrame->width = encoder->video->width;

encoder->videoFrame->height = encoder->video->height; encoder->videoFrame->pts = 0; 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 AV_PIX_FMT_0BGR32, #else AV_PIX_FMT_BGR32, +#endif #endif encoder->videoFrame->width, encoder->videoFrame->height, encoder->video->pix_fmt, SWS_POINT, 0, 0, 0);

@@ -416,7 +424,7 @@ }

uint8_t* pixels; unsigned stride; renderer->getPixels(renderer, &stride, (void**) &pixels); - stride *= 4; + stride *= BYTES_PER_PIXEL; AVPacket packet;