File indexing completed on 2025-02-09 05:41:15
0001 /* 0002 SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef _K3B_FFMPEG_WRAPPER_H_ 0007 #define _K3B_FFMPEG_WRAPPER_H_ 0008 0009 #include "k3bmsf.h" 0010 0011 /** 0012 * Create with K3bFFMpegWrapper::open 0013 */ 0014 class K3bFFMpegFile 0015 { 0016 friend class K3bFFMpegWrapper; 0017 0018 public: 0019 ~K3bFFMpegFile(); 0020 0021 const QString& filename() const { return m_filename; } 0022 0023 bool open(); 0024 void close(); 0025 0026 K3b::Msf length() const; 0027 int sampleRate() const; 0028 int channels() const; 0029 0030 /** 0031 * ffmpeg internal enumeration 0032 */ 0033 int type() const; 0034 QString typeComment() const; 0035 0036 QString title() const; 0037 QString author() const; 0038 QString comment() const; 0039 0040 int read( char* buf, int bufLen ); 0041 bool seek( const K3b::Msf& ); 0042 0043 private: 0044 explicit K3bFFMpegFile( const QString& filename ); 0045 int readPacket(); 0046 int fillOutputBuffer(); 0047 0048 QString m_filename; 0049 0050 class Private; 0051 Private* d; 0052 }; 0053 0054 0055 class K3bFFMpegWrapper 0056 { 0057 public: 0058 ~K3bFFMpegWrapper(); 0059 0060 /** 0061 * returns 0 on failure. 0062 */ 0063 K3bFFMpegFile* open( const QString& filename ) const; 0064 0065 static K3bFFMpegWrapper* instance(); 0066 0067 private: 0068 K3bFFMpegWrapper(); 0069 0070 static K3bFFMpegWrapper* s_instance; 0071 }; 0072 0073 #endif