i
國 立 交 通 大 學
多媒體工程研究所
碩 士 論 文
Android
The System Porting and Implementation of a Multimedia Lecturing
Presentation Player under the Android Platform
ii
The System Porting and Implementation of a Multimedia Lecturing Presentation
Player under the Android Platform
Student: Shih-Ting Huang
Advisor: Dr. Deng-Jyi Chen
A Thesis
Submitted to Institute of Multimedia Engineering College of Computer Science
National Chiao Tung University in partial Fulfillment of the Requirements
for the Degree of Master
in
Computer Science
August 2010
i
Android
(eBooks) (Tablets) (Smart Phones)
YouTube iTunes (Mobile Learning) PC PC Android HTC Hero Android PC Android
ii
The System Porting and Implementation of a
Multimedia Lecturing Presentation Player under
the Android Platform
Student: Shih-Ting Huang
Advisor: Dr. Deng-Jyi Chen
Department of Multimedia Engineering National Chiao Tung University
Abstract
With the fast steps of Information Technology innovation, network infrastructure became universally available. With these Information Technology implemented mobile devices such as eBooks, Tablets and smartphones, information can now be accessed at anytime, anywhere. The devices we use to gain such access are now tagged indispensable.
At present time, there are already many digital multimedia service providers existing in the market. YouTube and iTunes are two of the many successful stories. With the implementation of the maturely designed architecture, these providers are able to grant their service users to access and enjoy the multimedia namely any where any time through their mobile devices. In this research, we will start with analyzing and discussing the architecture used by these service providers, then continued by the design of the architectures and how they are implemented on the various platforms. At last, how the combination of the two assist scholars and learners to achieve the objective of Mobile Learning through their mobile devices.
As the modern computers are generally featured with matured e-learning systems, these systems can therefore be modified and referenced to assist in the development of e-learning on mobile platforms. However, as the multimedia lecturing creation tools require a great computing capability which no mobile device possesses, we only ported the multimedia lecturing presentation player onto mobile devices. With the e-learning blog, users can have access to the lecturing content through internet.
In this research, we have designed a multimedia lecturing presentation player and implemented to the selected platform, Android and test it on HTC Hero. In this section, we will analyze and discuss the differences of system resource, programming language and the
iii
supportive libraries between the Android platform and the PC platform. We will also talk about the fine-toning processes such as context-aware content adaption mechanism and execution efficiency of the player, in attempt to present the PC platform made multimedia lecturing content on the Android platform through the player in a desired manner.
v ... i ... iv ... v ... vii ... viii ... 1 1.1 ... 1 1.2 ... 2 1.3 ... 3 1.4 ... 4 ... 5 2.1 Android ... 5 2.2 Linux Android ... 6 2.3 Android ... 6 2.4 DRM ... 7 2.5 ... 7 2.5.1 ... 8 2.5.2 ... 8 2.5.3 ... 9 ... 11 3.1 ... 11 3.2 ... 12 3.2.1 -- PC ... 12 3.2.2 -- PC Android ... 14 3.3 ... 15 3.4 ... 15 3.5 ... 17 3.6 ... 18 3.6.1 ... 18 3.5.3 ... 19 3.6 ... 21 ... 26 4.1 ... 26
vi 4.1.1 ... 26 4.1.2 ... 27 4.1.3 bst ... 28 4.1.4 bst ... 28 4.2 ... 29 4.2.1 ... 30 4.2.2 ... 30 4.2.3 ... 33 4.2.4 ... 34 4.3 DRM ... 36 4.4 ... 36 4.4.1 ... 37 4.4.2 ... 37 4.5 ... 39 4.5.1 ... 39 4.5.2 ... 41 4.5.3 ... 42 ... 44 5.1 ... 44 5.1.1 ... 44 5.1.2 ... 45 5.2 Windows ... 48 5.2.1 ... 48 5.2.2 ... 50 5.3 Android ... 51 5.3.1 ... 52 5.3.2 ... 54 5.3.3 ... 54 ... 57 6.1 ... 57 6.2 ... 57 ... 59
vii 1 ... 9 2 ... 11 3 ... 11 4 ... 12 5 ... 15 6 ... 16 7 ... 16 8 ... 19 9 C/C++ ... 20 10 Android API ... 20 11 Java ... 21 12 ... 35 13 ... 40 14 ... 41
viii 1 ... 1 2 ... 2 3 Android 7 9 10 ... 6 4 ( PC ) ... 13 5 ( PC Android ) ... 14 6 Linux ... 17 7 Android ... 17 8 ... 19 9 ... 21 10 ... 22 11 bst ... 23 12 ... 24 13 script ... 25 14 ... 26 15 ... 27 16 bst ... 28 17 bst ... 29 18 bst ... 30 19 XML -- ... 31 20 XML -- XML ... 31 21 a b bst ... 31 ... 32 ... 33 ... 33 26 ... 34 ... 34 27 ... 36 28 DRM Client ... 36 29 ... 37 30 ... 38 31 ... 39 32 -- ... 39 33 -- ... 40 34 ... 40 35 -- ... 41 36 -- ... 42
ix 37 -- ... 42 38 -- ... 42 39 -- ... 43 40 -- ... 44 41 -- ... 44 42 -- ... 45 43 -- ... 45 44 -- ... 46 45 -- ... 46 46 -- ... 46 47 -- ... 47 48 -- ... 47 49 -- ... 48 50 -- DRM ... 48 51 (Windows )-- ... 49 52 (Windows )--DRM ... 49 53 (Windows )-- ... 49 54 (Windows )-- ... 50 55 (Windows )-- ... 50 56 (Windows ... 51 57 (Android )— ... 51 58 (Android )— / ... 52 59 (Android )-- ... 52 60 (Android )--DRM ... 52 61: (Android )-- ... 53 62 (Android )-- ... 53 63 (Android )-- ... 53 64 (Android )-- ... 54 65 (Android )-- ... 54 66 (Android )-- . 54 67 (Android )-- ... 55 68 (Android )-- ... 55 69 (Android )-- ... 56 70 (Android )-- ... 56 71 ... 58
1
1.1
(eBooks) (Tablets) (Smart phones) YouTube iTunes facebook 1 YouTube YouTube iTunesiPhone iPod touch iTunes
iTunes store
1
2 (Mobile Learning) PC PC 2007 Google Android WinCE 6.0 PC
1.2
1 2 23 Windows Android WinCE 6.0 Android Windows Android ( )
1.3
Android Android4
1.4
(Electronic Learning; E-Learning) 1
(Mobile Learning; M-Learning) 2 3
(Smart
Phone) (PDA)
(Program Porting) 4 21
(Context-aware Content Adaptation) 5
(Context)
(Digital Rights Management; DRM) 6 DRM
5
2.1 Android
7 8 9Android 2007 Google
(Open Handset Alliance; OHA ) Android Android
Android
HTC Google MOTO SAMSUNG Sony Ericsson
Acer Android Android
Android Google Service
Android Android
7 9
Applications
email client, calendar, maps,
browser Java Application Framework Framework API Libraries C/C++ Android System Android Runtime Android Runtime Android Linux Kernel Android Linux 2.6
6
3 Android 7 9 10
2.2 Linux
Android
Linux GNOME KDE Android
Linux 2.6 3
GNOME 9 10
GNOME GTK+ 11
glibc gstreamer Android GTK+ glibc
Andoird Bionic Libc C Library glibc glibc
Bionic Libc 9
1. BSD License glibc GPL License
2. 200k glibc glibc
3. pthread
4. Android :LOGI
Bionic Libc glibc Linux
C++
7 STLport 12
STLport ANSI C++
libutils 9
libutils Android C++ Android
libutils Process zlib 9 13 zlib zlib Linux Libxml2 14
Libxml2 C XML Gnome project
MIT License C C++
PHP Linux, Unix, Windows,
MacOS
JNI 9 15
Java Native Interface Java Android
Java application native code
2.4 DRM
DRM(Digital Rights Managment) 6
DRM 6 Content Server Content
Content Content DRM
License Server License License Server
Content
Content Devices DRM DRM
License
License Server DRM Server Content
DRM Server Devices
DRM Server Content
8 (Content adaptation)
2.5.1
(Context) 16 17 18 19 (Context-aware) 16 19 (Context) ( ) CPU codec ( )
2.5.2
16 21 (static) (dynamic)9 16 22 (Server-based adaptation) (Client-based adaptation) (Proxy-based adaptation) CPU ( )
2.5.3
20 21 110 1024*768 HTC Hero 480*320 X, Y 0 < X < 720, 0 < Y < 540 X’, Y’ 0 <X’<480, 0 < Y’ < 320 X’= X*(480/720) Y’= Y * ( 320 / 540 )
11 Windows Windows ; Android
3.1
Windows 24 25 26 20 2 (350KB) 312 4 PowerPoint 3.3 DRM 3.3 DRM Windows
Linux 21 23 Android Linux 2.6
Linux Android
3.2
PC Android
3.2.1
--
PC
13 4 ( PC ) 1. PowerPoint PDF 2. 3. DRM server 4. ( ) 1. 2. DRM DRM server 3. ( ) 1. IE 2. 3. 4.
14 5. DRM DRM server 6.
3.2.2
--
PC
Android
5 ( PC Android ) PC ( ) 1. 2. 3. DRM DRM server 4. ( ) 1. 2. 3. 4. 5. DRM DRM server 6.15
3.3
Android 1.5 HTC hero
CPU
Android Unicode Windows
Android Linux Windows
5
3.4
Windows 616 DRM DRM DRM Http get method
ActiveX Internet Explorer 6 Linux Android Linux / Windows ? Linux ? Android ? / DRM DRM ActiveX Internet Explorer Firefox Plugin Mozilla Firefox WebKit 7
17
3.5
Android Linux Linux Android 6 Linux Android 7 AndroidAndroid Mozilla Firefox Plugin
Web View Client XML Writer
18 File Selector
Local File Selector Web File Selector
Network PlaySystem XML UI UI Presentation ResourceFile Parser XML XML XML parser XML
Media Extractor Presentation Presentation Presentation Presentation Thread Network Download Scheduler HTTP Connection DRM Client DRM DRM Client UI
DRM Client authentication DRM Server DRM
3.6
3.6.1
Android Java C/C++ JNI(Java native
19
9 15
Java Eclipse
Application Framework API
C/C++ Dalvik Virtual Machine
Windows Linux Android
C++ C/C++ C/C++ Java
BCB6 GTK+ NDK Eclipse + Android
SDK 8
Linux C/C++
Android Linux GTK (GIMP ToolKit)
10 11 Firefox Plugin Android API UI
reuse C/C++ C/C++
Java Android API
3.5.3
20 ( ) C/C++ Android Windows BCB VC Linux C++ BCB VC 22 Android Bionic C C++ Platform Component
Windows Linux Android
Extra include Standard C++ Library No need No need STLport
Unicode Processing TTntString Glib utils
XML DOM Model XMLDOC LIBXML2 LIBXML2
ZIP decompress Processing zlib zlib zlib
Communication between C++ and Java programs No need No need JNI 9 C/C++
C++ STLport ndroid
STLport wstring wchar ndroid
libutils String16 char16 JNI Java
XML LIBXML2 zlib
( )Java
Java ndroid API
Android API
10 Android API
21
ndroid Flash HTC Hero
SWF Android API 11 11 Java 9 Windows Android Windows CE Linux 20 21 23 27 9
3.6
22 Windows Powerpoint (*.bst) bst publish.xml
: teacher.png index.htm lecturing.js teacher.png index.htm lecturing.js publish.xml bst 10 publish.xml publish.xml 1. 2. 3. 4. bst 5. DRM DRM DRM Server IP Course ID bst bst DRM bst
23 11 bst bst bst 1. Triple-DES DRM Server DRM
Triple-DES Key Key bst
DRM DRM Server DRM
publish.xml
2. Default Key
DRM Default
Key bst
Triple-DES (Symmetric Encryption
Algorithm)
1. DRM Server
publish.xml DRM DRM
Server
2. Default Key
publish.xml DRM Default Key
Default Key (SceneGraph)
24 PTT ( : ) PPTXML PPTXML ( : ) bst 12 0.01 Script Script 0.01
25 13 script 1. 2. / 3. / / 4. /
26 1. bst 2. DRM DRM Server 3.
4.1
bst bst bst bst bst4.1.1
14 1. 2. bst 3. bst publish.xml publish.xml bst bst bst27
4. publish.xml publish.xml publish.xml
DRM bst
5. DRM DRM
bst
6. DRM
DRM server Decoding Key
bst
4.1.2
15 1. 2. 3. publish.xml URL publish.xml 4. publish.xml bst 5. publish.xml publish.xml DRM DRM bst bst bst28 6. DRM Decoding Key bst bst
4.1.3 bst
bst 16 bst bst bst bst bst bst bst4.1.4 bst
bst bst bst bst bst bst bst29 bst bst bst thread bst bst bst bst bst bst 4.4.1
4.2
bst bst 17 bst 1. ResourceFile bst 2. XMLMedia Extractor Database 3. Presentation
30
5. Presentation Drawing Database
6.
4.2.1
bst bst 3.6 bst bst 18 bst 1. 2. Triple-DES 3. zlib ZIP XML bst XML WindowsWindows unicode UTF-16 Android unicode
UTF-8 unicode Android libutils
String16 UTF-16 unicode
31 1. XML Parser XML 2. XML Writer XML 3. Media Extractor XML Media Extractor : publish.xml PTTXML script 19 XML --XML Info XML : 20 XML -- XML XML Parser XML Writer
Linux Libxml2 Windows XMLDOC
XMLDOC Linux 22 Media Extractor : publish.xml PPTXML script 1. publish.xml bst publish.xml map TrackFileNames bst 21 a b bst (a) (b)
32 2. CSceneGraph (CActor) vector m_ImageFileName Key 21 3. script
Script CScriptSystem vector
script
CScriptAction Time Action Parameters 22 … class CActor { public: // string ActorName; string m_ImageFileName; // shape int m_X; int m_Y; int m_Width; int m_Height; ... }; class CSceneGraph { public: bool Visible; // string m_SceneName; int m_Width; int m_Height; int m_BackgroundColor; // int m_ActorIndex; vector<CActor *> m_ActorList; ... }; struct BufferInfo{ unsigned long size;// guchar *buffer;// };
class cmap:public map< string, BufferInfo >{
// Key MAP
public:
~cmap(){// ...} };
33
4.2.3
Windows 720*540 HTC Hero 480*320 ( / ) ( / ) W*H Windows 720*540 X,Y 0<X<720,0<Y<540 Android W*H X’,Y’ 0<X’<W, 0<Y’<H X’= X* W /720 Y’= Y* H /540 class CScriptAction { public:unsigned long Time; string Action; vector<string> Parameters; ... }; }; class CScriptSystem {
unsigned long m_TotalScriptTime; // std::vector<CScriptAction> Actions; // vector item std::vector<CScriptAction>::iterator NowAction; ... }; (0,0) (X,Y) (0,0) (X’,Y’)
34 android.graphics OriWidth OriHeight NewWidth NewHeight NewWidth = OriWidth*W/720 NewHeight = OriHeight*H/540
4.2.4
Drawing Module Audio
Module
Drawing Module
Java android.graphics Linux GDK
26 26 NewWidth NewHeight OriWidth OriHeight
35 Media Extractor 1. Media Extractor 4.2.2 22 Original PTT Bitmap 2. 23 12 Function name Canvas.drawLine Canvas.drawLine Canvas.drawText Canvas.drawLine Canvas.drawPath - / / Canvas.drawOval Canvas.drawRect 12 3. script info. Bitmap
36 27
4.3 DRM
DRM publish.xml bst publish.xml DRM DRM Client DRM Client DRM Server 28 DRM Client 1.2. publish.xml DRM Server IP Course ID
DRM Server
3. DRM Server XML
4. DRM server XML Decoding Key
5.
37
4.4.1
Web File Selector
publish.xml
Android WebView
WebView java script function call
29 WebView function call publish.xml URL WebView Lecturing.js
click function publish.xml URL
WebView WebView
4.4.2
bst Content Server 23 HTTP GET38 29 30 publish.xml table (1) bst bst (2) Domain Name IP IP
Domain Name server IP
(3) table thread bst bst Main routine thread 001-bst.bst -> 002-bst.bst -> 003-bst.bst -> 004-bst.bst thread 001-bst.bst 003-bst.bst thread 004-bst.bst 31
39 31
4.5
CPU
Presentation module Drawing Module Audio Module
(1) Drawing Module (2) Audio Module
4.5.1
Linux Android Linux 0.1 (PlayingTime) 0.1 32 --Android 1340 13 CPU 0.14 0.1 CPU 0.166 PlayingTime 0.1 PlayingTime 33 33 --0.1 34 PlayingTime System.currentTimeMillis() firstTimePoint pauseTimePeriod
41 pauseTimePeriod bst 0.175 14 14 bst Tend PlayingTime Tn PlayingTime Tn Tn-1~Tn Tn-1 Tend Tn Tn-1~Tn Tend Tn bst
4.5.2
CPU Android 35 --BeginFluoropen OnFluoropenBitmap Android API
Android Bitmap Multiply
42
36 (pre_x, pre_y)
(cur_x, cur_y)
36
--37
(pre_x, pre_y) (cur_x, cur_y) (paintSize) (left, top) (right, bottom)
37
--4.5.3
10 bst 38 38--43
--44
5.1
5.1.1
1. 3.3 [ ]->[ ] 40 --2. [ ] 41--45 3. 42
--5.1.2
1. [ ] 43 --1.46 44 --2. 45 --4. 46
--47 4. 47 --5. 48 --1.
48 49 --2. DRM DRM DRM [ ] 50 -- DRM
5.2 Windows
5.2.1
1. bst49 51 (Windows )--2. DRM 3 52 (Windows )--DRM 3. ? [ ] [ ] 53 (Windows
)--50 54 (Windows
)--5.2.2
1. IE 55 (Windows )--2.51 56 (Windows )--3. DRM
5.3 Android
1. 57 (Android )— 2.52 58 (Android )— /
5.3.1
1. bst 59 (Android )--2. DRM 5 60 (Android )--DRM 5. ? [ ] [ ]53 61: (Android )--6. 62 (Android )--7. 63 (Android )--8.
54 64 (Android
)--5.3.2
1. 2. 65 (Android )--3. 66 (Android )--4. DRM5.3.3
55 [menu] 67 (Android )--/ [HIDE] [ ] 68 (Android )--[ ]
56
69 (Android
)--[ ]
)--57
6.1
Android Android 1. 2. Android CPU 1. Timmer 2. 3. Android6.2
Android WMV Flash Content Server58 71 ( ) ( )
59
1 1-2
2003
2 C. Quinn, "mLearning: Mobile, Wireless, In-Your-Pocket Learning," 2000.
3 Mobile e-learning
2004 2004
4 J.D. Mooney, "Strategies for Supporting Application Portability," IEEE Computer, vol.23, issue 11, p. 59-70, Nov. 1990.
5 B. Vitor, T. A. Maria, "Context-Aware Content Adaptation: Standards and Research Trends," 2009,
http://www.visnet-noe.org/pdf/V_Barbosa-and-M_T_Andrade.pdf
6 S. R. Subramanya, B. K. Yi, "Digital rights management," IEEE Potential, 25(2): 31–34, March/April 2006.
7 Android|Official Website, http://www.android.com/
8 Open handset alliance, http://www.openhandsetalliance.com/ 9 Android developers, http://developer.android.com/index.html
10 Walkingice, "How Android Differs from GNU/Linux?" COSCUP, 2009. http://walkingice.twbbs.org/~walkingice/files/document/coscup_2009_walki ngice.pdf
11 GTK+, http://www.gtk.org/ 12 STLport, http://www.stlport.org/ 13 zlib, http://www.zlib.net/
14 The XML C parser and toolkit of Gnome, http://www.xmlsoft.org/ 15 Java Native Interface: Programmer's Guide and Specification,
http://java.sun.com/docs/books/jni/download/jni.pdf
16
-2006
17 A. K. Dey, G. D. Abowd, "Towards a Better Understanding of Context and Context-Awareness," Technical Report GIT-GVU-99-22,1999.
18 A. Celentano, O. Gaggi, "Context-aware design of adaptable multimodal documents, "2004.
19 A. K. Dey, "Understanding and Using Context," In Personal and Ubiquitous Computing Journal 5(1), p. 4 7, 2001.
20 PDA
2007
21 Linux -
60
22 Z. Lei, N. D. Georganas, "Context-based Media Adaptation in Pervasive Computing," Proc. of Canadian Conference on Electrical and Computer Engineering, 2001. 23 Linux - 2008 24 PowerCam 5 http://www.powercam.com.tw/ 25 4.0 http://tw.cyberlink.com/ 26 3.3 http://www.caidiy.com/ 27 WinCE 6.0 2010