equal
deleted
inserted
replaced
28 |
28 |
29 namespace |
29 namespace |
30 { |
30 { |
31 // Unit is milliseconds |
31 // Unit is milliseconds |
32 static const int CXENGINE_ELAPSED_TIME_TIMEOUT = 1000; // 1 second |
32 static const int CXENGINE_ELAPSED_TIME_TIMEOUT = 1000; // 1 second |
|
33 static const int VIEWFINDER_START_TIMEOUT = 500; // 0.5 second |
33 |
34 |
34 // Unit is seconds |
35 // Unit is seconds |
35 static const int CXENGINE_MAXIMUM_VIDEO_TIME = 90*60; // 90 minutes |
36 static const int CXENGINE_MAXIMUM_VIDEO_TIME = 90*60; // 90 minutes |
36 } |
37 } |
37 |
38 |
58 CX_DEBUG_ENTER_FUNCTION(); |
59 CX_DEBUG_ENTER_FUNCTION(); |
59 |
60 |
60 qRegisterMetaType<CxeVideoCaptureControl::State> (); |
61 qRegisterMetaType<CxeVideoCaptureControl::State> (); |
61 initializeStates(); |
62 initializeStates(); |
62 setupElapseTimer(); |
63 setupElapseTimer(); |
|
64 |
|
65 mViewFinderStartTimer.setSingleShot(true); |
|
66 mViewFinderStartTimer.setInterval(VIEWFINDER_START_TIMEOUT); |
|
67 connect(&mViewFinderStartTimer, SIGNAL(timeout()), this, SLOT(startViewfinder())); |
|
68 |
63 CX_DEBUG_EXIT_FUNCTION(); |
69 CX_DEBUG_EXIT_FUNCTION(); |
64 } |
70 } |
65 |
71 |
66 |
72 |
67 /*! |
73 /*! |
106 if (state() == Idle) { |
112 if (state() == Idle) { |
107 // nothing to do |
113 // nothing to do |
108 CX_DEBUG_EXIT_FUNCTION(); |
114 CX_DEBUG_EXIT_FUNCTION(); |
109 return; |
115 return; |
110 } |
116 } |
|
117 |
|
118 mViewFinderStartTimer.stop(); |
|
119 mViewfinderControl.stop(); |
|
120 |
111 // stop video-recording in-case if its ongoing. |
121 // stop video-recording in-case if its ongoing. |
112 stop(); |
122 stop(); |
113 |
123 |
114 setState(Idle); |
124 setState(Idle); |
115 |
125 |
222 if (!err) { |
232 if (!err) { |
223 // prepare zoom only when there are no errors during prepare. |
233 // prepare zoom only when there are no errors during prepare. |
224 emit prepareZoomForVideo(); |
234 emit prepareZoomForVideo(); |
225 } |
235 } |
226 |
236 |
227 mViewfinderControl.start(); |
237 // Start viewfinder with delay. |
|
238 mViewFinderStartTimer.start(); |
228 setState(Ready); |
239 setState(Ready); |
229 |
240 |
230 // emit video prepare status |
241 // emit video prepare status |
231 emit videoPrepareComplete(CxeError::None); |
242 emit videoPrepareComplete(CxeError::None); |
232 |
243 |
317 |
328 |
318 /*! |
329 /*! |
319 * @Return current video snapshot |
330 * @Return current video snapshot |
320 */ |
331 */ |
321 QPixmap CxeVideoCaptureControlDesktop::snapshot() const |
332 QPixmap CxeVideoCaptureControlDesktop::snapshot() const |
322 { |
333 { |
323 return mSnapshot; |
334 return mSnapshot; |
324 } |
335 } |
325 |
336 |
326 /*! |
337 /*! |
327 * @Return QList of all supported video quality details based on the camera index |
338 * @Return QList of all supported video quality details based on the camera index |
339 { |
350 { |
340 CX_DEBUG_ENTER_FUNCTION(); |
351 CX_DEBUG_ENTER_FUNCTION(); |
341 |
352 |
342 if (state() == Ready || state() == Paused) { |
353 if (state() == Ready || state() == Paused) { |
343 //we skip the playing of the sound in the desktop state for now |
354 //we skip the playing of the sound in the desktop state for now |
344 setState(Recording); |
355 setState(Recording); |
345 mRecordElapseTimer.start(); |
356 mRecordElapseTimer.start(); |
346 } |
357 } |
347 |
358 |
348 CX_DEBUG_EXIT_FUNCTION(); |
359 CX_DEBUG_EXIT_FUNCTION(); |
349 } |
360 } |
371 { |
382 { |
372 CX_DEBUG_ENTER_FUNCTION(); |
383 CX_DEBUG_ENTER_FUNCTION(); |
373 |
384 |
374 if (state() == Recording || state() == Paused) { |
385 if (state() == Recording || state() == Paused) { |
375 mFilenameGenerator.raiseCounterValue(); |
386 mFilenameGenerator.raiseCounterValue(); |
376 } |
387 |
377 |
388 mRecordElapseTimer.stop(); |
378 mViewfinderControl.stop(); |
389 mElapsedTime = 0; |
379 mRecordElapseTimer.stop(); |
390 |
380 mElapsedTime = 0; |
391 setState(Stopping); |
381 |
392 setState(Initialized); |
382 setState(Stopping); |
393 } |
383 setState(Initialized); |
|
384 |
394 |
385 CX_DEBUG_EXIT_FUNCTION(); |
395 CX_DEBUG_EXIT_FUNCTION(); |
386 } |
396 } |
387 |
397 |
388 |
398 |
539 mElapsedTime++; |
549 mElapsedTime++; |
540 |
550 |
541 CX_DEBUG( ("CxeVideoCaptureControlDesktop::handleElapseTimeout() <> mElapsedTime: %d", mElapsedTime ) ); |
551 CX_DEBUG( ("CxeVideoCaptureControlDesktop::handleElapseTimeout() <> mElapsedTime: %d", mElapsedTime ) ); |
542 } |
552 } |
543 |
553 |
|
554 /*! |
|
555 * Slot for starting viewfinder after a delay. |
|
556 * Delay helps viewfinder widget to find the right, visible transparent window to attach to. |
|
557 */ |
|
558 void CxeVideoCaptureControlDesktop::startViewfinder() |
|
559 { |
|
560 CX_DEBUG_ENTER_FUNCTION(); |
|
561 mViewfinderControl.start(); |
|
562 CX_DEBUG_EXIT_FUNCTION(); |
|
563 } |
|
564 |
|
565 |
544 void CxeVideoCaptureControlDesktop::setState(CxeVideoCaptureControl::State stateId, CxeError::Id error) |
566 void CxeVideoCaptureControlDesktop::setState(CxeVideoCaptureControl::State stateId, CxeError::Id error) |
545 { |
567 { |
546 mState = stateId; |
568 mState = stateId; |
547 CX_DEBUG( ("CxeVideoCaptureControlDesktop::setState <> mState: %d", mState ) ); |
569 CX_DEBUG( ("CxeVideoCaptureControlDesktop::setState <> mState: %d", mState ) ); |
548 emit stateChanged(mState, error); |
570 emit stateChanged(mState, error); |