diff options
author | OV2 <overfiend@sessionclan.de> | 2008-12-13 22:41:06 +0300 |
---|---|---|
committer | OctaneSnail <os@v12pwr.com> | 2008-12-14 12:40:29 +0300 |
commit | eec02175a222f21d09e0f58891835e7ac9b28c71 (patch) | |
tree | 87cd446de26b7dce8d0f48574d029f8ccec86f1c /Mediatype.h | |
parent | 82e5a3271ae675ddfd4f9153b3e19e8c0f911097 (diff) |
Implement automatic media file detection.
Signed-off-by: OctaneSnail <os@v12pwr.com>
Diffstat (limited to 'Mediatype.h')
-rw-r--r-- | Mediatype.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Mediatype.h b/Mediatype.h new file mode 100644 index 0000000..56a369e --- /dev/null +++ b/Mediatype.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2008, OV2 <overfiend@sessionclan.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef MEDIATYPE_H +#define MEDIATYPE_H + +#include "list.h" + +class CheckByteDetails { +public: + CheckByteDetails():offset(0),byteCount(0),mask(NULL),value(NULL) {} + ~CheckByteDetails() + { + if(mask) + delete [] mask; + if(value) + delete [] value; + } + + LONGLONG offset; + unsigned int byteCount; + BYTE *mask; + BYTE *value; +}; + +class CheckByteGroup : public Node<CheckByteGroup> { +public: + CheckByteGroup(): checkBytes(NULL),checkByteCount(0) {} + ~CheckByteGroup() + { + if(checkBytes) + delete [] checkBytes; + } + + CheckByteDetails *checkBytes; + unsigned int checkByteCount; +}; + +class MediaType: public Node<MediaType> { +public: + MediaType(): majorType(GUID_NULL),subType(GUID_NULL),checkByteGroupCount(0) {} + ~MediaType() + { + checkByteGroups.Clear(); + } + + GUID majorType; + GUID subType; + List<CheckByteGroup> checkByteGroups; + unsigned int checkByteGroupCount; +}; + +int getMediaTypeList(List<MediaType> *mediaTypeList); +int checkFileForMediaType(File *file,List<MediaType> *mediaTypeList,MediaType **foundMediaType); + +#endif
\ No newline at end of file |