Repository navigation
Expand file tree
/
Copy pathlibffplay.h
More file actions
110 lines (97 loc) · 3.61 KB
/
Copy pathlibffplay.h
File metadata and controls
110 lines (97 loc) · 3.61 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
* Copyright (c) 2014 Vasily Khoruzhick <anarsoul@gmail.com>
*
* ffplay is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ffplay is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ffplay; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __LIBFFPLAY_H
#define __LIBFFPLAY_H 1
#include <sys/types.h>
struct libffplay_ctx;
typedef struct libffplay_ctx libffplay_ctx_t;
typedef struct libffplay_audiomgr libffplay_audiomgr_t;
struct libffplay_audiomgr {
int (*open_device) (libffplay_audiomgr_t *self, int freq, int channels,
int bits_per_sample, void *opaque,
void (*audio_cb) (void *opaque,
void *buf,
size_t size));
int (*close_device) (libffplay_audiomgr_t *self);
};
typedef struct libffplay_picture libffplay_picture_t;
struct libffplay_picture {
void *planes[3];
size_t pitches[3];
size_t width;
size_t height;
void *userdata;
int allocated;
double pts, duration;
size_t pos;
int serial;
int sar_den;
int sar_num;
};
typedef struct libffplay_rect libffplay_rect_t;
struct libffplay_rect {
ssize_t x, y;
size_t w, h;
};
typedef struct libffplay_videomgr libffplay_videomgr_t;
struct libffplay_videomgr {
int (*alloc_picture_planes)(libffplay_videomgr_t *self, libffplay_picture_t *pic,
size_t wanted_width, size_t wanted_height);
void (*lock_picture)(libffplay_videomgr_t *self, libffplay_picture_t *pic);
void (*unlock_picture)(libffplay_videomgr_t *self, libffplay_picture_t *pic);
void (*free_picture_planes)(libffplay_videomgr_t *self, libffplay_picture_t *pic);
void (*display_picture)(libffplay_videomgr_t *self, libffplay_picture_t *pic);
};
enum {
LFP_EVENT_EOF,
LFP_EVENT_TIMESTAMP,
};
typedef struct libffplay_eventmgr libffplay_eventmgr_t;
struct libffplay_eventmgr {
void (*send_event)(libffplay_eventmgr_t *self, int event_type, void *data);
};
enum {
LFP_SEEK_SET = 0,
LFP_SEEK_CUR = 1,
};
#define LIBFFPLAY_METADATA_ARTIST "artist"
#define LIBFFPLAY_METADATA_TITLE "title"
#define LIBFFPLAY_METADATA_ALBUM "album"
#define LIBFFPLAY_METADATA_DATE "date"
libffplay_ctx_t *libffplay_init(void);
void libffplay_set_audiomgr(libffplay_ctx_t *ctx,
libffplay_audiomgr_t *audiomgr);
void libffplay_set_videomgr(libffplay_ctx_t *ctx,
libffplay_videomgr_t *videomgr);
void libffplay_set_eventmgr(libffplay_ctx_t *ctx,
libffplay_eventmgr_t *eventmgr);
/* returns duration if success, negative error code otherwise */
int libffplay_open(libffplay_ctx_t * ctx, const char *filename);
void libffplay_start_play(libffplay_ctx_t * ctx);
const char *libffplay_get_metadata(libffplay_ctx_t *ctx, const char *key);
void libffplay_pause(libffplay_ctx_t * ctx);
void libffplay_resume(libffplay_ctx_t * ctx);
void libffplay_toggle_pause(libffplay_ctx_t *ctx);
void libffplay_seek(libffplay_ctx_t * ctx, double pos, int whence);
double libffplay_tell(libffplay_ctx_t *ctx);
double libffplay_stream_length(libffplay_ctx_t *ctx);
void libffplay_stop(libffplay_ctx_t * ctx);
void libffplay_exit(libffplay_ctx_t * ctx);
void libffplay_video_refresh(libffplay_ctx_t * ctx, double *remaining_time);
void libffplay_deinit(libffplay_ctx_t *ctx);
#endif