forked from sailfishos/droidmedia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdroidmedia.h
91 lines (77 loc) · 2.65 KB
/
droidmedia.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* Copyright (C) 2014-2015 Jolla Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Authored by: Mohammed Hassan <mohammed.hassan@jolla.com>
*/
#ifndef DROID_MEDIA_H
#define DROID_MEDIA_H
#include <sys/types.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
class DroidMediaBuffer;
class DroidMediaBufferQueue;
#else
typedef void DroidMediaBuffer;
typedef void DroidMediaBufferQueue;
#endif
typedef void *EGLDisplay;
typedef void *EGLSyncKHR;
typedef void (*DroidMediaCallback)(void *data);
typedef struct {
void *data;
ssize_t size;
} DroidMediaData;
typedef struct {
DroidMediaCallback ref;
DroidMediaCallback unref;
void *data;
} DroidMediaBufferCallbacks;
typedef struct {
int32_t left;
int32_t top;
int32_t right;
int32_t bottom;
} DroidMediaRect;
typedef struct {
void (* buffers_released)(void *data);
void (* frame_available)(void *data);
} DroidMediaBufferQueueCallbacks;
/* droidmedia.cpp */
void droid_media_init();
void droid_media_deinit();
/* droidmediabuffer.cpp */
DroidMediaBuffer *droid_media_buffer_create_from_yv12_data(uint32_t w, uint32_t h,
DroidMediaData *data,
DroidMediaBufferCallbacks *cb);
uint32_t droid_media_buffer_get_transform(DroidMediaBuffer * buffer);
uint32_t droid_media_buffer_get_scaling_mode(DroidMediaBuffer * buffer);
int64_t droid_media_buffer_get_timestamp(DroidMediaBuffer * buffer);
uint64_t droid_media_buffer_get_frame_number(DroidMediaBuffer * buffer);
DroidMediaRect droid_media_buffer_get_crop_rect(DroidMediaBuffer * buffer);
uint32_t droid_media_buffer_get_width(DroidMediaBuffer * buffer);
uint32_t droid_media_buffer_get_height(DroidMediaBuffer * buffer);
void droid_media_buffer_release(DroidMediaBuffer *buffer,
EGLDisplay display, EGLSyncKHR fence);
/* private.h */
DroidMediaBuffer *droid_media_buffer_queue_acquire_buffer(DroidMediaBufferQueue *queue,
DroidMediaBufferCallbacks *cb);
void droid_media_buffer_queue_set_callbacks(DroidMediaBufferQueue *queue,
DroidMediaBufferQueueCallbacks *cb, void *data);
void droid_media_buffer_queue_acquire_and_release(DroidMediaBufferQueue *queue);
#ifdef __cplusplus
};
#endif
#endif /* DROID_MEDIA_H */