summaryrefslogtreecommitdiffstats
path: root/mencoder.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-06-24 01:53:58 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-06-24 01:53:58 +0300
commita232f564d3f271277135276281c03cca7807ef16 (patch)
tree63c0ebd5b39094e2cc24da83a4e5ce889964b003 /mencoder.c
parentde560e8167c21a8fd9ea34f5f42f377102d65232 (diff)
downloadmpv-a232f564d3f271277135276281c03cca7807ef16.tar.bz2
mpv-a232f564d3f271277135276281c03cca7807ef16.tar.xz
Create a context struct for OSD state
This commit creates the struct and passes it to some functions that needs to access OSD state but does not yet move much data from globals to it. vf_expand accesses the OSD state for rendering purposes outside of the normal OSD draw time. The way this currently works is suboptimal, but I did not attempt to clean it up now. To keep things working the same way vf_expand needs to know the address of the state object to be able to access the data even in the functions that should normally not need it. For that purpose this commit adds a VFCTRL to tell vf_expand the address of the object.
Diffstat (limited to 'mencoder.c')
-rw-r--r--mencoder.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/mencoder.c b/mencoder.c
index 6c157b7591..0ca429f9c2 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -94,6 +94,7 @@
#include "defaultopts.h"
MPOpts opts;
+struct osd_state *osd;
int vo_doublebuffering=0;
int vo_directrendering=0;
@@ -215,7 +216,7 @@ int vo_config(struct vo *vo, uint32_t width, uint32_t height,
int vo_control(struct vo *vo, uint32_t request, void *data) { abort(); }
int vo_draw_frame(struct vo *vo, uint8_t *src[]) { abort(); }
int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y) { abort(); }
-void vo_draw_osd(struct vo *vo) { abort(); }
+void vo_draw_osd(struct vo *vo, struct osd_state *osd) { abort(); }
void vo_flip_page(struct vo *vo) { abort(); }
void vo_check_events(struct vo *vo) { abort(); }
@@ -552,7 +553,7 @@ if (frameno_filename) {
}
#endif
- vo_init_osd();
+ osd = osd_create();
/* HACK, for some weird reason, push() has to be called twice,
otherwise options are not saved correctly */
@@ -1344,9 +1345,10 @@ case VCODEC_FRAMENO:
break;
default:
// decode_video will callback down to ve_*.c encoders, through the video filters
+ sh_video->vfilter->control(sh_video->vfilter, VFCTRL_SET_OSD_OBJ, osd);
{void *decoded_frame = decode_video(sh_video,frame_data.start,frame_data.in_size,
skip_flag>0 && (!sh_video->vfilter || ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) != CONTROL_TRUE), MP_NOPTS_VALUE);
- blit_frame = decoded_frame && filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE);}
+ blit_frame = decoded_frame && filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE, osd);}
if (sh_video->vf_initialized < 0) mencoder_exit(1, NULL);
@@ -1706,10 +1708,12 @@ static int slowseek(float end_pts, demux_stream_t *d_video, demux_stream_t *d_au
if (sh_video->pts >= end_pts) done = 1;
if (vfilter) {
+ sh_video->vfilter->control(sh_video->vfilter, VFCTRL_SET_OSD_OBJ,
+ osd);
int softskip = (vfilter->control(vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) == CONTROL_TRUE);
void *decoded_frame = decode_video(sh_video, frame_data->start, frame_data->in_size, !softskip, MP_NOPTS_VALUE);
if (decoded_frame)
- filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE);
+ filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE, osd);
}
if (print_info) mp_msg(MSGT_MENCODER, MSGL_STATUS,