Add SecondFormatContext

This commit is contained in:
Isaac Connor 2021-03-03 09:53:11 -05:00
parent 95fe689d58
commit 86541779d9
2 changed files with 9 additions and 3 deletions

View File

@ -54,6 +54,7 @@ Camera::Camera(
mVideoStream(nullptr),
mAudioStream(nullptr),
mFormatContext(nullptr),
mSecondFormatContext(nullptr),
bytes(0)
{
linesize = width * colours;
@ -68,9 +69,13 @@ Camera::~Camera() {
if ( mFormatContext ) {
// Should also free streams
avformat_free_context(mFormatContext);
mVideoStream = nullptr;
mAudioStream = nullptr;
}
if ( mSecondFormatContext ) {
// Should also free streams
avformat_free_context(mSecondFormatContext);
}
mVideoStream = nullptr;
mAudioStream = nullptr;
}
AVStream *Camera::get_VideoStream() {

View File

@ -56,7 +56,8 @@ protected:
AVCodecContext *mAudioCodecContext;
AVStream *mVideoStream;
AVStream *mAudioStream;
AVFormatContext *mFormatContext;
AVFormatContext *mFormatContext; // One for video, one for audio
AVFormatContext *mSecondFormatContext; // One for video, one for audio
unsigned int bytes;
public: