blob: 124ea23a1456f4047c54bc70c7ac957452131d5b [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
//
// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is MP4v2.
//
// The Initial Developer of the Original Code is Kona Blend.
// Portions created by Kona Blend are Copyright (C) 2008.
// All Rights Reserved.
//
// Contributors:
// Kona Blend, kona8lend@@gmail.com
//
///////////////////////////////////////////////////////////////////////////////
#ifndef MP4V2_PLATFORM_POSIX_H
#define MP4V2_PLATFORM_POSIX_H
///////////////////////////////////////////////////////////////////////////////
#include "libplatform/config.h"
///////////////////////////////////////////////////////////////////////////////
// constant macros are not usually used with C++ so the standard mechanism to
// activate it is to define before stdint.h
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
#endif
// format macros are not usually used with C++ so the standard mechanism to
// activate it is to define before inttypes.h
#ifndef __STDC_FORMAT_MACROS
# define __STDC_FORMAT_MACROS
#endif
#ifdef NEED_LFS_ACTIVATION
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE
# define _FILE_OFFSET_BITS 64
# endif
#endif
///////////////////////////////////////////////////////////////////////////////
#include "libplatform/platform_base.h"
#include <inttypes.h>
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
#include <functional>
#include <mp4v2/mp4v2.h>
///////////////////////////////////////////////////////////////////////////////
namespace mp4v2 { namespace platform {
// using namespace std;
using ::int8_t;
using ::int16_t;
using ::int32_t;
using ::int64_t;
using ::uint8_t;
using ::uint16_t;
using ::uint32_t;
using ::uint64_t;
}} // namespace mp4v2::platform
///////////////////////////////////////////////////////////////////////////////
// win32 platform requires O_BINARY when using old open() calls so we add
// this harmless bit-flag for posix to avoid .cpp platform conditionals
#ifndef O_BINARY
# define O_BINARY 0
#endif
///////////////////////////////////////////////////////////////////////////////
// ARM seems to require integer instructions operands to have 4-byte alignment
// so we set this macro to for some int<->string code to manually copy string
// bytes into an int which aligns it. This is much easier than trying to
// align pertinent string data (constants) from in text sections.
#if defined( __arm__ )
# define MP4V2_INTSTRING_ALIGNMENT 1
#else
# undef MP4V2_INTSTRING_ALIGNMENT
#endif
///////////////////////////////////////////////////////////////////////////////
#endif // MP4V2_PLATFORM_POSIX_H