diff options
author | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-16 07:11:12 +0300 |
---|---|---|
committer | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-23 13:41:05 +0300 |
commit | 9b06b5ed85ec28097428e7fe35631ce3a04685b5 (patch) | |
tree | 8fbb0ad6eecb1f337e153d5c6eb7fa2378b805f4 | |
parent | 0d59f81e546946648dfca93da6b74479d31369bc (diff) | |
download | mpv-9b06b5ed85ec28097428e7fe35631ce3a04685b5.tar.bz2 mpv-9b06b5ed85ec28097428e7fe35631ce3a04685b5.tar.xz |
Move correct_pts to options struct
-rw-r--r-- | cfg-mplayer.h | 4 | ||||
-rw-r--r-- | defaultopts.c | 7 | ||||
-rw-r--r-- | defaultopts.h | 1 | ||||
-rw-r--r-- | libmpcodecs/dec_video.c | 6 | ||||
-rw-r--r-- | libmpcodecs/vf_tfields.c | 9 | ||||
-rw-r--r-- | libmpcodecs/vf_yadif.c | 7 | ||||
-rw-r--r-- | libmpdemux/demux_lavf.c | 4 | ||||
-rw-r--r-- | libmpdemux/demux_mkv.c | 4 | ||||
-rw-r--r-- | libmpdemux/demuxer.c | 9 | ||||
-rw-r--r-- | libmpdemux/demuxer.h | 3 | ||||
-rw-r--r-- | mencoder.c | 4 | ||||
-rw-r--r-- | mplayer.c | 3 | ||||
-rw-r--r-- | options.h | 2 |
13 files changed, 38 insertions, 25 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 981a7a83ba..49b8ddccd4 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -326,8 +326,8 @@ const m_option_t mplayer_opts[]={ {"playlist", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL}, // a-v sync stuff: - {"correct-pts", &user_correct_pts, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {"no-correct-pts", &user_correct_pts, CONF_TYPE_FLAG, 0, 1, 0, NULL}, + FLAG_ON("correct-pts", user_correct_pts, 0), + FLAG_OFF("no-correct-pts", user_correct_pts, 0), {"noautosync", &autosync, CONF_TYPE_FLAG, 0, 0, -1, NULL}, {"autosync", &autosync, CONF_TYPE_INT, CONF_RANGE, 0, 10000, NULL}, // {"dapsync", &dapsync, CONF_TYPE_FLAG, 0, 0, 1, NULL}, diff --git a/defaultopts.c b/defaultopts.c index bc8a930e42..4787d5da09 100644 --- a/defaultopts.c +++ b/defaultopts.c @@ -8,5 +8,12 @@ void set_default_mplayer_options(struct MPOpts *opts) .audio_driver_list = NULL, .video_driver_list = NULL, .fixed_vo = 0, + .user_correct_pts = -1, }; } + +void set_default_mencoder_options(struct MPOpts *opts) +{ + set_default_mplayer_options(opts); + opts->user_correct_pts = 0; +} diff --git a/defaultopts.h b/defaultopts.h index 7305a07d75..15067204a7 100644 --- a/defaultopts.h +++ b/defaultopts.h @@ -1,2 +1,3 @@ struct MPOpts; void set_default_mplayer_options(struct MPOpts *opts); +void set_default_mencoder_options(struct MPOpts *opts); diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c index ab63ec4006..24f674e049 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -1,5 +1,6 @@ #include "config.h" +#include "options.h" #include <stdio.h> #ifdef HAVE_MALLOC_H @@ -335,8 +336,9 @@ void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size, unsigned int t = GetTimer(); unsigned int t2; double tt; + struct MPOpts *opts = sh_video->opts; - if (correct_pts && pts != MP_NOPTS_VALUE) { + if (opts->correct_pts && pts != MP_NOPTS_VALUE) { int delay = get_current_video_decoder_lag(sh_video); if (delay >= 0) { if (delay > sh_video->num_buffered_pts) @@ -393,7 +395,7 @@ void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size, else if (field_dominance == 1) mpi->fields &= ~MP_IMGFIELD_TOP_FIRST; - if (correct_pts) { + if (opts->correct_pts) { if (sh_video->num_buffered_pts) { sh_video->num_buffered_pts--; sh_video->pts = sh_video->buffered_pts[sh_video->num_buffered_pts]; diff --git a/libmpcodecs/vf_tfields.c b/libmpcodecs/vf_tfields.c index b95b4f83ef..eba28e3723 100644 --- a/libmpcodecs/vf_tfields.c +++ b/libmpcodecs/vf_tfields.c @@ -3,6 +3,7 @@ #include <string.h> #include "config.h" +#include "options.h" #include "mp_msg.h" #include "cpudetect.h" @@ -300,7 +301,6 @@ static void (*qpel_li)(unsigned char *d, unsigned char *s, int w, int h, int ds, static void (*qpel_4tap)(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up); static int continue_buffered_image(struct vf_instance_s *); -extern int correct_pts; static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts) { @@ -312,6 +312,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts) static int continue_buffered_image(struct vf_instance_s *vf) { + struct MPOpts *opts = vf->opts; int i=vf->priv->buffered_i; double pts = vf->priv->buffered_pts; mp_image_t *mpi = vf->priv->buffered_mpi; @@ -362,7 +363,7 @@ static int continue_buffered_image(struct vf_instance_s *vf) dmpi->stride[2] = 2*mpi->stride[2]; } ret |= vf_next_put_image(vf, dmpi, pts); - if (correct_pts) + if (opts->correct_pts) break; else if (!i) vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL); @@ -392,7 +393,7 @@ static int continue_buffered_image(struct vf_instance_s *vf) mpi->chroma_width, mpi->chroma_height, (i^!tff)); } ret |= vf_next_put_image(vf, dmpi, pts); - if (correct_pts) + if (opts->correct_pts) break; else if (!i) vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL); @@ -418,7 +419,7 @@ static int continue_buffered_image(struct vf_instance_s *vf) dmpi->stride[2], mpi->stride[2]*2, (i^!tff)); } ret |= vf_next_put_image(vf, dmpi, pts); - if (correct_pts) + if (opts->correct_pts) break; else if (!i) vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL); diff --git a/libmpcodecs/vf_yadif.c b/libmpcodecs/vf_yadif.c index 880c4cdaeb..19c1453166 100644 --- a/libmpcodecs/vf_yadif.c +++ b/libmpcodecs/vf_yadif.c @@ -24,6 +24,7 @@ #include "config.h" #include "cpudetect.h" +#include "options.h" #include "mp_msg.h" @@ -391,7 +392,6 @@ static int config(struct vf_instance_s* vf, } static int continue_buffered_image(struct vf_instance_s *vf); -extern int correct_pts; static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ int tff; @@ -422,6 +422,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ static int continue_buffered_image(struct vf_instance_s *vf) { + struct MPOpts *opts = vf->opts; mp_image_t *mpi = vf->priv->buffered_mpi; int tff = vf->priv->buffered_tff; double pts = vf->priv->buffered_pts; @@ -438,10 +439,10 @@ static int continue_buffered_image(struct vf_instance_s *vf) mpi->width,mpi->height); vf_clone_mpi_attributes(dmpi, mpi); filter(vf->priv, dmpi->planes, dmpi->stride, mpi->w, mpi->h, i ^ tff ^ 1, tff); - if (correct_pts && i < (vf->priv->mode & 1)) + if (opts->correct_pts && i < (vf->priv->mode & 1)) vf_queue_frame(vf, continue_buffered_image); ret |= vf_next_put_image(vf, dmpi, pts /*FIXME*/); - if (correct_pts) + if (opts->correct_pts) break; if(i<(vf->priv->mode&1)) vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL); diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 942a80fc56..ba898d10e4 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -22,6 +22,7 @@ #include <limits.h> #include "config.h" +#include "options.h" #include "mp_msg.h" #include "help_mp.h" @@ -405,6 +406,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { } static demuxer_t* demux_open_lavf(demuxer_t *demuxer){ + struct MPOpts *opts = demuxer->opts; AVFormatContext *avfc; AVFormatParameters ap; const AVOption *opt; @@ -420,7 +422,7 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){ if (opt_cryptokey) parse_cryptokey(avfc, opt_cryptokey); - if (user_correct_pts != 0) + if (opts->user_correct_pts != 0) avfc->flags |= AVFMT_FLAG_GENPTS; if (index_mode == 0) avfc->flags |= AVFMT_FLAG_IGNIDX; diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c index 4fbc415cb0..59db246caa 100644 --- a/libmpdemux/demux_mkv.c +++ b/libmpdemux/demux_mkv.c @@ -13,6 +13,7 @@ #include <ctype.h> #include <inttypes.h> +#include "options.h" #include "stream/stream.h" #include "demuxer.h" #include "stheader.h" @@ -1687,6 +1688,7 @@ static const videocodec_info_t vinfo[] = { static int demux_mkv_open_video (demuxer_t *demuxer, mkv_track_t *track, int vid) { + struct MPOpts *opts = demuxer->opts; BITMAPINFOHEADER *bih; void *ImageDesc = NULL; sh_video_t *sh_v; @@ -1797,7 +1799,7 @@ demux_mkv_open_video (demuxer_t *demuxer, mkv_track_t *track, int vid) bih = realloc (bih, bih->biSize); memcpy (bih + 1, track->private_data, track->private_size); } - track->reorder_timecodes = user_correct_pts == 0; + track->reorder_timecodes = opts->user_correct_pts == 0; if (!vi->id) { mp_msg (MSGT_DEMUX,MSGL_WARN, MSGTR_MPDEMUX_MKV_UnknownCodecID, track->codec_id, track->tnum); diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index c11c8a035a..377b34fd08 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -738,9 +738,6 @@ int get_demuxer_type_from_name(char *demuxer_name, int *force) int extension_parsing = 1; // 0=off 1=mixed (used only for unstable formats) -int correct_pts = 0; -int user_correct_pts = -1; - /* NOTE : Several demuxers may be opened at the same time so demuxers should NEVER rely on an external var to enable them @@ -1045,9 +1042,9 @@ demuxer_t *demux_open(struct MPOpts *opts, stream_t *vs, int file_format, else res = vd; - correct_pts = user_correct_pts; - if (correct_pts < 0) - correct_pts = + opts->correct_pts = opts->user_correct_pts; + if (opts->correct_pts < 0) + opts->correct_pts = demux_control(res, DEMUXER_CTRL_CORRECT_PTS, NULL) == DEMUXER_CTRL_OK; return res; diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index e01e95e612..c61f564eb7 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -150,9 +150,6 @@ typedef struct demuxer_info_st { struct demuxer_st; -extern int correct_pts; -extern int user_correct_pts; - /** * Demuxer description structure */ diff --git a/mencoder.c b/mencoder.c index dc318d3a07..873a4af734 100644 --- a/mencoder.c +++ b/mencoder.c @@ -91,6 +91,7 @@ #include "libmpcodecs/ae.h" #include "options.h" +#include "defaultopts.h" MPOpts opts; @@ -419,11 +420,10 @@ ao_data_t ao_data = {0,0,0,0,OUTBURST,-1,0}; audio_encoding_params_t aparams; audio_encoder_t *aencoder = NULL; -user_correct_pts = 0; - mp_msg_init(); // Create the config context and register the options + set_default_mencoder_options(&opts); mconfig = m_config_new(&opts); m_config_register_options(mconfig,mencoder_opts); @@ -2242,11 +2242,12 @@ err_out: static double update_video(int *blit_frame) { + struct MPOpts *opts = &mpctx->opts; sh_video_t * const sh_video = mpctx->sh_video; //-------------------- Decode a frame: ----------------------- double frame_time; *blit_frame = 0; // Don't blit if we hit EOF - if (!correct_pts) { + if (!opts->correct_pts) { unsigned char* start=NULL; void *decoded_frame = NULL; int drop_frame=0; @@ -5,6 +5,8 @@ typedef struct MPOpts { char **video_driver_list; char **audio_driver_list; int fixed_vo; + int correct_pts; + int user_correct_pts; } MPOpts; #endif |