📄 ivideodecoder.h
字号:
/*+++ *******************************************************************\
*
* Copyright and Disclaimer:
*
* ---------------------------------------------------------------
* This software is provided "AS IS" without warranty of any kind,
* either expressed or implied, including but not limited to the
* implied warranties of noninfringement, merchantability and/or
* fitness for a particular purpose.
* ---------------------------------------------------------------
*
* Copyright (c) 2008 Conexant Systems, Inc.
* All rights reserved.
*
\******************************************************************* ---*/
#ifndef _IVIDEO_DECODER_H_
#define _IVIDEO_DECODER_H_
extern "C"
{
#include <wdm.h>
}
#include <windef.h>
#include <unknown.h>
#include <ks.h>
#include <ksmedia.h>
#include "DirectIF.h"
const int VIDEO_PROCAMP_MIN = 0;
const int VIDEO_PROCAMP_MAX = 10000;
const int UNSIGNED_BYTE_MIN = 0;
const int UNSIGNED_BYTE_MAX = 0xFF;
const int SIGNED_BYTE_MIN = -128;
const int SIGNED_BYTE_MAX = 127;
const int SEVEN_BIT_MIN = 0;
const int SEVEN_BIT_MAX = 0x7F;
const int THREE_BIT_MIN = 0;
const int THREE_BIT_MAX = 0x07;
extern ULONG SaturationDefault;
extern ULONG ContrastDefault;
extern ULONG HueDefault;
extern ULONG BrightnessDefault;
extern ULONG SharpnessDefault;
#define COPY_PROTECTION_MASK 0x70
typedef enum
{
CX_PROTECTION_DISABLED = 0,
CX_PROTECTION_PSP = 1,
CX_PROTECTION_TYPE2CS = 2,
CX_PROTECTION_PSP_TYPE2CS = 3,
CX_PROTECTION_TYPE3CS = 6,
CX_PROTECTION_PSP_TYPE3CS = 7
}CX_PROTECTION_DETECTED_TYPES;
typedef enum
{
COPY_PROTECTION_NOT_DETECTED = 0,
COPY_PROTECTION_CS_TYPE1_DETECTED = 1,
COPY_PROTECTION_CS_TYPE2_DETECTED = 2,
COPY_PROTECTION_CS_TYPE3_DETECTED = 3
}COPY_PROTECTION_STATUS_TYPES;
enum VIDEO_MODE
{
VIDEO_MODE_PAL,
VIDEO_MODE_NTSC,
VIDEO_MODE_SECAM,
VIDEO_MODE_PAL_M,
VIDEO_MODE_PAL_N,
VIDEO_MODE_PAL_NC
};
#define NTSC_VIDEO_MODES 0xC
#define PAL_VIDEO_MODES 0x33
inline BOOLEAN map(
int srcMin,
int srcMax,
int srcVal,
int dstMin,
int dstMax,
int* dstVal)
{
if((srcMin == srcMax) || (srcVal < srcMin) || (srcVal > srcMax))
{
return FALSE;
}
// This is the overall expression used:
// *dstVal = (srcVal - srcMin)*(dstMax - dstMin) / (srcMax - srcMin) + dstMin;
// but we need to account for rounding so below we use the modulus
// operator to find the remainder and increment if necessary.
int numerator = (srcVal - srcMin)*(dstMax - dstMin);
int denominator = srcMax - srcMin;
int quotient = numerator/denominator;
if(2 * ( numerator % denominator ) >= denominator)
{
quotient++;
}
*dstVal = quotient + dstMin;
return TRUE;
}
static const
DWORD
NTSC_ASPECT_VIDEO_STANDARDS =
KS_AnalogVideo_NTSC_M |
KS_AnalogVideo_NTSC_M_J |
KS_AnalogVideo_PAL_M;
static const
DWORD
SECAM_ASPECT_VIDEO_STANDARDS =
KS_AnalogVideo_SECAM_B |
KS_AnalogVideo_SECAM_D |
KS_AnalogVideo_SECAM_G |
KS_AnalogVideo_SECAM_H |
KS_AnalogVideo_SECAM_K |
KS_AnalogVideo_SECAM_K1|
KS_AnalogVideo_SECAM_L |
KS_AnalogVideo_SECAM_L1;
static const
DWORD
PAL_ASPECT_VIDEO_STANDARDS =
KS_AnalogVideo_PAL_B |
KS_AnalogVideo_PAL_D |
KS_AnalogVideo_PAL_G |
KS_AnalogVideo_PAL_H |
KS_AnalogVideo_PAL_I |
KS_AnalogVideo_PAL_N |
KS_AnalogVideo_PAL_N_COMBO |
KS_AnalogVideo_SECAM_B |
KS_AnalogVideo_SECAM_D |
KS_AnalogVideo_SECAM_G |
KS_AnalogVideo_SECAM_H |
KS_AnalogVideo_SECAM_K |
KS_AnalogVideo_SECAM_K1|
KS_AnalogVideo_SECAM_L |
KS_AnalogVideo_SECAM_L1;
class Device;
class IVideoDecoder
{
public:
IVideoDecoder();
virtual ~IVideoDecoder(){};
VOID setVideoStandard(DWORD new_standard);
DWORD getVideoStandard(){return _video_standard;}
DWORD getVideoMode(){return _video_mode;}
virtual VOID setVideoInput(DWORD video_input, DWORD input_mux)= 0;
virtual VOID setResolution(ULONG width, ULONG height) = 0;
virtual VOID setVideoMode(VIDEO_MODE video_mode) = 0;
virtual VOID getResolution(ULONG *width, ULONG *height)=0;
virtual VOID enableVideoOutput() = 0;
virtual VOID disableVideoOutput() = 0;
virtual VOID waitForLock() = 0;
//Video Proc Amp
virtual BOOLEAN setBrightness(INT brightness) = 0;
virtual BOOLEAN setContrast(INT contrast) = 0;
virtual BOOLEAN setHue(INT hue) = 0;
virtual BOOLEAN setSaturation(INT saturation) = 0;
virtual BOOLEAN setSharpness(INT sharpness) = 0;
INT getBrightness(){return _brightness;}
INT getContrast(){return _contrast;}
INT getHue(){return _hue;}
INT getSaturation(){return _saturation;}
INT getSharpness(){return _sharpness;}
virtual DWORD getCopyProtectStatus() = 0;
virtual VOID videoMute() = 0;
virtual VOID videoUnmute() = 0;
virtual BOOLEAN IsVideoPresent() = 0;
virtual DWORD getSlicedVbiStartCodes() = 0;
virtual DWORD getSlicedVbiStopCodes() = 0;
virtual VOID powerUp() = 0;
virtual VOID powerDown() = 0;
virtual VOID notifyPreChannelChange()= 0;
virtual VOID notifyPostChannelChange()= 0;
virtual VOID setupHTL_CTRL() = 0;
virtual VOID EnableACGEnAndCKillen(BOOLEAN fld_CAGCEN, BOOLEAN fld_CKILLEN) = 0;
virtual DWORD caliberateDroopComp() = 0;
Device* getDevice(){return _p_device;}
protected:
DWORD _video_standard;
VIDEO_MODE _video_mode;
INT _saturation;
INT _hue;
INT _brightness;
INT _contrast;
INT _sharpness;
DWORD _input_mux;
DWORD _video_input;
BOOLEAN _enable_grey_video_at_channel_change;
DirectIF* _p_DIF;
Device* _p_device;
};
inline IVideoDecoder::IVideoDecoder():
_video_standard(KS_AnalogVideo_NTSC_M),
_video_mode(VIDEO_MODE_NTSC),
_saturation(SaturationDefault),
_hue(HueDefault),
_brightness(BrightnessDefault),
_contrast(ContrastDefault),
_sharpness(SharpnessDefault)
{
};
inline VOID IVideoDecoder::setVideoStandard(DWORD new_standard)
{
_video_standard = new_standard;
VIDEO_MODE video_mode = VIDEO_MODE_NTSC;
if(new_standard & NTSC_ASPECT_VIDEO_STANDARDS)
{
video_mode = VIDEO_MODE_NTSC;
}
else if(new_standard & SECAM_ASPECT_VIDEO_STANDARDS)
{
video_mode = VIDEO_MODE_SECAM;
}
else
{
video_mode = VIDEO_MODE_PAL;
if( new_standard == KS_AnalogVideo_PAL_N )
{
video_mode = VIDEO_MODE_PAL_N;
}
else if( new_standard == KS_AnalogVideo_PAL_N_COMBO )
{
video_mode = VIDEO_MODE_PAL_NC;
}
}
setVideoMode(video_mode);
if (_p_DIF)
{
_p_DIF->setStandard(_video_standard);
// MAE 25 Oct 2006 - Resume from suspend/hibernate issue:
// When the tuner resumes, the setfrequency call results eventually in a set
// to setVideoStandard(). If the previous input was composite or svideo, the
// DIF settings are not correct so we reset them here by refreshing the input
setVideoInput(_video_input, _input_mux);
}
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -