~schwann/qtubuntu-camera/qtcamera-no-thumbnails

« back to all changes in this revision

Viewing changes to unittests/mocks/aal/recorder_compatibility_layer.h

  • Committer: Tarmac
  • Author(s): Guenter Schwann
  • Date: 2013-06-07 12:25:19 UTC
  • mfrom: (46.2.10 qtcamera-video-recording)
  • Revision ID: tarmac-20130607122519-gjybf5yjncygcdfm
First version to support video recording.

Approved by PS Jenkins bot, Jim Hodapp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical Ltd
 
3
 *
 
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
 
7
 *
 
8
 *      http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
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.
 
15
 */
 
16
 
 
17
#ifndef RECORDER_COMPATIBILITY_LAYER_H_
 
18
#define RECORDER_COMPATIBILITY_LAYER_H_
 
19
 
 
20
#include <stdint.h>
 
21
#include <unistd.h>
 
22
 
 
23
#ifdef __cplusplus
 
24
extern "C" {
 
25
#endif
 
26
 
 
27
    struct MediaRecorderWrapper;
 
28
    struct CameraControl;
 
29
 
 
30
    // values are from andoid /frameworks/av/include/media/mediarecorder.h
 
31
    typedef enum
 
32
    {
 
33
        ANDROID_VIDEO_SOURCE_DEFAULT = 0,
 
34
        ANDROID_VIDEO_SOURCE_CAMERA = 1,
 
35
        ANDROID_VIDEO_SOURCE_GRALLOC_BUFFER = 2
 
36
    } VideoSource;
 
37
 
 
38
    // values are from andoid /system/core/include/system/audio.h
 
39
    typedef enum
 
40
    {
 
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
 
52
    } AudioSource;
 
53
 
 
54
    // values are from andoid /frameworks/av/include/media/mediarecorder.h
 
55
    typedef enum
 
56
    {
 
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
 
71
    } OutputFormat;
 
72
 
 
73
    // values are from andoid /frameworks/av/include/media/mediarecorder.h
 
74
    typedef enum
 
75
    {
 
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
 
80
    } VideoEncoder;
 
81
 
 
82
    // values are from andoid /frameworks/av/include/media/mediarecorder.h
 
83
    typedef enum
 
84
    {
 
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
 
91
    } AudioEncoder;
 
92
 
 
93
    // Callback types
 
94
    typedef void (*on_recorder_msg_error)(void *context);
 
95
 
 
96
    // Callback setters
 
97
    void android_recorder_set_error_cb(MediaRecorderWrapper *mr, on_recorder_msg_error cb,
 
98
                                       void *context);
 
99
 
 
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);
 
119
 
 
120
#ifdef __cplusplus
 
121
}
 
122
#endif
 
123
 
 
124
#endif