Ap4HintTrackReader.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:4k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*****************************************************************
  2. |
  3. |    AP4 - Hint Track Reader
  4. |
  5. |    Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
  6. |
  7. |
  8. |    This file is part of Bento4/AP4 (MP4 Atom Processing Library).
  9. |
  10. |    Unless you have obtained Bento4 under a difference license,
  11. |    this version of Bento4 is Bento4|GPL.
  12. |    Bento4|GPL is free software; you can redistribute it and/or modify
  13. |    it under the terms of the GNU General Public License as published by
  14. |    the Free Software Foundation; either version 2, or (at your option)
  15. |    any later version.
  16. |
  17. |    Bento4|GPL is distributed in the hope that it will be useful,
  18. |    but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. |    GNU General Public License for more details.
  21. |
  22. |    You should have received a copy of the GNU General Public License
  23. |    along with Bento4|GPL; see the file COPYING.  If not, write to the
  24. |    Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  25. |    02111-1307, USA.
  26. |
  27. ****************************************************************/
  28. #ifndef _AP4_HINT_TRACK_READER_H_
  29. #define _AP4_HINT_TRACK_READER_H_
  30. /*----------------------------------------------------------------------
  31. |       includes
  32. +---------------------------------------------------------------------*/
  33. #include "Ap4.h"
  34. #include "Ap4Sample.h"
  35. /*----------------------------------------------------------------------
  36. |       class declarations
  37. +---------------------------------------------------------------------*/
  38. class AP4_DataBuffer;
  39. class AP4_Movie;
  40. class AP4_Track;
  41. class AP4_RtpSampleData;
  42. class AP4_RtpPacket;
  43. class AP4_ImmediateRtpConstructor;
  44. class AP4_SampleRtpConstructor;
  45. /*----------------------------------------------------------------------
  46. |       AP4_HintTrackReader
  47. +---------------------------------------------------------------------*/
  48. class AP4_HintTrackReader
  49. {
  50. public:
  51.     // constructor and destructor
  52.     AP4_HintTrackReader(AP4_Track& hint_track, 
  53.                         AP4_Movie& movie, 
  54.                         AP4_UI32 ssrc = 0); // if 0, random value is chosen
  55.     ~AP4_HintTrackReader();
  56.     // methods
  57.     AP4_Result      GetNextPacket(AP4_DataBuffer& packet, 
  58.                                   AP4_TimeStamp& ts_ms);
  59.     AP4_Result      SeekToTimeStampMs(AP4_TimeStamp desired_ts,
  60.                                       AP4_TimeStamp& actual_ts);
  61.     AP4_TimeStamp   GetCurrentTimeStampMs();
  62.     AP4_Result      Rewind();
  63.     AP4_Result      GetSdpText(AP4_String& sdp);
  64.     AP4_Track*      GetMediaTrack() { return m_MediaTrack; }
  65.     
  66. private:
  67.     // methods
  68.     AP4_Result GetRtpSample(AP4_Ordinal index);
  69.     AP4_Result BuildRtpPacket(AP4_RtpPacket* packet, 
  70.                               AP4_DataBuffer& packet_data);
  71.     AP4_Result WriteImmediateRtpData(AP4_ImmediateRtpConstructor* constructor,
  72.                                      AP4_ByteStream* data_stream);
  73.     AP4_Result WriteSampleRtpData(AP4_SampleRtpConstructor* constructor,
  74.                                   AP4_ByteStream* data_stream);
  75.     // members
  76.     AP4_Track&          m_HintTrack;
  77.     AP4_Track*          m_MediaTrack;
  78.     AP4_UI32            m_MediaTimeScale;
  79.     AP4_Sample          m_CurrentHintSample;
  80.     AP4_RtpSampleData*  m_RtpSampleData;
  81.     AP4_UI32            m_Ssrc;
  82.     AP4_Ordinal         m_SampleIndex;
  83.     AP4_Ordinal         m_PacketIndex;
  84.     AP4_UI16            m_RtpSequenceStart;
  85.     AP4_TimeStamp       m_RtpTimeStampStart;
  86.     AP4_UI32            m_RtpTimeScale;
  87. };
  88. #endif // _AP4_HINT_TRACK_READER_H_