diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 424fb839a..323229da7 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -1329,7 +1329,7 @@ void EventStream::runStream() { delta_us = (unsigned int)(frame_data->delta * 1000000); if ( effective_fps < base_fps ) - delta_us = (delta_us * base_fps)/effective_fps; + delta_us = (unsigned int)((delta_us * base_fps)/effective_fps); send_frame = true; } } diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 8077b0224..ec60745a2 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -3568,7 +3568,7 @@ void MonitorStream::runStream() } frame_count++; } - usleep( (1000000 * ZM_RATE_BASE)/((base_fps?base_fps:1)*abs(replay_rate*2)) ); + usleep( (unsigned long)((1000000 * ZM_RATE_BASE)/((base_fps?base_fps:1)*abs(replay_rate*2))) ); if ( ttl ) { if ( (now.tv_sec - stream_start_time) > ttl ) diff --git a/src/zm_mpeg.cpp b/src/zm_mpeg.cpp index 1ed87fe2c..27c6ce61d 100644 --- a/src/zm_mpeg.cpp +++ b/src/zm_mpeg.cpp @@ -67,7 +67,7 @@ void VideoStream::SetupFormat( const char *p_filename, const char *p_format ) snprintf( ofc->filename, sizeof(ofc->filename), "%s", filename ); } -void VideoStream::SetupCodec( int colours, int width, int height, int bitrate, int frame_rate ) +void VideoStream::SetupCodec( int colours, int width, int height, int bitrate, double frame_rate ) { pf = (colours==1?PIX_FMT_GRAY8:PIX_FMT_RGB24); @@ -102,14 +102,14 @@ void VideoStream::SetupCodec( int colours, int width, int height, int bitrate, i of which frame timestamps are represented. for fixed-fps content, timebase should be 1/framerate and timestamp increments should be identically 1. */ - c->time_base.den = frame_rate; - c->time_base.num = 1; + c->time_base.den = (int)(frame_rate*100); + c->time_base.num = 100; #else /* frames per second */ c->frame_rate = frame_rate; c->frame_rate_base = 1; #endif - c->gop_size = frame_rate/2; /* emit one intra frame every half second or so */ + //c->gop_size = frame_rate/2; /* emit one intra frame every half second or so */ c->gop_size = 12; if ( c->gop_size < 3 ) c->gop_size = 3; @@ -233,7 +233,7 @@ void VideoStream::OpenStream() av_write_header(ofc); } -VideoStream::VideoStream( const char *filename, const char *format, int bitrate, int frame_rate, int colours, int width, int height ) +VideoStream::VideoStream( const char *filename, const char *format, int bitrate, double frame_rate, int colours, int width, int height ) { if ( !initialised ) { diff --git a/src/zm_mpeg.h b/src/zm_mpeg.h index 8c6b7ba43..ff363bb39 100644 --- a/src/zm_mpeg.h +++ b/src/zm_mpeg.h @@ -54,11 +54,11 @@ protected: static void Initialise(); void SetupFormat( const char *p_filename, const char *format ); - void SetupCodec( int colours, int width, int height, int bitrate, int frame_rate ); + void SetupCodec( int colours, int width, int height, int bitrate, double frame_rate ); void SetParameters(); public: - VideoStream( const char *filename, const char *format, int bitrate, int frame_rate, int colours, int width, int height ); + VideoStream( const char *filename, const char *format, int bitrate, double frame_rate, int colours, int width, int height ); ~VideoStream(); const char *MimeType() const; void OpenStream(); diff --git a/src/zm_stream.cpp b/src/zm_stream.cpp index 0b9c45621..487477820 100644 --- a/src/zm_stream.cpp +++ b/src/zm_stream.cpp @@ -60,7 +60,7 @@ void StreamBase::updateFrameRate( double fps ) while( effective_fps > maxfps ) { effective_fps /= 2.0; - frame_mod *= 2.0; + frame_mod *= 2; } Debug( 3, "aEFPS:%.2f, aFM:%d", effective_fps, frame_mod ); }