DivXNetworks, Inc.
Main Page | Namespace List | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals | Related Pages

FormatInfo.h

Go to the documentation of this file.
00001 
00015 #ifndef _Q_FormatInfo_h
00016 #define _Q_FormatInfo_h
00017 
00018 #include "./FourCC.h"
00019 
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023 
00025 typedef struct FormatInfo
00026 {
00028     FourCC fourCC;
00029 
00032     int bpp;
00033 
00035     int width;
00036     
00038     int height; 
00039 
00041     int inverted;
00042 
00044     int pixelAspectX;
00045 
00047     int pixelAspectY;
00048 
00050     int sizeMax;
00051 
00053     int timescale;
00054 
00057     int framePeriod;
00058 
00060     int framePeriodIsConstant;
00061 } 
00062 FormatInfo;
00063 
00067 static int FormatInfo_getTotalPixels(const FormatInfo* pFormatInfo) 
00068 { 
00069     return pFormatInfo->height * pFormatInfo->width; 
00070 }
00071 
00075 static int FormatInfo_getFrameSize(const FormatInfo* pFormatInfo) 
00076 { 
00077     return FormatInfo_getTotalPixels(pFormatInfo) * pFormatInfo->bpp / 8;; 
00078 }
00079 
00083 static double FormatInfo_getFramerate(const FormatInfo* pFormatInfo) 
00084 { 
00085     return (double)pFormatInfo->timescale / (double)pFormatInfo->framePeriod; 
00086 }
00087 
00088 static int FormatInfo_diff(const FormatInfo* pFormat1, const FormatInfo* pFormat2)
00089 {
00090     return
00091         (pFormat1->fourCC != pFormat2->fourCC) ||
00092         (pFormat1->fourCC == 0 && pFormat1->bpp != pFormat2->bpp) ||
00093         (pFormat1->width != pFormat2->width) ||
00094         (pFormat1->height != pFormat2->height) ||
00095         (pFormat1->inverted != pFormat2->inverted) ||
00096         (pFormat1->pixelAspectX != pFormat2->pixelAspectX) ||
00097         (pFormat1->pixelAspectY != pFormat2->pixelAspectY) ||
00098         (pFormat1->timescale != pFormat2->timescale) ||
00099         (pFormat1->framePeriodIsConstant != pFormat2->framePeriodIsConstant) ||
00100         (pFormat1->framePeriodIsConstant && (pFormat1->framePeriod != pFormat2->framePeriod));
00101 }
00102 
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106 
00107 #endif // _Q_FormatInfo_h
00108 

Generated on Tue Jan 24 16:43:33 2006 for DivX Codec API Documentation.