| 1 | /********** |
| 2 | This library is free software; you can redistribute it and/or modify it under |
| 3 | the terms of the GNU Lesser General Public License as published by the |
| 4 | Free Software Foundation; either version 3 of the License, or (at your |
| 5 | option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) |
| 6 | |
| 7 | This library is distributed in the hope that it will be useful, but WITHOUT |
| 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for |
| 10 | more details. |
| 11 | |
| 12 | You should have received a copy of the GNU Lesser General Public License |
| 13 | along with this library; if not, write to the Free Software Foundation, Inc., |
| 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 15 | **********/ |
| 16 | // "liveMedia" |
| 17 | // Copyright (c) 1996-2020 Live Networks, Inc. All rights reserved. |
| 18 | // A media track, demultiplexed from a Matroska file |
| 19 | // C++ header |
| 20 | |
| 21 | #ifndef _MATROSKA_DEMUXED_TRACK_HH |
| 22 | #define _MATROSKA_DEMUXED_TRACK_HH |
| 23 | |
| 24 | #ifndef _FRAMED_SOURCE_HH |
| 25 | #include "FramedSource.hh" |
| 26 | #endif |
| 27 | |
| 28 | class MatroskaDemux; // forward |
| 29 | |
| 30 | class MatroskaDemuxedTrack: public FramedSource { |
| 31 | public: |
| 32 | void seekToTime(double& seekNPT); |
| 33 | |
| 34 | private: // We are created only by a MatroskaDemux (a friend) |
| 35 | friend class MatroskaDemux; |
| 36 | MatroskaDemuxedTrack(UsageEnvironment& env, unsigned trackNumber, MatroskaDemux& sourceDemux); |
| 37 | virtual ~MatroskaDemuxedTrack(); |
| 38 | |
| 39 | private: |
| 40 | // redefined virtual functions: |
| 41 | virtual void doGetNextFrame(); |
| 42 | virtual char const* MIMEtype() const; |
| 43 | |
| 44 | private: // We are accessed only by MatroskaDemux and by MatroskaFileParser (a friend) |
| 45 | friend class MatroskaFileParser; |
| 46 | unsigned char* to() { return fTo; } |
| 47 | unsigned maxSize() { return fMaxSize; } |
| 48 | unsigned& frameSize() { return fFrameSize; } |
| 49 | unsigned& numTruncatedBytes() { return fNumTruncatedBytes; } |
| 50 | struct timeval& presentationTime() { return fPresentationTime; } |
| 51 | unsigned& durationInMicroseconds() { return fDurationInMicroseconds; } |
| 52 | |
| 53 | struct timeval& prevPresentationTime() { return fPrevPresentationTime; } |
| 54 | int& durationImbalance() { return fDurationImbalance; } |
| 55 | |
| 56 | private: |
| 57 | unsigned fOurTrackNumber; |
| 58 | MatroskaDemux& fOurSourceDemux; |
| 59 | struct timeval fPrevPresentationTime; |
| 60 | int fDurationImbalance; |
| 61 | unsigned fOpusTrackNumber; // hack for Opus audio |
| 62 | }; |
| 63 | |
| 64 | #endif |
| 65 | |