Forgot that I was trying to solve case of stream is true and record_audio

is false.
This commit is contained in:
Steve Gilvarry 2016-07-13 08:31:10 +10:00
parent f1b9e1205a
commit b05eabfe1d
1 changed files with 30 additions and 12 deletions

View File

@ -597,16 +597,25 @@ int FfmpegCamera::CaptureAndRecord( Image &image, bool recording, char* event_fi
if ( recording && !wasRecording ) { if ( recording && !wasRecording ) {
//Instantiate the video storage module //Instantiate the video storage module
if (mAudioStreamId == -1 && !record_audio) { if (record_audio) {
if (mAudioStreamId == -1) {
Debug(3, "Record Audio on but no audio stream found");
videoStore = new VideoStore((const char *) event_file, "mp4", videoStore = new VideoStore((const char *) event_file, "mp4",
mFormatContext->streams[mVideoStreamId], mFormatContext->streams[mVideoStreamId],
NULL, startTime); NULL, startTime);
} else { } else {
Debug(3, "Video module initiated with audio stream");
videoStore = new VideoStore((const char *) event_file, "mp4", videoStore = new VideoStore((const char *) event_file, "mp4",
mFormatContext->streams[mVideoStreamId], mFormatContext->streams[mVideoStreamId],
mFormatContext->streams[mAudioStreamId], mFormatContext->streams[mAudioStreamId],
startTime); startTime);
} }
} else {
Debug(3, "Record_audio is false so exclude audio stream");
videoStore = new VideoStore((const char *) event_file, "mp4",
mFormatContext->streams[mVideoStreamId],
NULL, startTime);
}
wasRecording = true; wasRecording = true;
strcpy(oldDirectory, event_file); strcpy(oldDirectory, event_file);
@ -630,16 +639,25 @@ int FfmpegCamera::CaptureAndRecord( Image &image, bool recording, char* event_fi
videoStore = NULL; videoStore = NULL;
} }
if (mAudioStreamId == -1 && !record_audio) { if (record_audio) {
if (mAudioStreamId == -1) {
Debug(3, "Record Audio on but no audio stream found");
videoStore = new VideoStore((const char *) event_file, "mp4", videoStore = new VideoStore((const char *) event_file, "mp4",
mFormatContext->streams[mVideoStreamId], mFormatContext->streams[mVideoStreamId],
NULL, startTime); NULL, startTime);
} else { } else {
Debug(3, "Video module initiated with audio stream");
videoStore = new VideoStore((const char *) event_file, "mp4", videoStore = new VideoStore((const char *) event_file, "mp4",
mFormatContext->streams[mVideoStreamId], mFormatContext->streams[mVideoStreamId],
mFormatContext->streams[mAudioStreamId], mFormatContext->streams[mAudioStreamId],
startTime); startTime);
} }
} else {
Debug(3, "Record_audio is false so exclude audio stream");
videoStore = new VideoStore((const char *) event_file, "mp4",
mFormatContext->streams[mVideoStreamId],
NULL, startTime);
}
strcpy(oldDirectory, event_file); strcpy(oldDirectory, event_file);
} }