From 29aee11d7d5f5df3c430324e31bb2436ce17a9eb Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Sun, 30 Nov 2008 20:29:04 +0000 Subject: Add imgfmt and vo_cap to headers. --- src/xine-engine/video_out.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/xine-engine') diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index fb01805df..77a7134fc 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -280,6 +280,7 @@ struct xine_video_port_s { #define VO_CAP_UNSCALED_OVERLAY 0x00000010 /* driver can blend overlay at output resolution */ #define VO_CAP_CROP 0x00000020 /* driver can crop */ #define VO_CAP_XXMC 0x00000040 /* driver can use extended XvMC */ +#define VO_CAP_VDPAU_H264 0x00000080 /* driver can use Nvidia VDPAU for H264 */ /* -- cgit v1.2.3 From 9b8b18236adf6ab7abf540946075eb8ff9c6c790 Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Mon, 1 Dec 2008 15:12:00 +0000 Subject: Introduce vdpau_accel_t. --- src/xine-engine/accel_vdpau.h | 65 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/xine-engine/accel_vdpau.h (limited to 'src/xine-engine') diff --git a/src/xine-engine/accel_vdpau.h b/src/xine-engine/accel_vdpau.h new file mode 100644 index 000000000..39231314c --- /dev/null +++ b/src/xine-engine/accel_vdpau.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2008 the xine project + * + * This file is part of xine, a free video player. + * + * xine is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * xine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + * Common acceleration definitions for vdpau + * + * + */ + +#ifndef HAVE_XINE_ACCEL_VDPAU_H +#define HAVE_XINE_ACCEL_VDPAU_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + + +typedef struct { + + VdpDevice vdp_device; + + VdpVideoSurfaceCreate *vdp_video_surface_create; + VdpVideoSurfaceDestroy *vdp_video_surface_destroy; + VdpDecoderCreate *vdp_decoder_create; + VdpDecoderDestroy *vdp_decoder_destroy; + VdpDecoderRender *vdp_decoder_render; + + VdpVideoSurface surface; + + union _VdpPictureInfo { + VdpPictureInfoMPEG1Or2 mpeg; + VdpPictureInfoH264 h264; + VdpPictureInfoVC1 vc1; + } info; + +} vdpau_accel_t; + +#ifdef __cplusplus +} +#endif + +#endif + -- cgit v1.2.3 From 0bd66ea5009e84048bc2d0bfa99960802f1dae03 Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Mon, 1 Dec 2008 18:36:41 +0000 Subject: Decoder initialising (WIP). --- src/xine-engine/accel_vdpau.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/accel_vdpau.h b/src/xine-engine/accel_vdpau.h index 39231314c..ef76fe5ee 100644 --- a/src/xine-engine/accel_vdpau.h +++ b/src/xine-engine/accel_vdpau.h @@ -49,12 +49,6 @@ typedef struct { VdpVideoSurface surface; - union _VdpPictureInfo { - VdpPictureInfoMPEG1Or2 mpeg; - VdpPictureInfoH264 h264; - VdpPictureInfoVC1 vc1; - } info; - } vdpau_accel_t; #ifdef __cplusplus -- cgit v1.2.3 From fcceca2c84e5b1cb24262591ee8de98ccedca1db Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Mon, 8 Dec 2008 10:51:07 +0000 Subject: Export vdp_get_error_string; define MPEG12 cap. --- src/xine-engine/accel_vdpau.h | 1 + src/xine-engine/video_out.h | 1 + 2 files changed, 2 insertions(+) (limited to 'src/xine-engine') diff --git a/src/xine-engine/accel_vdpau.h b/src/xine-engine/accel_vdpau.h index ef76fe5ee..f5b80e4d4 100644 --- a/src/xine-engine/accel_vdpau.h +++ b/src/xine-engine/accel_vdpau.h @@ -41,6 +41,7 @@ typedef struct { VdpDevice vdp_device; + VdpGetErrorString *vdp_get_error_string; VdpVideoSurfaceCreate *vdp_video_surface_create; VdpVideoSurfaceDestroy *vdp_video_surface_destroy; VdpDecoderCreate *vdp_decoder_create; diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 77a7134fc..b3903d4f8 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -281,6 +281,7 @@ struct xine_video_port_s { #define VO_CAP_CROP 0x00000020 /* driver can crop */ #define VO_CAP_XXMC 0x00000040 /* driver can use extended XvMC */ #define VO_CAP_VDPAU_H264 0x00000080 /* driver can use Nvidia VDPAU for H264 */ +#define VO_CAP_VDPAU_MPEG12 0x00000100 /* driver can use Nvidia VDPAU for mpeg1/2 */ /* -- cgit v1.2.3 From 65ae9896ac134cad57835d5dcf8ec5594efe7d2c Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Fri, 12 Dec 2008 06:49:08 +0000 Subject: Locking fixes. --- src/xine-engine/accel_vdpau.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/accel_vdpau.h b/src/xine-engine/accel_vdpau.h index f5b80e4d4..73965abc2 100644 --- a/src/xine-engine/accel_vdpau.h +++ b/src/xine-engine/accel_vdpau.h @@ -43,7 +43,6 @@ typedef struct { VdpGetErrorString *vdp_get_error_string; VdpVideoSurfaceCreate *vdp_video_surface_create; - VdpVideoSurfaceDestroy *vdp_video_surface_destroy; VdpDecoderCreate *vdp_decoder_create; VdpDecoderDestroy *vdp_decoder_destroy; VdpDecoderRender *vdp_decoder_render; -- cgit v1.2.3 From fa9e2c2f46c18cf16a0f6acbc75e671876c29d51 Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Sun, 21 Dec 2008 18:49:33 +0000 Subject: Chroma type. --- src/xine-engine/accel_vdpau.h | 2 +- src/xine-engine/video_out.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/accel_vdpau.h b/src/xine-engine/accel_vdpau.h index 73965abc2..e489408c5 100644 --- a/src/xine-engine/accel_vdpau.h +++ b/src/xine-engine/accel_vdpau.h @@ -42,12 +42,12 @@ typedef struct { VdpDevice vdp_device; VdpGetErrorString *vdp_get_error_string; - VdpVideoSurfaceCreate *vdp_video_surface_create; VdpDecoderCreate *vdp_decoder_create; VdpDecoderDestroy *vdp_decoder_destroy; VdpDecoderRender *vdp_decoder_render; VdpVideoSurface surface; + VdpChromaType chroma; } vdpau_accel_t; diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index b3903d4f8..17ddd660b 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -271,6 +271,7 @@ struct xine_video_port_s { #define VO_PAN_SCAN_FLAG 4 #define VO_INTERLACED_FLAG 8 #define VO_NEW_SEQUENCE_FLAG 16 /* set after MPEG2 Sequence Header Code (used by XvMC) */ +#define VO_CHROMA_422 32 /* used by VDPAU, default is chroma_420 */ /* video driver capabilities */ #define VO_CAP_YV12 0x00000001 /* driver can handle YUV 4:2:0 pictures */ @@ -280,8 +281,8 @@ struct xine_video_port_s { #define VO_CAP_UNSCALED_OVERLAY 0x00000010 /* driver can blend overlay at output resolution */ #define VO_CAP_CROP 0x00000020 /* driver can crop */ #define VO_CAP_XXMC 0x00000040 /* driver can use extended XvMC */ -#define VO_CAP_VDPAU_H264 0x00000080 /* driver can use Nvidia VDPAU for H264 */ -#define VO_CAP_VDPAU_MPEG12 0x00000100 /* driver can use Nvidia VDPAU for mpeg1/2 */ +#define VO_CAP_VDPAU_H264 0x00000080 /* driver can use VDPAU for H264 */ +#define VO_CAP_VDPAU_MPEG12 0x00000100 /* driver can use VDPAU for mpeg1/2 */ /* -- cgit v1.2.3 From 92d89235ad1e8a413422947b92b957a5453950ea Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Sat, 27 Dec 2008 17:20:17 +0000 Subject: Initial support for ARGB overlay. --- src/xine-engine/osd.c | 15 +++++++++++++++ src/xine-engine/osd.h | 13 +++++++++++++ src/xine-engine/video_out.h | 2 ++ src/xine-engine/xine_interface.c | 5 +++++ 4 files changed, 35 insertions(+) (limited to 'src/xine-engine') diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 05acd4779..0bc1574ca 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -152,6 +152,8 @@ static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width osd->x2 = 0; osd->y2 = 0; + osd->argb_buffer = NULL; + memcpy(osd->color, textpalettes_color[0], sizeof(textpalettes_color[0])); memcpy(osd->trans, textpalettes_trans[0], sizeof(textpalettes_trans[0])); @@ -228,6 +230,9 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { this->event.object.handle = osd->handle; memset( this->event.object.overlay, 0, sizeof(*this->event.object.overlay) ); + + this->event.object.overlay->argb_buffer = osd->argb_buffer; + this->event.object.overlay->unscaled = unscaled; this->event.object.overlay->x = osd->display_x + osd->x1; this->event.object.overlay->y = osd->display_y + osd->y1; @@ -1537,6 +1542,15 @@ static void osd_draw_bitmap(osd_object_t *osd, uint8_t *bitmap, } } +static void osd_set_argb_buffer(osd_object_t *osd, uint32_t *argb_buffer) +{ + osd->argb_buffer = argb_buffer; + osd->x2 = osd->width; + osd->x1 = 0; + osd->y2 = osd->height; + osd->y1 = 0; +} + static uint32_t osd_get_capabilities (osd_object_t *osd) { osd_renderer_t *this = osd->renderer; @@ -1612,6 +1626,7 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) { this->get_text_size = osd_get_text_size; this->close = osd_renderer_close; this->draw_bitmap = osd_draw_bitmap; + this->set_argb_buffer = osd_set_argb_buffer; this->show_unscaled = osd_show_unscaled; this->get_capabilities = osd_get_capabilities; diff --git a/src/xine-engine/osd.h b/src/xine-engine/osd.h index 70193a2ea..ed3118a05 100644 --- a/src/xine-engine/osd.h +++ b/src/xine-engine/osd.h @@ -65,6 +65,13 @@ struct osd_object_s { osd_font_t *font; osd_ft2context_t *ft2; + + + /* this holds an optional ARGB overlay, which + * is only be used by supported video_out modules. + * right now this is only vdpau */ + uint32_t *argb_buffer; + }; /* this one is public */ @@ -211,6 +218,12 @@ struct osd_renderer_s { */ uint32_t (*get_capabilities) (osd_object_t *osd); + /* + * set a buffer to an argb buffer + */ + void (*set_argb_buffer) (osd_object_t *osd, uint32_t *argb_buffer); + + /* private stuff */ pthread_mutex_t osd_mutex; diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 17ddd660b..7fa34ac8b 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -419,6 +419,8 @@ struct vo_overlay_s { int hili_rgb_clut; /* true if clut was converted to rgb */ int unscaled; /* true if it should be blended unscaled */ + + uint32_t *argb_buffer; }; diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index d1d5a18d9..1f6175a06 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -855,6 +855,11 @@ void xine_osd_draw_bitmap(xine_osd_t *this, uint8_t *bitmap, this->osd.renderer->draw_bitmap(&this->osd, bitmap, x1, y1, width, height, palette_map); } +void xine_osd_set_argb_buffer(xine_osd_t *this, uint32_t *argb_buffer) { + this->osd.renderer->set_argb_buffer(&this->osd, argb_buffer); +} + + const char *const *xine_post_list_inputs(xine_post_t *this_gen) { post_plugin_t *this = (post_plugin_t *)this_gen; return this->input_ids; -- cgit v1.2.3 From 5c9bcbcefee17fdd254bcecd3865cd1a5202134b Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Sun, 28 Dec 2008 19:47:18 +0000 Subject: Fix argb overlay; allow partial buffer updates to improve performance. --- src/xine-engine/osd.c | 15 ++++++++++----- src/xine-engine/osd.h | 3 ++- src/xine-engine/xine_interface.c | 5 +++-- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 0bc1574ca..4b521e539 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -1542,13 +1542,18 @@ static void osd_draw_bitmap(osd_object_t *osd, uint8_t *bitmap, } } -static void osd_set_argb_buffer(osd_object_t *osd, uint32_t *argb_buffer) +static void osd_set_argb_buffer(osd_object_t *osd, uint32_t *argb_buffer, + int x, int y, int width, int height) { osd->argb_buffer = argb_buffer; - osd->x2 = osd->width; - osd->x1 = 0; - osd->y2 = osd->height; - osd->y1 = 0; + if(osd->x1 == 0 || x < osd->x1) + osd->x1 = x; + if(osd->x2 == 0 || (x + width) > osd->x2) + osd->x2 = x + width; + if(osd->y1 == 0 || y < osd->y1) + osd->y1 = y; + if(osd->y2 == 0 || (y + height) > osd->y2) + osd->y2 = y + height; } static uint32_t osd_get_capabilities (osd_object_t *osd) { diff --git a/src/xine-engine/osd.h b/src/xine-engine/osd.h index ed3118a05..a6acc11ab 100644 --- a/src/xine-engine/osd.h +++ b/src/xine-engine/osd.h @@ -221,7 +221,8 @@ struct osd_renderer_s { /* * set a buffer to an argb buffer */ - void (*set_argb_buffer) (osd_object_t *osd, uint32_t *argb_buffer); + void (*set_argb_buffer) (osd_object_t *osd, uint32_t *argb_buffer, + int x, int y, int width, int height); /* private stuff */ diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 1f6175a06..4f59785a1 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -855,8 +855,9 @@ void xine_osd_draw_bitmap(xine_osd_t *this, uint8_t *bitmap, this->osd.renderer->draw_bitmap(&this->osd, bitmap, x1, y1, width, height, palette_map); } -void xine_osd_set_argb_buffer(xine_osd_t *this, uint32_t *argb_buffer) { - this->osd.renderer->set_argb_buffer(&this->osd, argb_buffer); +void xine_osd_set_argb_buffer(xine_osd_t *this, uint32_t *argb_buffer, + int x, int y, int width, int height) { + this->osd.renderer->set_argb_buffer(&this->osd, argb_buffer, x, y, width, height); } -- cgit v1.2.3 From 862354fcea8351ddf7b6745a1d5bf559e37d2d32 Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Mon, 29 Dec 2008 01:38:20 +0000 Subject: Add future frame. --- src/xine-engine/video_out.c | 7 ++++++- src/xine-engine/video_out.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index be062cc5d..6b0353bee 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -931,7 +931,7 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, /* extra info of the backup is thrown away, because it is not up to date */ _x_extra_info_reset(img->extra_info); } - + img->future_frame = NULL; return img; } else { @@ -989,6 +989,11 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, /* * remove frame from display queue and show it */ + + if ( img->next ) + img->future_frame = img->next; + else + img->future_frame = NULL; img = vo_remove_from_img_buf_queue_int (this->display_img_buf_queue, 1, 0, 0, 0, 0, 0); pthread_mutex_unlock(&this->display_img_buf_queue->mutex); diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 7fa34ac8b..76b347a41 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -149,6 +149,9 @@ struct vo_frame_s { /* displacement for overlays */ int overlay_offset_x, overlay_offset_y; + + /* pointer to the next frame in display order, used by some vo deint */ + struct vo_frame_s *future_frame; /* * that part is used only by video_out.c for frame management -- cgit v1.2.3 From cf092eb7e4e762d7bbf92f78bf2be9667ed1a1b4 Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Tue, 30 Dec 2008 10:51:35 +0000 Subject: Future frame fixups. --- src/xine-engine/video_out.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 6b0353bee..f99067ad4 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -930,8 +930,8 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, img->vpts = cur_vpts; /* extra info of the backup is thrown away, because it is not up to date */ _x_extra_info_reset(img->extra_info); + img->future_frame = NULL; } - img->future_frame = NULL; return img; } else { @@ -990,10 +990,12 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, * remove frame from display queue and show it */ - if ( img->next ) - img->future_frame = img->next; - else - img->future_frame = NULL; + if ( img ) { + if ( img->next ) + img->future_frame = img->next; + else + img->future_frame = NULL; + } img = vo_remove_from_img_buf_queue_int (this->display_img_buf_queue, 1, 0, 0, 0, 0, 0); pthread_mutex_unlock(&this->display_img_buf_queue->mutex); -- cgit v1.2.3 From db791923958fd4c72f75d4fede7aff189ff879a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Fri, 2 Jan 2009 18:00:01 +0000 Subject: Add framegrabbing support; extend ARGB OSD interface. --- src/xine-engine/osd.c | 173 ++++++++++++++++++++++++++------------- src/xine-engine/osd.h | 25 +++++- src/xine-engine/video_out.h | 24 +++++- src/xine-engine/xine.c | 48 ++++++++--- src/xine-engine/xine_interface.c | 8 +- 5 files changed, 202 insertions(+), 76 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 4b521e539..7f4e6aefb 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -143,16 +143,19 @@ static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width osd->next = this->osds; this->osds = osd; + osd->extent_width = 0; + osd->extent_height = 0; osd->width = width; osd->height = height; osd->area = calloc(width, height); + osd->area_touched = 0; - osd->x1 = width; - osd->y1 = height; - osd->x2 = 0; - osd->y2 = 0; + osd->x1 = osd->argb_layer.x1 = width; + osd->y1 = osd->argb_layer.y1 = height; + osd->x2 = osd->argb_layer.x2 = 0; + osd->y2 = osd->argb_layer.y2 = 0; - osd->argb_buffer = NULL; + pthread_mutex_init(&osd->argb_layer.mutex, NULL); memcpy(osd->color, textpalettes_color[0], sizeof(textpalettes_color[0])); memcpy(osd->trans, textpalettes_trans[0], sizeof(textpalettes_trans[0])); @@ -171,6 +174,18 @@ static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width return osd; } +/* + * osd extent must be set to achive video resolution independent osds + * both sizes must be > 0 to take effect. otherwise, video resolution + * will still be used. the extent defines the reference coordinate + * system which is matched to the video output area. + */ +static void osd_set_extent (osd_object_t *osd, int extent_width, int extent_height) { + + osd->extent_width = extent_width; + osd->extent_height = extent_height; +} + /* @@ -231,7 +246,7 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { memset( this->event.object.overlay, 0, sizeof(*this->event.object.overlay) ); - this->event.object.overlay->argb_buffer = osd->argb_buffer; + this->event.object.overlay->argb_layer = &osd->argb_layer; this->event.object.overlay->unscaled = unscaled; this->event.object.overlay->x = osd->display_x + osd->x1; @@ -239,6 +254,9 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { this->event.object.overlay->width = osd->x2 - osd->x1; this->event.object.overlay->height = osd->y2 - osd->y1; + this->event.object.overlay->extent_width = osd->extent_width; + this->event.object.overlay->extent_height = osd->extent_height; + this->event.object.overlay->hili_top = 0; this->event.object.overlay->hili_bottom = this->event.object.overlay->height; this->event.object.overlay->hili_left = 0; @@ -246,53 +264,59 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { /* there will be at least that many rle objects (one for each row) */ this->event.object.overlay->num_rle = 0; - /* We will never need more rle objects than columns in any row - Rely on lazy page allocation to avoid us actually taking up - this much RAM */ - this->event.object.overlay->data_size = osd->width * osd->height; - rle_p = this->event.object.overlay->rle = - malloc(this->event.object.overlay->data_size * sizeof(rle_elem_t) ); + if (!osd->area_touched) { + /* avoid rle encoding when only argb_layer is modified */ + this->event.object.overlay->data_size = 0; + rle_p = this->event.object.overlay->rle = NULL; + } else { + /* We will never need more rle objects than columns in any row + Rely on lazy page allocation to avoid us actually taking up + this much RAM */ + this->event.object.overlay->data_size = osd->width * osd->height; + rle_p = this->event.object.overlay->rle = + malloc(this->event.object.overlay->data_size * sizeof(rle_elem_t) ); - for( y = osd->y1; y < osd->y2; y++ ) { + for( y = osd->y1; y < osd->y2; y++ ) { #ifdef DEBUG_RLE - lprintf("osd_show %p y = %d: ", osd, y); + lprintf("osd_show %p y = %d: ", osd, y); #endif - c = osd->area + y * osd->width + osd->x1; + c = osd->area + y * osd->width + osd->x1; - /* initialize a rle object with the first pixel's color */ - rle.len = 1; - rle.color = *c++; + /* initialize a rle object with the first pixel's color */ + rle.len = 1; + rle.color = *c++; - /* loop over the remaining pixels in the row */ - for( x = osd->x1 + rle.len; x < osd->x2; x++, c++ ) { - if( rle.color != *c ) { + /* loop over the remaining pixels in the row */ + for( x = osd->x1 + rle.len; x < osd->x2; x++, c++ ) { + if( rle.color != *c ) { #ifdef DEBUG_RLE - lprintf("(%d, %d), ", rle.len, rle.color); + lprintf("(%d, %d), ", rle.len, rle.color); #endif - *rle_p++ = rle; - this->event.object.overlay->num_rle++; + *rle_p++ = rle; + this->event.object.overlay->num_rle++; - rle.color = *c; - rle.len = 1; - } else { - rle.len++; + rle.color = *c; + rle.len = 1; + } else { + rle.len++; + } } - } #ifdef DEBUG_RLE - lprintf("(%d, %d)\n", rle.len, rle.color); + lprintf("(%d, %d)\n", rle.len, rle.color); #endif - *rle_p++ = rle; - this->event.object.overlay->num_rle++; - } + *rle_p++ = rle; + this->event.object.overlay->num_rle++; + } #ifdef DEBUG_RLE - lprintf("osd_show %p rle ends\n", osd); + lprintf("osd_show %p rle ends\n", osd); #endif - lprintf("num_rle = %d\n", this->event.object.overlay->num_rle); - - memcpy(this->event.object.overlay->hili_color, osd->color, sizeof(osd->color)); - memcpy(this->event.object.overlay->hili_trans, osd->trans, sizeof(osd->trans)); - memcpy(this->event.object.overlay->color, osd->color, sizeof(osd->color)); - memcpy(this->event.object.overlay->trans, osd->trans, sizeof(osd->trans)); + lprintf("num_rle = %d\n", this->event.object.overlay->num_rle); + + memcpy(this->event.object.overlay->hili_color, osd->color, sizeof(osd->color)); + memcpy(this->event.object.overlay->hili_trans, osd->trans, sizeof(osd->trans)); + memcpy(this->event.object.overlay->color, osd->color, sizeof(osd->color)); + memcpy(this->event.object.overlay->trans, osd->trans, sizeof(osd->trans)); + } this->event.event_type = OVERLAY_EVENT_SHOW; this->event.vpts = vpts; @@ -376,11 +400,14 @@ static int osd_hide (osd_object_t *osd, int64_t vpts) { static void osd_clear (osd_object_t *osd) { lprintf("osd=%p\n",osd); - memset(osd->area, 0, osd->width * osd->height); - osd->x1 = osd->width; - osd->y1 = osd->height; - osd->x2 = 0; - osd->y2 = 0; + if (osd->area_touched) { + osd->area_touched = 0; + memset(osd->area, 0, osd->width * osd->height); + } + osd->x1 = osd->argb_layer.x1 = osd->width; + osd->y1 = osd->argb_layer.y1 = osd->height; + osd->x2 = osd->argb_layer.x2 = 0; + osd->y2 = osd->argb_layer.y2 = 0; } /* @@ -402,6 +429,7 @@ static void osd_point (osd_object_t *osd, int x, int y, int color) { osd->x2 = MAX(osd->x2, (x + 1)); osd->y1 = MIN(osd->y1, y); osd->y2 = MAX(osd->y2, (y + 1)); + osd->area_touched = 1; c = osd->area + y * osd->width + x; *c = color; @@ -461,6 +489,7 @@ static void osd_line (osd_object_t *osd, osd->x2 = MAX( osd->x2, x2 ); osd->y1 = MIN( osd->y1, y1 ); osd->y2 = MAX( osd->y2, y2 ); + osd->area_touched = 1; dx = x2 - x1; dy = y2 - y1; @@ -574,6 +603,7 @@ static void osd_filled_rect (osd_object_t *osd, osd->x2 = MAX( osd->x2, dx ); osd->y1 = MIN( osd->y1, y ); osd->y2 = MAX( osd->y2, dy ); + osd->area_touched = 1; dx -= x; dy -= y; @@ -1131,6 +1161,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, if( x1 < osd->x1 ) osd->x1 = x1; if( y1 < osd->y1 ) osd->y1 = y1; + osd->area_touched = 1; inbuf = text; inbytesleft = strlen(text); @@ -1479,6 +1510,7 @@ static void osd_free_object (osd_object_t *osd_to_close) { else this->osds = osd->next; + pthread_mutex_destroy(&osd->argb_layer.mutex); free( osd ); break; } @@ -1524,6 +1556,7 @@ static void osd_draw_bitmap(osd_object_t *osd, uint8_t *bitmap, osd->x2 = MAX( osd->x2, x1+width ); osd->y1 = MIN( osd->y1, y1 ); osd->y2 = MAX( osd->y2, y1+height ); + osd->area_touched = 1; for( y=0; yargb_buffer = argb_buffer; - if(osd->x1 == 0 || x < osd->x1) - osd->x1 = x; - if(osd->x2 == 0 || (x + width) > osd->x2) - osd->x2 = x + width; - if(osd->y1 == 0 || y < osd->y1) - osd->y1 = y; - if(osd->y2 == 0 || (y + height) > osd->y2) - osd->y2 = y + height; + if (osd->argb_layer.buffer != argb_buffer) { + dirty_x = 0; + dirty_y = 0; + dirty_width = osd->width; + dirty_height = osd->height; + } + + /* keep osd_object clipping behavior */ + osd->x1 = MIN( osd->x1, dirty_x ); + osd->x2 = MAX( osd->x2, dirty_x + dirty_width ); + osd->y1 = MIN( osd->y1, dirty_y ); + osd->y2 = MAX( osd->y2, dirty_y + dirty_height ); + + pthread_mutex_lock(&osd->argb_layer.mutex); + + /* argb layer update area accumulation */ + osd->argb_layer.x1 = MIN( osd->argb_layer.x1, dirty_x ); + osd->argb_layer.x2 = MAX( osd->argb_layer.x2, dirty_x + dirty_width ); + osd->argb_layer.y1 = MIN( osd->argb_layer.y1, dirty_y ); + osd->argb_layer.y2 = MAX( osd->argb_layer.y2, dirty_y + dirty_height ); + + osd->argb_layer.buffer = argb_buffer; + + pthread_mutex_unlock(&osd->argb_layer.mutex); } static uint32_t osd_get_capabilities (osd_object_t *osd) { osd_renderer_t *this = osd->renderer; uint32_t capabilities = 0; + uint32_t vo_capabilities; #ifdef HAVE_FT2 capabilities |= XINE_OSD_CAP_FREETYPE2; #endif this->stream->xine->port_ticket->acquire(this->stream->xine->port_ticket, 1); - if( this->stream->video_out->get_capabilities(this->stream->video_out) & - VO_CAP_UNSCALED_OVERLAY) - capabilities |= XINE_OSD_CAP_UNSCALED; + vo_capabilities = this->stream->video_out->get_capabilities(this->stream->video_out); this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1); + + if (vo_capabilities & VO_CAP_UNSCALED_OVERLAY) + capabilities |= XINE_OSD_CAP_UNSCALED; + + if (vo_capabilities & VO_CAP_CUSTOM_EXTENT_OVERLAY) + capabilities |= XINE_OSD_CAP_CUSTOM_EXTENT; + + if (vo_capabilities & VO_CAP_ARGB_LAYER_OVERLAY) + capabilities |= XINE_OSD_CAP_ARGB_LAYER; return capabilities; } @@ -1634,6 +1690,7 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) { this->set_argb_buffer = osd_set_argb_buffer; this->show_unscaled = osd_show_unscaled; this->get_capabilities = osd_get_capabilities; + this->set_extent = osd_set_extent; return this; } diff --git a/src/xine-engine/osd.h b/src/xine-engine/osd.h index a6acc11ab..36e6fc0ae 100644 --- a/src/xine-engine/osd.h +++ b/src/xine-engine/osd.h @@ -47,8 +47,12 @@ struct osd_object_s { int width, height; /* work area dimentions */ uint8_t *area; /* work area */ + int area_touched; /* work area was used for painting */ int display_x,display_y; /* where to display it in screen */ + /* extent of reference coordinate system */ + int extent_width, extent_height; + /* clipping box inside work area */ int x1, y1; int x2, y2; @@ -70,7 +74,7 @@ struct osd_object_s { /* this holds an optional ARGB overlay, which * is only be used by supported video_out modules. * right now this is only vdpau */ - uint32_t *argb_buffer; + argb_layer_t argb_layer; }; @@ -219,10 +223,25 @@ struct osd_renderer_s { uint32_t (*get_capabilities) (osd_object_t *osd); /* - * set a buffer to an argb buffer + * define extent of reference coordinate system for video + * resolution independent osds. both sizes must be > 0 to + * take effect. otherwise, video resolution will be used. + */ + void (*set_extent) (osd_object_t *osd, int extent_width, int extent_height); + + /* + * set an argb buffer to be blended into video + * the buffer must exactly match the osd dimensions + * and stay valid while the osd is on screen. pass + * a NULL pointer to safely remove the buffer from + * the osd layer. only the dirty area will be + * updated on screen. for convinience the whole + * osd object will be considered dirty when setting + * a different buffer pointer. + * see also XINE_OSD_CAP_ARGB_LAYER */ void (*set_argb_buffer) (osd_object_t *osd, uint32_t *argb_buffer, - int x, int y, int width, int height); + int dirty_x, int dirty_y, int dirty_width, int dirty_height); /* private stuff */ diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 76b347a41..0c73ddafa 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -68,6 +68,14 @@ struct vo_frame_s { * member functions */ + /* Provide a copy of the frame's image in an image format already known to xine. data's member */ + /* have already been intialized to frame's content on entry, so it's usually only necessary to */ + /* change format and img_size. In case img is set, it will point to a memory block of suitable */ + /* size (size has been determined by a previous call with img == NULL). img content and img_size */ + /* must adhere to the specification of _x_get_current_frame_data(). */ + /* Currently this is needed for all image formats except XINE_IMGFMT_YV12 and XINE_IMGFMT_YUY2. */ + void (*proc_provide_standard_frame_data) (vo_frame_t *vo_img, xine_current_frame_data_t *data); + /* Duplicate picture data and acceleration specific data of a frame. */ /* if the image format isn't already known by Xine. Currently this is needed */ /* For all image formats except XINE_IMGFMT_YV12 and XINE_IMGFMT_YUY2 */ @@ -286,6 +294,8 @@ struct xine_video_port_s { #define VO_CAP_XXMC 0x00000040 /* driver can use extended XvMC */ #define VO_CAP_VDPAU_H264 0x00000080 /* driver can use VDPAU for H264 */ #define VO_CAP_VDPAU_MPEG12 0x00000100 /* driver can use VDPAU for mpeg1/2 */ +#define VO_CAP_CUSTOM_EXTENT_OVERLAY 0x01000000 /* driver can blend custom extent overlay to output extent */ +#define VO_CAP_ARGB_LAYER_OVERLAY 0x02000000 /* driver supports true color overlay */ /* @@ -398,6 +408,14 @@ typedef struct rle_elem_s { uint16_t color; } rle_elem_t; +typedef struct argb_layer_s { + pthread_mutex_t mutex; + uint32_t *buffer; + /* dirty area */ + int x1, y1; + int x2, y2; +} argb_layer_t; + struct vo_overlay_s { rle_elem_t *rle; /* rle code buffer */ @@ -408,6 +426,10 @@ struct vo_overlay_s { int width; /* width of subpicture area */ int height; /* height of subpicture area */ + /* extent of reference coordinate system */ + int extent_width; + int extent_height; + uint32_t color[OVL_PALETTE_SIZE]; /* color lookup table */ uint8_t trans[OVL_PALETTE_SIZE]; /* mixer key table */ int rgb_clut; /* true if clut was converted to rgb */ @@ -423,7 +445,7 @@ struct vo_overlay_s { int unscaled; /* true if it should be blended unscaled */ - uint32_t *argb_buffer; + argb_layer_t *argb_layer; }; diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index e4e36527f..e0c98c018 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -1963,6 +1963,8 @@ static int _x_get_current_frame_data (xine_stream_t *stream, stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); frame = stream->video_out->get_last_frame (stream->video_out); + if (frame) + frame->lock(frame); stream->xine->port_ticket->release(stream->xine->port_ticket, 0); if (!frame) { @@ -1994,6 +1996,30 @@ static int _x_get_current_frame_data (xine_stream_t *stream, switch (frame->format) { + default: + if (frame->proc_provide_standard_frame_data) { + uint8_t *img = data->img; + size_t img_size = data->img_size; + data->img = 0; + data->img_size = 0; + + /* ask frame implementation for required img buffer size */ + frame->proc_provide_standard_frame_data(frame, data); + required_size = data->img_size; + + data->img = img; + data->img_size = img_size; + break; + } + + if (!data->img && !(flags & XINE_FRAME_DATA_ALLOCATE_IMG)) + break; /* not interested in image data */ + + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + "xine: error, snapshot function not implemented for format 0x%x\n", frame->format); + /* fall though and provide "green" YV12 image */ + data->format = XINE_IMGFMT_YV12; + case XINE_IMGFMT_YV12: required_size = frame->width * frame->height + ((frame->width + 1) / 2) * ((frame->height + 1) / 2) @@ -2006,26 +2032,21 @@ static int _x_get_current_frame_data (xine_stream_t *stream, + ((frame->width + 1) / 2) * frame->height; break; - default: - if (data->img || (flags & XINE_FRAME_DATA_ALLOCATE_IMG)) { - xprintf (stream->xine, XINE_VERBOSITY_DEBUG, - "xine: error, snapshot function not implemented for format 0x%x\n", frame->format); - _x_abort (); - } - - required_size = 0; } if (flags & XINE_FRAME_DATA_ALLOCATE_IMG) { /* return allocated buffer size */ data->img_size = required_size; /* allocate img or fail */ - if (!(data->img = calloc(1, required_size))) + if (!(data->img = calloc(1, required_size))) { + frame->free(frame); return 0; + } } else { /* fail if supplied buffer is to small */ if (data->img && !img_size_unknown && data->img_size < required_size) { data->img_size = required_size; + frame->free(frame); return 0; } /* return used buffer size */ @@ -2061,11 +2082,14 @@ static int _x_get_current_frame_data (xine_stream_t *stream, break; default: - xprintf (stream->xine, XINE_VERBOSITY_DEBUG, - "xine: error, snapshot function not implemented for format 0x%x\n", frame->format); - _x_abort (); + if (frame->proc_provide_standard_frame_data) + frame->proc_provide_standard_frame_data(frame, data); + else if (!(flags & XINE_FRAME_DATA_ALLOCATE_IMG)) + memset(data->img, 0, data->img_size); } } + + frame->free(frame); return 1; } diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 4f59785a1..08ff4dc22 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -856,8 +856,12 @@ void xine_osd_draw_bitmap(xine_osd_t *this, uint8_t *bitmap, } void xine_osd_set_argb_buffer(xine_osd_t *this, uint32_t *argb_buffer, - int x, int y, int width, int height) { - this->osd.renderer->set_argb_buffer(&this->osd, argb_buffer, x, y, width, height); + int dirty_x, int dirty_y, int dirty_width, int dirty_height) { + this->osd.renderer->set_argb_buffer(&this->osd, argb_buffer, dirty_x, dirty_y, dirty_width, dirty_height); +} + +void xine_osd_set_extent(xine_osd_t *this, int extent_width, int extent_height) { + this->osd.renderer->set_extent(&this->osd, extent_width, extent_height); } -- cgit v1.2.3 From 012932581636f44ad0e991570f6ff069a8421619 Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Mon, 5 Jan 2009 07:20:47 +0000 Subject: Enable sharpness and noise_reduction; add an option for progressive_flag. --- src/xine-engine/video_out.c | 4 ++++ src/xine-engine/video_out.h | 4 +++- src/xine-engine/xine_interface.c | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index f99067ad4..171190bc5 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -1434,6 +1434,8 @@ static int vo_get_property (xine_video_port_t *this_gen, int property) { ret = this->crop_bottom; break; + case XINE_PARAM_VO_SHARPNESS: + case XINE_PARAM_VO_NOISE_REDUCTION: case XINE_PARAM_VO_HUE: case XINE_PARAM_VO_SATURATION: case XINE_PARAM_VO_CONTRAST: @@ -1523,6 +1525,8 @@ static int vo_set_property (xine_video_port_t *this_gen, int property, int value ret = this->crop_bottom = value; break; + case XINE_PARAM_VO_SHARPNESS: + case XINE_PARAM_VO_NOISE_REDUCTION: case XINE_PARAM_VO_HUE: case XINE_PARAM_VO_SATURATION: case XINE_PARAM_VO_CONTRAST: diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 0c73ddafa..845ab0079 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -260,7 +260,9 @@ struct xine_video_port_s { #define VO_PROP_OUTPUT_HEIGHT 20 /* read-only */ #define VO_PROP_OUTPUT_XOFFSET 21 /* read-only */ #define VO_PROP_OUTPUT_YOFFSET 22 /* read-only */ -#define VO_NUM_PROPERTIES 23 +#define VO_PROP_SHARPNESS 24 +#define VO_PROP_NOISE_REDUCTION 25 +#define VO_NUM_PROPERTIES 26 /* number of colors in the overlay palette. Currently limited to 256 at most, because some alphablend functions use an 8-bit index into diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 08ff4dc22..20101b436 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -474,6 +474,8 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { stream->xine->verbosity = value; break; + case XINE_PARAM_VO_SHARPNESS: + case XINE_PARAM_VO_NOISE_REDUCTION: case XINE_PARAM_VO_HUE: case XINE_PARAM_VO_SATURATION: case XINE_PARAM_VO_CONTRAST: @@ -635,6 +637,8 @@ int xine_get_param (xine_stream_t *stream, int param) { ret = stream->xine->verbosity; break; + case XINE_PARAM_VO_SHARPNESS: + case XINE_PARAM_VO_NOISE_REDUCTION: case XINE_PARAM_VO_HUE: case XINE_PARAM_VO_SATURATION: case XINE_PARAM_VO_CONTRAST: -- cgit v1.2.3 From 4649f23f1841a95c0630eff250d13868b98ac3f0 Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Fri, 9 Jan 2009 17:03:29 +0000 Subject: Add preemption reinit support. --- src/xine-engine/accel_vdpau.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/xine-engine') diff --git a/src/xine-engine/accel_vdpau.h b/src/xine-engine/accel_vdpau.h index e489408c5..99cea4568 100644 --- a/src/xine-engine/accel_vdpau.h +++ b/src/xine-engine/accel_vdpau.h @@ -49,6 +49,9 @@ typedef struct { VdpVideoSurface surface; VdpChromaType chroma; + int vdp_runtime_nr; /* this is used to keep in sync on preemptions */ + int *current_vdp_runtime_nr; + } vdpau_accel_t; #ifdef __cplusplus -- cgit v1.2.3 From 183b9fb01f43bfd4b4877e2509a0cfe58fb7738a Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Sun, 25 Jan 2009 16:04:08 +0000 Subject: Select correct color standard for H.264. --- src/xine-engine/accel_vdpau.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/xine-engine') diff --git a/src/xine-engine/accel_vdpau.h b/src/xine-engine/accel_vdpau.h index 99cea4568..92a46e46f 100644 --- a/src/xine-engine/accel_vdpau.h +++ b/src/xine-engine/accel_vdpau.h @@ -49,6 +49,8 @@ typedef struct { VdpVideoSurface surface; VdpChromaType chroma; + VdpColorStandard color_standard; + int vdp_runtime_nr; /* this is used to keep in sync on preemptions */ int *current_vdp_runtime_nr; -- cgit v1.2.3 From e8c9517c396f161b752c85a8b048c7cdde8c9496 Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Fri, 30 Jan 2009 17:32:06 +0000 Subject: Initial VC1 commit. --- src/xine-engine/video_out.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/xine-engine') diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 845ab0079..bbf0dcc35 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -296,6 +296,7 @@ struct xine_video_port_s { #define VO_CAP_XXMC 0x00000040 /* driver can use extended XvMC */ #define VO_CAP_VDPAU_H264 0x00000080 /* driver can use VDPAU for H264 */ #define VO_CAP_VDPAU_MPEG12 0x00000100 /* driver can use VDPAU for mpeg1/2 */ +#define VO_CAP_VDPAU_VC1 0x00000200 /* driver can use VDPAU for mpeg1/2 */ #define VO_CAP_CUSTOM_EXTENT_OVERLAY 0x01000000 /* driver can blend custom extent overlay to output extent */ #define VO_CAP_ARGB_LAYER_OVERLAY 0x02000000 /* driver supports true color overlay */ -- cgit v1.2.3 From c65baeabb4c0d31faabb8f1af1b8e7a923dec292 Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Sat, 7 Feb 2009 10:34:36 +0000 Subject: Don't remove vdpau decoders from catalogue if failed to open. It could be because of no free decoder (it should be tried again later). --- src/xine-engine/load_plugins.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 4f7492c65..f0e33ceed 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -1959,7 +1959,13 @@ video_decoder_t *_x_get_video_decoder (xine_stream_t *stream, uint8_t stream_typ vd = ((video_decoder_class_t *)node->plugin_class)->open_plugin(node->plugin_class, stream); - if (vd) { + if (vd == 1) { + /* HACK: plugin failed to instantiate because required resources are unavailable at that time, + but may be available later, so don't remove this plugin from catalog. */ + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + "load_plugins: plugin %s failed to instantiate, resources temporarily unavailable.\n", node->info->id); + } + else if (vd) { inc_node_ref(node); vd->node = node; xprintf(stream->xine, XINE_VERBOSITY_DEBUG, -- cgit v1.2.3 From 6b74e1ea780e2f1f20aa45f5a130ca20151a12fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Mon, 23 Mar 2009 11:18:27 +0000 Subject: Allow interception of vdpau frame type by post plugins; fix dpb issues on broken streams (missing or doubled images in dpb). --- src/xine-engine/accel_vdpau.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/xine-engine') diff --git a/src/xine-engine/accel_vdpau.h b/src/xine-engine/accel_vdpau.h index 92a46e46f..7ddc5e21f 100644 --- a/src/xine-engine/accel_vdpau.h +++ b/src/xine-engine/accel_vdpau.h @@ -38,6 +38,7 @@ extern "C" { typedef struct { + vo_frame_t *vo_frame; VdpDevice vdp_device; @@ -56,6 +57,9 @@ typedef struct { } vdpau_accel_t; +#define VDPAU_DATA(frame_gen) ((frame_gen) ? (vdpau_accel_t *)(frame_gen)->accel_data : (vdpau_accel_t *)0) +#define VDPAU_FRAME(frame_gen) ((frame_gen) ? (vdpau_accel_t *)VDPAU_DATA(frame_gen)->vo_frame : (vdpau_frame_t *)0) + #ifdef __cplusplus } #endif -- cgit v1.2.3 From 152bbca94ab1e298c68a7b810222a5ae6f5a8808 Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Thu, 11 Jun 2009 01:06:33 +0100 Subject: video_window_overlay + vdpau_dispose fixes. --- src/xine-engine/osd.c | 26 ++++++++++++++++++++++++++ src/xine-engine/osd.h | 11 +++++++++++ src/xine-engine/video_out.c | 14 ++++++++++++++ src/xine-engine/video_out.h | 7 +++++++ src/xine-engine/xine_interface.c | 4 ++++ 5 files changed, 62 insertions(+) (limited to 'src/xine-engine') diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 7f4e6aefb..73470be1f 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -143,6 +143,10 @@ static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width osd->next = this->osds; this->osds = osd; + osd->video_window_x = 0; + osd->video_window_y = 0; + osd->video_window_width = 0; + osd->video_window_height = 0; osd->extent_width = 0; osd->extent_height = 0; osd->width = width; @@ -186,6 +190,19 @@ static void osd_set_extent (osd_object_t *osd, int extent_width, int extent_heig osd->extent_height = extent_height; } +/* + * osd video window defines an area withing osd extent where the + * video shall be scaled to while an osd is displayed on screen. + * both width and height must be > 0 to take effect. + */ +static void osd_set_video_window (osd_object_t *osd, int window_x, int window_y, int window_width, int window_height) { + + osd->video_window_x = window_x; + osd->video_window_y = window_y; + osd->video_window_width = window_width; + osd->video_window_height = window_height; +} + /* @@ -254,6 +271,11 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { this->event.object.overlay->width = osd->x2 - osd->x1; this->event.object.overlay->height = osd->y2 - osd->y1; + this->event.object.overlay->video_window_x = osd->video_window_x; + this->event.object.overlay->video_window_y = osd->video_window_y; + this->event.object.overlay->video_window_width = osd->video_window_width; + this->event.object.overlay->video_window_height = osd->video_window_height; + this->event.object.overlay->extent_width = osd->extent_width; this->event.object.overlay->extent_height = osd->extent_height; @@ -1627,6 +1649,9 @@ static uint32_t osd_get_capabilities (osd_object_t *osd) { if (vo_capabilities & VO_CAP_ARGB_LAYER_OVERLAY) capabilities |= XINE_OSD_CAP_ARGB_LAYER; + if (vo_capabilities & VO_CAP_VIDEO_WINDOW_OVERLAY) + capabilities |= XINE_OSD_CAP_VIDEO_WINDOW; + return capabilities; } @@ -1691,6 +1716,7 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) { this->show_unscaled = osd_show_unscaled; this->get_capabilities = osd_get_capabilities; this->set_extent = osd_set_extent; + this->set_video_window = osd_set_video_window; return this; } diff --git a/src/xine-engine/osd.h b/src/xine-engine/osd.h index 36e6fc0ae..be5e2218c 100644 --- a/src/xine-engine/osd.h +++ b/src/xine-engine/osd.h @@ -50,6 +50,10 @@ struct osd_object_s { int area_touched; /* work area was used for painting */ int display_x,display_y; /* where to display it in screen */ + /* video output area within osd extent */ + int video_window_x, video_window_y; + int video_window_width, video_window_height; + /* extent of reference coordinate system */ int extent_width, extent_height; @@ -243,6 +247,13 @@ struct osd_renderer_s { void (*set_argb_buffer) (osd_object_t *osd, uint32_t *argb_buffer, int dirty_x, int dirty_y, int dirty_width, int dirty_height); + /* + * osd video window defines an area withing osd extent where the + * video shall be scaled to while an osd is displayed on screen. + * both width and height must be > 0 to take effect. + */ + void (*set_video_window) (osd_object_t *osd, + int window_x, int window_y, int window_width, int window_height); /* private stuff */ diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 171190bc5..152f0878a 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -437,6 +437,20 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { int frames_to_skip; int duration; + /*if (1) { + static int64_t pts = 0; + fprintf(stderr, "img->pts: %lld, pts: %lld, img->duration: %d", img->pts, pts, img->duration); + if (img->pts) { + if (pts != img->pts) + fprintf(stderr, " ERROR: %12ld", img->pts - pts); + pts = img->pts + img->duration; + } + else { + pts += img->duration; + } + fprintf(stderr, "\n"); + }*/ + /* handle anonymous streams like NULL for easy checking */ if (stream == XINE_ANON_STREAM) stream = NULL; diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index bbf0dcc35..480c1c8f2 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -299,6 +299,7 @@ struct xine_video_port_s { #define VO_CAP_VDPAU_VC1 0x00000200 /* driver can use VDPAU for mpeg1/2 */ #define VO_CAP_CUSTOM_EXTENT_OVERLAY 0x01000000 /* driver can blend custom extent overlay to output extent */ #define VO_CAP_ARGB_LAYER_OVERLAY 0x02000000 /* driver supports true color overlay */ +#define VO_CAP_VIDEO_WINDOW_OVERLAY 0x04000000 /* driver can scale video to an area within overlay */ /* @@ -429,6 +430,12 @@ struct vo_overlay_s { int width; /* width of subpicture area */ int height; /* height of subpicture area */ + /* area within osd extent to scale video to */ + int video_window_x; + int video_window_y; + int video_window_width; + int video_window_height; + /* extent of reference coordinate system */ int extent_width; int extent_height; diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 20101b436..8301414cd 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -868,6 +868,10 @@ void xine_osd_set_extent(xine_osd_t *this, int extent_width, int extent_height) this->osd.renderer->set_extent(&this->osd, extent_width, extent_height); } +void xine_osd_set_video_window(xine_osd_t *this, int window_x, int window_y, int window_width, int window_height) { + this->osd.renderer->set_video_window(&this->osd, window_x, window_y, window_width, window_height); +} + const char *const *xine_post_list_inputs(xine_post_t *this_gen) { post_plugin_t *this = (post_plugin_t *)this_gen; -- cgit v1.2.3 From 2daed669573c55bcd621153bdfffa251758e0f83 Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Thu, 11 Jun 2009 13:07:37 +0100 Subject: Cleanup. --- src/xine-engine/video_out.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 152f0878a..171190bc5 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -437,20 +437,6 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { int frames_to_skip; int duration; - /*if (1) { - static int64_t pts = 0; - fprintf(stderr, "img->pts: %lld, pts: %lld, img->duration: %d", img->pts, pts, img->duration); - if (img->pts) { - if (pts != img->pts) - fprintf(stderr, " ERROR: %12ld", img->pts - pts); - pts = img->pts + img->duration; - } - else { - pts += img->duration; - } - fprintf(stderr, "\n"); - }*/ - /* handle anonymous streams like NULL for easy checking */ if (stream == XINE_ANON_STREAM) stream = NULL; -- cgit v1.2.3