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
1 files changed,
9 insertions(+),
1 deletions(-)
M
src/platform/ffmpeg/ffmpeg-encoder.c
→
src/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;