1. Google's libjingle, multiple threads, signal/slot, event loop, sockets in NDK.
2. NanoHTTPD, building web server
这个是它自己的结构:
Filename | Size | Rev | Date | Author |
---|---|---|---|---|
CameraView.java | 5.3 KB | r58 | Feb 24, 2012 | achang.zhou |
MainActivity.java | 11.3 KB | r55 | Feb 5, 2012 | achang.zhou |
NanoHTTPD.java | 33.1 KB | r60 | Mar 19, 2012 | achang.zhou |
NativeAgent.java | 1.3 KB | r47 | Jan 29, 2012 | achang.zhou |
NetInfoAdapter.java | 4.5 KB | r17 | Dec 25, 2011 | achang.zhou |
StreamingLoop.java | 1.9 KB | r40 | Jan 16, 2012 | achang.zhou |
StreamingServer.java | 2.3 KB | r51 | Jan 30, 2012 | achang.zhou |
Camera.open()
to get an instance of the camera object.SurfaceView
to the camera usingCamera.setPreviewDisplay()
.Camera.startPreview()
to begin displaying the live camera images.MediaRecorder
by calling Camera.unlock()
.MediaRecorder
methods in this order. For more information, see the MediaRecorder
reference documentation.
setCamera()
- Set the camera to be used for video capture, use your application's current instance ofCamera
.setAudioSource()
- Set the audio source, use MediaRecorder.AudioSource.CAMCORDER
.setVideoSource()
- Set the video source, use MediaRecorder.VideoSource.CAMERA
.MediaRecorder.setProfile
method, and get a profile instance using CamcorderProfile.get()
. For versions of Android prior to 2.2, you must set the video output format and encoding parameters:
setOutputFormat()
- Set the output format, specify the default setting orMediaRecorder.OutputFormat.MPEG_4
.setAudioEncoder()
- Set the sound encoding type, specify the default setting orMediaRecorder.AudioEncoder.AMR_NB
.setVideoEncoder()
- Set the video encoding type, specify the default setting orMediaRecorder.VideoEncoder.MPEG_4_SP
.setOutputFile()
- Set the output file, usegetOutputMediaFile(MEDIA_TYPE_VIDEO).toString()
from the example method in the Saving Media Files section.setPreviewDisplay()
- Specify the SurfaceView
preview layout element for your application. Use the same object you specified for Connect Preview. Caution: You must call these MediaRecorder
configuration methods in this order, otherwise your application will encounter errors and the recording will fail.
MediaRecorder
with provided configuration settings by callingMediaRecorder.prepare()
.MediaRecorder.start()
.MediaRecorder.stop()
.MediaRecorder.reset()
.MediaRecorder
by calling MediaRecorder.release()
.MediaRecorder
sessions can use it by callingCamera.lock()
. Starting with Android 4.0 (API level 14), this call is not required unless theMediaRecorder.prepare()
call fails.Camera.stopPreview()
.Camera.release()
.
Libjingle ships with two command-line sample applications:
class Switch { public: signal0<> Clicked; }; class Light : public has_slots<> { public: void ToggleState(); void TurnOn(); void TurnOff(); }; Switch sw1, sw2; Light lp1, lp2;
Switch sw3, sw4, all_on, all_off; Light lp3, lp4; sw3.Clicked.connect(&lp3, &Light::ToggleState); sw4.Clicked.connect(&lp4, &Light::ToggleState); all_on.Clicked.connect(&lp1, &Light::TurnOn()); all_on.Clicked.connect(&lp2, &Light::TurnOn()); all_on.Clicked.connect(&lp3, &Light::TurnOn()); all_on.Clicked.connect(&lp4, &Light::TurnOn()); all_off.Clicked.connect(&lp1, &Light::TurnOff()); all_off.Clicked.connect(&lp2, &Light::TurnOff()); all_off.Clicked.connect(&lp3, &Light::TurnOff()); all_off.Clicked.connect(&lp4, &Light::TurnOff());通过connect函数,就可以将信号绑定在相应的槽函数上了。譬如运行sw3.clicked(),那么就会触发ToggleState,同理,all_on.Clicked(),那么所有的灯都亮了。。。