-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathffmpeg.h
74 lines (51 loc) · 2.02 KB
/
ffmpeg.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
#include <math.h>
#include <pthread.h>
#include <float.h>
#include <libavformat/avformat.h>
#include <libavutil/opt.h>
#include <libavutil/file.h>
#include <libavutil/pixfmt.h>
#include <libswscale/swscale.h>
#include <libavutil/pixdesc.h>
#include <libavutil/intreadwrite.h>
#include <libavutil/imgutils.h>
#include <libavutil/display.h>
#define BUFFER_SIZE 1 << 12
#define READ_CALLBACK 1
//#define WRITE_CALLBACK 2
#define SEEK_CALLBACK 2
#define INTERRUPT_CALLBACK 4
#define HAS_VIDEO_STREAM 1
#define HAS_AUDIO_STREAM 2
#define ERR_TOO_BIG FFERRTAG('H','M','M','M')
struct thumb_frame {
AVFrame *frame;
int *hist;
};
typedef struct ThumbContext {
int n, alpha, max_frames;
struct thumb_frame *frames;
double *median;
const AVPixFmtDescriptor *desc;
size_t hist_size;
} ThumbContext;
int allocate_format_context(AVFormatContext **fmt_ctx);
int create_format_context(AVFormatContext *fmt_ctx, int callbacks);
void free_format_context(AVFormatContext *fmt_ctx);
void get_metadata(AVFormatContext *fmt_ctx, char **artist, char **title);
int find_streams(AVFormatContext *fmt_ctx, AVStream **video_stream, int *orientation);
int create_codec_context(AVStream *video_stream, AVCodecContext **dec_ctx);
AVFrame *convert_frame_to_rgb(AVFrame *frame, int alpha);
//int encode_frame_to_png(AVFormatContext *fmt_ctx, AVFrame *frame);
AVPacket create_packet();
int
obtain_next_frame(AVFormatContext *fmt_ctx, AVCodecContext *dec_ctx, int stream_index, AVPacket *pkt, AVFrame **frame);
int64_t find_duration(AVFormatContext *fmt_ctx);
ThumbContext *create_thumb_context(AVStream *stream, AVFrame *frame);
void free_thumb_context(ThumbContext *thumb_ctx);
AVFrame *process_frames(ThumbContext *thumb_ctx);
void populate_histogram(ThumbContext *thumb_ctx, int n, AVFrame *frame);
extern int readCallback(void *opaque, uint8_t *buf, int buf_size);
//extern int writeCallback(void *opaque, uint8_t *buf, int buf_size);
extern int64_t seekCallback(void *opaque, int64_t seek, int whence);
extern int interruptCallback(void *opaque);