|
||||
File indexing completed on 2025-01-18 10:04:15
0001 // Created by: Kirill GAVRILOV 0002 // Copyright (c) 2019 OPEN CASCADE SAS 0003 // 0004 // This file is part of Open CASCADE Technology software library. 0005 // 0006 // This library is free software; you can redistribute it and/or modify it under 0007 // the terms of the GNU Lesser General Public License version 2.1 as published 0008 // by the Free Software Foundation, with special exception defined in the file 0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0010 // distribution for complete text of the license and disclaimer of any warranty. 0011 // 0012 // Alternatively, this file may be used under the terms of Open CASCADE 0013 // commercial license or contractual agreement. 0014 0015 #ifndef _Media_CodecContext_HeaderFile 0016 #define _Media_CodecContext_HeaderFile 0017 0018 #include <Media_Packet.hxx> 0019 0020 struct AVCodec; 0021 struct AVCodecContext; 0022 struct AVStream; 0023 class Media_Frame; 0024 0025 //! AVCodecContext wrapper - the coder/decoder holder. 0026 class Media_CodecContext : public Standard_Transient 0027 { 0028 DEFINE_STANDARD_RTTIEXT(Media_CodecContext, Standard_Transient) 0029 public: 0030 0031 //! Constructor. 0032 Standard_EXPORT Media_CodecContext(); 0033 0034 //! Destructor. 0035 Standard_EXPORT virtual ~Media_CodecContext(); 0036 0037 //! Return context. 0038 AVCodecContext* Context() const { return myCodecCtx; } 0039 0040 //! Open codec specified within the stream. 0041 //! @param theStream stream to open 0042 //! @param thePtsStartBase PTS start in seconds 0043 //! @param theNbThreads amount of threads to use for AVMEDIA_TYPE_VIDEO stream; 0044 //! -1 means OSD_Parallel::NbLogicalProcessors(), 0045 //! 0 means auto by FFmpeg itself 0046 //! >0 means specified number of threads (decoder should support multi-threading to take effect) 0047 Standard_EXPORT bool Init (const AVStream& theStream, 0048 double thePtsStartBase, 0049 int theNbThreads = -1); 0050 0051 //! Open codec. 0052 //! @param theStream stream to open 0053 //! @param thePtsStartBase PTS start in seconds 0054 //! @param theNbThreads amount of threads to use for AVMEDIA_TYPE_VIDEO stream; 0055 //! -1 means OSD_Parallel::NbLogicalProcessors(), 0056 //! 0 means auto by FFmpeg itself 0057 //! >0 means specified number of threads (decoder should support multi-threading to take effect) 0058 //! @param theCodecId codec (AVCodecID) to open 0059 Standard_EXPORT bool Init (const AVStream& theStream, 0060 double thePtsStartBase, 0061 int theNbThreads, 0062 int theCodecId); 0063 0064 //! Close input. 0065 Standard_EXPORT void Close(); 0066 0067 //! @return source frame width 0068 Standard_EXPORT int SizeX() const; 0069 0070 //! @return source frame height 0071 Standard_EXPORT int SizeY() const; 0072 0073 //! Return stream index. 0074 int StreamIndex() const { return myStreamIndex; } 0075 0076 //! avcodec_flush_buffers() wrapper. 0077 Standard_EXPORT void Flush(); 0078 0079 //! Return true if packet belongs to this stream. 0080 Standard_EXPORT bool CanProcessPacket (const Handle(Media_Packet)& thePacket) const; 0081 0082 //! avcodec_send_packet() wrapper. 0083 Standard_EXPORT bool SendPacket (const Handle(Media_Packet)& thePacket); 0084 0085 //! avcodec_receive_frame() wrapper. 0086 Standard_EXPORT bool ReceiveFrame (const Handle(Media_Frame)& theFrame); 0087 0088 protected: 0089 0090 AVCodecContext* myCodecCtx; //!< codec context 0091 AVCodec* myCodec; //!< opened codec 0092 double myPtsStartBase; //!< starting PTS in context 0093 double myPtsStartStream; //!< starting PTS in the stream 0094 double myTimeBase; //!< stream timebase 0095 int myStreamIndex; //!< stream index 0096 float myPixelAspectRatio; //!< pixel aspect ratio 0097 0098 }; 0099 0100 #endif // _Media_CodecContext_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |