ff_ffplay.h 5.4 KB
Newer Older
Z
Zhang Rui 已提交
1
/*
2
 * ff_ffplay.h
3
 *
X
Xinzheng Zhang 已提交
4
 * Copyright (c) 2003 Bilibili
Z
Zhang Rui 已提交
5 6
 * Copyright (c) 2003 Fabrice Bellard
 * Copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
7
 *
Z
Zhang Rui 已提交
8
 * This file is part of ijkPlayer.
9
 *
Z
Zhang Rui 已提交
10
 * ijkPlayer is free software; you can redistribute it and/or
11 12 13 14
 * 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.
 *
Z
Zhang Rui 已提交
15
 * ijkPlayer is distributed in the hope that it will be useful,
16 17 18 19 20
 * 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
Z
Zhang Rui 已提交
21
 * License along with ijkPlayer; if not, write to the Free Software
22 23 24
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

Z
Zhang Rui 已提交
25 26
#ifndef FFPLAY__FF_FFPLAY_H
#define FFPLAY__FF_FFPLAY_H
27

28
#include "ff_ffplay_def.h"
Z
Zhang Rui 已提交
29 30
#include "ff_fferror.h"
#include "ff_ffmsg.h"
31

Z
Zhang Rui 已提交
32 33
void      ffp_global_init();
void      ffp_global_uninit();
34 35
void      ffp_global_set_log_report(int use_report);
void      ffp_global_set_log_level(int log_level);
Z
Zhang Rui 已提交
36
void      ffp_global_set_inject_callback(ijk_inject_callback cb);
37
void      ffp_io_stat_register(void (*cb)(const char *url, int type, int bytes));
Z
Zhang Rui 已提交
38 39 40
void      ffp_io_stat_complete_register(void (*cb)(const char *url,
                                                   int64_t read_bytes, int64_t total_size,
                                                   int64_t elpased_time, int64_t total_duration));
41

Z
Zhang Rui 已提交
42 43
FFPlayer *ffp_create();
void      ffp_destroy(FFPlayer *ffp);
Z
Zhang Rui 已提交
44
void      ffp_destroy_p(FFPlayer **pffp);
Z
Zhang Rui 已提交
45
void      ffp_reset(FFPlayer *ffp);
Z
Zhang Rui 已提交
46

Z
Zhang Rui 已提交
47
/* set options before ffp_prepare_async_l() */
48

49
void     ffp_set_frame_at_time(FFPlayer *ffp, const char *path, int64_t start_time, int64_t end_time, int num, int definition);
50
void     *ffp_set_inject_opaque(FFPlayer *ffp, void *opaque);
R
raymondzheng 已提交
51
void     *ffp_set_ijkio_inject_opaque(FFPlayer *ffp, void *opaque);
52 53
void      ffp_set_option(FFPlayer *ffp, int opt_category, const char *name, const char *value);
void      ffp_set_option_int(FFPlayer *ffp, int opt_category, const char *name, int64_t value);
54
void      ffp_set_option_intptr(FFPlayer *ffp, int opt_category, const char *name, uintptr_t value);
55

Z
Zhang Rui 已提交
56 57 58
int       ffp_get_video_codec_info(FFPlayer *ffp, char **codec_info);
int       ffp_get_audio_codec_info(FFPlayer *ffp, char **codec_info);

Z
Zhang Rui 已提交
59
/* playback controll */
Z
Zhang Rui 已提交
60
int       ffp_prepare_async_l(FFPlayer *ffp, const char *file_name);
Z
Zhang Rui 已提交
61
int       ffp_start_from_l(FFPlayer *ffp, long msec);
Z
Zhang Rui 已提交
62 63
int       ffp_start_l(FFPlayer *ffp);
int       ffp_pause_l(FFPlayer *ffp);
64
int       ffp_is_paused_l(FFPlayer *ffp);
Z
Zhang Rui 已提交
65 66
int       ffp_stop_l(FFPlayer *ffp);
int       ffp_wait_stop_l(FFPlayer *ffp);
Z
Zhang Rui 已提交
67

68
/* all in milliseconds */
Z
Zhang Rui 已提交
69 70 71
int       ffp_seek_to_l(FFPlayer *ffp, long msec);
long      ffp_get_current_position_l(FFPlayer *ffp);
long      ffp_get_duration_l(FFPlayer *ffp);
72
long      ffp_get_playable_duration_l(FFPlayer *ffp);
Z
Zhang Rui 已提交
73 74
void      ffp_set_loop(FFPlayer *ffp, int loop);
int       ffp_get_loop(FFPlayer *ffp);
75

76
/* for internal usage */
77
int       ffp_packet_queue_init(PacketQueue *q);
Z
Zhang Rui 已提交
78 79 80 81 82 83 84 85 86 87 88 89
void      ffp_packet_queue_destroy(PacketQueue *q);
void      ffp_packet_queue_abort(PacketQueue *q);
void      ffp_packet_queue_start(PacketQueue *q);
void      ffp_packet_queue_flush(PacketQueue *q);
int       ffp_packet_queue_get(PacketQueue *q, AVPacket *pkt, int block, int *serial);
int       ffp_packet_queue_get_or_buffering(FFPlayer *ffp, PacketQueue *q, AVPacket *pkt, int *serial, int *finished);
int       ffp_packet_queue_put(PacketQueue *q, AVPacket *pkt);
bool      ffp_is_flush_packet(AVPacket *pkt);

Frame    *ffp_frame_queue_peek_writable(FrameQueue *f);
void      ffp_frame_queue_push(FrameQueue *f);

90
int       ffp_queue_picture(FFPlayer *ffp, AVFrame *src_frame, double pts, double duration, int64_t pos, int serial);
91

92 93 94
int       ffp_get_master_sync_type(VideoState *is);
double    ffp_get_master_clock(VideoState *is);

95 96
void      ffp_toggle_buffering_l(FFPlayer *ffp, int start_buffering);
void      ffp_toggle_buffering(FFPlayer *ffp, int start_buffering);
97
void      ffp_check_buffering_l(FFPlayer *ffp);
Z
Zhang Rui 已提交
98
void      ffp_track_statistic_l(FFPlayer *ffp, AVStream *st, PacketQueue *q, FFTrackCacheStatistic *cache);
99 100
void      ffp_audio_statistic_l(FFPlayer *ffp);
void      ffp_video_statistic_l(FFPlayer *ffp);
101
void      ffp_statistic_l(FFPlayer *ffp);
102

Z
Zhang Rui 已提交
103 104
int       ffp_video_thread(FFPlayer *ffp);

Z
Zhang Rui 已提交
105 106
void      ffp_set_video_codec_info(FFPlayer *ffp, const char *module, const char *codec);
void      ffp_set_audio_codec_info(FFPlayer *ffp, const char *module, const char *codec);
Y
yuazhen 已提交
107
void      ffp_set_subtitle_codec_info(FFPlayer *ffp, const char *module, const char *codec);
Z
Zhang Rui 已提交
108

Z
Zhang Rui 已提交
109
void      ffp_set_playback_rate(FFPlayer *ffp, float rate);
110
void      ffp_set_playback_volume(FFPlayer *ffp, float volume);
Z
Zhang Rui 已提交
111
int       ffp_get_video_rotate_degrees(FFPlayer *ffp);
112 113
int       ffp_set_stream_selected(FFPlayer *ffp, int stream, int selected);

Z
Zhang Rui 已提交
114
float     ffp_get_property_float(FFPlayer *ffp, int id, float default_value);
Z
Zhang Rui 已提交
115
void      ffp_set_property_float(FFPlayer *ffp, int id, float value);
116 117
int64_t   ffp_get_property_int64(FFPlayer *ffp, int id, int64_t default_value);
void      ffp_set_property_int64(FFPlayer *ffp, int id, int64_t value);
Z
Zhang Rui 已提交
118

Z
Zhang Rui 已提交
119
// must be freed with free();
Z
Zhang Rui 已提交
120
struct IjkMediaMeta *ffp_get_meta_l(FFPlayer *ffp);
Z
Zhang Rui 已提交
121

122
#endif