-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path_demux.h
45 lines (30 loc) · 953 Bytes
/
_demux.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
#ifndef __DEMUX_H__
#define __DEMUX_H__
#include <libavutil/imgutils.h>
#include <libavutil/samplefmt.h>
#include <libavutil/timestamp.h>
#include <libavformat/avformat.h>
typedef struct
{
AVFormatContext* fmt_ctx;
AVCodecContext* vdec_ctx;
AVCodecContext* adec_ctx;
AVFrame* frame;
AVPacket pkt;
int video_stream_idx;
int audio_stream_idx;
int has_video_stream;
int has_audio_stream;
int cur_video_pts_in_ms;
} demux_ctx_t;
demux_ctx_t* demux_open(char* filename);
void demux_release_frame(demux_ctx_t* ctx, uint8_t* frame);
void demux_close(demux_ctx_t* ctx);
uint8_t* demux_get_frame(demux_ctx_t* ctx);
int demux_get_width(demux_ctx_t* ctx);
int demux_get_height(demux_ctx_t* ctx);
// forward/backward by delta_ms
// stream_type: 0 for video 1 for audio
int demux_move(demux_ctx_t* ctx, int stream_type, int delta_ms);
int demux_goto(demux_ctx_t* ctx, int stream_type, int ms, int flag);
#endif