M4SYS_AccessUnit.h revision 7c9d8018755adf1857571125ba1b3598c96ea506
1/* 2 * Copyright (C) 2004-2011 NXP Software 3 * Copyright (C) 2011 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17/** 18 ************************************************************************ 19 * @file M4SYS_AccessUnit.h 20 * @brief Access unit manipulation 21 * @note This file defines the access unit structure, 22 * and declares functions to manipulate it. 23 ************************************************************************ 24*/ 25 26#ifndef M4SYS_ACCESSUNIT_H 27#define M4SYS_ACCESSUNIT_H 28 29#include "M4OSA_Types.h" 30#include "M4OSA_Error.h" 31#include "M4OSA_Memory.h" 32#include "M4OSA_Time.h" 33#include "M4SYS_Stream.h" 34 35/** The attribute of a fragment*/ 36typedef enum { 37 M4SYS_kFragAttrOk = 01, /**< The fragment is correct, there is no error 38 (size cannot be 0)*/ 39 M4SYS_kFragAttrCorrupted = 02, /**< The fragment is corrupted (there is at least a bit or byte 40 error somewhere in the fragment (size cannot be 0)*/ 41 M4SYS_kFragAttrLost = 03 /**< The fragment is lost, so the size must be 0.*/ 42} M4SYS_FragAttr; 43 44 45/** A Fragment is a piece of access unit. It can be decoded without decoding the others*/ 46typedef struct { 47 M4OSA_MemAddr8 fragAddress; /**< The data pointer. All fragments of the same access unit 48 must be contiguous in memory*/ 49 M4OSA_UInt32 size; /**< The size of the fragment. It must be 0 if fragment is 50 flagged 'lost'*/ 51 M4SYS_FragAttr isCorrupted; /**< The attribute of this fragment*/ 52} M4SYS_Frag; 53 54/**< The attribute of an access unit*/ 55typedef M4OSA_UInt8 M4SYS_AU_Attr; 56 57#define AU_Corrupted 0x01 /**< At least one fragment of the access unit is flagged corrupted.*/ 58#define AU_B_Frame 0x02 /**< The access unit is a B_frame*/ 59#define AU_RAP 0x04 /**< The access unit is a random access point.*/ 60 61 62/** An access unit is the smallest piece of data with timing information.*/ 63typedef struct { 64 M4SYS_StreamDescription* stream ; 65 M4OSA_MemAddr32 dataAddress; /**< The data pointer. The size of this block 66 (allocated size) must be a 32-bits integer multiple*/ 67 M4OSA_UInt32 size; /**< The size in bytes of the dataAddress. The size may 68 not match a 32-bits word boundary.*/ 69 M4OSA_Time CTS; /**< The Composition Time Stamp*/ 70 M4OSA_Time DTS; /**< The Decoded Time Stamp*/ 71 M4SYS_AU_Attr attribute; /**< The attribute of the access unit*/ 72 M4OSA_UInt8 nbFrag; /**< The number of fragments. It can be 0 if there is 73 no fragment.*/ 74 M4SYS_Frag** frag; /**< An array of 'nbFrag' fragments. It stores the 75 fragments structure. The original definition 76 < of frag has been changed from M4SYS_Frag* frag[] 77 to M4SYS_Frag** frag since the support 78 < of such syntax is only a Microsoft extension of 79 the C compiler. */ 80} M4SYS_AccessUnit; 81 82/* Error codes */ 83#define M4ERR_AU_NO_MORE_FRAG M4OSA_ERR_CREATE(M4_ERR,M4SYS_CMAPI,0x000001) 84#define M4ERR_AU_BUFFER_OVERFLOW M4OSA_ERR_CREATE(M4_ERR,M4SYS_CMAPI,0x000002) 85#define M4ERR_AU_BAD_INDEX M4OSA_ERR_CREATE(M4_ERR,M4SYS_CMAPI,0x000003) 86#define M4ERR_NOT_ENOUGH_FRAG M4OSA_ERR_CREATE(M4_ERR,M4SYS_CMAPI,0x000004) 87 88 89 90#endif /*M4SYS_ACCESSUNIT_H*/ 91 92