00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _AP4_TRAK_H_
00030 #define _AP4_TRAK_H_
00031
00032
00033
00034
00035 #include "Ap4.h"
00036 #include "Ap4Array.h"
00037 #include "Ap4SampleDescription.h"
00038 #include "Ap4SampleTable.h"
00039
00040
00041
00042
00043 class AP4_StblAtom;
00044 class AP4_ByteStream;
00045 class AP4_Sample;
00046 class AP4_DataBuffer;
00047 class AP4_TrakAtom;
00048 class AP4_MoovAtom;
00049
00050
00051
00052
00053 const AP4_UI32 AP4_TRACK_DEFAULT_MOVIE_TIMESCALE = 1000;
00054
00055
00056
00057
00058 class AP4_Track {
00059 public:
00060
00061 typedef enum {
00062 TYPE_UNKNOWN,
00063 TYPE_AUDIO,
00064 TYPE_VIDEO,
00065 TYPE_TEXT,
00066 TYPE_HINT
00067 } Type;
00068
00069
00070 AP4_Track(Type type,
00071 AP4_SampleTable* sample_table,
00072 AP4_UI32 track_id,
00073 AP4_UI32 movie_time_scale,
00074 AP4_UI32 media_time_scale,
00075 AP4_UI32 media_duration,
00076 const char* language,
00077 AP4_UI32 width,
00078 AP4_UI32 height);
00079 AP4_Track(AP4_TrakAtom& atom,
00080 AP4_ByteStream& sample_stream,
00081 AP4_UI32 movie_time_scale);
00082 virtual ~AP4_Track();
00083 AP4_Track::Type GetType() { return m_Type; }
00084 AP4_UI32 GetDuration();
00085 AP4_Duration GetDurationMs();
00086 AP4_Cardinal GetSampleCount();
00087 AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample);
00088 AP4_Result ReadSample(AP4_Ordinal index,
00089 AP4_Sample& sample,
00090 AP4_DataBuffer& data);
00091 AP4_Result GetSampleIndexForTimeStampMs(AP4_TimeStamp ts,
00092 AP4_Ordinal& index);
00093 AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
00094 AP4_UI32 GetId();
00095 AP4_Result SetId(AP4_UI32 track_id);
00096 AP4_TrakAtom* GetTrakAtom() { return m_TrakAtom; }
00097 AP4_Result SetMovieTimeScale(AP4_UI32 time_scale);
00098 AP4_UI32 GetMediaTimeScale();
00099
00100 AP4_String GetTrackName();
00101 AP4_String GetTrackLanguage();
00102
00103 protected:
00104
00105 AP4_TrakAtom* m_TrakAtom;
00106 bool m_TrakAtomIsOwned;
00107 Type m_Type;
00108 AP4_SampleTable* m_SampleTable;
00109 bool m_SampleTableIsOwned;
00110 AP4_UI32 m_MovieTimeScale;
00111 AP4_UI32 m_MediaTimeScale;
00112 };
00113
00114 #endif // _AP4_TRAK_H_