cameralityviewfinder.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Copyright (c) 2010-2011 Nokia Corporation and/or its subsidiary(-ies).
  3. * All rights reserved.
  4. * This component and the accompanying materials are made available
  5. * under the terms of "Eclipse Public License v1.0"
  6. * which accompanies this distribution, and is available
  7. * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  8. *
  9. * Initial Contributors:
  10. * Nokia Corporation - initial contribution.
  11. *
  12. * Contributors:
  13. *
  14. * Description: Camerality viewfinder.
  15. *
  16. */
  17. #ifndef CAMERALITYVIEWFINDER_H_
  18. #define CAMERALITYVIEWFINDER_H_
  19. #include <ecam.h>
  20. #include <videorecorder.h>
  21. class MCameralityViewfinderObserver;
  22. /*!
  23. * CCameralityViewfinder class
  24. */
  25. class CCameralityViewfinder :
  26. public CBase,
  27. public MCameraObserver2,
  28. public MVideoRecorderUtilityObserver
  29. {
  30. public:
  31. enum TViewfinderState
  32. {
  33. EIdle,
  34. EReady,
  35. ERunning
  36. };
  37. enum TAspectRatio
  38. {
  39. ERatio4by3,
  40. ERatio16by9,
  41. ERatio11by9
  42. };
  43. public: // Public constructor and destructor
  44. static CCameralityViewfinder *NewL();
  45. virtual ~CCameralityViewfinder();
  46. public: // From MCameraObserver2
  47. virtual void HandleEvent(const TECAMEvent& aEvent);
  48. virtual void ViewFinderReady(MCameraBuffer& aCameraBuffer, TInt aError);
  49. virtual void ImageBufferReady(MCameraBuffer& aCameraBuffer, TInt aError);
  50. virtual void VideoBufferReady(MCameraBuffer& aCameraBuffer, TInt aError);
  51. public: // From MVideoRecorderUtilityObserver
  52. virtual void MvruoOpenComplete(TInt aError);
  53. virtual void MvruoPrepareComplete(TInt aError);
  54. virtual void MvruoRecordComplete(TInt aError);
  55. virtual void MvruoEvent(const TMMFEvent& aEvent);
  56. public: // New methods
  57. void SetObserver(MCameralityViewfinderObserver* aObserver);
  58. TViewfinderState State() const;
  59. void Start(RWindowBase& aWindow, TRect& aRect);
  60. void Stop();
  61. void Release();
  62. private:
  63. void SetState(TViewfinderState aState);
  64. TBool CheckError(TInt aError);
  65. void Initialize();
  66. void HintUseCase();
  67. void Open();
  68. void Prepare();
  69. void StartNow();
  70. void FindControllerL(TUid& controllerId,
  71. TUid& formatId);
  72. static TAspectRatio AspectRatio(const TSize& size);
  73. private:
  74. CCameralityViewfinder();
  75. void ConstructL();
  76. private:
  77. CCamera* iCamera;
  78. CVideoRecorderUtility* iVideoRecorder;
  79. MCameralityViewfinderObserver* iObserver;
  80. RWindowBase* iWindow;
  81. TRect iRect;
  82. TViewfinderState iState;
  83. };
  84. class MCameralityViewfinderObserver
  85. {
  86. public:
  87. virtual void ViewfinderStateChanged(
  88. CCameralityViewfinder::TViewfinderState oldState,
  89. CCameralityViewfinder::TViewfinderState newState) = 0;
  90. virtual void ViewfinderError(TInt error) = 0;
  91. };
  92. #endif /* CAMERALITYVIEWFINDER_H_ */
  93. // end of file