@@ -36,8 +36,7 @@ CameraDevice::CameraDevice()
36
36
{
37
37
InitializeCameraDevice ();
38
38
39
- // set up the different modules/components
40
- mCameraAVStreamManager .Init ();
39
+ InitializeStreams ();
41
40
}
42
41
43
42
CameraDevice::~CameraDevice ()
@@ -76,6 +75,8 @@ CameraError CameraDevice::InitializeStreams()
76
75
InitializeAudioStreams ();
77
76
InitializeSnapshotStreams ();
78
77
78
+ StartVideoStream (1 );
79
+ StartSnapshotStream (1 );
79
80
return CameraError::SUCCESS;
80
81
}
81
82
@@ -184,7 +185,7 @@ GstElement* CameraDevice::CreatePipeline(const std::string & pipelineString, Cam
184
185
}
185
186
186
187
// Helper function to set V4L2 control
187
- CameraError CameraDevice::SetV4l2Control (int controlId, int value)
188
+ CameraError CameraDevice::SetV4l2Control (uint32_t controlId, int value)
188
189
{
189
190
if (videoDeviceFd == -1 )
190
191
{
@@ -230,7 +231,7 @@ CameraError CameraDevice::StartVideoStream(uint16_t streamID)
230
231
231
232
if (it->codec == VideoCodecEnum::kH264 )
232
233
{
233
- pipelineString += " x264enc ! rtph264pay ! " ;
234
+ pipelineString += " videoconvert ! videoscale ! x264enc tune=zerolatency ! rtph264pay ! " ;
234
235
}
235
236
else if (it->codec == VideoCodecEnum::kHevc )
236
237
{
@@ -241,7 +242,8 @@ CameraError CameraDevice::StartVideoStream(uint16_t streamID)
241
242
return CameraError::ERROR_VIDEO_STREAM_START_FAILED;
242
243
}
243
244
244
- pipelineString += " udpsink host=127.0.0.1 port=" + VIDEO_STREAM_GST_DEST_PORT; // Known socket
245
+ // pipelineString += "udpsink host=127.0.0.1 port=" + VIDEO_STREAM_GST_DEST_PORT; // Known socket
246
+ pipelineString += " udpsink host=127.0.0.1 port=5000" ; // Known socket
245
247
246
248
CameraError error = CameraError::SUCCESS;
247
249
it->videoPipeline = CreatePipeline (pipelineString, error);
@@ -298,10 +300,12 @@ CameraError CameraDevice::StartSnapshotStream(uint16_t streamID)
298
300
return CameraError::ERROR_SNAPSHOT_STREAM_START_FAILED;
299
301
}
300
302
303
+ #if 0
301
304
// Construct the GStreamer pipeline string
302
305
std::string pipelineString = "v4l2src device=/dev/video0 ! "
303
- " video/x-raw,width=" + std::to_string (it->videoRes .width ) +
304
- " ,height=" + std::to_string (it->videoRes .height ) + " ! " ;
306
+ //"video/x-raw,width=" + std::to_string(it->videoRes.width) +
307
+ "image/jpeg,width=" + std::to_string(it->videoRes.width) +
308
+ ",height=" + std::to_string(it->videoRes.height) + ",framerate=1/1 ! ";
305
309
306
310
if (it->codec == ImageCodecEnum::kJpeg)
307
311
{
@@ -311,7 +315,9 @@ CameraError CameraDevice::StartSnapshotStream(uint16_t streamID)
311
315
{
312
316
return CameraError::ERROR_SNAPSHOT_STREAM_START_FAILED;
313
317
}
318
+ #endif
314
319
320
+ std::string pipelineString = " v4l2src device=/dev/video0 ! videoconvert ! jpegenc snapshot=true ! " ;
315
321
pipelineString += " filesink location=./capture_snapshot.jpg" ;
316
322
317
323
// Create the GStreamer pipeline
0 commit comments