Commit 4c9ad6d5 authored by Steve Lhomme's avatar Steve Lhomme

libebml2/libmatroska2: optimize the padding of some structures for faster data access

+ fix some pedantic VS11 beta warnings

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/foundation_src@830 a6f86f6d-0131-4f8e-9e7b-e335508773d5
parent 444c9d4a
......@@ -44,7 +44,7 @@ extern "C" {
#define DATE_DLL
#endif
DATE_DLL systick_t GetTimeTick();
DATE_DLL systick_t GetTimeTick(void);
#if defined(TARGET_WIN) || defined(TARGET_PS2SDK) || defined(TARGET_LINUX) || defined(TARGET_OSX) || defined(TARGET_ANDROID)
#define GetTimeFreq() 1000
#else
......@@ -62,7 +62,7 @@ typedef struct datepack_t
intptr_t WeekDay; // 1 = Sunday, 2 = Monday, etc
} datepack_t;
DATE_DLL datetime_t GetTimeDate(); // UTC in s (reference is 1st January 2001 00:00:00.000 UTC, use a helper to get the localized string value)
DATE_DLL datetime_t GetTimeDate(void); // UTC in s (reference is 1st January 2001 00:00:00.000 UTC, use a helper to get the localized string value)
DATE_DLL datetime_t TimePackToRel(const datepack_t *tp, bool_t FromLocal);
DATE_DLL bool_t GetDatePacked(datetime_t t, datepack_t *tp, bool_t ToLocal);
DATE_DLL bool_t GetIsDst(datetime_t t); // may not be correct on all platforms
......
......@@ -112,10 +112,10 @@ typedef struct stream
typedef struct memstream
{
stream Base;
size_t Pos;
size_t Size;
filepos_t VirtualOffset;
const uint8_t* Ptr;
size_t Pos;
size_t Size;
} memstream;
......@@ -127,8 +127,8 @@ typedef struct streamdir
{
tchar_t FileName[MAXPATH];
tchar_t DisplayName[MAXPATH];
int Type; // from Exts, FTYPE_DIR for directory
filepos_t Size;
int Type; // from Exts, FTYPE_DIR for directory
datetime_t ModifiedDate;
} streamdir;
......
......@@ -107,12 +107,12 @@ typedef struct parser
buffer Buffer;
charconv* CC;
charconv* EscapeCC;
tchar_t *BigLine;
boolmem_t Element;
boolmem_t ElementEof;
boolmem_t URL;
boolmem_t OwnCC;
boolmem_t Error;
tchar_t *BigLine;
} parser;
......
......@@ -478,9 +478,6 @@ struct nodemodule
{
node Base;
nodemodule* Next;
uint8_t Found;
uint8_t Config;
uint8_t Changed;
void* Module;
void* Db;
void* Func;
......@@ -491,6 +488,9 @@ struct nodemodule
array ClassRefs;
void *LockRefs;
#endif
uint8_t Found;
uint8_t Config;
uint8_t Changed;
};
struct nodecontext
......@@ -520,7 +520,6 @@ struct nodecontext
void (*LuaAddRef)(void* Cookie, int* Ref);
#endif
void (*ReportError)(nodecontext*, node* Node, fourcc_t MsgClass, int MsgNo, va_list Args);
uint16_t AppId;
#if defined(TARGET_PALMOS)
fourcc_t ProjFourCC;
#endif
......@@ -532,6 +531,7 @@ struct nodecontext
#if defined(TARGET_SYMBIAN)
void *FsSession;
#endif
uint16_t AppId;
};
#define NODECONTEXT_CLASS FOURCC('N','C','T','X')
......@@ -622,8 +622,8 @@ NODE_DLL datetime_t Node_GetDataDatetime(const node*, dataid Id);
DLLEXPORT err_t DLLRegister(nodemodule*);
DLLEXPORT void DLLUnRegister(nodemodule*);
DLLEXPORT void DLLTest();
DLLEXPORT void DLLTest2();
DLLEXPORT void DLLTest(void);
DLLEXPORT void DLLTest2(void);
NODE_DLL bool_t Node_IsPartOf(const void*, fourcc_t PartOfClass);
NODE_DLL err_t Node_Toggle(void* Node,dataid Id);
......
......@@ -45,14 +45,7 @@
struct matroska_block
{
ebml_binary Base;
uint16_t TrackNumber;
int16_t LocalTimecode;
bool_t LocalTimecodeUsed;
timecode_t GlobalTimecode;
bool_t IsKeyframe;
bool_t IsDiscardable;
bool_t Invisible;
char Lacing;
filepos_t FirstFrameLocation;
array SizeList; // int32_t
array SizeListIn; // int32_t
......@@ -64,6 +57,13 @@ struct matroska_block
ebml_master *WriteTrack;
ebml_master *WriteSegInfo;
#endif
bool_t IsKeyframe;
bool_t IsDiscardable;
bool_t Invisible;
bool_t LocalTimecodeUsed;
int16_t LocalTimecode;
uint16_t TrackNumber;
char Lacing;
};
#define MATROSKA_BLOCK_CLASS FOURCC('M','K','B','L')
......
......@@ -121,8 +121,11 @@ static err_t BlockTrackChanged(matroska_block *Block)
static err_t ClusterTimeChanged(matroska_cluster *Cluster)
{
timecode_t ClusterTimecode, BlockTimecode;
timecode_t ClusterTimecode;
#if defined(CONFIG_EBML_WRITING)
timecode_t BlockTimecode;
ebml_element *Elt, *GBlock;
#endif
Cluster->Base.Base.bNeedDataSizeUpdate = 1;
ClusterTimecode = MATROSKA_ClusterTimecode(Cluster);
......@@ -513,8 +516,10 @@ void MATROSKA_ClusterSort(matroska_cluster *Cluster)
void MATROSKA_ClusterSetTimecode(matroska_cluster *Cluster, timecode_t Timecode)
{
ebml_integer *TimecodeElt;
#if defined(CONFIG_EBML_WRITING)
ebml_element *Elt, *GBlock;
timecode_t BlockTimeCode;
#endif
assert(EBML_ElementIsType((ebml_element*)Cluster, &MATROSKA_ContextCluster));
Cluster->GlobalTimecode = Timecode;
......@@ -921,7 +926,7 @@ err_t MATROSKA_BlockReadData(matroska_block *Element, stream *Input)
Elt2 = EBML_MasterFindChild((ebml_master*)Elt, &MATROSKA_ContextContentEncodingScope);
if (Elt2)
CompressionScope = EBML_IntegerValue((ebml_integer*)Elt2);
CompressionScope = (int)EBML_IntegerValue((ebml_integer*)Elt2);
Elt = EBML_MasterFindChild((ebml_master*)Elt, &MATROSKA_ContextContentCompression);
if (!Elt)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment