summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-27 20:54:07 +0100
committerwm4 <wm4@nowhere>2013-11-27 21:14:39 +0100
commitf09b2ff661040828e2b17fad89613f7706b10e7d (patch)
tree5c5b54a30cf6bf0e1ffda152be3e2b91b1f2a0e1
parentf2b5267e88ca68dd6933c97aa4f12e5c073b5a48 (diff)
downloadmpv-f09b2ff661040828e2b17fad89613f7706b10e7d.tar.bz2
mpv-f09b2ff661040828e2b17fad89613f7706b10e7d.tar.xz
cosmetics: rename video/audio reset functions
These used the suffix _resync_stream, which is a bit misleading. Nothing gets "resynchronized", they really just reset state. (Some audio decoders actually used to "resync" by reading packets for resuming playback, but that's not the case anymore.) Also move the function in dec_video.c to the top of the file.
-rw-r--r--audio/decode/ad.h2
-rw-r--r--audio/decode/ad_lavc.c2
-rw-r--r--audio/decode/ad_mpg123.c2
-rw-r--r--audio/decode/dec_audio.c6
-rw-r--r--audio/decode/dec_audio.h2
-rw-r--r--mpvcore/player/command.c4
-rw-r--r--mpvcore/player/playloop.c4
-rw-r--r--video/decode/dec_video.c14
-rw-r--r--video/decode/dec_video.h2
-rw-r--r--video/decode/vd.h2
-rw-r--r--video/decode/vd_lavc.c2
11 files changed, 21 insertions, 21 deletions
diff --git a/audio/decode/ad.h b/audio/decode/ad.h
index 9a696fb630..56f8944120 100644
--- a/audio/decode/ad.h
+++ b/audio/decode/ad.h
@@ -40,7 +40,7 @@ struct ad_functions {
};
enum ad_ctrl {
- ADCTRL_RESYNC_STREAM = 1, // resync, called after seeking
+ ADCTRL_RESET = 1, // flush and reset state, e.g. after seeking
};
#endif /* MPLAYER_AD_H */
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index 45e06c8b3d..4093fa77bd 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -301,7 +301,7 @@ static int control(struct dec_audio *da, int cmd, void *arg)
{
struct priv *ctx = da->priv;
switch (cmd) {
- case ADCTRL_RESYNC_STREAM:
+ case ADCTRL_RESET:
avcodec_flush_buffers(ctx->avctx);
ctx->frame.samples = 0;
talloc_free(ctx->packet);
diff --git a/audio/decode/ad_mpg123.c b/audio/decode/ad_mpg123.c
index aacc1cb76b..f65553bd77 100644
--- a/audio/decode/ad_mpg123.c
+++ b/audio/decode/ad_mpg123.c
@@ -347,7 +347,7 @@ static int control(struct dec_audio *da, int cmd, void *arg)
struct ad_mpg123_context *con = da->priv;
switch (cmd) {
- case ADCTRL_RESYNC_STREAM:
+ case ADCTRL_RESET:
mpg123_close(con->handle);
if (mpg123_open_feed(con->handle) != MPG123_OK) {
diff --git a/audio/decode/dec_audio.c b/audio/decode/dec_audio.c
index 6f46b79a93..26452b702e 100644
--- a/audio/decode/dec_audio.c
+++ b/audio/decode/dec_audio.c
@@ -135,7 +135,7 @@ static const struct ad_functions *find_driver(const char *name)
int audio_init_best_codec(struct dec_audio *d_audio, char *audio_decoders)
{
assert(!d_audio->ad_driver);
- audio_resync_stream(d_audio);
+ audio_reset_decoding(d_audio);
struct mp_decoder_entry *decoder = NULL;
struct mp_decoder_list *list =
@@ -347,10 +347,10 @@ int audio_decode(struct dec_audio *d_audio, struct mp_audio_buffer *outbuf,
return 0;
}
-void audio_resync_stream(struct dec_audio *d_audio)
+void audio_reset_decoding(struct dec_audio *d_audio)
{
d_audio->pts = MP_NOPTS_VALUE;
d_audio->pts_offset = 0;
if (d_audio->ad_driver)
- d_audio->ad_driver->control(d_audio, ADCTRL_RESYNC_STREAM, NULL);
+ d_audio->ad_driver->control(d_audio, ADCTRL_RESET, NULL);
}
diff --git a/audio/decode/dec_audio.h b/audio/decode/dec_audio.h
index aac2bd4719..7e8896fa61 100644
--- a/audio/decode/dec_audio.h
+++ b/audio/decode/dec_audio.h
@@ -50,7 +50,7 @@ struct mp_decoder_list *audio_decoder_list(void);
int audio_init_best_codec(struct dec_audio *d_audio, char *audio_decoders);
int audio_decode(struct dec_audio *d_audio, struct mp_audio_buffer *outbuf,
int minsamples);
-void audio_resync_stream(struct dec_audio *d_audio);
+void audio_reset_decoding(struct dec_audio *d_audio);
void audio_uninit(struct dec_audio *d_audio);
int audio_init_filters(struct dec_audio *d_audio, int in_samplerate,
diff --git a/mpvcore/player/command.c b/mpvcore/player/command.c
index 884a9244b0..bb72ec4d9a 100644
--- a/mpvcore/player/command.c
+++ b/mpvcore/player/command.c
@@ -624,10 +624,10 @@ static int mp_property_angle(m_option_t *prop, int action, void *arg,
angle = demuxer_set_angle(demuxer, *(int *)arg);
if (angle >= 0) {
if (mpctx->d_video)
- video_resync_stream(mpctx->d_video);
+ video_reset_decoding(mpctx->d_video);
if (mpctx->d_audio)
- audio_resync_stream(mpctx->d_audio);
+ audio_reset_decoding(mpctx->d_audio);
}
return M_PROPERTY_OK;
case M_PROPERTY_GET_TYPE: {
diff --git a/mpvcore/player/playloop.c b/mpvcore/player/playloop.c
index 73c751652c..d2c3904c77 100644
--- a/mpvcore/player/playloop.c
+++ b/mpvcore/player/playloop.c
@@ -170,7 +170,7 @@ void add_step_frame(struct MPContext *mpctx, int dir)
static void seek_reset(struct MPContext *mpctx, bool reset_ao)
{
if (mpctx->d_video) {
- video_resync_stream(mpctx->d_video);
+ video_reset_decoding(mpctx->d_video);
vo_seek_reset(mpctx->video_out);
if (mpctx->d_video->vf_initialized == 1)
vf_chain_seek_reset(mpctx->d_video->vfilter);
@@ -184,7 +184,7 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao)
}
if (mpctx->d_audio) {
- audio_resync_stream(mpctx->d_audio);
+ audio_reset_decoding(mpctx->d_audio);
if (mpctx->d_audio->afilter)
af_control_all(mpctx->d_audio->afilter, AF_CONTROL_RESET, NULL);
if (reset_ao)
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index 1fc156271b..497ae56a02 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -56,6 +56,13 @@ const vd_functions_t * const mpcodecs_vd_drivers[] = {
NULL
};
+void video_reset_decoding(struct dec_video *d_video)
+{
+ video_vd_control(d_video, VDCTRL_RESET, NULL);
+ d_video->prev_codec_reordered_pts = MP_NOPTS_VALUE;
+ d_video->prev_sorted_pts = MP_NOPTS_VALUE;
+}
+
int video_vd_control(struct dec_video *d_video, int cmd, void *arg)
{
const struct vd_functions *vd = d_video->vd_driver;
@@ -101,13 +108,6 @@ int video_get_colors(struct dec_video *d_video, const char *item, int *value)
return 0;
}
-void video_resync_stream(struct dec_video *d_video)
-{
- video_vd_control(d_video, VDCTRL_RESYNC_STREAM, NULL);
- d_video->prev_codec_reordered_pts = MP_NOPTS_VALUE;
- d_video->prev_sorted_pts = MP_NOPTS_VALUE;
-}
-
void video_reinit_vo(struct dec_video *d_video)
{
video_vd_control(d_video, VDCTRL_REINIT_VO, NULL);
diff --git a/video/decode/dec_video.h b/video/decode/dec_video.h
index a9c64cb695..cb4724af33 100644
--- a/video/decode/dec_video.h
+++ b/video/decode/dec_video.h
@@ -77,7 +77,7 @@ struct mp_image *video_decode(struct dec_video *d_video,
int video_get_colors(struct dec_video *d_video, const char *item, int *value);
int video_set_colors(struct dec_video *d_video, const char *item, int value);
-void video_resync_stream(struct dec_video *d_video);
+void video_reset_decoding(struct dec_video *d_video);
void video_reinit_vo(struct dec_video *d_video);
int video_vd_control(struct dec_video *d_video, int cmd, void *arg);
diff --git a/video/decode/vd.h b/video/decode/vd.h
index 045914f502..bf3a8e4374 100644
--- a/video/decode/vd.h
+++ b/video/decode/vd.h
@@ -43,7 +43,7 @@ extern const vd_functions_t *const mpcodecs_vd_drivers[];
enum vd_ctrl {
VDCTRL_GET_PARAMS = 1, // retrieve struct mp_image_params
- VDCTRL_RESYNC_STREAM, // reset decode state after seeking
+ VDCTRL_RESET, // reset decode state after seeking
VDCTRL_QUERY_UNSEEN_FRAMES, // current decoder lag
VDCTRL_REINIT_VO, // reinit filter/VO chain
};
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index c13ef68aad..d29bad6d29 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -821,7 +821,7 @@ static int control(struct dec_video *vd, int cmd, void *arg)
vd_ffmpeg_ctx *ctx = vd->priv;
AVCodecContext *avctx = ctx->avctx;
switch (cmd) {
- case VDCTRL_RESYNC_STREAM:
+ case VDCTRL_RESET:
avcodec_flush_buffers(avctx);
return CONTROL_TRUE;
case VDCTRL_QUERY_UNSEEN_FRAMES:;