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

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

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

Z
Zhang Rui 已提交
31 32
void      ffp_global_init();
void      ffp_global_uninit();
33 34
void      ffp_global_set_log_report(int use_report);
void      ffp_global_set_log_level(int log_level);
Z
Zhang Rui 已提交
35
void      ffp_global_set_inject_callback(ijk_inject_callback cb);
36
void      ffp_io_stat_register(void (*cb)(const char *url, int type, int bytes));
Z
Zhang Rui 已提交
37 38 39
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));
40

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

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

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);

Z
Zhang Rui 已提交
51 52 53
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 已提交
54
/* playback controll */
Z
Zhang Rui 已提交
55
int       ffp_prepare_async_l(FFPlayer *ffp, const char *file_name);
Z
Zhang Rui 已提交
56
int       ffp_start_from_l(FFPlayer *ffp, long msec);
Z
Zhang Rui 已提交
57 58
int       ffp_start_l(FFPlayer *ffp);
int       ffp_pause_l(FFPlayer *ffp);
59
int       ffp_is_paused_l(FFPlayer *ffp);
Z
Zhang Rui 已提交
60 61
int       ffp_stop_l(FFPlayer *ffp);
int       ffp_wait_stop_l(FFPlayer *ffp);
Z
Zhang Rui 已提交
62

63
/* all in milliseconds */
Z
Zhang Rui 已提交
64 65 66
int       ffp_seek_to_l(FFPlayer *ffp, long msec);
long      ffp_get_current_position_l(FFPlayer *ffp);
long      ffp_get_duration_l(FFPlayer *ffp);
67
long      ffp_get_playable_duration_l(FFPlayer *ffp);
Z
Zhang Rui 已提交
68 69
void      ffp_set_loop(FFPlayer *ffp, int loop);
int       ffp_get_loop(FFPlayer *ffp);
70

71
/* for internal usage */
72
int       ffp_packet_queue_init(PacketQueue *q);
Z
Zhang Rui 已提交
73 74 75 76 77 78 79 80 81 82 83 84
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);

85 86 87
int       ffp_get_master_sync_type(VideoState *is);
double    ffp_get_master_clock(VideoState *is);

88 89
void      ffp_toggle_buffering_l(FFPlayer *ffp, int start_buffering);
void      ffp_toggle_buffering(FFPlayer *ffp, int start_buffering);
90
void      ffp_check_buffering_l(FFPlayer *ffp);
91

Z
Zhang Rui 已提交
92 93
int       ffp_video_thread(FFPlayer *ffp);

Z
Zhang Rui 已提交
94 95 96
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);

Z
Zhang Rui 已提交
97
int       ffp_get_video_rotate_degrees(FFPlayer *ffp);
Z
Zhang Rui 已提交
98
float     ffp_get_property_float(FFPlayer *ffp, int id, float default_value);
Z
Zhang Rui 已提交
99

Z
Zhang Rui 已提交
100
// must be freed with free();
Z
Zhang Rui 已提交
101
struct IjkMediaMeta *ffp_get_meta_l(FFPlayer *ffp);
Z
Zhang Rui 已提交
102

103
#endif