From 9a9b361f0e17703ce4eb6205643cab9c0fc50352 Mon Sep 17 00:00:00 2001 From: "yuzhuohuang@qq.com" Date: Wed, 14 Nov 2012 11:53:03 +0800 Subject: [PATCH] Add pgs color type setting --- src/filters/transform/vsfilter/DirectVobSub.cpp | 33 ++- .../transform/vsfilter/DirectVobSubFilter.cpp | 33 ++- src/filters/transform/vsfilter/IDirectVobSubXy.h | 2 + src/filters/transform/vsfilter/StdAfx.h | 1 + src/filters/transform/vsfilter/VSFilter.rc | 1 + src/filters/transform/vsfilter/resource.h | 4 +- src/subpic/color_conv_table.cpp | 43 +++- src/subpic/color_conv_table.h | 6 + src/subtitles/BaseSub.h | 6 +- src/subtitles/CompositionObject.cpp | 271 ++++++++++++++++----- src/subtitles/CompositionObject.h | 26 +- src/subtitles/DVBSub.cpp | 16 +- src/subtitles/DVBSub.h | 1 + src/subtitles/HdmvSub.cpp | 20 +- src/subtitles/HdmvSub.h | 2 +- src/subtitles/RenderedHdmvSubtitle.cpp | 6 + src/subtitles/RenderedHdmvSubtitle.h | 3 +- 17 files changed, 388 insertions(+), 86 deletions(-) diff --git a/src/filters/transform/vsfilter/DirectVobSub.cpp b/src/filters/transform/vsfilter/DirectVobSub.cpp index c762954..3e70227 100644 --- a/src/filters/transform/vsfilter/DirectVobSub.cpp +++ b/src/filters/transform/vsfilter/DirectVobSub.cpp @@ -206,8 +206,35 @@ CDirectVobSub::CDirectVobSub() } //fix me: CStringw = CString - m_xy_str_opt[STRING_LOAD_EXT_LIST] = + m_xy_str_opt[STRING_LOAD_EXT_LIST] = theApp.GetProfileString(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOAD_EXT_LIST), _T("ass;ssa;srt;idx;txt;usf;xss;ssf;smi;psb;rt")); + + CString str_pgs_yuv_setting = theApp.GetProfileString(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_PGS_COLOR_TYPE), _T("GUESS.GUESS")); + if (str_pgs_yuv_setting.Left(2).CompareNoCase(_T("TV"))==0) + { + m_xy_str_opt[STRING_PGS_YUV_RANGE] = _T("TV"); + } + else if (str_pgs_yuv_setting.Left(2).CompareNoCase(_T("PC"))==0) + { + m_xy_str_opt[STRING_PGS_YUV_RANGE] = _T("PC"); + } + else + { + m_xy_str_opt[STRING_PGS_YUV_RANGE] = _T("GUESS"); + } + + if (str_pgs_yuv_setting.Right(3).CompareNoCase(_T("601"))==0) + { + m_xy_str_opt[STRING_PGS_YUV_MATRIX] = _T("BT601"); + } + else if (str_pgs_yuv_setting.Right(3).CompareNoCase(_T("709"))==0) + { + m_xy_str_opt[STRING_PGS_YUV_MATRIX] = _T("BT709"); + } + else + { + m_xy_str_opt[STRING_PGS_YUV_MATRIX] = _T("GUESS"); + } } CDirectVobSub::~CDirectVobSub() @@ -684,6 +711,10 @@ STDMETHODIMP CDirectVobSub::UpdateRegistry() theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_USER_SPECIFIED_LAYOUT_SIZE_Y), m_xy_size_opt[SIZE_USER_SPECIFIED_LAYOUT_SIZE].cy); theApp.WriteProfileString(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOAD_EXT_LIST), m_xy_str_opt[STRING_LOAD_EXT_LIST]);//fix me:m_xy_str_opt[] is wide char string + + CString str_pgs_yuv_type = m_xy_str_opt[STRING_PGS_YUV_RANGE] + m_xy_str_opt[STRING_PGS_YUV_MATRIX]; + theApp.WriteProfileString(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_PGS_COLOR_TYPE), str_pgs_yuv_type); + //save output color config { int count = GetOutputColorSpaceNumber(); diff --git a/src/filters/transform/vsfilter/DirectVobSubFilter.cpp b/src/filters/transform/vsfilter/DirectVobSubFilter.cpp index c3fdca8..fc45314 100644 --- a/src/filters/transform/vsfilter/DirectVobSubFilter.cpp +++ b/src/filters/transform/vsfilter/DirectVobSubFilter.cpp @@ -1900,10 +1900,33 @@ void CDirectVobSubFilter::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyl m_script_selected_yuv = pRTS->m_eYCbCrMatrix; m_script_selected_range = pRTS->m_eYCbCrRange; - pRTS->Deinit(); + pRTS->Deinit(); playres = pRTS->m_dstScreenSize; - } - } + } + else if(clsid == __uuidof(CRenderedHdmvSubtitle)) + { + CRenderedHdmvSubtitle *sub = dynamic_cast(pSubStream); + CompositionObject::ColorType color_type = CompositionObject::NONE; + CompositionObject::YuvRangeType range_type = CompositionObject::RANGE_NONE; + if ( m_xy_str_opt[STRING_PGS_YUV_RANGE].CompareNoCase(_T("PC"))==0 ) + { + range_type = CompositionObject::RANGE_PC; + } + else if ( m_xy_str_opt[STRING_PGS_YUV_RANGE].CompareNoCase(_T("TV"))==0 ) + { + range_type = CompositionObject::RANGE_TV; + } + if ( m_xy_str_opt[STRING_PGS_YUV_MATRIX].CompareNoCase(_T("BT601"))==0 ) + { + color_type = CompositionObject::YUV_Rec601; + } + else if ( m_xy_str_opt[STRING_PGS_YUV_MATRIX].CompareNoCase(_T("BT709"))==0 ) + { + color_type = CompositionObject::YUV_Rec709; + } + sub->SetYuvType(color_type, range_type); + } + } if(!fApplyDefStyle) { @@ -1929,8 +1952,8 @@ void CDirectVobSubFilter::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyl SetYuvMatrix(); XySetSize(SIZE_ASS_PLAY_RESOLUTION, playres); - if(m_simple_provider) - m_simple_provider->SetSubPicProvider(CComQIPtr(pSubStream)); + if(m_simple_provider) + m_simple_provider->SetSubPicProvider(CComQIPtr(pSubStream)); } void CDirectVobSubFilter::InvalidateSubtitle(REFERENCE_TIME rtInvalidate, DWORD_PTR nSubtitleId) diff --git a/src/filters/transform/vsfilter/IDirectVobSubXy.h b/src/filters/transform/vsfilter/IDirectVobSubXy.h index 54cfb92..9b3d310 100644 --- a/src/filters/transform/vsfilter/IDirectVobSubXy.h +++ b/src/filters/transform/vsfilter/IDirectVobSubXy.h @@ -46,6 +46,8 @@ extern "C" { enum//string { STRING_LOAD_EXT_LIST, + STRING_PGS_YUV_RANGE,//TV,PC,GUESS(default) + STRING_PGS_YUV_MATRIX,//BT601,BT709,GUESS(default) STRING_COUNT }; enum diff --git a/src/filters/transform/vsfilter/StdAfx.h b/src/filters/transform/vsfilter/StdAfx.h index d03e5b0..44a8b42 100644 --- a/src/filters/transform/vsfilter/StdAfx.h +++ b/src/filters/transform/vsfilter/StdAfx.h @@ -32,3 +32,4 @@ #include "../../../subtitles/RTS.h" #include "../../../subtitles/cache_manager.h" #include "../../../subtitles/subpixel_position_controler.h" +#include "../../../subtitles/RenderedHdmvSubtitle.h" diff --git a/src/filters/transform/vsfilter/VSFilter.rc b/src/filters/transform/vsfilter/VSFilter.rc index e9a3cca..290d6d2 100644 --- a/src/filters/transform/vsfilter/VSFilter.rc +++ b/src/filters/transform/vsfilter/VSFilter.rc @@ -658,6 +658,7 @@ BEGIN IDS_RG_USER_SPECIFIED_LAYOUT_SIZE_X "USER_SPECIFIED_RENDER_SIZE_X" IDS_RG_USER_SPECIFIED_LAYOUT_SIZE_Y "USER_SPECIFIED_RENDER_SIZE_Y" IDS_RG_LOAD_EXT_LIST "LOAD_EXT_LIST" + IDS_RG_PGS_COLOR_TYPE "PGS_COLOR_TYPE" END STRINGTABLE diff --git a/src/filters/transform/vsfilter/resource.h b/src/filters/transform/vsfilter/resource.h index 055d4a5..1abd51b 100644 --- a/src/filters/transform/vsfilter/resource.h +++ b/src/filters/transform/vsfilter/resource.h @@ -44,8 +44,7 @@ #define IDS_RG_EXTERNALLOAD 139 #define IDS_RG_WEBLOAD 140 #define IDS_RG_EMBEDDEDLOAD 141 -#define IDS_RG_USE_BT709 142 -#define IDS_RG_COLOR_SPACE 142 +#define IDS_RG_COLOR_SPACE 142 #define IDS_R_PERFORMANCE 143 #define IDS_R_TIMING 144 #define IDS_RTM_SUBTITLEDELAY 145 @@ -100,6 +99,7 @@ #define IDS_RG_USER_SPECIFIED_LAYOUT_SIZE_X 193 #define IDS_RG_USER_SPECIFIED_LAYOUT_SIZE_Y 194 #define IDS_RG_LOAD_EXT_LIST 195 +#define IDS_RG_PGS_COLOR_TYPE 196 #define IDC_FILENAME 201 #define IDD_DVSMAINPAGE 201 #define IDC_OPEN 202 diff --git a/src/subpic/color_conv_table.cpp b/src/subpic/color_conv_table.cpp index cdebf69..8a5bcd6 100644 --- a/src/subpic/color_conv_table.cpp +++ b/src/subpic/color_conv_table.cpp @@ -25,7 +25,7 @@ DWORD func(int r8, int g8, int b8)\ const int c2y_cyb = int(double_cyb*Y_RANGE/255*FRACTION_SCALE+0.5);\ const int c2y_cyg = int(double_cyg*Y_RANGE/255*FRACTION_SCALE+0.5);\ const int c2y_cyr = int(double_cyr*Y_RANGE/255*FRACTION_SCALE+0.5);\ - const int c2y_cu = int(1.0/double_cu*1024+0.5);\ + const int c2y_cu = int(1.0/double_cu*1024+0.5);/*Fix me: BT.601 uv range should be 16~240? */\ const int c2y_cv = int(1.0/double_cv*1024+0.5);\ const int cy_cy = int(255.0/Y_RANGE*FRACTION_SCALE+0.5);\ \ @@ -242,6 +242,13 @@ DWORD ColorConvTable::Argb2Ayuv( DWORD argb ) return (argb & 0xff000000) | s_default_conv_set.r8g8b8_to_yuv_func(r, g, b); } +DWORD ColorConvTable::Ayuv2Auyv( DWORD ayuv ) +{ + int y = (ayuv & 0x00ff0000) >> 8; + int u = (ayuv & 0x0000ff00) << 8; + return (ayuv & 0xff0000ff)| u | y; +} + DWORD ColorConvTable::PreMulArgb2Ayuv( int a8, int r8, int g8, int b8 ) { return s_default_conv_set.pre_mul_argb_to_ayuv_func(a8, r8, g8, b8); @@ -281,11 +288,45 @@ DWORD ColorConvTable::A8Y8U8V8_To_ARGB_TV_BT601( int a8, int y8, int u8, int v8 return (a8<<24) | YUVToRGB_TV_BT601(y8, u8, v8); } +DWORD ColorConvTable::A8Y8U8V8_To_ARGB_PC_BT601( int a8, int y8, int u8, int v8 ) +{ + return (a8<<24) | YUVToRGB_PC_BT601(y8, u8, v8); +} + DWORD ColorConvTable::A8Y8U8V8_To_ARGB_TV_BT709( int a8, int y8, int u8, int v8 ) { return (a8<<24) | YUVToRGB_TV_BT709(y8, u8, v8); } +DWORD ColorConvTable::A8Y8U8V8_To_ARGB_PC_BT709( int a8, int y8, int u8, int v8 ) +{ + return (a8<<24) | YUVToRGB_PC_BT709(y8, u8, v8); +} + +DWORD ColorConvTable::A8Y8U8V8_PC_To_TV( int a8, int y8, int u8, int v8 ) +{ + const int FRACTION_SCALE = 1<<16; + const int YUV_MIN = 16; + const int cy = int(219.0/255*FRACTION_SCALE+0.5); + const int cuv = int(224.0/255*FRACTION_SCALE+0.5);/*Fixme: the RGBToYUVs we used doesnot seem to stretch chroma correctly*/ + y8 = ((y8*cy)>>16) + YUV_MIN; + u8 = ((u8*cuv)>>16) + YUV_MIN; + v8 = ((v8*cuv)>>16) + YUV_MIN; + return (a8<<24) | (y8<<16) | (u8<<8) | v8; +} + +DWORD ColorConvTable::A8Y8U8V8_TV_To_PC( int a8, int y8, int u8, int v8 ) +{ + const int FRACTION_SCALE = 1<<16; + const int YUV_MIN = 16; + const int cy = int(255/219.0*FRACTION_SCALE+0.5); + const int cuv = int(255/224.0*FRACTION_SCALE+0.5);/*Fixme: the RGBToYUVs we used doesnot seem to stretch chroma correctly*/ + y8 = ((y8-YUV_MIN)*cy)>>16; + u8 = ((u8-YUV_MIN)*cuv)>>16; + v8 = ((v8-YUV_MIN)*cuv)>>16; + return (a8<<24) | (y8<<16) | (u8<<8) | v8; +} + struct YuvPos { int y; diff --git a/src/subpic/color_conv_table.h b/src/subpic/color_conv_table.h index e285dfb..f59993d 100644 --- a/src/subpic/color_conv_table.h +++ b/src/subpic/color_conv_table.h @@ -32,14 +32,20 @@ struct ColorConvTable static DWORD Argb2Ayuv(DWORD argb); static DWORD Argb2Auyv(DWORD argb); + static DWORD Ayuv2Auyv(DWORD ayuv); static DWORD Rgb2Y(int r8, int g8, int b8); static DWORD PreMulArgb2Ayuv( int a8, int r8, int g8, int b8 ); static DWORD Ayuv2Argb(DWORD ayuv); static DWORD Ayuv2Argb_TV_BT601(DWORD ayuv); static DWORD A8Y8U8V8_To_ARGB_TV_BT601( int a8, int y8, int u8, int v8 ); + static DWORD A8Y8U8V8_To_ARGB_PC_BT601( int a8, int y8, int u8, int v8 ); static DWORD Ayuv2Argb_TV_BT709(DWORD ayuv); static DWORD A8Y8U8V8_To_ARGB_TV_BT709( int a8, int y8, int u8, int v8 ); + static DWORD A8Y8U8V8_To_ARGB_PC_BT709( int a8, int y8, int u8, int v8 ); + + static DWORD A8Y8U8V8_PC_To_TV( int a8, int y8, int u8, int v8 ); + static DWORD A8Y8U8V8_TV_To_PC( int a8, int y8, int u8, int v8 ); private: ColorConvTable(); }; diff --git a/src/subtitles/BaseSub.h b/src/subtitles/BaseSub.h index d30c235..052c777 100644 --- a/src/subtitles/BaseSub.h +++ b/src/subtitles/BaseSub.h @@ -31,6 +31,8 @@ enum SUBTITLE_TYPE { class CBaseSub { public: + typedef CompositionObject::ColorType ColorType; + typedef CompositionObject::YuvRangeType YuvRangeType; static const REFERENCE_TIME INVALID_TIME = _I64_MIN; @@ -45,7 +47,9 @@ public: virtual REFERENCE_TIME GetStop(POSITION nPos) = NULL; virtual void Render(SubPicDesc& spd, REFERENCE_TIME rt, RECT& bbox) = NULL; virtual HRESULT GetTextureSize(POSITION pos, SIZE& MaxTextureSize, SIZE& VideoSize, POINT& VideoTopLeft) = NULL; - + virtual HRESULT SetYuvType(ColorType colorType, YuvRangeType yuvRangeType) = NULL; protected: SUBTITLE_TYPE m_nType; + ColorType m_colorTypeSetting; + YuvRangeType m_yuvRangeSetting; }; diff --git a/src/subtitles/CompositionObject.cpp b/src/subtitles/CompositionObject.cpp index 4e3a487..f50d309 100644 --- a/src/subtitles/CompositionObject.cpp +++ b/src/subtitles/CompositionObject.cpp @@ -38,9 +38,10 @@ CompositionObject::~CompositionObject() delete [] m_pRLEData; } -void CompositionObject::SetPalette(int nNbEntry, HDMV_PALETTE* pPalette, bool bIsHD) +void CompositionObject::SetPalette(int nNbEntry, HDMV_PALETTE* pPalette, ColorType color_type, YuvRangeType yuv_range) { - m_OriginalColorType = bIsHD ? YUV_Rec709 : YUV_Rec601; + m_OriginalColorType = color_type; + m_OriginalYuvRangeType = yuv_range; m_colorType = -1; @@ -55,107 +56,253 @@ void CompositionObject::InitColor(const SubPicDesc& spd) { #define COMBINE_AYUV(a, y, u, v) ((((((((int)(a))<<8)|y)<<8)|u)<<8)|v) //fix me: move all color conv function into color_conv_table or dsutil +#define FULL_TYPE(x,y) (((x)<<8)|y) int paletteNumber = m_Palette.GetCount(); if (m_colorType!=spd.type) { m_colorType = -1; - if(m_OriginalColorType!=NONE) + ColorConvTable::YuvMatrixType cur_type; + ColorConvTable::YuvRangeType cur_range; + if (m_OriginalColorType==YUV_Rec601) { - m_colorType = spd.type; - switch(spd.type) + cur_type = ColorConvTable::BT601; + } + else if (m_OriginalColorType==YUV_Rec709) + { + cur_type = ColorConvTable::BT709; + } + else + { + XY_LOG_ERROR("Not supported"); + ASSERT(0); + return; + } + if (m_OriginalYuvRangeType==RANGE_TV) + { + cur_range = ColorConvTable::RANGE_TV; + } + else if (m_OriginalYuvRangeType==RANGE_PC) + { + cur_range = ColorConvTable::RANGE_PC; + } + else + { + XY_LOG_ERROR("Not supported"); + ASSERT(0); + return; + } + + m_colorType = spd.type; + switch(spd.type) + { + case MSP_AYUV_PLANAR: + case MSP_AYUV: + if (FULL_TYPE(cur_type,cur_range)== + FULL_TYPE(ColorConvTable::GetDefaultYUVType(), ColorConvTable::GetDefaultRangeType())) { - case MSP_AYUV_PLANAR: - case MSP_AYUV: - if ((m_OriginalColorType==YUV_Rec709 && ColorConvTable::GetDefaultYUVType()==ColorConvTable::BT709) || - (m_OriginalColorType==YUV_Rec601 && ColorConvTable::GetDefaultYUVType()==ColorConvTable::BT601)) + for (int i=0;i m_Palette; - enum ColorType - { - NONE, - YUV_Rec601, - YUV_Rec709, - RGB - }; ColorType m_OriginalColorType; + YuvRangeType m_OriginalYuvRangeType; - DWORD m_Colors[256]; + DWORD m_Colors[256]; int m_colorType; void DvbRenderField(SubPicDesc& spd, CGolombBuffer& gb, short nXStart, short nYStart, short nLength); diff --git a/src/subtitles/DVBSub.cpp b/src/subtitles/DVBSub.cpp index a70e42e..f62450b 100644 --- a/src/subtitles/DVBSub.cpp +++ b/src/subtitles/DVBSub.cpp @@ -330,7 +330,14 @@ void CDVBSub::Render(SubPicDesc& spd, REFERENCE_TIME rt, RECT& bbox) nY = pRegion->vertAddr + pRegion->objects[j].object_vertical_position; pObject->m_width = pRegion->width; pObject->m_height = pRegion->height; - pObject->SetPalette(pCLUT->size, pCLUT->palette, m_Display.width > 720); + + CompositionObject::ColorType color_type = m_colorTypeSetting; + if (color_type==CompositionObject::NONE) + { + color_type = m_Display.width > 720 ? CompositionObject::YUV_Rec709 : CompositionObject::YUV_Rec601; + } + pObject->SetPalette(pCLUT->size, pCLUT->palette, color_type, + m_yuvRangeSetting==CompositionObject::RANGE_NONE ? CompositionObject::RANGE_TV : m_yuvRangeSetting); pObject->InitColor(spd); pObject->RenderDvb(spd, nX, nY); TRACE_DVB(_T(" --> %d/%d - %d/%d\n"), i + 1, pPage->regionCount, j + 1, pRegion->objectCount); @@ -426,6 +433,13 @@ void CDVBSub::Reset() } } +HRESULT CDVBSub::SetYuvType( ColorType colorType, YuvRangeType yuvRangeType ) +{ + m_colorTypeSetting = colorType; + m_yuvRangeSetting = yuvRangeType; + return S_OK; +} + HRESULT CDVBSub::ParsePage(CGolombBuffer& gb, WORD wSegLength, CAutoPtr& pPage) { int nEnd = gb.GetPos() + wSegLength; diff --git a/src/subtitles/DVBSub.h b/src/subtitles/DVBSub.h index cfb8e0a..a61ba94 100644 --- a/src/subtitles/DVBSub.h +++ b/src/subtitles/DVBSub.h @@ -41,6 +41,7 @@ public: virtual REFERENCE_TIME GetStart(POSITION nPos); virtual REFERENCE_TIME GetStop(POSITION nPos); virtual void Reset(); + virtual HRESULT SetYuvType(ColorType colorType, YuvRangeType yuvRangeType); // EN 300-743, table 2 enum DVB_SEGMENT_TYPE { diff --git a/src/subtitles/HdmvSub.cpp b/src/subtitles/HdmvSub.cpp index ef8eb9c..d069c48 100644 --- a/src/subtitles/HdmvSub.cpp +++ b/src/subtitles/HdmvSub.cpp @@ -353,8 +353,17 @@ void CHdmvSub::Render(SubPicDesc& spd, REFERENCE_TIME rt, RECT& bbox) CompositionObject* pObject = pPresentationSegment->objects.GetNext(pos); if (pObject->GetRLEDataSize() && pObject->m_width > 0 && pObject->m_height > 0 - && spd.w >= (pObject->m_horizontal_position + pObject->m_width) && spd.h >= (pObject->m_vertical_position + pObject->m_height)) { - pObject->SetPalette(pPresentationSegment->CLUT.size, pPresentationSegment->CLUT.palette, pPresentationSegment->video_descriptor.nVideoWidth > 720); + && spd.w >= (pObject->m_horizontal_position + pObject->m_width) + && spd.h >= (pObject->m_vertical_position + pObject->m_height)) + { + CompositionObject::ColorType color_type = m_colorTypeSetting; + if (color_type==CompositionObject::NONE) + { + color_type = pPresentationSegment->video_descriptor.nVideoWidth > 720 ? + CompositionObject::YUV_Rec709 : CompositionObject::YUV_Rec601; + } + pObject->SetPalette(pPresentationSegment->CLUT.size, pPresentationSegment->CLUT.palette, color_type, + m_yuvRangeSetting==CompositionObject::RANGE_NONE ? CompositionObject::RANGE_TV : m_yuvRangeSetting); bbox.left = min(pObject->m_horizontal_position, bbox.left); bbox.top = min(pObject->m_vertical_position, bbox.top); @@ -404,6 +413,13 @@ void CHdmvSub::Reset() } } +HRESULT CHdmvSub::SetYuvType( ColorType colorType, YuvRangeType yuvRangeType ) +{ + m_colorTypeSetting = colorType; + m_yuvRangeSetting = yuvRangeType; + return S_OK; +} + CHdmvSub::HDMV_PRESENTATION_SEGMENT* CHdmvSub::FindPresentationSegment(REFERENCE_TIME rt) { POSITION pos = m_pPresentationSegments.GetHeadPosition(); diff --git a/src/subtitles/HdmvSub.h b/src/subtitles/HdmvSub.h index b088220..c0736c2 100644 --- a/src/subtitles/HdmvSub.h +++ b/src/subtitles/HdmvSub.h @@ -118,7 +118,7 @@ public: void Render(SubPicDesc& spd, REFERENCE_TIME rt, RECT& bbox); HRESULT GetTextureSize(POSITION pos, SIZE& MaxTextureSize, SIZE& VideoSize, POINT& VideoTopLeft); void Reset(); - + virtual HRESULT SetYuvType(ColorType colorType, YuvRangeType yuvRangeType); private: HDMV_SEGMENT_TYPE m_nCurSegment; diff --git a/src/subtitles/RenderedHdmvSubtitle.cpp b/src/subtitles/RenderedHdmvSubtitle.cpp index 89567c1..760531d 100644 --- a/src/subtitles/RenderedHdmvSubtitle.cpp +++ b/src/subtitles/RenderedHdmvSubtitle.cpp @@ -185,3 +185,9 @@ STDMETHODIMP_(bool) CRenderedHdmvSubtitle::IsColorTypeSupported( int type ) type==MSP_XY_AUYV || type==MSP_RGBA; } + +HRESULT CRenderedHdmvSubtitle::SetYuvType( CBaseSub::ColorType colorType, CBaseSub::YuvRangeType yuvRangeType ) +{ + CAutoLock cAutoLock(&m_csCritSec); + return m_pSub->SetYuvType(colorType, yuvRangeType); +} diff --git a/src/subtitles/RenderedHdmvSubtitle.h b/src/subtitles/RenderedHdmvSubtitle.h index 65de713..b18b938 100644 --- a/src/subtitles/RenderedHdmvSubtitle.h +++ b/src/subtitles/RenderedHdmvSubtitle.h @@ -62,8 +62,9 @@ public: STDMETHODIMP Reload(); HRESULT ParseSample (IMediaSample* pSample); - HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate); + HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate); + HRESULT SetYuvType(CBaseSub::ColorType colorType, CBaseSub::YuvRangeType yuvRangeType); private : CString m_name; LCID m_lcid; -- 2.11.4.GIT