summaryrefslogtreecommitdiffstats
path: root/video/out/vo_xv.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/vo_xv.c')
-rw-r--r--video/out/vo_xv.c44
1 files changed, 19 insertions, 25 deletions
diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c
index d3257730d7..d2d5b737e7 100644
--- a/video/out/vo_xv.c
+++ b/video/out/vo_xv.c
@@ -29,8 +29,6 @@
#include <libavutil/common.h>
-#include "config.h"
-
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
@@ -94,6 +92,7 @@ struct xvctx {
int Shmem_Flag;
XShmSegmentInfo Shminfo[MAX_BUFFERS];
int Shm_Warned_Slow;
+ struct mp_image_params dst_params;
};
#define MP_FOURCC(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((unsigned)(d)<<24))
@@ -403,7 +402,7 @@ static void read_xv_csp(struct vo *vo)
ctx->cached_csp = 0;
int bt709_enabled;
if (xv_get_eq(vo, ctx->xv_port, "bt_709", &bt709_enabled))
- ctx->cached_csp = bt709_enabled == 100 ? MP_CSP_BT_709 : MP_CSP_BT_601;
+ ctx->cached_csp = bt709_enabled == 100 ? PL_COLOR_SYSTEM_BT_709 : PL_COLOR_SYSTEM_BT_601;
}
@@ -467,8 +466,6 @@ static int reconfig(struct vo *vo, struct mp_image_params *params)
struct xvctx *ctx = vo->priv;
int i;
- mp_image_unrefp(&ctx->original_image);
-
ctx->image_height = params->h;
ctx->image_width = params->w;
ctx->image_format = params->imgfmt;
@@ -523,10 +520,17 @@ static int reconfig(struct vo *vo, struct mp_image_params *params)
ctx->current_buf = 0;
ctx->current_ip_buf = 0;
- int is_709 = params->color.space == MP_CSP_BT_709;
+ int is_709 = params->repr.sys == PL_COLOR_SYSTEM_BT_709;
xv_set_eq(vo, ctx->xv_port, "bt_709", is_709 * 200 - 100);
read_xv_csp(vo);
+ ctx->dst_params = *params;
+ if (ctx->cached_csp)
+ ctx->dst_params.repr.sys = ctx->cached_csp;
+ mp_mutex_lock(&vo->params_mutex);
+ vo->target_params = &ctx->dst_params;
+ mp_mutex_unlock(&vo->params_mutex);
+
resize(vo);
return 0;
@@ -656,7 +660,7 @@ static struct mp_image get_xv_buffer(struct vo *vo, int buf_index)
if (vo->params) {
struct mp_image_params params = *vo->params;
if (ctx->cached_csp)
- params.color.space = ctx->cached_csp;
+ params.repr.sys = ctx->cached_csp;
mp_image_set_attributes(&img, &params);
}
@@ -674,7 +678,7 @@ static void wait_for_completion(struct vo *vo, int max_outstanding)
" for XShm completion events...\n");
ctx->Shm_Warned_Slow = 1;
}
- mp_sleep_us(1000);
+ mp_sleep_ns(MP_TIME_MS_TO_NS(1));
vo_x11_check_events(vo);
}
}
@@ -704,8 +708,7 @@ static void get_vsync(struct vo *vo, struct vo_vsync_info *info)
present_sync_get_info(x11->present, info);
}
-// Note: REDRAW_FRAME can call this with NULL.
-static void draw_image(struct vo *vo, mp_image_t *mpi)
+static void draw_frame(struct vo *vo, struct vo_frame *frame)
{
struct xvctx *ctx = vo->priv;
@@ -715,19 +718,17 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
return;
struct mp_image xv_buffer = get_xv_buffer(vo, ctx->current_buf);
- if (mpi) {
- mp_image_copy(&xv_buffer, mpi);
+ if (frame->current) {
+ mp_image_copy(&xv_buffer, frame->current);
} else {
mp_image_clear(&xv_buffer, 0, 0, xv_buffer.w, xv_buffer.h);
}
struct mp_osd_res res = osd_res_from_image_params(vo->params);
- osd_draw_on_image(vo->osd, res, mpi ? mpi->pts : 0, 0, &xv_buffer);
+ osd_draw_on_image(vo->osd, res, frame->current ? frame->current->pts : 0, 0, &xv_buffer);
- if (mpi != ctx->original_image) {
- talloc_free(ctx->original_image);
- ctx->original_image = mpi;
- }
+ if (frame->current != ctx->original_image)
+ ctx->original_image = frame->current;
}
static int query_format(struct vo *vo, int format)
@@ -750,8 +751,6 @@ static void uninit(struct vo *vo)
struct xvctx *ctx = vo->priv;
int i;
- talloc_free(ctx->original_image);
-
if (ctx->ai)
XvFreeAdaptorInfo(ctx->ai);
ctx->ai = NULL;
@@ -874,14 +873,10 @@ static int preinit(struct vo *vo)
static int control(struct vo *vo, uint32_t request, void *data)
{
- struct xvctx *ctx = vo->priv;
switch (request) {
case VOCTRL_SET_PANSCAN:
resize(vo);
return VO_TRUE;
- case VOCTRL_REDRAW_FRAME:
- draw_image(vo, ctx->original_image);
- return true;
}
int events = 0;
int r = vo_x11_control(vo, &events, request, data);
@@ -900,7 +895,7 @@ const struct vo_driver video_out_xv = {
.query_format = query_format,
.reconfig = reconfig,
.control = control,
- .draw_image = draw_image,
+ .draw_frame = draw_frame,
.flip_page = flip_page,
.get_vsync = get_vsync,
.wakeup = vo_x11_wakeup,
@@ -928,7 +923,6 @@ const struct vo_driver video_out_xv = {
{"auto", CK_METHOD_AUTOPAINT})},
{"colorkey", OPT_INT(colorkey)},
{"buffers", OPT_INT(cfg_buffers), M_RANGE(1, MAX_BUFFERS)},
- {"no-colorkey", OPT_REMOVED("use ck-method=none instead")},
{0}
},
.options_prefix = "xv",