From 032420beb2dac9059fef87fcaf32ef04649be5a7 Mon Sep 17 00:00:00 2001 From: Isaac Isaac Date: Tue, 9 Feb 2021 13:16:19 -0500 Subject: [PATCH] Don't need to init mVideoStream etc as they are done in Camera(). Set stream_index in packet. --- src/zm_local_camera.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/zm_local_camera.cpp b/src/zm_local_camera.cpp index ba626f106..9881b50f6 100644 --- a/src/zm_local_camera.cpp +++ b/src/zm_local_camera.cpp @@ -318,15 +318,15 @@ LocalCamera::LocalCamera( int p_hue, int p_colour, bool p_capture, - bool p_record_audio, + bool p_record_audio, unsigned int p_extras) : - Camera( monitor, LOCAL_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture, p_record_audio ), - device( p_device ), - channel( p_channel ), - standard( p_standard ), - palette( p_palette ), - channel_index( 0 ), - extras ( p_extras ) + Camera(monitor, LOCAL_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture, p_record_audio), + device(p_device), + channel(p_channel), + standard(p_standard), + palette(p_palette), + channel_index(0), + extras(p_extras) { // If we are the first, or only, input on this device then // do the initial opening etc @@ -337,7 +337,7 @@ LocalCamera::LocalCamera( if ( capture ) { if ( device_prime ) { - Debug( 2, "V4L support enabled, using V4L%d api", v4l_version ); + Debug(2, "V4L support enabled, using V4L%d api", v4l_version); } if ( !last_camera || channel != last_camera->channel ) { @@ -356,10 +356,10 @@ LocalCamera::LocalCamera( uint32_t checkval = 0xAABBCCDD; if ( *(unsigned char*)&checkval == 0xDD ) { BigEndian = 0; - Debug(2,"little-endian processor detected"); + Debug(2, "little-endian processor detected"); } else if ( *(unsigned char*)&checkval == 0xAA ) { BigEndian = 1; - Debug(2,"Big-endian processor detected"); + Debug(2, "Big-endian processor detected"); } else { Error("Unable to detect the processor's endianness. Assuming little-endian."); BigEndian = 0; @@ -676,9 +676,6 @@ LocalCamera::LocalCamera( imgConversionContext = nullptr; } // end if capture and conversion_tye == swscale #endif - mVideoStreamId = 0; - mAudioStreamId = -1; - mVideoStream = nullptr; } // end LocalCamera::LocalCamera LocalCamera::~LocalCamera() { @@ -2175,6 +2172,7 @@ int LocalCamera::Capture(ZMPacket &zm_packet) { zm_packet.image->Assign(width, height, colours, subpixelorder, buffer, imagesize); } // end if doing conversion or not + zm_packet.packet.stream_index = mVideoStreamId; zm_packet.codec_type = AVMEDIA_TYPE_VIDEO; zm_packet.keyframe = 1; return 1;