顯示具有 Symbian 標籤的文章。 顯示所有文章
顯示具有 Symbian 標籤的文章。 顯示所有文章

2007年12月10日 星期一

【Symbian】改變錄影格式

在Nokia官網裡提供的錄影程式,預設是使用QCIF(176x144)錄影,解析度似乎低了些,加入及修改下述的程式片段來提高錄影的品質。

使用mp4格式,CIF(352x288)
_LIT8(KMimeTypeMPEG4VSPL3, "video/mp4v-es; profile-level-id=3");
使用mp4格式,CIF(640x480, 30 fps, Nokia N95 & N93Support)
_LIT8(KMimeTypeMPEG4VSPL4, "video/mp4v-es; profile-level-id=4");
在程式片段中,在寫入檔案的部份要定義格式
iUtility->OpenFileL( iFilename,
iCameraHandle,
iControllerUid,
iFormatUid,
KMimeTypeMPEG4VSPL4);
在Prepare()之前,必需要錄影格式設定好
TRAP_IGNORE( iUtility->SetVideoFrameSizeL( iUtility ));
TRAP_IGNORE( iUtility->SetVideoBitRateL( KMMFVariableVideoBitRate ));
......
iUtility->Prepare();

2007年11月22日 星期四

Naming Conventions for Symbian

最近比賽告一段落了,要開始學習Symbian的學習,發現....還蠻多東西要看的,像是基本的Coding conventions更為重要啊。以下是在Symbain上Coding時需要注意的convention:

(此資料轉載於Blue119's blog)

Function Convention

  • Trailing "D" indicates the deletion of an object
  • Trailing "L" means function may leave
  • Trailing "C" means an item is placed on the cleanup stack

-------------------------------------------

Variable Convention

  • Member variables' names begin with 'i'
  • Arguments' names begin with 'a'
  • Automatics' (local variables) names have no initial letter, but start in lower case
  • Constants' names begin with 'K'
  • Global variables are usually avoided, but when used, their names begin with a capital letter.

-----------------------------------

Class Convention

'T' Classes

  • Classes that don't own external objects/resources and so can be declared on the stack 'T'types contain their value.
  • They do not own any external object, either directly (by pointer) or indirectly (by handle).
  • they do not need a destructor to cleanup resources.
  • 'T' types may be allocated either on the stack (that is locally as C++ automatic variables) or as members of other classes.
  • note that the default stack size is 8KB in Symbian OS.
  • Structure types mostly begin with 'T'.
'C' Classes
If a class needs to dynamically allocate any memory or own another class, it should derive, directly or indirectly, from CBase (a built-in Symbian OS class), and its class name should begin with 'C'. CBase-derived classes have the following properties:
  • They are allocated on the heap (dynamically allocated) — not on the stack, and not as members of other classes.
  • The allocator used for this class hierarchy initializes all member data to binary zeroes.
  • They are passed by pointer, or reference, and so do not need an explicit copy constructor or assignment operator unless there is clear intention that a particular class supports copying.
  • They have a virtual destructor, which is used for standard cleanup processing.
  • They support two-phased construction – this will be covered later in the section.
'R' Classes
These classes are used to access system resources, for example files, via handles. The following are characteristics of ‘R’ classes:
  • They contain a handle that is used to pass on requests to other objects.
  • They are opened using an "Open()" function particular to the ‘R’ class, and closed using a "Close()" function particular to the class. An ‘R’ object must be closed once if it has been opened.
  • They may be freely bit-wise copied.
  • They have no explicit constructor, destructor, copy constructor or assignment operator.
'M' Classes
Characteristic:
  • Abstract
  • Pure virtual functions
  • No member data
Purpose:
  • define an interface
Advantage:
  • reduce dependencies between classes
Rule:
  • the only use of multiple inheritance
  • A C class derive from one other C class and zero or more M classes
'M'classes have the following restrictions:
  • They should contain no member data.
  • They should not contain constructors or destructors, or overloaded operators.
'M' classes usually contain pure virtual functions that define a fully abstract interface.

轉載自Blue119's blog:Symbian Coding Conventions:Class

2007年9月29日 星期六

Symbian C++第一次的接觸

因為計劃的關係,要開始接觸從大學時就想玩的Symbian C++程式開發。
開始前必須要先把環境set up起來,所以開始找尋開發相關的資料,直接從google下手?當然不嘍,直接前往Forum Nokia,就可以找到Series 60 SDK Tools,裡面的資料相當的豐富,甚至develop documents也相當的多。

如果要使用Symbian C++作為開發工具必須要先安裝好開發環境,在Forum Nokia網站中,可以發現目前Nokia兩大主要的平台:

Series 40
└以低階切入市場,所以Series 40 platforms推出的手機價格約在2000~8000左右。在開發方面,Series 40只提供使用者J2ME develop,目前Series 40已經更新到5th Edition。
Series 60
└主要提供高階市場使用,有較完善的軟體支援與開發工具。除了提供J2ME develop之外,在Forum Nokia網站中,可以下載到Series 60 Symbian C++2的developments Tools and SDKs,使用者可以直接使用Symbian OS API撰寫Series 60上的程式。

以上為Nokia主推的Symbian platforms。當然,Symbian platforms不只有以上兩種,Nokia早期時還有Series 80(Nokia 9210),另外也有SonyEricsson主推的Symbian UIQ platforms(p800, p900)。

下圖為Series platform structure


--------------------------------------------------------------------------------------------

在這次的計劃中,主要是使用Series 60 platforms,並利用C++進行開發,當然對我而言是一個新的挑戰,畢竟之前沒有摸過C++與MFC,所以可能需要花一點時間在基本工上。

下載開發工具
需下載之工具
└ IDE開發工具(MS Visual Studio .NET或Carbide C++)
└ S60 Platform SDKs for Symbian OS, for C++
└ ActivePerl (http://www.activestate.com/)

直接連上Forum Nokia(http://www.forum.nokia.com/)下載工具,在網頁左邊Menu選單可以看到Platforms,點選後可以選擇Series 40 & 60 platforms。在下載SDKs前,必需要先選定所要開始的IDE工具,可以使用MS Visual Studio .NET進行開發(請下載Carbide.vs),或是使用Carbide C++工具進行開發(很像Eclipse IDE)。

在這邊我直接使用Carbide C++進行開發。

安裝流程
1. S60 Platform SDKs for Symbian OS, for C++
2. ActivePerl
3. Carbide C++
4. 重開機

重開機完成後,直接執行Carbide C++,第一次執行時,會詢問設定workspaces,就依照自己的習慣設定吧。

(Carbide C++ IDE畫面)