| 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 filter that breaks up an MPEG-4 video elementary stream into |
| 19 | // frames for: |
| 20 | // - Visual Object Sequence (VS) Header + Visual Object (VO) Header |
| 21 | // + Video Object Layer (VOL) Header |
| 22 | // - Group of VOP (GOV) Header |
| 23 | // - VOP frame |
| 24 | // C++ header |
| 25 | |
| 26 | #ifndef _MPEG4_VIDEO_STREAM_FRAMER_HH |
| 27 | #define _MPEG4_VIDEO_STREAM_FRAMER_HH |
| 28 | |
| 29 | #ifndef _MPEG_VIDEO_STREAM_FRAMER_HH |
| 30 | #include "MPEGVideoStreamFramer.hh" |
| 31 | #endif |
| 32 | |
| 33 | class MPEG4VideoStreamFramer: public MPEGVideoStreamFramer { |
| 34 | public: |
| 35 | static MPEG4VideoStreamFramer* |
| 36 | createNew(UsageEnvironment& env, FramedSource* inputSource); |
| 37 | |
| 38 | u_int8_t profile_and_level_indication() const { |
| 39 | return fProfileAndLevelIndication; |
| 40 | } |
| 41 | |
| 42 | unsigned char* getConfigBytes(unsigned& numBytes) const; |
| 43 | |
| 44 | void setConfigInfo(u_int8_t profileAndLevelIndication, char const* configStr); |
| 45 | // Assigns the "profile_and_level_indication" number, and the 'config' bytes. |
| 46 | // If this function is not called, then this data is only assigned later, when it appears in the input stream. |
| 47 | |
| 48 | protected: |
| 49 | MPEG4VideoStreamFramer(UsageEnvironment& env, |
| 50 | FramedSource* inputSource, |
| 51 | Boolean createParser = True); |
| 52 | // called only by createNew(), or by subclass constructors |
| 53 | virtual ~MPEG4VideoStreamFramer(); |
| 54 | |
| 55 | void startNewConfig(); |
| 56 | void appendToNewConfig(unsigned char* newConfigBytes, |
| 57 | unsigned numNewBytes); |
| 58 | void completeNewConfig(); |
| 59 | |
| 60 | private: |
| 61 | // redefined virtual functions: |
| 62 | virtual Boolean isMPEG4VideoStreamFramer() const; |
| 63 | |
| 64 | protected: |
| 65 | u_int8_t fProfileAndLevelIndication; |
| 66 | unsigned char* fConfigBytes; |
| 67 | unsigned fNumConfigBytes; |
| 68 | |
| 69 | private: |
| 70 | unsigned char* fNewConfigBytes; |
| 71 | unsigned fNumNewConfigBytes; |
| 72 | friend class MPEG4VideoStreamParser; // hack |
| 73 | }; |
| 74 | |
| 75 | #endif |
| 76 | |