summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libspudvb/xine_spudvb_decoder.c63
1 files changed, 24 insertions, 39 deletions
diff --git a/src/libspudvb/xine_spudvb_decoder.c b/src/libspudvb/xine_spudvb_decoder.c
index e6e885e1f..1e33c48af 100644
--- a/src/libspudvb/xine_spudvb_decoder.c
+++ b/src/libspudvb/xine_spudvb_decoder.c
@@ -32,7 +32,11 @@
#include "osd.h"
#define MAX_REGIONS 7
-/*#define LOG 1*/
+#define SPU_MAX_WIDTH 720
+#define SPU_MAX_HEIGHT 576
+
+/*#define LOG*/
+#define LOG_MODULE "spudvb"
typedef struct {
int x, y;
@@ -145,19 +149,15 @@ static void update_region (dvb_spu_decoder_t * this, int region_id, int region_w
page_t *page = &dvbsub->page;
/* reject invalid sizes and set some limits ! */
- if ( region_width<=0 || region_height<=0 || region_width>720 || region_height>576 ) {
+ if ( region_width<=0 || region_height<=0 || region_width>SPU_MAX_WIDTH || region_height>SPU_MAX_HEIGHT ) {
free( reg->img );
reg->img = NULL;
-#ifdef LOG
- printf("SPUDVB: rejected region %d = %dx%d\n", region_id, region_width, region_height );
-#endif
+ lprintf("rejected region %d = %dx%d\n", region_id, region_width, region_height );
return;
}
if ( (reg->width*reg->height) < (region_width*region_height) ) {
-#ifdef LOG
- printf("SPUDVB: update size of region %d = %dx%d\n", region_id, region_width, region_height);
-#endif
+ lprintf("update size of region %d = %dx%d\n", region_id, region_width, region_height);
free( reg->img );
reg->img = NULL;
}
@@ -173,9 +173,7 @@ static void update_region (dvb_spu_decoder_t * this, int region_id, int region_w
if ( fill ) {
memset( reg->img, fill_color, region_width*region_height );
reg->empty = 1;
-#ifdef LOG
- printf("SPUDVB : FILL REGION %d\n", region_id);
-#endif
+ lprintf("FILL REGION %d\n", region_id);
}
reg->width = region_width;
reg->height = region_height;
@@ -594,13 +592,11 @@ static void* dvbsub_timer_func(void *this_gen)
if(this && this->stream && this->stream->osd_renderer) {
int i;
for ( i=0; i<MAX_REGIONS; i++ ) {
- if ( !this->dvbsub->regions[i].osd )
- continue;
+ if ( !this->dvbsub->regions[i].osd )
+ continue;
- this->stream->osd_renderer->hide( this->dvbsub->regions[i].osd, 0 );
-#ifdef LOG
- printf("SPUDVB: thread hiding = %d\n",i);
-#endif
+ this->stream->osd_renderer->hide( this->dvbsub->regions[i].osd, 0 );
+ lprintf("thread hiding = %d\n",i);
}
}
pthread_cond_wait(&this->dvbsub_restart_timeout, &this->dvbsub_osd_mutex);
@@ -627,7 +623,7 @@ static void draw_subtitles (dvb_spu_decoder_t * this)
int dest_width=0, dest_height;
this->stream->video_out->status(this->stream->video_out, NULL, &dest_width, &dest_height, &dum);
- if ( !dest_width )
+ if ( !dest_width || !dest_height )
return;
/* render all regions onto the page */
@@ -637,8 +633,8 @@ static void draw_subtitles (dvb_spu_decoder_t * this)
int display = 0;
for ( r=0; r<MAX_REGIONS; r++ ) {
if ( this->dvbsub->page.regions[r].is_visible ) {
- display = 1;
- break;
+ display = 1;
+ break;
}
}
if ( !display )
@@ -658,7 +654,7 @@ static void draw_subtitles (dvb_spu_decoder_t * this)
uint8_t *reg;
int reg_width;
uint8_t tmp[dest_width*576];
- if (this->dvbsub->regions[r].width>dest_width) {
+ if ( this->dvbsub->regions[r].width>dest_width && !(this->stream->video_driver->get_capabilities(this->stream->video_driver) & VO_CAP_CUSTOM_EXTENT_OVERLAY)) {
downscale_region_image(&this->dvbsub->regions[r], tmp, dest_width);
reg = tmp;
reg_width = dest_width;
@@ -674,34 +670,25 @@ static void draw_subtitles (dvb_spu_decoder_t * this)
}
pthread_mutex_lock(&this->dvbsub_osd_mutex);
-#ifdef LOG
- printf("SPUDVB: this->vpts=%llu\n",this->vpts);
-#endif
+ lprintf("this->vpts=%llu\n",this->vpts);
for ( r=0; r<MAX_REGIONS; r++ ) {
-#ifdef LOG
- printf("SPUDVB : region=%d, visible=%d, osd=%d, empty=%d\n", r, this->dvbsub->page.regions[r].is_visible, this->dvbsub->regions[r].osd?1:0, this->dvbsub->regions[r].empty );
-#endif
+ lprintf("region=%d, visible=%d, osd=%d, empty=%d\n", r, this->dvbsub->page.regions[r].is_visible, this->dvbsub->regions[r].osd?1:0, this->dvbsub->regions[r].empty );
if ( this->dvbsub->page.regions[r].is_visible && this->dvbsub->regions[r].osd && !this->dvbsub->regions[r].empty ) {
+ this->stream->osd_renderer->set_extent(this->dvbsub->regions[r].osd, SPU_MAX_WIDTH, SPU_MAX_HEIGHT);
this->stream->osd_renderer->set_position( this->dvbsub->regions[r].osd, this->dvbsub->page.regions[r].x, this->dvbsub->page.regions[r].y );
this->stream->osd_renderer->show( this->dvbsub->regions[r].osd, this->vpts );
-#ifdef LOG
- printf("SPUDVB: show region = %d\n",r);
-#endif
+ lprintf("show region = %d\n",r);
}
else {
if ( this->dvbsub->regions[r].osd ) {
this->stream->osd_renderer->hide( this->dvbsub->regions[r].osd, this->vpts );
-#ifdef LOG
- printf("SPUDVB: hide region = %d\n",r);
-#endif
+ lprintf("hide region = %d\n",r);
}
}
}
this->dvbsub_hide_timeout.tv_nsec = 0;
this->dvbsub_hide_timeout.tv_sec = time(NULL) + this->dvbsub->page.page_time_out;
-#ifdef LOG
- printf("SPUDVB: page_time_out %d\n",this->dvbsub->page.page_time_out);
-#endif
+ lprintf("page_time_out %d\n",this->dvbsub->page.page_time_out);
pthread_cond_signal(&this->dvbsub_restart_timeout);
pthread_mutex_unlock(&this->dvbsub_osd_mutex);
}
@@ -760,9 +747,7 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf)
metronom_clock_t *const clock = this->stream->xine->clock;
const int64_t curvpts = clock->get_current_time( clock );
/* if buf->pts is unreliable, show page asap (better than nothing) */
-#ifdef LOG
- printf("SPUDVB: spu_vpts=%lld - current_vpts=%lld\n", vpts, curvpts);
-#endif
+ lprintf("spu_vpts=%lld - current_vpts=%lld\n", vpts, curvpts);
if ( vpts<=curvpts || (vpts-curvpts)>(5*90000) )
this->vpts = 0;
else