From c9a7d3ecf5a5e979c4503dbf1f072898ffd72574 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 11 Apr 2006 14:43:17 +0000 Subject: *** empty log message *** --- lib/libdv_wrapper.cc | 21 +++++++++++++++++++-- lib/libdv_wrapper.h | 16 +++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/libdv_wrapper.cc b/lib/libdv_wrapper.cc index 563c709..5a385b1 100644 --- a/lib/libdv_wrapper.cc +++ b/lib/libdv_wrapper.cc @@ -67,8 +67,11 @@ void LibDVWrapper::setSampling(DV::Sampling sampling) decoder->sampling = (dv_sample_t)sampling; } -void LibDVWrapper::setOutputBuffer(char *output) +void LibDVWrapper::setOutputBuffer(char *output, DV::ColorSpace c) { + colorspace = c; + switch(colorspace) { + case DV::YUV: #ifdef COLORSPACE_YV12 yuv[0] = (unsigned char*)output; yuv[1] = (unsigned char*)yuv[0] + (width * height); @@ -80,6 +83,20 @@ void LibDVWrapper::setOutputBuffer(char *output) yuv[0] = (unsigned char*)output; pitches[0] = width * 2; #endif + break; + + case DV::RGB: + yuv[0] = (unsigned char*)output; + yuv[1] = yuv[2] = NULL; + pitches[0] = width * 3; + break; + + case DV::BGR0: + yuv[0] = (unsigned char*)output; + yuv[1] = yuv[2] = NULL; + pitches[0] = width * 4; + break; + } } void LibDVWrapper::decode(char *input) @@ -96,7 +113,7 @@ void LibDVWrapper::decode(char *input) dv_decode_full_frame(decoder, (const uint8_t*)input, - e_dv_color_yuv, + (dv_color_space_t)colorspace, yuv, pitches); } diff --git a/lib/libdv_wrapper.h b/lib/libdv_wrapper.h index d98cae6..16a7d94 100644 --- a/lib/libdv_wrapper.h +++ b/lib/libdv_wrapper.h @@ -78,6 +78,19 @@ namespace DV { YUV_420 = e_dv_sample_420, YUV_422 = e_dv_sample_422 } Sampling; + + /* + typedef enum color_space_e { + e_dv_color_yuv, + e_dv_color_rgb, + e_dv_color_bgr0, + } dv_color_space_t; + */ + typedef enum { + YUV = e_dv_color_yuv, + RGB = e_dv_color_rgb, + BGR0 = e_dv_color_bgr0 + } ColorSpace; }; class LibDVWrapper { @@ -91,7 +104,7 @@ public: void setSystem(DV::System system); void setSampling(DV::Sampling sampling); - void setOutputBuffer(char *output); + void setOutputBuffer(char *output, DV::ColorSpace colorspace = DV::YUV); void decode(char *input); @@ -103,6 +116,7 @@ private: unsigned char* yuv[3]; dv_decoder_t *decoder; + DV::ColorSpace colorspace; }; #endif/*__MIAV_LIBDV_WRAPPER_H__*/ -- cgit v1.2.3