Add support for more than 8 bits per pixel in ffmpeg

This commit is contained in:
jfmcarreira committed 2016-02-04 16:19:42 +00:00
1 parent a6db350c58
commit 717894f84a
3 files changed
+22 -9

No files matched your search

+14 -1
View File
@@ -112,7 +112,8 @@ Void LibAvContextHandle::closeAvFormat()
m_bHasStream = false;
}
Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt& height, Int& pixel_format, Double& frame_rate, UInt64& num_frames )
Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt& height, Int& pixel_format, UInt& bits_pel, Double& frame_rate,
UInt64& num_frames )
{
fmt_ctx = NULL;
video_dec_ctx = NULL;
@@ -211,6 +212,13 @@ Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt&
num_frames = num_frames == 0 ? 1 : num_frames;
Int pix_fmt = video_dec_ctx->pix_fmt;
// Set bits per pixel to default (8 bits)
bits_pel = 8;
/**
* Auxiliar conversation to re-use similar pixfmt
*/
switch( pix_fmt )
{
case AV_PIX_FMT_YUVJ420P:
@@ -222,6 +230,11 @@ Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt&
case AV_PIX_FMT_YUVJ444P:
pix_fmt = AV_PIX_FMT_YUV444P;
break;
case AV_PIX_FMT_GRAY16LE:
case AV_PIX_FMT_GRAY16BE:
bits_pel = 16;
pix_fmt = AV_PIX_FMT_GRAY8;
break;
}
width = video_dec_ctx->width;