2
* Copyright (C) 2013 Canonical Ltd
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#ifndef RECORDER_COMPATIBILITY_LAYER_H_
18
#define RECORDER_COMPATIBILITY_LAYER_H_
27
struct MediaRecorderWrapper;
30
// values are from andoid /frameworks/av/include/media/mediarecorder.h
33
ANDROID_VIDEO_SOURCE_DEFAULT = 0,
34
ANDROID_VIDEO_SOURCE_CAMERA = 1,
35
ANDROID_VIDEO_SOURCE_GRALLOC_BUFFER = 2
38
// values are from andoid /system/core/include/system/audio.h
41
ANDROID_AUDIO_SOURCE_DEFAULT = 0,
42
ANDROID_AUDIO_SOURCE_MIC = 1,
43
ANDROID_AUDIO_SOURCE_VOICE_UPLINK = 2,
44
ANDROID_AUDIO_SOURCE_VOICE_DOWNLINK = 3,
45
ANDROID_AUDIO_SOURCE_VOICE_CALL = 4,
46
ANDROID_AUDIO_SOURCE_CAMCORDER = 5,
47
ANDROID_AUDIO_SOURCE_VOICE_RECOGNITION = 6,
48
ANDROID_AUDIO_SOURCE_VOICE_COMMUNICATION = 7,
49
ANDROID_AUDIO_SOURCE_REMOTE_SUBMIX = 8,
50
ANDROID_AUDIO_SOURCE_CNT,
51
ANDROID_AUDIO_SOURCE_MAX = ANDROID_AUDIO_SOURCE_CNT - 1
54
// values are from andoid /frameworks/av/include/media/mediarecorder.h
57
ANDROID_OUTPUT_FORMAT_DEFAULT = 0,
58
ANDROID_OUTPUT_FORMAT_THREE_GPP = 1,
59
ANDROID_OUTPUT_FORMAT_MPEG_4 = 2,
60
ANDROID_OUTPUT_FORMAT_AUDIO_ONLY_START = 3,
61
/* These are audio only file formats */
62
ANDROID_OUTPUT_FORMAT_RAW_AMR = 3, //to be backward compatible
63
ANDROID_OUTPUT_FORMAT_AMR_NB = 3,
64
ANDROID_OUTPUT_FORMAT_AMR_WB = 4,
65
ANDROID_OUTPUT_FORMAT_AAC_ADIF = 5,
66
ANDROID_OUTPUT_FORMAT_AAC_ADTS = 6,
67
/* Stream over a socket, limited to a single stream */
68
ANDROID_OUTPUT_FORMAT_RTP_AVP = 7,
69
/* H.264/AAC data encapsulated in MPEG2/TS */
70
ANDROID_OUTPUT_FORMAT_MPEG2TS = 8
73
// values are from andoid /frameworks/av/include/media/mediarecorder.h
76
ANDROID_VIDEO_ENCODER_DEFAULT = 0,
77
ANDROID_VIDEO_ENCODER_H263 = 1,
78
ANDROID_VIDEO_ENCODER_H264 = 2,
79
ANDROID_VIDEO_ENCODER_MPEG_4_SP = 3
82
// values are from andoid /frameworks/av/include/media/mediarecorder.h
85
ANDROID_AUDIO_ENCODER_DEFAULT = 0,
86
ANDROID_AUDIO_ENCODER_AMR_NB = 1,
87
ANDROID_AUDIO_ENCODER_AMR_WB = 2,
88
ANDROID_AUDIO_ENCODER_AAC = 3,
89
ANDROID_AUDIO_ENCODER_HE_AAC = 4,
90
ANDROID_AUDIO_ENCODER_AAC_ELD = 5
94
typedef void (*on_recorder_msg_error)(void *context);
97
void android_recorder_set_error_cb(MediaRecorderWrapper *mr, on_recorder_msg_error cb,
100
// Main recorder control API
101
MediaRecorderWrapper *android_media_new_recorder();
102
int android_recorder_initCheck(MediaRecorderWrapper *mr);
103
int android_recorder_setCamera(MediaRecorderWrapper *mr, CameraControl* control);
104
int android_recorder_setVideoSource(MediaRecorderWrapper *mr, VideoSource vs);
105
int android_recorder_setAudioSource(MediaRecorderWrapper *mr, AudioSource as);
106
int android_recorder_setOutputFormat(MediaRecorderWrapper *mr, OutputFormat of);
107
int android_recorder_setVideoEncoder(MediaRecorderWrapper *mr, VideoEncoder ve);
108
int android_recorder_setAudioEncoder(MediaRecorderWrapper *mr, AudioEncoder ae);
109
int android_recorder_setOutputFile(MediaRecorderWrapper *mr, int fd);
110
int android_recorder_setVideoSize(MediaRecorderWrapper *mr, int width, int height);
111
int android_recorder_setVideoFrameRate(MediaRecorderWrapper *mr, int frames_per_second);
112
int android_recorder_setParameters(MediaRecorderWrapper *mr, const char* parameters);
113
int android_recorder_start(MediaRecorderWrapper *mr);
114
int android_recorder_stop(MediaRecorderWrapper *mr);
115
int android_recorder_prepare(MediaRecorderWrapper *mr);
116
int android_recorder_reset(MediaRecorderWrapper *mr);
117
int android_recorder_close(MediaRecorderWrapper *mr);
118
int android_recorder_release(MediaRecorderWrapper *mr);