Home | History | Annotate | Download | only in inc
      1 /*
      2  * Copyright (C) 2011 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 /**
     18 
     19  ************************************************************************
     20  * @file         M4SYS_Stream.h
     21  * @brief        Stream manipulation
     22  * @note         This file defines the stream structure.
     23  ************************************************************************
     24 */
     25 
     26 #ifndef M4SYS_STREAM_H
     27 #define M4SYS_STREAM_H
     28 
     29 #include "M4OSA_Types.h"
     30 #include "M4OSA_Memory.h"
     31 #include "M4OSA_Time.h"
     32 
     33 typedef M4OSA_UInt32 M4SYS_StreamID;
     34 
     35 /** The streamType type provides a way to distinguish all streams (AAC, AMR, YUV420, MPEG-4 Video,
     36      H263). Stream types can be sorted in 2 ways:
     37 @arg   Some of them are raw data, others are encoded
     38 @arg   Some of them are related to an audio media, a video media...
     39 @n So a specific naming convention has been designed to allow a quick parsing of the streamType
     40     value to return the above categories. StreamType is an un-signed integer on 16 bits.
     41 @arg   The first byte (MSB) defines the codec type. It can be either Audio,Video, Picture,
     42          Text or Scene.
     43 @arg   The second byte (LSB) defines the sub-codecs type (ie YUV420, PCM_16 bits, AMR...).
     44         Moreover if this value is greater than 0x80 the stream is a raw stream, else the stream
     45         is an encoded one
     46 @n   0x0000 is a forbidden value, it describes an unknown stream */
     47 
     48 typedef enum {
     49    M4SYS_kUnknown       = 0x0000,
     50    /* Stream type definition
     51        0xYYZZ   : YY is the codec type (Audio, Video, Picture, Scene ...)
     52                   ZZ is the sub-codec type (AAC, AMR , ...)
     53                      if ZZ is greater than 0x80 it is a raw format*/
     54 
     55    /* Audio ones   : Range from [0x0100-0x01FF]*/
     56    M4SYS_kAudioUnknown  = 0x0100,
     57    M4SYS_kAAC           = 0x0101,
     58    M4SYS_kCELP          = 0x0102,
     59    M4SYS_kAMR           = 0x0103,
     60    M4SYS_kAMR_WB        = 0x0104,
     61    M4SYS_kMP3           = 0x0105,
     62    M4SYS_kMIDI          = 0x0106,
     63    M4SYS_kWMA           = 0x0107,
     64    M4SYS_kREALAUDIO     = 0x0108,
     65    M4SYS_kEVRC            = 0x0109,
     66    M4SYS_kPCM_16bitsS   = 0x0181, /* PCM 16 bits Signed */
     67    M4SYS_kPCM_16bitsU   = 0x0182, /* PCM 16 bits Un-signed */
     68    M4SYS_kPCM_8bitsU    = 0x0183, /* PCM  8 bits Un-signed */
     69 /* FixAA 2008/03/03 types: M4SYS_kPCM_16bitsS, M4SYS_kPCM_16bitsU and M4SYS_kPCM_8bitsU
     70    are now only used by AudioMixer and ReaderAVI => An update is necessary in the future for use
     71    type M4SYS_kPCM */
     72    M4SYS_kXMF            = 0x0184,
     73    M4SYS_kSMAF          = 0x0185,
     74    M4SYS_kIMEL          = 0x0186,
     75    M4SYS_kBBA            = 0x0187,
     76    M4SYS_kBPC            = 0x0188,
     77    M4SYS_kADPCM         = 0x0189,  /* ADPCM added */
     78    M4SYS_kPCM           = 0x0190,  /* stream type added: PCM;  PR2569 fixAA */
     79    M4SYS_kAudioAll        = 0x01FF,  /* all audio streams */
     80 
     81    /* Video ones   : Range [0x0200-0x02FF]*/
     82    M4SYS_kVideoUnknown  = 0x0200,
     83    M4SYS_kMPEG_4        = 0x0201,
     84    M4SYS_kH263          = 0x0202,
     85    M4SYS_kH263pp        = 0x0203,
     86    M4SYS_kH264          = 0x0204,
     87    M4SYS_kREALVIDEO     = 0x0205,
     88    M4SYS_kYUV420        = 0x0281,
     89    M4SYS_kRGB32         = 0x0282,
     90    M4SYS_kBGR32         = 0x0283,
     91    M4SYS_kRGB24         = 0x0284,
     92    M4SYS_kBGR24         = 0x0285,
     93    M4SYS_kVideoAll        = 0x02FF,  /* all video streams */
     94 
     95   /* Picture ones : Range [0x0300-0x03FF]*/
     96    M4SYS_kPictureUnknown = 0x0300,
     97    M4SYS_kJPEG           = 0x0301,
     98    M4SYS_kGIF            = 0x0302,
     99    M4SYS_kBMP            = 0x0383,
    100    M4SYS_kStillAll         = 0x03FF,  /* all still picture streams */
    101 
    102    /* Text ones    : Range [0x0400-0x04FF]*/
    103    M4SYS_kTextUnknown  = 0x0400,
    104    M4SYS_kTimedText    = 0x0401,
    105    M4SYS_kUTF8         = 0x0481,
    106    M4SYS_kUTF16        = 0x0482,
    107    M4SYS_kUCS2         = 0x0483,
    108    M4SYS_kTextAll       = 0x04FF,  /* all text streams */
    109 
    110    /* Scene & Graphics ones   : Range [0x0500-0x05FF]*/
    111    M4SYS_kSceneUnknown  = 0x0500,
    112    M4SYS_kSMIL          = 0x0501,
    113    M4SYS_kBIFS          = 0x0502,
    114    M4SYS_kSceneAll        = 0x05FF,  /* all scene streams */
    115 
    116    /* hinted ones   : Range [0x0600-0x06FF]*/
    117    M4SYS_kHintedUnknown = 0x0600,
    118    M4SYS_kRTP           = 0x0601,
    119    M4SYS_kMPEG2_TS      = 0x0602,
    120    M4SYS_kHintedAll        = 0x06FF,  /* all packetized streams */
    121 
    122    /* MPEG-4 system ones : Range [0x0700-0x07FF]*/
    123    M4SYS_kSysUnknown    = 0x0700,
    124    M4SYS_kODS           = 0x0701,
    125    M4SYS_kIPMP          = 0x0702,
    126    M4SYS_kOCI           = 0x0703,
    127    M4SYS_kSysAll        = 0x07FF /* all system streams*/
    128 } M4SYS_StreamType ;
    129 
    130 typedef struct {
    131    M4SYS_StreamID     streamID ;
    132    M4OSA_UInt32      value ;
    133 } M4SYS_StreamIDValue ;
    134 
    135 typedef struct {
    136    M4SYS_StreamID    streamID ;
    137    M4OSA_UInt32      size ;
    138    M4OSA_MemAddr32   addr ;
    139 } M4SYS_StreamIDmemAddr ;
    140 
    141 /** This strucure defines a set of properties associated to a stream*/
    142 typedef struct {
    143   M4SYS_StreamID   streamID;    /**< The ID of the stream. It must be unique for a media
    144                                 (ie in a MP4 file, two tracks can not have two times the same ID).
    145                                  0 is forbidden.*/
    146   M4SYS_StreamType streamType;    /**< The stream type of the stream*/
    147   M4OSA_UInt8      profileLevel;  /**< The profile & level of a stream. It is related to the
    148                                        stream type & the definition comes from the standard bodies
    149                                        (i.e. MPEG-4 Video & MPEG-4 Audio). Some values are
    150                                        pre-defined: 0xFE=userPrivate 0xFF=no Profile &
    151                                        Level specified*/
    152   M4OSA_UInt32     decoderSpecificInfoSize;  /**< The decoder configuration. These bytes are
    153                                                    needed to initialise a decoder.*/
    154   M4OSA_MemAddr32  decoderSpecificInfo; /**< The size (in bytes) of the decoder specific info.*/
    155   M4OSA_UInt32     timeScale;     /**< The time scale of the stream. It means that all timing
    156                                         duration of this stream are computed in this timescale
    157                                         (ie timeScale = 8000, means there are 8000 ticks in
    158                                         one second)*/
    159   M4OSA_Time       duration;        /**< The stream duration of this stream. The time unit is the
    160                                         time scale. The value can be set to M4SYS_UnknownTime if
    161                                         the duration is not known.*/
    162   M4OSA_Int32      averageBitrate;  /**< The average bitrate (in bit per second) of this stream.
    163                                          The average bitrate is computed on the stream duration.
    164                                          -1 value means either there is no average bitrate or no
    165                                          average bitrate is provided.*/
    166   M4OSA_Int32      maxBitrate;      /**< The maximum bitrate (in bit per second) of this stream.
    167                                          The maximum bitrate is computed on a sliding window of 1
    168                                          second. -1 value means either there is no max. bitrate or
    169                                          no max. bitrate is provided.*/
    170 } M4SYS_StreamDescription;
    171 
    172 typedef enum {
    173    M4SYS_kPreviousRAP      = 0x01 ,
    174    M4SYS_kNextRAP          = 0x02 ,
    175    M4SYS_kClosestRAP       = 0x03 ,
    176    M4SYS_kNoRAPprevious    = 0x11 ,
    177    M4SYS_kNoRAPnext        = 0x12 ,
    178    M4SYS_kNoRAPclosest     = 0x13 ,
    179    M4SYS_kBeginning        = 0x20
    180 } M4SYS_SeekAccessMode ;
    181 
    182 #endif /*M4SYS_STREAM_H*/
    183 
    184 
    185 
    186