2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_MP_CORE_H
|
|
|
|
#define MPLAYER_MP_CORE_H
|
2008-01-01 21:35:58 +00:00
|
|
|
|
2008-12-08 18:04:08 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2008-03-31 03:19:29 +00:00
|
|
|
#include "options.h"
|
2008-03-04 23:35:24 +00:00
|
|
|
#include "mixer.h"
|
|
|
|
#include "subreader.h"
|
2008-01-30 07:21:05 +00:00
|
|
|
|
2007-02-21 00:49:24 +00:00
|
|
|
// definitions used internally by the core player code
|
|
|
|
|
2008-02-14 14:23:55 +00:00
|
|
|
#define INITIALIZED_VO 1
|
|
|
|
#define INITIALIZED_AO 2
|
|
|
|
#define INITIALIZED_GUI 4
|
|
|
|
#define INITIALIZED_GETCH2 8
|
|
|
|
#define INITIALIZED_SPUDEC 32
|
|
|
|
#define INITIALIZED_STREAM 64
|
|
|
|
#define INITIALIZED_VOBSUB 256
|
|
|
|
#define INITIALIZED_DEMUXER 512
|
|
|
|
#define INITIALIZED_ACODEC 1024
|
|
|
|
#define INITIALIZED_VCODEC 2048
|
|
|
|
#define INITIALIZED_ALL 0xFFFF
|
2007-02-21 00:49:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define SUB_SOURCE_SUBS 0
|
|
|
|
#define SUB_SOURCE_VOBSUB 1
|
|
|
|
#define SUB_SOURCE_DEMUX 2
|
|
|
|
#define SUB_SOURCES 3
|
|
|
|
|
|
|
|
|
2008-08-13 05:06:26 +00:00
|
|
|
enum stop_play_reason {
|
|
|
|
KEEP_PLAYING = 0, // must be 0, numeric values of others do not matter
|
|
|
|
AT_END_OF_FILE,
|
|
|
|
PT_NEXT_ENTRY,
|
|
|
|
PT_PREV_ENTRY,
|
|
|
|
PT_NEXT_SRC,
|
|
|
|
PT_PREV_SRC,
|
|
|
|
PT_UP_NEXT,
|
|
|
|
PT_UP_PREV,
|
|
|
|
PT_STOP,
|
|
|
|
};
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2008-12-02 19:53:41 +00:00
|
|
|
typedef enum {
|
|
|
|
EXIT_NONE,
|
|
|
|
EXIT_QUIT,
|
|
|
|
EXIT_EOF,
|
|
|
|
EXIT_ERROR
|
|
|
|
} exit_reason_t;
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2009-03-29 19:45:06 +00:00
|
|
|
struct content_source {
|
|
|
|
struct stream *stream;
|
|
|
|
struct demuxer *demuxer;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct timeline_part {
|
|
|
|
double start;
|
|
|
|
double source_start;
|
|
|
|
struct content_source *source;
|
|
|
|
};
|
|
|
|
|
2009-04-02 02:00:22 +00:00
|
|
|
struct chapter {
|
|
|
|
double start;
|
|
|
|
char *name;
|
|
|
|
};
|
|
|
|
|
2007-02-21 00:49:24 +00:00
|
|
|
typedef struct MPContext {
|
2008-03-31 03:19:29 +00:00
|
|
|
struct MPOpts opts;
|
2008-04-26 07:44:59 +00:00
|
|
|
struct m_config *mconfig;
|
2008-04-20 04:36:34 +00:00
|
|
|
struct vo_x11_state *x11_state;
|
2008-04-29 12:12:19 +00:00
|
|
|
struct mp_fifo *key_fifo;
|
2008-04-30 04:15:52 +00:00
|
|
|
struct input_ctx *input;
|
2008-06-23 22:53:58 +00:00
|
|
|
struct osd_state *osd;
|
2009-03-30 00:13:17 +00:00
|
|
|
|
|
|
|
bool add_osd_seek_info;
|
|
|
|
// if nonzero, hide current OSD contents when GetTimerMS() reaches this
|
|
|
|
unsigned int osd_show_percentage_until;
|
|
|
|
unsigned int osd_visible;
|
|
|
|
|
2007-02-21 00:49:24 +00:00
|
|
|
int osd_function;
|
2008-02-01 20:11:14 +00:00
|
|
|
const ao_functions_t *audio_out;
|
2008-04-23 06:49:25 +00:00
|
|
|
struct play_tree *playtree;
|
|
|
|
struct play_tree_iter *playtree_iter;
|
2008-04-26 12:17:51 +00:00
|
|
|
char *filename; // currently playing file
|
2008-08-13 05:06:26 +00:00
|
|
|
enum stop_play_reason stop_play;
|
2007-02-21 00:49:24 +00:00
|
|
|
int play_tree_step;
|
2008-04-26 12:31:39 +00:00
|
|
|
unsigned int initialized_flags; // which subsystems have been initialized
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2009-03-29 19:45:06 +00:00
|
|
|
struct content_source *sources;
|
|
|
|
int num_sources;
|
|
|
|
struct timeline_part *timeline;
|
|
|
|
int num_timeline_parts;
|
|
|
|
int timeline_part;
|
2009-04-02 02:00:22 +00:00
|
|
|
struct chapter *chapters;
|
|
|
|
int num_chapters;
|
2009-03-29 19:45:06 +00:00
|
|
|
double video_offset;
|
|
|
|
|
2008-04-24 02:49:44 +00:00
|
|
|
struct stream *stream;
|
|
|
|
struct demuxer *demuxer;
|
2008-04-23 06:49:25 +00:00
|
|
|
struct sh_audio *sh_audio;
|
|
|
|
struct sh_video *sh_video;
|
|
|
|
struct demux_stream *d_audio;
|
|
|
|
struct demux_stream *d_video;
|
|
|
|
struct demux_stream *d_sub;
|
2007-02-21 00:49:24 +00:00
|
|
|
mixer_t mixer;
|
2008-04-03 03:25:41 +00:00
|
|
|
struct vo *video_out;
|
2007-02-21 21:59:33 +00:00
|
|
|
// Frames buffered in the vo ready to flip. Currently always 0 or 1.
|
|
|
|
// This is really a vo variable but currently there's no suitable vo
|
|
|
|
// struct.
|
|
|
|
int num_buffered_frames;
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2008-12-08 18:04:08 +00:00
|
|
|
// Show a video frame as quickly as possible without trying to adjust
|
|
|
|
// for AV sync. Used when starting a file or after seeking.
|
|
|
|
bool update_video_immediately;
|
2007-03-11 06:16:14 +00:00
|
|
|
// AV sync: the next frame should be shown when the audio out has this
|
|
|
|
// much (in seconds) buffered data left. Increased when more data is
|
|
|
|
// written to the ao, decreased when moving to the next frame.
|
|
|
|
// In the audio-only case used as a timer since the last seek
|
|
|
|
// by the audio CPU usage meter.
|
|
|
|
double delay;
|
2008-11-29 06:09:57 +00:00
|
|
|
// AV sync: time until next frame should be shown
|
|
|
|
float time_frame;
|
2008-12-08 18:04:08 +00:00
|
|
|
// How long the last vo flip() call took. Used to adjust timing with
|
|
|
|
// the goal of making flip() calls finish (rather than start) at the
|
|
|
|
// specified time.
|
|
|
|
float last_vo_flip_duration;
|
|
|
|
// How much video timing has been changed to make it match the audio
|
|
|
|
// timeline. Used for status line information only.
|
|
|
|
double total_avsync_change;
|
|
|
|
// A-V sync difference when last frame was displayed. Kept to display
|
|
|
|
// the same value if the status line is updated at a time where no new
|
|
|
|
// video frame is shown.
|
|
|
|
double last_av_difference;
|
2007-03-11 06:16:14 +00:00
|
|
|
|
2008-04-28 09:09:31 +00:00
|
|
|
// Timestamp from the last time some timing functions read the
|
|
|
|
// current time, in (occasionally wrapping) microseconds. Used
|
|
|
|
// to turn a new time value to a delta from last time.
|
|
|
|
unsigned int last_time;
|
|
|
|
|
2008-04-21 03:17:22 +00:00
|
|
|
// Used to communicate the parameters of a seek between parts
|
2009-04-02 02:00:22 +00:00
|
|
|
double rel_seek_secs;
|
2008-04-21 03:17:22 +00:00
|
|
|
int abs_seek_pos;
|
|
|
|
|
2007-02-22 20:44:48 +00:00
|
|
|
float begin_skip; ///< start time of the current skip while on edlout mode
|
|
|
|
// audio is muted if either EDL or user activates mute
|
2007-02-21 00:49:24 +00:00
|
|
|
short edl_muted; ///< Stores whether EDL is currently in muted mode.
|
|
|
|
short user_muted; ///< Stores whether user wanted muted mode.
|
|
|
|
|
|
|
|
int global_sub_size; // this encompasses all subtitle sources
|
|
|
|
int global_sub_pos; // this encompasses all subtitle sources
|
|
|
|
int set_of_sub_pos;
|
|
|
|
int set_of_sub_size;
|
|
|
|
int global_sub_indices[SUB_SOURCES];
|
|
|
|
// set_of_ass_tracks[i] contains subtitles from set_of_subtitles[i]
|
|
|
|
// parsed by libass or NULL if format unsupported
|
2008-04-23 06:49:25 +00:00
|
|
|
struct ass_track_s *set_of_ass_tracks[MAX_SUBTITLE_FILES];
|
2007-02-21 00:49:24 +00:00
|
|
|
sub_data* set_of_subtitles[MAX_SUBTITLE_FILES];
|
|
|
|
|
|
|
|
int file_format;
|
|
|
|
|
|
|
|
int last_dvb_step;
|
|
|
|
int dvbin_reopen;
|
|
|
|
|
2008-11-29 06:09:57 +00:00
|
|
|
int paused;
|
|
|
|
// step this many frames, then pause
|
|
|
|
int step_frames;
|
2008-01-26 11:51:34 +00:00
|
|
|
|
2008-12-08 18:04:08 +00:00
|
|
|
// Set after showing warning about decoding being too slow for realtime
|
|
|
|
// playback rate. Used to avoid showing it multiple times.
|
|
|
|
bool drop_message_shown;
|
|
|
|
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_DVDNAV
|
2008-04-24 02:49:44 +00:00
|
|
|
struct mp_image *nav_smpi; ///< last decoded dvdnav video image
|
2008-01-26 11:51:34 +00:00
|
|
|
unsigned char *nav_buffer; ///< last read dvdnav video frame
|
|
|
|
unsigned char *nav_start; ///< pointer to last read video buffer
|
|
|
|
int nav_in_size; ///< last read size
|
|
|
|
#endif
|
2007-02-21 00:49:24 +00:00
|
|
|
} MPContext;
|
|
|
|
|
|
|
|
|
|
|
|
// Most of these should not be globals
|
|
|
|
extern FILE *edl_fd;
|
|
|
|
extern int file_filter;
|
|
|
|
// These appear in options list
|
|
|
|
extern int forced_subs_only;
|
|
|
|
|
2008-04-24 02:49:44 +00:00
|
|
|
struct ao_data;
|
|
|
|
int build_afilter_chain(struct MPContext *mpctx, struct sh_audio *sh_audio, struct ao_data *ao_data);
|
2008-04-21 03:07:22 +00:00
|
|
|
void uninit_player(struct MPContext *mpctx, unsigned int mask);
|
|
|
|
void reinit_audio_chain(struct MPContext *mpctx);
|
|
|
|
void init_vo_spudec(struct MPContext *mpctx);
|
2008-04-21 03:55:23 +00:00
|
|
|
double playing_audio_pts(struct MPContext *mpctx);
|
2008-12-03 23:55:52 +00:00
|
|
|
void exit_player_with_rc(struct MPContext *mpctx, exit_reason_t how, int rc);
|
2008-04-21 03:07:22 +00:00
|
|
|
void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr);
|
|
|
|
int reinit_video_chain(struct MPContext *mpctx);
|
2008-11-29 06:09:57 +00:00
|
|
|
void pause_player(struct MPContext *mpctx);
|
|
|
|
void unpause_player(struct MPContext *mpctx);
|
2008-12-01 17:53:57 +00:00
|
|
|
void add_step_frame(struct MPContext *mpctx);
|
2009-04-02 02:00:22 +00:00
|
|
|
int seek_chapter(struct MPContext *mpctx, int chapter, double *seek_pts,
|
|
|
|
char **chapter_name);
|
|
|
|
int get_current_chapter(struct MPContext *mpctx);
|
|
|
|
char *chapter_display_name(struct MPContext *mpctx, int chapter);
|
2008-01-01 21:35:58 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_MP_CORE_H */
|