Merge branch 'storageareas' into ffmpeg_output

This commit is contained in:
Isaac Connor
2017-11-08 17:22:07 -05:00
55 changed files with 3247 additions and 2337 deletions

View File

@@ -317,7 +317,7 @@ int FfmpegCamera::Capture( Image &image ) {
} // end if packet.stream_index == mVideoStreamId
zm_av_packet_unref( &packet );
} // end while ! frameComplete
return (0);
return 1;
} // FfmpegCamera::Capture
int FfmpegCamera::PostCapture() {
@@ -495,7 +495,16 @@ int FfmpegCamera::OpenFfmpeg() {
}
}
}
} else {
#ifdef AV_CODEC_ID_H265
if ( mVideoCodecContext->codec_id == AV_CODEC_ID_H265 ) {
Debug( 1, "Input stream appears to be h265. The stored event file may not be viewable in browser." );
} else {
#endif
Error( "Input stream is not h264. The stored event file may not be viewable in browser." );
#ifdef AV_CODEC_ID_H265
}
#endif
} // end if h264
#endif
@@ -752,6 +761,7 @@ int FfmpegCamera::CaptureAndRecord( Image &image, timeval recording, char* event
while ( ! frameComplete ) {
av_init_packet( &packet );
Debug(4,"before read frame");
ret = av_read_frame( mFormatContext, &packet );
if ( ret < 0 ) {
av_strerror( ret, errbuf, AV_ERROR_MAX_STRING_SIZE );
@@ -961,11 +971,11 @@ else if ( packet.pts && video_last_pts > packet.pts ) {
ret = avcodec_receive_frame( mVideoCodecContext, mRawFrame );
if ( ret < 0 ) {
av_strerror( ret, errbuf, AV_ERROR_MAX_STRING_SIZE );
Error( "Unable to send packet at frame %d: %s, continuing", frameCount, errbuf );
Warning( "Unable to receive frame %d: %s, continuing", frameCount, errbuf );
zm_av_packet_unref( &packet );
continue;
}
#if HAVE_AVUTIL_HWCONTEXT_H
}
#endif
@@ -981,8 +991,6 @@ else if ( packet.pts && video_last_pts > packet.pts ) {
}
#endif
Debug( 4, "Decoded video packet at frame %d", frameCount );
if ( frameComplete ) {
Debug( 4, "Got frame %d", frameCount );
@@ -1013,6 +1021,7 @@ else if ( packet.pts && video_last_pts > packet.pts ) {
Debug( 3, "Not framecomplete after av_read_frame" );
} // end if frameComplete
} else if ( packet.stream_index == mAudioStreamId ) { //FIXME best way to copy all other streams
frameComplete = 1;
if ( videoStore ) {
if ( record_audio ) {
if ( have_video_keyframe ) {
@@ -1034,6 +1043,8 @@ else if ( packet.pts && video_last_pts > packet.pts ) {
} else {
Debug(4, "Have audio packet, but not recording atm" );
}
zm_av_packet_unref( &packet );
return 0;
} else {
#if LIBAVUTIL_VERSION_CHECK(56, 23, 0, 23, 0)
Debug( 3, "Some other stream index %d, %s", packet.stream_index, av_get_media_type_string( mFormatContext->streams[packet.stream_index]->codecpar->codec_type) );
@@ -1045,7 +1056,7 @@ else if ( packet.pts && video_last_pts > packet.pts ) {
// the packet contents are ref counted... when queuing, we allocate another packet and reference it with that one, so we should always need to unref here, which should not affect the queued version.
zm_av_packet_unref( &packet );
} // end while ! frameComplete
return (frameCount);
return frameCount;
} // end FfmpegCamera::CaptureAndRecord