-
Notifications
You must be signed in to change notification settings - Fork 16
/
minirtmp_player.h
62 lines (49 loc) · 1.6 KB
/
minirtmp_player.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
#pragma once
#include "minirtmp.h"
#include "system.h"
#define MRTMP_OK 0
#define MRTMP_FAIL -1
#define MRTMP_EVENT_OPEN 0 // code=0 - stream successfully opened, fail otherwise
#define MRTMP_EVENT_STOP 1 // code=0 - stream stopped normally, fail otherwise
#define MRTMP_EVENT_LATE 2 // decoding is slow, code is not used
typedef struct MRTMP_Packet
{
void *data;
struct MRTMP_Packet *next;
uint32_t pts;
int size, type;
} MRTMP_Packet;
typedef void (*MRTMP_PACKET_CALLBACK)(void *user, MRTMP_Packet *pkt);
typedef void (*MRTMP_EVENT_CALLBACK)(void *user, int event, int code);
typedef struct MRTMP_Player
{
CRITICAL_SECTION reader_lock;
CRITICAL_SECTION pkt_lock;
MINIRTMP rtmp;
MRTMP_PACKET_CALLBACK packet_cb;
void *packet_user_data;
MRTMP_EVENT_CALLBACK event_cb;
void *event_user_data;
HANDLE thread;
HANDLE open_thread;
const char *open_url;
MRTMP_Packet *packets;
MRTMP_Packet *tail;
int stop_flag, stopped_flag, paused_flag, packets_in_buf, packets_eof;
int width, height;
} MRTMP_Player;
#ifdef __cplusplus
extern "C" {
#endif
void mrtmp_player_init(MRTMP_Player *p);
void mrtmp_set_packet_callback(MRTMP_Player *p, MRTMP_PACKET_CALLBACK cb, void *user_data);
void mrtmp_set_event_callback(MRTMP_Player *p, MRTMP_EVENT_CALLBACK cb, void *user_data);
int mrtmp_open_url(MRTMP_Player *p, const char *url);
int mrtmp_open_url_async(MRTMP_Player *p, const char *url_str);
void mrtmp_close_url(MRTMP_Player *p);
void mrtmp_play(MRTMP_Player *p);
void mrtmp_pause(MRTMP_Player *p);
void mrtmp_stop(MRTMP_Player *p);
#ifdef __cplusplus
}
#endif