Mercurial > hg > enc-imaf
view IM_AF Encoder/IM_AM Encoder/IM_AF Encoder.h @ 1:19490164927c
working version
author | Eugenio Oñate Hospital <eo301@eecs.qmul.ac.uk> |
---|---|
date | Thu, 26 Jul 2012 16:52:19 +0100 |
parents | 138a3cea9792 |
children | 1636a6250528 |
line wrap: on
line source
// // IM_AF Encoder.h // IM_AM Encoder // // Created by eugenio oƱate hospital on 14/06/12. // Copyright (c) 2012 SAE. All rights reserved. // #ifndef IM_AM_Encoder_IM_AF_Encoder_h #define IM_AM_Encoder_IM_AF_Encoder_h /* for va_list typedef */ #include <stdarg.h> /* for FILE typedef, */ #include <stdio.h> #define maxtracks 10 #define maxpreset 10 #define maxrules 10 typedef long long u64; typedef unsigned int u32; typedef unsigned short u16; typedef struct nametrack { char title[20]; }nametrack[maxtracks]; typedef struct FileTypeBox { u32 size; u32 type; // ftyp u32 major_brand; // brand identifier u32 minor_version; // informative integer for the mirror version u32 compatible_brands[2]; //list, to the end of the box, of brands }FileTypeBox; typedef struct MoiveBox //extends Box('moov') { u32 size; u32 type; // moov struct MovieHeaderBox { u32 size; u32 type; // mvhd u32 version; // version + flag u32 creation_time; u32 modification_time; u32 timescale; // specifies the time-scale u32 duration; u32 rate; // typically 1.0 u16 volume; // typically full volume u16 reserved; // =0 u32 reserved2[2]; //=0 u32 matrix[9]; // information matrix for video (u,v,w) u32 pre_defined[6]; // =0 u32 next_track_ID; //non zero value for the next track ID }MovieHeaderBox; struct TrackBox { u32 size; u32 type; struct TrackHeaderBox { u32 size; u32 type; u32 version; // version + flag u32 creation_time; u32 modification_time; u32 track_ID; u32 reserved; // =0 u32 duration; u32 reserved2[2]; // =0 u16 layer; // =0 // for video u16 alternate_group; // =0 u16 volume; // full volume is 1 = 0x0100 u16 reserved3;// =0 u32 matrix[9]; // for video u32 width; // video u32 height; // video }TrackHeaderBox; struct MediaBox // extends Box('mdia') { u32 size; u32 type; struct MediaHeaderBox // extends FullBox('mdhd', version,0) { u32 size; u32 type; u32 version; // version + flag u32 creation_time; u32 modification_time; u32 timescale; u32 duration; u16 language; // [pad,5x3] = 16 bits and pad = 0 u16 pre_defined; // =0 }MediaHeaderBox; struct HandlerBox { u32 size; u32 type; u32 version; // version = 0 + flag u32 pre_defined; // =0 u32 handler_type; // = 'soun' for audio track, text or hint u32 reserved[3]; // =0 unsigned char data[5]; // Does not work! only 4 bytes }HandlerBox; struct MediaInformationBox //extends Box('minf') { u32 size; u32 type; // smhd in sound track only!! struct SoundMediaHeaderBox { u32 size; u32 type; u32 version; u16 balance; // =0 place mono tracks in stereo. 0 is center u16 reserved; // =0 }SoundMediaHeaderBox; struct DataInformationBox //extends Box('dinf') { u32 size; u32 type; struct DataReferenceBox { u32 size; u32 type; u32 flags; u32 entry_count; // counts the actual entries. struct DataEntryUrlBox //extends FullBox('url', version=0, flags) { u32 size; u32 type; u32 flags; }DataEntryUrlBox; }DataReferenceBox; }DataInformationBox; struct SampleTableBox // extends Box('stbl') { u32 size; u32 type; struct TimeToSampleBox{ u32 size; u32 type; u32 version; u32 entry_count; u32 sample_count[3000]; u32 sample_delta[3000]; }TimeToSampleBox; struct SampleDescriptionBox // stsd { u32 size; u32 type; u32 version; u32 entry_count; // = 1 number of entries // unsigned char esds[88]; struct AudioSampleEntry{ u32 size; u32 type; //mp4a char reserved[6]; u16 data_reference_index; // = 1 u32 reserved2[2]; u16 channelcount; // = 2 u16 samplesize; // = 16 u32 reserved3; u32 samplerate; // 44100 << 16 // unsigned char esds[81]; struct ESbox{ u32 size; u32 type; u32 version; struct ES_Descriptor{ unsigned char tag; unsigned char length; u16 ES_ID; unsigned char mix; struct DecoderConfigDescriptor{ unsigned char tag; unsigned char length; unsigned char objectProfileInd; u32 mix; u32 maxBitRate; u32 avgBitrate; /* struct DecoderSpecificInfo{ unsigned char tag; unsigned length; // unsigned char decSpecificInfosize; unsigned char decSpecificInfoData[2]; }DecoderSpecificInfo; */ }DecoderConfigDescriptor; struct SLConfigDescriptor{ unsigned char tag; unsigned char length; unsigned char predifined; }SLConfigDescriptor; }ES_Descriptor; }ESbox; }AudioSampleEntry; }SampleDescriptionBox; struct SampleSizeBox{ u32 size; u32 type; u32 version; u32 sample_size; // =0 u32 sample_count; u32 entry_size[8000]; }SampleSizeBox; struct SampleToChunk{ u32 size; u32 type; u32 version; u32 entry_count; u32 first_chunk; u32 samples_per_chunk; u32 sample_description_index; }SampleToChunk; struct ChunkOffsetBox{ u32 size; u32 type; u32 version; u32 entry_count; u32 chunk_offset[maxtracks]; }ChunkOffsetBox; }SampleTableBox; }MediaInformationBox; }MediaBox; }TrackBox[maxtracks]; // max 10 tracks /* struct GroupContainerBox // extends Box('grco') { u16 num_groups; struct GroupBox //extended FullBox('grup', version=0,flags) { int flags; //display disable & edit disable. See page 9 ISO23000-12 u32 group_ID; //uniquely identifies a group u16 num_elements; //num elementes involved in the group u32 element_ID[10]; //size [num_elements] char group_activation_mode; u16 group_activation_elements_number; u16 group_reference_volume; // reference group volume char group_name[30]; // string UTF-8 char group_description[100]; // string }GroupBox[10]; }GroupContainerBox; */ struct PresetContainerBox // extends Box('prco') { u32 size; u32 type; unsigned char num_preset; unsigned char default_preset_ID; struct PresetBox //extends FullBox('prst',version=0,flags) { u32 size; u32 type; u32 flags; unsigned char preset_ID; unsigned char num_preset_elements; struct presElemId{ u32 preset_element_ID; }presElemId[maxtracks]; unsigned char preset_type; unsigned char preset_global_volume; //IF preset_type == 1 struct presVolumElem{ unsigned char preset_volume_element; }presVolumElem[maxtracks]; /* u16 num_updates; struct updateSample{ u16 update_sample_number; struct presVolumElem2{ unsigned char preset_volume_element2; }presVolumElem2[maxtracks]; }updateSample[5]; */ char preset_name[14]; }PresetBox[maxpreset]; }PresetContainerBox; struct RulesContainer{ u32 size; u32 type; u16 num_selection_rules; u16 num_mixing_rules; struct SelectionRules{ u32 size; u32 type; u32 version; u16 selection_rule_ID; unsigned char selection_rule_type; u32 element_ID; char rule_description[14]; }SelectionRules; struct MixingRules{ u32 size; u32 type; u32 version; u16 mixing_rule_ID; unsigned char mixing_type; u32 element_ID; u32 key_elem_ID; char mix_description[11]; }MixingRules; }RulesContainer; }MovieBox; typedef struct MediaDataBox // extends Box('mdat') { u32 size; u32 type; unsigned char data; }MediaDataBox; /*typedef struct MetaBox // extends FullBox('meta',version=0,0) { struct HandlerBox theHandler; struct DataEntryUrlBox dinfo; struct ItemLocationBox // extends FullBox('iloc',version,0) { u16 Size; u16 item_count; //counts the number of resources in the following array u16 item_ID; u16 c_method; //reserved(12)=0 + contruction_method(4) only if version == 1 u16 data_reference_index; int base_offset; // size depends int(8*base_offset_size). // base value for offset calculations. u16 extent_count; // Count number of extents into which the resources is fragmented. int extent_index; int extent_offset; // size offset_size*8 int extent_length; // size length_size*8 }ItemLocationBox; // struct ItemInfoExtension. I dont use it struct XMLBox // extends('xml', version=0,0) { char *xml; // string }XMLBox; struct BinaryXMLBox // extends('bxml', version=0,0) { char *data; //to end of box }BinaryXMLBox; struct PrimaryItemBox { u16 Item_ID; //ID of primary item }PrimaryItemBox; }MetaBox; */ #endif