implemented audio exporting
The encoder was moved to its own thread and will transcode the PCM from the audio renderer into the chosen codec while the video frames are still received. The implementation isn't perfect and could use some cleaning up, but it is functional at the moment.
This commit is contained in:
+23
-10
@@ -42,17 +42,12 @@ private:
|
||||
AudioRenderingParams audio_params_;
|
||||
};
|
||||
|
||||
class Encoder
|
||||
class Encoder : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Encoder(const EncodingParams& params);
|
||||
|
||||
DISABLE_COPY_MOVE(Encoder)
|
||||
|
||||
virtual bool Open() = 0;
|
||||
virtual void Write(FramePtr frame) = 0;
|
||||
virtual void Close() = 0;
|
||||
|
||||
/**
|
||||
* @brief Create a Encoder instance using a Encoder ID
|
||||
*
|
||||
@@ -60,15 +55,33 @@ public:
|
||||
*
|
||||
* A Encoder instance or nullptr if a Decoder with this ID does not exist
|
||||
*/
|
||||
static EncoderPtr CreateFromID(const QString& id, const EncodingParams ¶ms);
|
||||
static Encoder *CreateFromID(const QString& id, const EncodingParams ¶ms);
|
||||
|
||||
protected:
|
||||
const EncodingParams& params() const;
|
||||
|
||||
bool open_;
|
||||
public slots:
|
||||
void Open();
|
||||
void Write(FramePtr frame);
|
||||
virtual void WriteAudio(const AudioRenderingParams& pcm_info, const QString& pcm_filename) = 0;
|
||||
void Close();
|
||||
|
||||
signals:
|
||||
void OpenSucceeded();
|
||||
void OpenFailed();
|
||||
|
||||
void Closed();
|
||||
|
||||
protected:
|
||||
virtual bool OpenInternal() = 0;
|
||||
virtual void WriteInternal(FramePtr frame) = 0;
|
||||
virtual void CloseInternal() = 0;
|
||||
|
||||
bool IsOpen() const;
|
||||
|
||||
private:
|
||||
EncodingParams params_;
|
||||
|
||||
bool open_;
|
||||
};
|
||||
|
||||
#endif // ENCODER_H
|
||||
|
||||
Reference in New Issue
Block a user