|
|
|||
File indexing completed on 2026-05-15 08:24:37
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 //! Constructor. 0031 Standard_EXPORT Media_CodecContext(); 0032 0033 //! Destructor. 0034 Standard_EXPORT virtual ~Media_CodecContext(); 0035 0036 //! Return context. 0037 AVCodecContext* Context() const { return myCodecCtx; } 0038 0039 //! Open codec specified within the stream. 0040 //! @param theStream stream to open 0041 //! @param thePtsStartBase PTS start in seconds 0042 //! @param theNbThreads amount of threads to use for AVMEDIA_TYPE_VIDEO stream; 0043 //! -1 means OSD_Parallel::NbLogicalProcessors(), 0044 //! 0 means auto by FFmpeg itself 0045 //! >0 means specified number of threads (decoder should support 0046 //! 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 0058 //! multi-threading to take effect) 0059 //! @param theCodecId codec (AVCodecID) to open 0060 Standard_EXPORT bool Init(const AVStream& theStream, 0061 double thePtsStartBase, 0062 int theNbThreads, 0063 int theCodecId); 0064 0065 //! Close input. 0066 Standard_EXPORT void Close(); 0067 0068 //! @return source frame width 0069 Standard_EXPORT int SizeX() const; 0070 0071 //! @return source frame height 0072 Standard_EXPORT int SizeY() const; 0073 0074 //! Return stream index. 0075 int StreamIndex() const { return myStreamIndex; } 0076 0077 //! avcodec_flush_buffers() wrapper. 0078 Standard_EXPORT void Flush(); 0079 0080 //! Return true if packet belongs to this stream. 0081 Standard_EXPORT bool CanProcessPacket(const Handle(Media_Packet)& thePacket) const; 0082 0083 //! avcodec_send_packet() wrapper. 0084 Standard_EXPORT bool SendPacket(const Handle(Media_Packet)& thePacket); 0085 0086 //! avcodec_receive_frame() wrapper. 0087 Standard_EXPORT bool ReceiveFrame(const Handle(Media_Frame)& theFrame); 0088 0089 protected: 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 #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 |
|