00001
00002
00003 #ifdef USING_XVMC
00004
00005 # if defined(USING_XVMCW) || defined(USING_XVMC_VLD)
00006 extern "C" Status XvMCPutSlice2(Display*,XvMCContext*,char*,int,int);
00007 # else
00008 Status XvMCPutSlice2(Display*, XvMCContext*, char*, int, int)
00009 { return XvMCBadSurface; }
00010 # endif
00011
00012 static QString ErrorStringXvMC(int val)
00013 {
00014 QString str = "unrecognized return value";
00015 switch (val)
00016 {
00017 case Success: str = "Success" ; break;
00018 case BadValue: str = "BadValue" ; break;
00019 case BadMatch: str = "BadMatch" ; break;
00020 case BadAlloc: str = "BadAlloc" ; break;
00021 }
00022 return str;
00023 }
00024
00025 static xvmc_render_state_t *GetRender(VideoFrame *frame)
00026 {
00027 if (frame)
00028 return (xvmc_render_state_t*) frame->buf;
00029 return NULL;
00030 }
00031
00032 static uint calcBPM(int chroma)
00033 {
00034 int ret;
00035 switch (chroma)
00036 {
00037 case XVMC_CHROMA_FORMAT_420: ret = 6;
00038 case XVMC_CHROMA_FORMAT_422: ret = 4+2;
00039 case XVMC_CHROMA_FORMAT_444: ret = 4+4;
00040 default: ret = 6;
00041
00042
00043 }
00044 return ret;
00045 }
00046 #endif // USING_XVMC
00047
00048
00049 class XvMCBufferSettings
00050 {
00051 public:
00052 XvMCBufferSettings() :
00053 num_xvmc_surf(1),
00054 needed_for_display(1),
00055 min_num_xvmc_surfaces(8),
00056 max_num_xvmc_surfaces(16),
00057 num_xvmc_surfaces(min_num_xvmc_surfaces),
00058 aggressive(false) {}
00059
00060 void SetOSDNum(uint val)
00061 {
00062 num_xvmc_surf = val;
00063 }
00064
00065 void SetNumSurf(uint val)
00066 {
00067 num_xvmc_surfaces = min(max(val, min_num_xvmc_surfaces),
00068 max_num_xvmc_surfaces);
00069 }
00070
00072 uint GetOSDNum(void) const { return num_xvmc_surf; }
00073
00076 uint GetNeededBeforeDisplay(void)
00077 const { return needed_for_display; }
00078
00080 uint GetMinSurf(void) const { return min_num_xvmc_surfaces; }
00081
00083 uint GetMaxSurf(void) const { return max_num_xvmc_surfaces; }
00084
00086 uint GetNumSurf(void) const { return num_xvmc_surfaces; }
00087
00089 uint GetPreBufferGoal(void) const
00090 {
00091 uint reserved = GetFrameReserve() + XVMC_PRE_NUM +
00092 XVMC_POST_NUM + XVMC_SHOW_NUM;
00093 return num_xvmc_surfaces - reserved;
00094 }
00095
00098 uint GetFrameReserve(void) const
00099 { return num_xvmc_surf + XVMC_SHOW_NUM; }
00100
00102 bool IsAggressive(void) const { return aggressive; }
00103
00104 private:
00106 uint num_xvmc_surf;
00110 uint needed_for_display;
00112 uint min_num_xvmc_surfaces;
00114 uint max_num_xvmc_surfaces;
00116 uint num_xvmc_surfaces;
00118 bool aggressive;
00119
00121 static const uint XVMC_PRE_NUM = 1;
00123 static const uint XVMC_POST_NUM = 1;
00125 static const uint XVMC_SHOW_NUM = 1;
00126 };
00127