diff options
Diffstat (limited to 'src/xine-engine')
53 files changed, 2026 insertions, 2026 deletions
diff --git a/src/xine-engine/accel_xvmc.h b/src/xine-engine/accel_xvmc.h index cec5f9558..197b76050 100644 --- a/src/xine-engine/accel_xvmc.h +++ b/src/xine-engine/accel_xvmc.h @@ -3,23 +3,23 @@ * Copyright (C) 2004 the Unichrome 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 XvMC. + * Common acceleration definitions for XvMC. * * */ @@ -81,7 +81,7 @@ typedef struct xine_xxmc_s { */ xine_xvmc_t xvmc; - + unsigned mpeg; unsigned acceleration; int fallback_format; @@ -103,7 +103,7 @@ typedef struct xine_xxmc_s { * For thread-safety only. */ - int (*proc_xxmc_lock_valid) (vo_frame_t *cur_frame, vo_frame_t *fw_frame, + int (*proc_xxmc_lock_valid) (vo_frame_t *cur_frame, vo_frame_t *fw_frame, vo_frame_t *bw_frame,unsigned pc_type); void (*proc_xxmc_unlock) (vo_driver_t *this_gen); } xine_xxmc_t; diff --git a/src/xine-engine/alphablend.c b/src/xine-engine/alphablend.c index 1dcd47eb7..4727740bd 100644 --- a/src/xine-engine/alphablend.c +++ b/src/xine-engine/alphablend.c @@ -1,7 +1,7 @@ /* * * Copyright (C) James Courtier-Dutton James@superbug.demon.co.uk - July 2001 - * + * * Copyright (C) 2000 Thomas Mirlacher * 2002-2004 the xine project * @@ -114,7 +114,7 @@ rle_img_advance_line(rle_elem_t *rle, rle_elem_t *rle_limit, int w) /* * heck, this function is overly complicated and currently buggy. - * if James would like to revive it (implementing proper clipping - + * if James would like to revive it (implementing proper clipping - * not to confuse with button highlight) i would have no objections, * but for now i will be using an alternate version based on rgb24. [MF] * @@ -181,7 +181,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, printf("blend_rgb16: dy_step=%i, x_scale=%i\n", dy_step, x_scale); #endif if (img_width & 1) img_width++; - img_offset = ( ( (y_off * img_height) / dst_height) * img_width) + img_offset = ( ( (y_off * img_height) / dst_height) * img_width) + ( (x_off * img_width) / dst_width); #ifdef LOG_BLEND_RGB16 printf("blend_rgb16: x=%i, y=%i, w=%i, h=%i, img_offset=%lf\n", img_overl->x, img_overl->y, @@ -190,7 +190,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, img_offset); #endif img_pix = (uint16_t *) img + (int)img_offset; -/* +/* + (y_off * img_height / dst_height) * img_width + (x_off * img_width / dst_width); */ @@ -200,26 +200,26 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else @@ -233,7 +233,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, x = x1_scaled = x2_scaled = 0; #ifdef LOG_BLEND_RGB16 - printf("blend_rgb16 started\n"); + printf("blend_rgb16 started\n"); #endif while (zone_state != 6) { @@ -287,10 +287,10 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled); } x += rle_this_bite; - if (x >= src_width ) { + if (x >= src_width ) { x -= src_width; img_pix += img_width; - + dy += dy_step; if (dy >= INT_TO_SCALED(1)) { dy -= INT_TO_SCALED(1); @@ -304,7 +304,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, } else { rle = rle_start; /* y-scaling, reuse the last rle encoded line */ } - } + } rle_remainder = rlelen = rle->len; clr_next = rle->color; rle++; @@ -345,7 +345,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled); } x += rle_this_bite; - if (x >= src_width ) { + if (x >= src_width ) { x -= src_width; img_pix += img_width; dy += dy_step; @@ -390,7 +390,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled); } x += rle_this_bite; - if (x >= src_width ) { + if (x >= src_width ) { x -= src_width; img_pix += img_width; dy += dy_step; @@ -410,7 +410,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, zone_state = 5; break; } - } + } if (rle >= rle_limit) { zone_state = 6; } @@ -435,7 +435,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled); } x += rle_this_bite; - if (x >= src_width ) { + if (x >= src_width ) { x -= src_width; img_pix += img_width; dy += dy_step; @@ -455,7 +455,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, zone_state = 5; break; } - } + } if (rle >= rle_limit) { zone_state = 6; } @@ -473,7 +473,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled); } x += rle_this_bite; - if (x >= src_width ) { + if (x >= src_width ) { x -= src_width; img_pix += img_width; dy += dy_step; @@ -489,7 +489,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, } else { rle = rle_start; /* y-scaling, reuse the last rle encoded line */ } - } + } rle_remainder = rlelen = rle->len; clr_next = rle->color; rle++; @@ -513,7 +513,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled); } x += rle_this_bite; - if (x >= src_width ) { + if (x >= src_width ) { x -= src_width; img_pix += img_width; dy += dy_step; @@ -529,7 +529,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, } else { rle = rle_start; /* y-scaling, reuse the last rle encoded line */ } - } + } rle_remainder = rlelen = rle->len; clr_next = rle->color; rle++; @@ -544,7 +544,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, #ifdef LOG_BLEND_RGB16 printf("blend_rgb16 ended\n"); #endif - + } #endif @@ -576,26 +576,26 @@ void _x_blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else @@ -619,7 +619,7 @@ void _x_blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, if (rlelen <= 0) { if (rle >= rle_limit) break; - + rlelen = rle->len; clr = rle->color; rle++; @@ -627,7 +627,7 @@ void _x_blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, if (!mask) { /* above or below highlight area */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; @@ -646,7 +646,7 @@ void _x_blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, trans = img_overl->trans; } else { /* ends left */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; @@ -666,25 +666,25 @@ void _x_blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, trans = img_overl->hili_trans; } else { /* starts right */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; trans = img_overl->trans; - + if( x + rle_bite >= clip_right ) clipped = 1; } } else { /* starts not left and ends not right */ - + rle_bite = rlelen; /* we're in the center area so choose highlight palette */ colors = (clut_t*)img_overl->hili_color; trans = img_overl->hili_trans; } } - + x2_scaled = SCALED_TO_INT((x + rle_bite) * x_scale); o = trans[clr]; @@ -743,26 +743,26 @@ void _x_blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else @@ -786,7 +786,7 @@ void _x_blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, if (rlelen <= 0) { if (rle >= rle_limit) break; - + rlelen = rle->len; clr = rle->color; rle++; @@ -794,7 +794,7 @@ void _x_blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, if (!mask) { /* above or below highlight area */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; @@ -813,7 +813,7 @@ void _x_blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, trans = img_overl->trans; } else { /* ends left */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; @@ -833,25 +833,25 @@ void _x_blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, trans = img_overl->hili_trans; } else { /* starts right */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; trans = img_overl->trans; - + if( x + rle_bite >= clip_right ) clipped = 1; } } else { /* starts not left and ends not right */ - + rle_bite = rlelen; /* we're in the center area so choose highlight palette */ colors = (clut_t*)img_overl->hili_color; trans = img_overl->hili_trans; } } - + x2_scaled = SCALED_TO_INT((x + rle_bite) * x_scale); o = trans[clr]; @@ -910,50 +910,50 @@ void _x_blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else hili_left = clip_left; - + for (y = dy = 0; y < src_height && rle < rle_limit; ) { int mask = !(y < img_overl->hili_top || y >= img_overl->hili_bottom); rle_elem_t *rle_start = rle; int rlelen = 0; uint8_t clr = 0; - + for (x = x1_scaled = 0; x < src_width;) { int rle_bite; clut_t *colors; uint8_t *trans; uint16_t o; int clipped = (y < clip_top); - + /* take next element from rle list everytime an element is finished */ if (rlelen <= 0) { if (rle >= rle_limit) break; - + rlelen = rle->len; clr = rle->color; rle++; @@ -961,7 +961,7 @@ void _x_blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl, if (!mask) { /* above or below highlight area */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; @@ -980,7 +980,7 @@ void _x_blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl, trans = img_overl->trans; } else { /* ends left */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; @@ -1000,25 +1000,25 @@ void _x_blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl, trans = img_overl->hili_trans; } else { /* starts right */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; trans = img_overl->trans; - + if( x + rle_bite >= clip_right ) clipped = 1; } } else { /* starts not left and ends not right */ - + rle_bite = rlelen; /* we're in the center area so choose highlight palette */ colors = (clut_t*)img_overl->hili_color; trans = img_overl->hili_trans; } } - + x2_scaled = SCALED_TO_INT((x + rle_bite) * x_scale); o = trans[clr]; @@ -1056,11 +1056,11 @@ static void mem_blend8(uint8_t *mem, uint8_t val, uint8_t o, size_t sz) } } -static void blend_yuv_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, +static void blend_yuv_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, uint8_t *(*blend_yuv_data)[ 3 ][ 2 ]) { int x; - + for (x = 0; x < src_width; x += 2) { /* get opacity of the 4 pixels that share chroma */ int o00 = (*blend_yuv_data)[ 0 ][ 0 ][ x + 0 ]; @@ -1078,7 +1078,7 @@ static void blend_yuv_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, int cr01 = (*blend_yuv_data)[ 1 ][ 0 ][ x + 1 ]; int cr10 = (*blend_yuv_data)[ 1 ][ 1 ][ x + 0 ]; int cr11 = (*blend_yuv_data)[ 1 ][ 1 ][ x + 1 ]; - + int cb00 = (*blend_yuv_data)[ 2 ][ 0 ][ x + 0 ]; int cb01 = (*blend_yuv_data)[ 2 ][ 0 ][ x + 1 ]; int cb10 = (*blend_yuv_data)[ 2 ][ 1 ][ x + 0 ]; @@ -1113,11 +1113,11 @@ static uint8_t *(*blend_yuv_grow_extra_data(alphablend_t *extra_data, int osd_wi int max_width; uint8_t *data[ 3 ][ 2 ]; } *header = (struct header_s *)extra_data->buffer; - + size_t needed_buffer_size = sizeof (*header) + osd_width * sizeof (uint8_t[ 3 ][ 2 ]); - + if (extra_data->buffer_size < needed_buffer_size) { - + free(extra_data->buffer); header = calloc(1, needed_buffer_size); if (!header) { @@ -1143,7 +1143,7 @@ static uint8_t *(*blend_yuv_grow_extra_data(alphablend_t *extra_data, int osd_wi return &(header->data); } - + void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, int dst_width, int dst_height, int dst_pitches[3], alphablend_t *extra_data) @@ -1168,12 +1168,12 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, int hili_right, hili_left; int clip_right, clip_left, clip_top; uint8_t clr=0; - + int any_line_buffered = 0; int exact_blend_width = ((src_width <= (dst_width - x_off)) ? src_width : (dst_width - x_off)); int exact_blend_width_m2 = (x_odd + exact_blend_width + 1) & ~1; /* make it a (larger) multiple of 2 */ uint8_t *(*blend_yuv_data)[ 3 ][ 2 ] = 0; - + uint8_t *dst_y = dst_base[0] + dst_pitches[0] * y_off + x_off; uint8_t *dst_cr = dst_base[2] + (y_off / 2) * dst_pitches[1] + (x_off / 2); uint8_t *dst_cb = dst_base[1] + (y_off / 2) * dst_pitches[2] + (x_off / 2); @@ -1188,26 +1188,26 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else @@ -1219,16 +1219,16 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, if (enable_exact_blending) { if (exact_blend_width <= 0) return; - + blend_yuv_data = blend_yuv_grow_extra_data(extra_data, exact_blend_width_m2); if (!blend_yuv_data) return; - + /* make linebuffer transparent */ memset(&(*blend_yuv_data)[ 0 ][ 0 ][ 0 ], 0, exact_blend_width_m2); memset(&(*blend_yuv_data)[ 0 ][ 1 ][ 0 ], 0, exact_blend_width_m2); } - + rlelen=rle_remainder=0; for (y = 0; y < src_height; y++) { if (rle >= rle_limit) { @@ -1237,7 +1237,7 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, #endif break; } - + ymask = ((y < img_overl->hili_top) || (y >= img_overl->hili_bottom)); xmask = 0; #ifdef LOG_BLEND_YUV @@ -1247,14 +1247,14 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, for (x = 0; x < src_width;) { uint16_t o; int clipped = (y < clip_top); - + if (rle >= rle_limit) { #ifdef LOG_BLEND_YUV printf("x-rle_limit\n"); #endif break; } - + #ifdef LOG_BLEND_YUV printf("1:rle_len=%d, remainder=%d, x=%d\n",rlelen, rle_remainder, x); #endif @@ -1263,7 +1263,7 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, #ifdef LOG_BLEND_YUV printf("alphablend: major bug in blend_yuv < 0\n"); #endif - } + } if (rlelen == 0) { rle_remainder = rlelen = rle->len; clr = rle->color; @@ -1281,11 +1281,11 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, #endif if (ymask == 0) { - if (x < hili_left) { + if (x < hili_left) { /* Starts outside highlight area */ if ((x + rle_remainder) > hili_left ) { #ifdef LOG_BLEND_YUV - printf("Outside highlight left %d, ending inside\n", hili_left); + printf("Outside highlight left %d, ending inside\n", hili_left); #endif /* Cutting needed, starts outside, ends inside */ rle_this_bite = (hili_left - x); @@ -1296,7 +1296,7 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, xmask = 0; } else { #ifdef LOG_BLEND_YUV - printf("Outside highlight left %d, ending outside\n", hili_left); + printf("Outside highlight left %d, ending outside\n", hili_left); #endif /* no cutting needed, starts outside, ends outside */ rle_this_bite = rle_remainder; @@ -1335,7 +1335,7 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, } } else if (x >= hili_right) { /* Starts outside highlight area, ends outside highlight area */ - if ((x + rle_remainder ) > src_width ) { + if ((x + rle_remainder ) > src_width ) { #ifdef LOG_BLEND_YUV printf("Outside highlight right %d, ending eol\n", hili_right); #endif @@ -1381,7 +1381,7 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, /* clip against right edge of destination area */ if ((x + rle_this_bite) > (dst_width - x_off)) { int toClip = (x + rle_this_bite) - (dst_width - x_off); - + rle_this_bite -= toClip; rle_remainder += toClip; rlelen += toClip; @@ -1392,7 +1392,7 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, memset(&(*blend_yuv_data)[ 0 ][ (y + y_odd) & 1 ][ x + x_odd ], o, rle_this_bite); any_line_buffered |= ((y + y_odd) & 1) ? 2 : 1; } - + if (o && !clipped) { if(o >= 15) { memset(dst_y + x, my_clut[clr].y, rle_this_bite); @@ -1434,17 +1434,17 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, /* make second line transparent */ memset(&(*blend_yuv_data)[ 0 ][ 1 ][ 0 ], 0, exact_blend_width_m2); } - + blend_yuv_exact(dst_cr, dst_cb, exact_blend_width, blend_yuv_data); - + any_line_buffered = 0; } } - + dst_cr += dst_pitches[2]; dst_cb += dst_pitches[1]; } - + dst_y += dst_pitches[0]; } @@ -1455,21 +1455,21 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, /* make second line transparent */ memset(&(*blend_yuv_data)[ 0 ][ 1 ][ 0 ], 0, exact_blend_width_m2); } - + blend_yuv_exact(dst_cr, dst_cb, exact_blend_width, blend_yuv_data); } } - + #ifdef LOG_BLEND_YUV printf("overlay_blend ended\n"); #endif } - + static void blend_yuy2_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, uint8_t *(*blend_yuy2_data)[ 3 ]) { int x; - + for (x = 0; x < src_width; x += 2) { /* get opacity of the 2 pixels that share chroma */ int o0 = (*blend_yuy2_data)[ 0 ][ x + 0 ]; @@ -1481,7 +1481,7 @@ static void blend_yuy2_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, /* get the chroma components of the 2 pixels */ int cr0 = (*blend_yuy2_data)[ 1 ][ x + 0 ]; int cr1 = (*blend_yuy2_data)[ 1 ][ x + 1 ]; - + int cb0 = (*blend_yuy2_data)[ 2 ][ x + 0 ]; int cb1 = (*blend_yuy2_data)[ 2 ][ x + 1 ]; @@ -1496,7 +1496,7 @@ static void blend_yuy2_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, /* * No need to adjust chroma values with +/- 128: - * *dst_cb + * *dst_cb * = 128 + ((*dst_cb-128) * t2 + (cb0-128) * o0 + (cb1-128) * o1) / (2 * 0xf); * = 128 + (*dst_cb * t2 + cb0 * o0 + cb1 * o1 + (t2*(-128) - 128*o0 - 128*o1)) / (2 * 0xf); * = 128 + (*dst_cb * t2 + cb0 * o0 + cb1 * o1 + ((2*0xf-o0-o1)*(-128) - 128*o0 - 128*o1)) / (2 * 0xf); @@ -1512,8 +1512,8 @@ static void blend_yuy2_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, * =(almost) X * 0x1112/0x10000 * = (X * 0x1112) >> 16 * - * The tricky point is 0x1111/0xffff --> 0x1112/0x10000. - * All calculations are done using integers and X is in + * The tricky point is 0x1111/0xffff --> 0x1112/0x10000. + * All calculations are done using integers and X is in * range of [0 ... 0xff*0xf*4]. This results in error of * X*0x1112/0x10000 - X/0xf * = X*(0x1112/0x10000 - 1/0xf) @@ -1523,7 +1523,7 @@ static void blend_yuy2_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, * As the error is less than 1 and always positive, whole error * "disappears" during truncation (>>16). Rounding to exact results is * guaranteed by selecting 0x1112 instead of more accurate 0x1111 - * (with 0x1111 error=X*(-0.00001111...)). With 0x1112 error is + * (with 0x1111 error=X*(-0.00001111...)). With 0x1112 error is * always positive, but still less than one. * So, one can forget the "=(almost)" as it is really "=" when source * operands are within 0...0xff (U,V) and 0...0xf (A). @@ -1531,7 +1531,7 @@ static void blend_yuy2_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, * 1/0x10000 (= >>16) was originally selected because of MMX pmullhw * instruction; it makes possible to do whole calculation in MMX using * uint16's (pmullhw is (X*Y)>>16). - * + * * Here X/(2*0xf) = X/0xf/2 = ((X*0x1112)>>16)>>1 = (X*0x1112)>>17 */ @@ -1555,11 +1555,11 @@ static uint8_t *(*blend_yuy2_grow_extra_data(alphablend_t *extra_data, int osd_w int max_width; uint8_t *data[ 3 ]; } *header = (struct header_s *)extra_data->buffer; - + size_t needed_buffer_size = sizeof (*header) + osd_width * sizeof (uint8_t[ 3 ]); - + if (extra_data->buffer_size < needed_buffer_size) { - + free(extra_data->buffer); header = calloc(1, needed_buffer_size); if (!header) { @@ -1619,7 +1619,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, int exact_blend_width = ((src_width <= (dst_width - x_off)) ? src_width : (dst_width - x_off)); int exact_blend_width_m2 = (x_odd + exact_blend_width + 1) & ~1; /* make it a (larger) multiple of 2 */ uint8_t *(*blend_yuy2_data)[ 3 ] = 0; - + uint8_t *dst_y = dst_img + dst_pitch * y_off + 2 * x_off; uint8_t *dst; @@ -1631,26 +1631,26 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else @@ -1662,11 +1662,11 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, if (enable_exact_blending) { if (exact_blend_width <= 0) return; - + blend_yuy2_data = blend_yuy2_grow_extra_data(extra_data, exact_blend_width_m2); if (!blend_yuy2_data) return; - + /* make linebuffer transparent */ memset(&(*blend_yuy2_data)[ 0 ][ 0 ], 0, exact_blend_width_m2); } @@ -1675,7 +1675,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, for (y = 0; y < src_height; y++) { if (rle >= rle_limit) break; - + ymask = ((y < img_overl->hili_top) || (y >= img_overl->hili_bottom)); dst = dst_y; @@ -1685,12 +1685,12 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, if (rle >= rle_limit) break; - + if ((rlelen < 0) || (rle_remainder < 0)) { #ifdef LOG_BLEND_YUV printf("alphablend: major bug in blend_yuv < 0\n"); #endif - } + } if (rlelen == 0) { rle_remainder = rlelen = rle->len; clr = rle->color; @@ -1708,11 +1708,11 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, #endif if (ymask == 0) { - if (x < hili_left) { + if (x < hili_left) { /* Starts outside highlight area */ if ((x + rle_remainder) > hili_left ) { #ifdef LOG_BLEND_YUV - printf("Outside highlight left %d, ending inside\n", hili_left); + printf("Outside highlight left %d, ending inside\n", hili_left); #endif /* Cutting needed, starts outside, ends inside */ rle_this_bite = (hili_left - x); @@ -1722,7 +1722,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, my_trans = img_overl->trans; } else { #ifdef LOG_BLEND_YUV - printf("Outside highlight left %d, ending outside\n", hili_left); + printf("Outside highlight left %d, ending outside\n", hili_left); #endif /* no cutting needed, starts outside, ends outside */ rle_this_bite = rle_remainder; @@ -1758,7 +1758,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, } } else if (x >= hili_right) { /* Starts outside highlight area, ends outsite highlight area */ - if ((x + rle_remainder ) > src_width ) { + if ((x + rle_remainder ) > src_width ) { #ifdef LOG_BLEND_YUV printf("Outside highlight right %d, ending eol\n", hili_right); #endif @@ -1798,7 +1798,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, /* clip against right edge of destination area */ if ((x + rle_this_bite) > (dst_width - x_off)) { int toClip = (x + rle_this_bite) - (dst_width - x_off); - + rle_this_bite -= toClip; rle_remainder += toClip; rlelen += toClip; @@ -1850,7 +1850,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, mem_blend32(dst, &yuy2.b[0], o, l); dst += 4*l; } - + if(rle_this_bite & 1) { *dst = BLEND_BYTE(*dst, yuy2.b[0], o); dst++; @@ -1875,15 +1875,15 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, dst += rle_this_bite*2; } } - + x += rle_this_bite; } - + if (enable_exact_blending) { /* blend buffered line */ if (any_line_buffered) { blend_yuy2_exact(dst_y - x_odd * 2 + 3, dst_y - x_odd * 2 + 1, exact_blend_width, blend_yuy2_data); - + any_line_buffered = 0; } } @@ -1892,7 +1892,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, } } -void _x_clear_xx44_palette(xx44_palette_t *p) +void _x_clear_xx44_palette(xx44_palette_t *p) { register int i; register uint32_t *cluts = p->cluts; @@ -1904,20 +1904,20 @@ void _x_clear_xx44_palette(xx44_palette_t *p) i = 2*OVL_PALETTE_SIZE; while(i--) *ids++ = -1; - p->max_used=1; + p->max_used=1; } -void _x_init_xx44_palette(xx44_palette_t *p, unsigned num_entries) +void _x_init_xx44_palette(xx44_palette_t *p, unsigned num_entries) { - p->size = (num_entries > XX44_PALETTE_SIZE) ? XX44_PALETTE_SIZE : num_entries; + p->size = (num_entries > XX44_PALETTE_SIZE) ? XX44_PALETTE_SIZE : num_entries; } -void _x_dispose_xx44_palette(xx44_palette_t *p) +void _x_dispose_xx44_palette(xx44_palette_t *p) { } static void colorToPalette(const uint32_t *icolor, unsigned char *palette_p, - unsigned num_xvmc_components, char *xvmc_components) + unsigned num_xvmc_components, char *xvmc_components) { const clut_t *color = (const clut_t *) icolor; unsigned int i; @@ -1925,7 +1925,7 @@ static void colorToPalette(const uint32_t *icolor, unsigned char *palette_p, switch(xvmc_components[i]) { case 'V': *palette_p = color->cr; break; case 'U': *palette_p = color->cb; break; - case 'Y': + case 'Y': default: *palette_p = color->y; break; } palette_p++; @@ -1935,7 +1935,7 @@ static void colorToPalette(const uint32_t *icolor, unsigned char *palette_p, void _x_xx44_to_xvmc_palette(const xx44_palette_t *p,unsigned char *xvmc_palette, unsigned first_xx44_entry, unsigned num_xx44_entries, - unsigned num_xvmc_components, char *xvmc_components) + unsigned num_xvmc_components, char *xvmc_components) { register unsigned int i; register const uint32_t *cluts = p->cluts + first_xx44_entry; @@ -1946,16 +1946,16 @@ void _x_xx44_to_xvmc_palette(const xx44_palette_t *p,unsigned char *xvmc_palette xvmc_palette += num_xvmc_components; } } -} +} -static int xx44_paletteIndex(xx44_palette_t *p, int color, uint32_t clut) +static int xx44_paletteIndex(xx44_palette_t *p, int color, uint32_t clut) { register unsigned int i; register uint32_t *cluts = p->cluts; register int tmp; - if ((tmp = p->lookup_cache[color]) >= 0) + if ((tmp = p->lookup_cache[color]) >= 0) if (cluts[tmp] == clut) return tmp; for (i=0; i<p->max_used; ++i) { @@ -1972,7 +1972,7 @@ static int xx44_paletteIndex(xx44_palette_t *p, int color, uint32_t clut) static void memblend_xx44(uint8_t *mem,uint8_t val, register size_t size, uint8_t mask) { - register uint8_t + register uint8_t masked_val; if (0 == (masked_val = val & mask)) return; @@ -1984,16 +1984,16 @@ static void memblend_xx44(uint8_t *mem,uint8_t val, register size_t size, uint8_ } void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, - int dst_width, int dst_height, int dst_pitch, + int dst_width, int dst_height, int dst_pitch, alphablend_t *extra_data, - xx44_palette_t *palette,int ia44) + xx44_palette_t *palette,int ia44) { int src_width, src_height; rle_elem_t *rle, *rle_limit; int mask; int x_off, y_off; int x, y; - uint8_t norm_pixel,hili_pixel; + uint8_t norm_pixel,hili_pixel; uint8_t *dst_y; uint8_t *dst; uint8_t alphamask = (ia44) ? 0x0F : 0xF0; @@ -2017,26 +2017,26 @@ void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else @@ -2053,10 +2053,10 @@ void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, if (len > 0) { norm_pixel = (uint8_t)((xx44_paletteIndex(palette,rle->color, - img_overl->color[rle->color]) << 4) | + img_overl->color[rle->color]) << 4) | (img_overl->trans[rle->color] & 0x0F)); hili_pixel = (uint8_t)((xx44_paletteIndex(palette,rle->color+OVL_PALETTE_SIZE, - img_overl->hili_color[rle->color]) << 4) | + img_overl->hili_color[rle->color]) << 4) | (img_overl->hili_trans[rle->color] & 0x0F)); if (!ia44) { norm_pixel = ((norm_pixel & 0x0F) << 4) | ((norm_pixel & 0xF0) >> 4); @@ -2091,7 +2091,7 @@ void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, dst += len; } } - } else if (x < hili_right) { + } else if (x < hili_right) { if (len <= hili_right - x) { if(!clipped) memblend_xx44(dst,hili_pixel,len, alphamask); @@ -2123,7 +2123,7 @@ void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, x += rle->len; rle++; if (rle >= rle_limit) break; - } + } if (rle >= rle_limit) break; dst_y += dst_pitch; } @@ -2139,7 +2139,7 @@ static void alphablend_disable_exact_osd_alpha_blending_changed(void *user_data, void _x_alphablend_init(alphablend_t *extra_data, xine_t *xine) { config_values_t *config = xine->config; - + extra_data->buffer = 0; extra_data->buffer_size = 0; extra_data->offset_x = 0; diff --git a/src/xine-engine/alphablend.h b/src/xine-engine/alphablend.h index 7aa63b306..86cc68302 100644 --- a/src/xine-engine/alphablend.h +++ b/src/xine-engine/alphablend.h @@ -97,7 +97,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, */ void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, - int dst_width, int dst_height, int dst_pitch, + int dst_width, int dst_height, int dst_pitch, alphablend_t *extra_data, xx44_palette_t *palette,int ia44) XINE_PROTECTED; diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 855dee372..dd15bf696 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2005 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 @@ -60,18 +60,18 @@ static void *audio_decoder_loop (void *stream_gen) { while (running) { - lprintf ("audio_loop: waiting for package...\n"); + lprintf ("audio_loop: waiting for package...\n"); if( !replaying_headers ) buf = stream->audio_fifo->get (stream->audio_fifo); - lprintf ("audio_loop: got package pts = %"PRId64", type = %08x\n", buf->pts, buf->type); + lprintf ("audio_loop: got package pts = %"PRId64", type = %08x\n", buf->pts, buf->type); _x_extra_info_merge( stream->audio_decoder_extra_info, buf->extra_info ); stream->audio_decoder_extra_info->seek_count = stream->video_seek_count; - + switch (buf->type) { - + case BUF_CONTROL_HEADERS_DONE: pthread_mutex_lock (&stream->counter_lock); stream->header_count_audio++; @@ -85,11 +85,11 @@ static void *audio_decoder_loop (void *stream_gen) { /* decoder dispose might call port functions */ running_ticket->acquire(running_ticket, 0); - + if (stream->audio_decoder_plugin) { lprintf ("close old decoder\n"); - + stream->keep_ao_driver_open = !!(buf->decoder_flags & BUF_FLAG_GAPLESS_SW); _x_free_audio_decoder (stream, stream->audio_decoder_plugin); stream->audio_decoder_plugin = NULL; @@ -97,15 +97,15 @@ static void *audio_decoder_loop (void *stream_gen) { stream->audio_type = 0; stream->keep_ao_driver_open = 0; } - + running_ticket->release(running_ticket, 0); - + if( !(buf->decoder_flags & BUF_FLAG_GAPLESS_SW) ) stream->metronom->handle_audio_discontinuity (stream->metronom, DISC_STREAMSTART, 0); - + buftype_unknown = 0; break; - + case BUF_CONTROL_END: /* free all held header buffers, see comments below */ @@ -128,12 +128,12 @@ static void *audio_decoder_loop (void *stream_gen) { */ while(1) { int num_bufs, num_streams; - + running_ticket->acquire(running_ticket, 0); num_bufs = stream->audio_out->get_property(stream->audio_out, AO_PROP_BUFS_IN_FIFO); num_streams = stream->audio_out->get_property(stream->audio_out, AO_PROP_NUM_STREAMS); running_ticket->release(running_ticket, 0); - + if( num_bufs > 0 && num_streams == 1 && !stream->early_finish_event) xine_usec_sleep (10000); else @@ -144,7 +144,7 @@ static void *audio_decoder_loop (void *stream_gen) { pthread_mutex_lock (&stream->counter_lock); stream->finished_count_audio++; - + lprintf ("reached end marker # %d\n", stream->finished_count_audio); pthread_cond_broadcast (&stream->counter_changed); @@ -164,18 +164,18 @@ static void *audio_decoder_loop (void *stream_gen) { stream->audio_channel_auto = -1; break; - + case BUF_CONTROL_QUIT: /* decoder dispose might call port functions */ running_ticket->acquire(running_ticket, 0); - + if (stream->audio_decoder_plugin) { _x_free_audio_decoder (stream, stream->audio_decoder_plugin); stream->audio_decoder_plugin = NULL; stream->audio_track_map_entries = 0; stream->audio_type = 0; } - + running_ticket->release(running_ticket, 0); running = 0; break; @@ -193,14 +193,14 @@ static void *audio_decoder_loop (void *stream_gen) { running_ticket->release(running_ticket, 0); } break; - + case BUF_CONTROL_DISCONTINUITY: if (stream->audio_decoder_plugin) { running_ticket->acquire(running_ticket, 0); stream->audio_decoder_plugin->discontinuity (stream->audio_decoder_plugin); running_ticket->release(running_ticket, 0); } - + stream->metronom->handle_audio_discontinuity (stream->metronom, DISC_RELATIVE, buf->disc_off); break; @@ -210,7 +210,7 @@ static void *audio_decoder_loop (void *stream_gen) { stream->audio_decoder_plugin->discontinuity (stream->audio_decoder_plugin); running_ticket->release(running_ticket, 0); } - + if (buf->decoder_flags & BUF_FLAG_SEEK) { stream->metronom->handle_audio_discontinuity (stream->metronom, DISC_STREAMSEEK, buf->disc_off); } else { @@ -220,7 +220,7 @@ static void *audio_decoder_loop (void *stream_gen) { case BUF_CONTROL_AUDIO_CHANNEL: { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "audio_decoder: suggested switching to stream_id %02x\n", buf->decoder_info[0]); stream->audio_channel_auto = buf->decoder_info[0] & 0xff; } @@ -248,27 +248,27 @@ static void *audio_decoder_loop (void *stream_gen) { xine_profiler_start_count (prof_audio_decode); running_ticket->acquire(running_ticket, 0); - + if ( (buf->type & 0xFF000000) == BUF_AUDIO_BASE ) { - + uint32_t audio_type = 0; int i,j; uint32_t chan=buf->type&0x0000FFFF; /* printf("audio_decoder: buf_type=%08x auto=%08x user=%08x\n", - buf->type, + buf->type, stream->audio_channel_auto, audio_channel_user); */ /* update track map */ - + i = 0; - while ( (i<stream->audio_track_map_entries) && ((stream->audio_track_map[i]&0x0000FFFF)<chan) ) + while ( (i<stream->audio_track_map_entries) && ((stream->audio_track_map[i]&0x0000FFFF)<chan) ) i++; - - if ( (i==stream->audio_track_map_entries) + + if ( (i==stream->audio_track_map_entries) || ((stream->audio_track_map[i]&0x0000FFFF)!=chan) ) { xine_event_t ui_event; @@ -304,7 +304,7 @@ static void *audio_decoder_loop (void *stream_gen) { lprintf ("audio_channel_auto = %d\n", stream->audio_channel_auto); if (stream->audio_channel_auto>=0) { - + if ((buf->type & 0xFF) == stream->audio_channel_auto) { audio_type = buf->type; } else @@ -321,30 +321,30 @@ static void *audio_decoder_loop (void *stream_gen) { } /* now, decode stream buffer if it's the right audio type */ - + if (buf->type == audio_type) { - + int streamtype = (buf->type>>16) & 0xFF; /* close old decoder of audio type has changed */ - - if( buf->type != buftype_unknown && + + if( buf->type != buftype_unknown && (stream->audio_decoder_streamtype != streamtype || !stream->audio_decoder_plugin) ) { - + if (stream->audio_decoder_plugin) { _x_free_audio_decoder (stream, stream->audio_decoder_plugin); } - + stream->audio_decoder_streamtype = streamtype; stream->audio_decoder_plugin = _x_get_audio_decoder (stream, streamtype); - + _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_HANDLED, (stream->audio_decoder_plugin != NULL)); } - + if (audio_type != stream->audio_type) { - + if (stream->audio_decoder_plugin) { xine_event_t event; @@ -355,23 +355,23 @@ static void *audio_decoder_loop (void *stream_gen) { xine_event_send(stream, &event); } } - + /* finally - decode data */ - - if (stream->audio_decoder_plugin) + + if (stream->audio_decoder_plugin) stream->audio_decoder_plugin->decode_data (stream->audio_decoder_plugin, buf); - - if (buf->type != buftype_unknown && + + if (buf->type != buftype_unknown && !_x_stream_info_get(stream, XINE_STREAM_INFO_AUDIO_HANDLED)) { xine_log (stream->xine, XINE_LOG_MSG, _("audio_decoder: no plugin available to handle '%s'\n"), _x_buf_audio_name( buf->type ) ); - + if( !_x_meta_info_get(stream, XINE_META_INFO_AUDIOCODEC) ) _x_meta_info_set_utf8(stream, XINE_META_INFO_AUDIOCODEC, _x_buf_audio_name( buf->type )); - + buftype_unknown = buf->type; - /* fatal error - dispose plugin */ + /* fatal error - dispose plugin */ if (stream->audio_decoder_plugin) { _x_free_audio_decoder (stream, stream->audio_decoder_plugin); stream->audio_decoder_plugin = NULL; @@ -380,7 +380,7 @@ static void *audio_decoder_loop (void *stream_gen) { } } } else if( buf->type != buftype_unknown ) { - xine_log (stream->xine, XINE_LOG_MSG, + xine_log (stream->xine, XINE_LOG_MSG, _("audio_decoder: error, unknown buffer type: %08x\n"), buf->type ); buftype_unknown = buf->type; } @@ -388,14 +388,14 @@ static void *audio_decoder_loop (void *stream_gen) { if (running_ticket->ticket_revoked) running_ticket->renew(running_ticket, 0); running_ticket->release(running_ticket, 0); - + xine_profiler_stop_count (prof_audio_decode); } /* some decoders require a full reinitialization when audio * channel is changed (rate might be change and even a - * different codec may be used). - * + * different codec may be used). + * * we must close the old decoder and process all the headers * again, since they are needed for decoder initialization. */ @@ -408,7 +408,7 @@ static void *audio_decoder_loop (void *stream_gen) { running_ticket->acquire(running_ticket, 0); _x_free_audio_decoder (stream, stream->audio_decoder_plugin); running_ticket->release(running_ticket, 0); - + stream->audio_decoder_plugin = NULL; stream->audio_track_map_entries = 0; stream->audio_type = 0; @@ -456,7 +456,7 @@ static void *audio_decoder_loop (void *stream_gen) { } first_header = last_header = NULL; } - + return NULL; } @@ -471,7 +471,7 @@ int _x_audio_decoder_init (xine_stream_t *stream) { return 1; } else { int num_buffers; - + /* The fifo size is based on dvd playback where buffers are filled * with 2k of data. With 230 buffers and a typical audio data rate * of 1.8 Mbit/s (four ac3 streams), the fifo can hold about 2 seconds @@ -479,7 +479,7 @@ int _x_audio_decoder_init (xine_stream_t *stream) { * We provide buffers of 8k size instead of 2k for demuxers sending * larger chunks. */ - + num_buffers = stream->xine->config->register_num (stream->xine->config, "engine.buffers.audio_num_buffers", 230, @@ -489,7 +489,7 @@ int _x_audio_decoder_init (xine_stream_t *stream) { "mean smoother playback for unreliable inputs, but " "also increased latency and memory consumption."), 20, NULL, NULL); - + stream->audio_fifo = _x_fifo_buffer_new (num_buffers, 8192); stream->audio_channel_user = -1; stream->audio_channel_auto = -1; @@ -505,17 +505,17 @@ int _x_audio_decoder_init (xine_stream_t *stream) { pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER); pthread_attr_setschedparam(&pth_attrs, &pth_params); pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM); - - stream->audio_thread_created = 1; + + stream->audio_thread_created = 1; if ((err = pthread_create (&stream->audio_thread, &pth_attrs, audio_decoder_loop, stream)) != 0) { - xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "audio_decoder: can't create new thread (%s)\n", strerror(err)); stream->audio_thread_created = 0; pthread_attr_destroy(&pth_attrs); return 0; } - + pthread_attr_destroy(&pth_attrs); } return 1; @@ -532,16 +532,16 @@ void _x_audio_decoder_shutdown (xine_stream_t *stream) { buf = stream->audio_fifo->buffer_pool_alloc (stream->audio_fifo); buf->type = BUF_CONTROL_QUIT; stream->audio_fifo->put (stream->audio_fifo, buf); - + pthread_join (stream->audio_thread, &p); stream->audio_thread_created = 0; } - + stream->audio_fifo->dispose (stream->audio_fifo); stream->audio_fifo = NULL; } int _x_get_audio_channel (xine_stream_t *stream) { - return stream->audio_type & 0xFFFF; + return stream->audio_type & 0xFFFF; } diff --git a/src/xine-engine/audio_decoder.h b/src/xine-engine/audio_decoder.h index 8f75ba242..9f695685f 100644 --- a/src/xine-engine/audio_decoder.h +++ b/src/xine-engine/audio_decoder.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 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 @@ -46,14 +46,14 @@ struct audio_decoder_class_s { * open a new instance of this plugin class */ audio_decoder_t* (*open_plugin) (audio_decoder_class_t *this, xine_stream_t *stream); - + /* * return short, human readable identifier for this plugin class */ char* (*get_identifier) (audio_decoder_class_t *this); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ char* (*get_description) (audio_decoder_class_t *this); @@ -69,8 +69,8 @@ struct audio_decoder_class_s { struct audio_decoder_s { /* - * decode data from buf and feed decoded samples to - * audio output + * decode data from buf and feed decoded samples to + * audio output */ void (*decode_data) (audio_decoder_t *this, buf_element_t *buf); @@ -79,13 +79,13 @@ struct audio_decoder_s { * audio data not related to recently decoded data) */ void (*reset) (audio_decoder_t *this); - + /* * inform decoder that a time reference discontinuity has happened. * that is, it must forget any currently held pts value */ - void (*discontinuity) (audio_decoder_t *this); - + void (*discontinuity) (audio_decoder_t *this); + /* * close down, free all resources */ diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index a6f83dc9d..601af196a 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2006 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 self program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -22,7 +22,7 @@ * 20-8-2001 First implementation of Audio sync and Audio driver separation. * (c) 2001 James Courtier-Dutton James@superbug.demon.co.uk */ - + /* * General Programming Guidelines: - * New concept of an "audio_frame". @@ -98,7 +98,7 @@ #define ZERO_BUF_SIZE 5000 /* By adding gap errors (difference between reported and expected - * sound card clock) into metronom's vpts_offset we can use its + * sound card clock) into metronom's vpts_offset we can use its * smoothing algorithms to correct sound card clock drifts. * obs: previously this error was added to xine scr. * @@ -154,13 +154,13 @@ typedef struct { #define EQ_BANDS 10 #define EQ_CHANNELS 8 -#define FP_FRBITS 28 +#define FP_FRBITS 28 #define EQ_REAL(x) ((int)((x) * (1 << FP_FRBITS))) typedef struct { int beta; - int alpha; + int alpha; int gamma; } sIIRCoefficients; @@ -193,15 +193,15 @@ static const sIIRCoefficients iir_cf[] = { /* 16k Hz*/ { EQ_REAL(2.4201241845e-01), EQ_REAL(3.7899379077e-01), EQ_REAL(-8.0847117831e-01) }, }; - + typedef struct { - + xine_audio_port_t ao; /* public part */ /* private stuff */ ao_driver_t *driver; pthread_mutex_t driver_lock; - + uint32_t driver_open:1; uint32_t audio_loop_running:1; uint32_t audio_thread_created:1; @@ -226,7 +226,7 @@ typedef struct { int64_t audio_step; /* pts per 32 768 samples (sample = #bytes/2) */ int32_t frames_per_kpts; /* frames per 1024/90000 sec */ - + int av_sync_method_conf; resample_sync_t resample_sync_info; double resample_sync_factor; /* correct buffer length by this factor @@ -249,7 +249,7 @@ typedef struct { /* FIXME: replace all this->clock->speed with this->current_speed. we should make * sure nobody will change speed without going through xine.c:set_speed_internal */ int slow_fast_audio; /* play audio even on slow/fast speeds */ - + int16_t last_sample[RESAMPLE_MAX_CHANNELS]; audio_buffer_t *frame_buf[2]; /* two buffers for "stackable" conversions */ int16_t *zero_space; @@ -275,7 +275,7 @@ typedef struct { int eq_k; sXYData eq_data_history[EQ_BANDS][EQ_CHANNELS]; - + } aos_t; struct audio_fifo_s { @@ -440,7 +440,7 @@ static void fifo_wait_empty (audio_fifo_t *fifo) { } -static void write_pause_burst(aos_t *this, uint32_t num_frames) { +static void write_pause_burst(aos_t *this, uint32_t num_frames) { uint16_t sbuf[4096]; sbuf[0] = 0xf872; @@ -470,7 +470,7 @@ static void ao_fill_gap (aos_t *this, int64_t pts_len) { if ((this->output.mode == AO_CAP_MODE_A52) || (this->output.mode == AO_CAP_MODE_AC5)) { write_pause_burst(this,num_frames); - return; + return; } while (num_frames > 0 && !this->discard_buffers) { @@ -494,7 +494,7 @@ static void ensure_buffer_size (audio_buffer_t *buf, int bytes_per_frame, int frames) { int size = bytes_per_frame * frames; - + if (buf->mem_size < size) { buf->mem = realloc( buf->mem, size ); buf->mem_size = size; @@ -525,7 +525,7 @@ int _x_ao_mode2channels( int mode ) { return 6; } return 0; -} +} int _x_ao_channels2mode( int channels ) { @@ -556,7 +556,7 @@ static void audio_filter_compress (aos_t *this, int16_t *mem, int num_frames) { return; maxs = 0; - + /* measure */ for (i=0; i<num_frames*num_channels; i++) { @@ -572,12 +572,12 @@ static void audio_filter_compress (aos_t *this, int16_t *mem, int num_frames) { this->compression_factor = this->compression_factor * 0.999 + f_max * 0.001; if (this->compression_factor > f_max) this->compression_factor = f_max; - + if (this->compression_factor > this->compression_factor_max) this->compression_factor = this->compression_factor_max; } else f_max = 1.0; - + lprintf ("max=%d f_max=%f compression_factor=%f\n", maxs, f_max, this->compression_factor); /* apply it */ @@ -613,11 +613,11 @@ static void audio_filter_amp (aos_t *this, void *buf, int num_frames) { /* Force limit on amp_factor to prevent clipping */ if (test < INT8_MIN) { this->amp_factor = amp_factor = amp_factor * INT8_MIN / test; - test=INT8_MIN; + test=INT8_MIN; } if (test > INT8_MAX) { this->amp_factor = amp_factor = amp_factor * INT8_MIN / test; - test=INT8_MAX; + test=INT8_MAX; } mem[i] = test; } @@ -630,11 +630,11 @@ static void audio_filter_amp (aos_t *this, void *buf, int num_frames) { /* Force limit on amp_factor to prevent clipping */ if (test < INT16_MIN) { this->amp_factor = amp_factor = amp_factor * INT16_MIN / test; - test=INT16_MIN; + test=INT16_MIN; } if (test > INT16_MAX) { this->amp_factor = amp_factor = amp_factor * INT16_MIN / test; - test=INT16_MAX; + test=INT16_MAX; } mem[i] = test; } @@ -938,7 +938,7 @@ static int resample_rate_adjust(aos_t *this, int64_t gap, audio_buffer_t *buf) { if (gap_diff < RESAMPLE_MAX_GAP_DIFF) { #if LOG_RESAMPLE_SYNC int num_frames; - + /* if we are already resampling to a different output rate, consider * this during calculation */ num_frames = (this->do_resample) ? (buf->num_frames * this->frame_rate_factor) @@ -973,7 +973,7 @@ static int resample_rate_adjust(aos_t *this, int64_t gap, audio_buffer_t *buf) { info->window_duration += buf->vpts - info->last_vpts; info->last_vpts = buf->vpts; info->window++; - } + } return 0; } @@ -981,7 +981,7 @@ static int resample_rate_adjust(aos_t *this, int64_t gap, audio_buffer_t *buf) { static int ao_change_settings(aos_t *this, uint32_t bits, uint32_t rate, int mode); /* Audio output loop: - - * 1) Check for pause. + * 1) Check for pause. * 2) Make sure audio hardware is in RUNNING state. * 3) Get delay * 4) Do drop, 0-fill or output samples. @@ -1009,7 +1009,7 @@ static void *ao_loop (void *this_gen) { /* * get buffer to process for this loop iteration */ - + if (!in_buf) { lprintf ("loop: get buf from fifo\n"); in_buf = fifo_peek (this->out_fifo); @@ -1034,18 +1034,18 @@ static void *ao_loop (void *this_gen) { continue; } pthread_mutex_unlock(&this->flush_audio_driver_lock); - - /* + + /* * wait until user unpauses stream * if we are playing at a different speed (without slow_fast_audio flag) * we must process/free buffers otherwise the entire engine will stop. */ - + pthread_mutex_lock(&this->current_speed_lock); - if ( this->audio_loop_running && - (this->clock->speed == XINE_SPEED_PAUSE || - (this->clock->speed != XINE_FINE_SPEED_NORMAL && + if ( this->audio_loop_running && + (this->clock->speed == XINE_SPEED_PAUSE || + (this->clock->speed != XINE_FINE_SPEED_NORMAL && !this->slow_fast_audio) ) ) { if (this->clock->speed != XINE_SPEED_PAUSE) { @@ -1083,7 +1083,7 @@ static void *ao_loop (void *this_gen) { in_buf->format.rate != this->input.rate || in_buf->format.mode != this->input.mode ) { lprintf("audio format has changed\n"); - if( !in_buf->stream->emergency_brake && + if( !in_buf->stream->emergency_brake && ao_change_settings(this, in_buf->format.bits, in_buf->format.rate, @@ -1107,7 +1107,7 @@ static void *ao_loop (void *this_gen) { delay = 0; pthread_mutex_unlock( &this->driver_lock ); - + if (in_buf && in_buf->num_frames) { xine_list_iterator_t ite; @@ -1127,8 +1127,8 @@ static void *ao_loop (void *this_gen) { } } - cur_time = this->clock->get_current_time (this->clock); - + cur_time = this->clock->get_current_time (this->clock); + /* we update current_extra_info if either there is no video stream that could do that * or if the current_extra_info is getting too much out of date */ if( in_buf && in_buf->stream && (!in_buf->stream->video_decoder_plugin || @@ -1138,9 +1138,9 @@ static void *ao_loop (void *this_gen) { _x_extra_info_merge( in_buf->stream->current_extra_info, in_buf->extra_info ); pthread_mutex_unlock( &in_buf->stream->current_extra_info_lock ); } - + /* - * where, in the timeline is the "end" of the + * where, in the timeline is the "end" of the * hardware audio buffer at the moment? */ @@ -1148,12 +1148,12 @@ static void *ao_loop (void *this_gen) { lprintf ("current delay is %" PRId64 ", current time is %" PRId64 "\n", delay, cur_time); /* External A52 decoder delay correction */ - if ((this->output.mode==AO_CAP_MODE_A52) || (this->output.mode==AO_CAP_MODE_AC5)) + if ((this->output.mode==AO_CAP_MODE_A52) || (this->output.mode==AO_CAP_MODE_AC5)) delay += this->passthrough_offset; if(this->frames_per_kpts) hw_vpts += (delay * 1024) / this->frames_per_kpts; - + /* * calculate gap: */ @@ -1189,13 +1189,13 @@ static void *ao_loop (void *this_gen) { in_buf->vpts, gap); in_buf = NULL; - - /* for small gaps ( tolerance < abs(gap) < AO_MAX_GAP ) + + /* for small gaps ( tolerance < abs(gap) < AO_MAX_GAP ) * feedback them into metronom's vpts_offset (when using * metronom feedback for A/V sync) */ } else if ( abs(gap) < AO_MAX_GAP && abs(gap) > this->gap_tolerance && - cur_time > (last_sync_time + SYNC_TIME_INVERVAL) && + cur_time > (last_sync_time + SYNC_TIME_INVERVAL) && bufs_since_sync >= SYNC_BUF_INTERVAL && !this->resample_sync_method ) { xine_list_iterator_t *ite; @@ -1248,7 +1248,7 @@ static void *ao_loop (void *this_gen) { result = 0; } fifo_remove (this->out_fifo); - + if( result < 0 ) { /* device unplugged. */ xprintf(this->xine, XINE_VERBOSITY_LOG, _("write to sound card failed. Assuming the device was unplugged.\n")); @@ -1272,7 +1272,7 @@ static void *ao_loop (void *this_gen) { pthread_mutex_unlock( &this->driver_lock ); /* closing the driver will result in XINE_MSG_AUDIO_OUT_UNAVAILABLE to be emitted */ } - + lprintf ("loop: next buf from fifo\n"); if (in_buf->stream) _x_refcounter_dec(in_buf->stream->refcounter); @@ -1325,9 +1325,9 @@ int xine_get_next_audio_frame (xine_audio_port_t *this_gen, continue; } stream = xine_list_get_value(this->streams, ite); - + /* FIXME: ugly, use conditions and locks instead? */ - + pthread_mutex_lock (&this->out_fifo->mutex); in_buf = this->out_fifo->first; if (!in_buf) { @@ -1381,10 +1381,10 @@ void xine_free_audio_frame (xine_audio_port_t *this_gen, xine_audio_frame_t *fra } static int ao_update_resample_factor(aos_t *this) { - + if( !this->driver_open ) return 0; - + switch (this->resample_conf) { case 1: /* force off */ this->do_resample = 0; @@ -1409,7 +1409,7 @@ static int ao_update_resample_factor(aos_t *this) { this->frame_rate_factor = ( XINE_FINE_SPEED_NORMAL / (double)this->current_speed ) * ((double)(this->output.rate)) / ((double)(this->input.rate)); this->frames_per_kpts = (this->output.rate * 1024) / 90000; this->audio_step = ((int64_t)90000 * (int64_t)32768) / (int64_t)this->input.rate; - + lprintf ("audio_step %" PRId64 " pts per 32768 frames\n", this->audio_step); return this->output.rate; } @@ -1418,7 +1418,7 @@ static int ao_change_settings(aos_t *this, uint32_t bits, uint32_t rate, int mod int output_sample_rate; if(this->driver_open && !this->grab_only) - this->driver->close(this->driver); + this->driver->close(this->driver); this->driver_open = 0; this->input.mode = mode; @@ -1427,7 +1427,7 @@ static int ao_change_settings(aos_t *this, uint32_t bits, uint32_t rate, int mod if (!this->grab_only) { /* not all drivers/cards support 8 bits */ - if( this->input.bits == 8 && + if( this->input.bits == 8 && !(this->driver->get_capabilities(this->driver) & AO_CAP_8BITS) ) { bits = 16; xprintf (this->xine, XINE_VERBOSITY_LOG, @@ -1447,7 +1447,7 @@ static int ao_change_settings(aos_t *this, uint32_t bits, uint32_t rate, int mod xprintf (this->xine, XINE_VERBOSITY_LOG, _("stereo not supported by driver, converting to mono.\n")); } - + output_sample_rate=(this->driver->open) (this->driver,bits,(this->force_rate ? this->force_rate : rate),mode); } else output_sample_rate = this->input.rate; @@ -1495,7 +1495,7 @@ static inline void dec_num_driver_actions(aos_t *this) { static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream, uint32_t bits, uint32_t rate, int mode) { - + aos_t *this = (aos_t *) this_gen; int channels; @@ -1511,7 +1511,7 @@ static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream, pthread_mutex_lock( &this->driver_lock ); ret = ao_change_settings(this, bits, rate, mode); pthread_mutex_unlock( &this->driver_lock ); - + if( !ret ) { stream->emergency_brake = 1; _x_message (stream, XINE_MSG_AUDIO_OUT_UNAVAILABLE, NULL); @@ -1522,7 +1522,7 @@ static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream, } } - /* + /* * set metainfo */ if (stream) { @@ -1541,7 +1541,7 @@ static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream, pthread_mutex_lock(&this->streams_lock); xine_list_push_back(this->streams, stream); pthread_mutex_unlock(&this->streams_lock); - + return this->output.rate; } @@ -1549,18 +1549,18 @@ static audio_buffer_t *ao_get_buffer (xine_audio_port_t *this_gen) { aos_t *this = (aos_t *) this_gen; audio_buffer_t *buf; - + while (!(buf = fifo_remove_nonblock (this->free_fifo))) if (this->xine->port_ticket->ticket_revoked) this->xine->port_ticket->renew(this->xine->port_ticket, 1); - + _x_extra_info_reset( buf->extra_info ); buf->stream = NULL; - + return buf; } -static void ao_put_buffer (xine_audio_port_t *this_gen, +static void ao_put_buffer (xine_audio_port_t *this_gen, audio_buffer_t *buf, xine_stream_t *stream) { aos_t *this = (aos_t *) this_gen; @@ -1573,11 +1573,11 @@ static void ao_put_buffer (xine_audio_port_t *this_gen, /* handle anonymous streams like NULL for easy checking */ if (stream == XINE_ANON_STREAM) stream = NULL; - + buf->stream = stream; - + pts = buf->vpts; - + if (stream) { buf->format.bits = _x_stream_info_get(stream, XINE_STREAM_INFO_AUDIO_BITS); buf->format.rate = _x_stream_info_get(stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE); @@ -1587,7 +1587,7 @@ static void ao_put_buffer (xine_audio_port_t *this_gen, } buf->extra_info->vpts = buf->vpts; - + lprintf ("ao_put_buffer, pts=%" PRId64 ", vpts=%" PRId64 ", flushmode=%d\n", pts, buf->vpts, this->discard_buffers); @@ -1597,7 +1597,7 @@ static void ao_put_buffer (xine_audio_port_t *this_gen, fifo_append (this->out_fifo, buf); } else fifo_append (this->free_fifo, buf); - + this->last_audio_vpts = buf->vpts; lprintf ("ao_put_buffer done\n"); @@ -1620,7 +1620,7 @@ static void ao_close(xine_audio_port_t *this_gen, xine_stream_t *stream) { break; } } - ite = xine_list_front(this->streams); + ite = xine_list_front(this->streams); pthread_mutex_unlock(&this->streams_lock); /* close driver if no streams left */ @@ -1643,7 +1643,7 @@ static void ao_close(xine_audio_port_t *this_gen, xine_stream_t *stream) { pthread_mutex_lock( &this->driver_lock ); if(this->driver_open) - this->driver->close(this->driver); + this->driver->close(this->driver); this->driver_open = 0; pthread_mutex_unlock( &this->driver_lock ); } @@ -1653,7 +1653,7 @@ static void ao_exit(xine_audio_port_t *this_gen) { aos_t *this = (aos_t *) this_gen; int vol; int prop = 0; - + audio_buffer_t *buf, *next; if (this->audio_loop_running) { @@ -1669,15 +1669,15 @@ static void ao_exit(xine_audio_port_t *this_gen) { pthread_join (this->audio_thread, &p); this->audio_thread_created = 0; } - + if (!this->grab_only) { pthread_mutex_lock( &this->driver_lock ); - + if((this->driver->get_capabilities(this->driver)) & AO_CAP_MIXER_VOL) prop = AO_PROP_MIXER_VOL; else if((this->driver->get_capabilities(this->driver)) & AO_CAP_PCM_VOL) prop = AO_PROP_PCM_VOL; - + vol = this->driver->get_property(this->driver, prop); this->xine->config->update_num(this->xine->config, "audio.volume.mixer_volume", vol); if(this->driver_open) @@ -1699,7 +1699,7 @@ static void ao_exit(xine_audio_port_t *this_gen) { free (this->frame_buf[1]->extra_info); free (this->frame_buf[1]); free (this->zero_space); - + pthread_mutex_destroy(&this->current_speed_lock); pthread_mutex_destroy(&this->flush_audio_driver_lock); pthread_cond_destroy(&this->flush_audio_driver_reached); @@ -1733,11 +1733,11 @@ static void ao_exit(xine_audio_port_t *this_gen) { pthread_mutex_destroy(&this->free_fifo->mutex); pthread_cond_destroy(&this->free_fifo->empty); pthread_cond_destroy(&this->free_fifo->not_empty); - + pthread_mutex_destroy(&this->out_fifo->mutex); pthread_cond_destroy(&this->out_fifo->empty); pthread_cond_destroy(&this->out_fifo->not_empty); - + free (this->free_fifo); free (this->out_fifo); free (this); @@ -1746,7 +1746,7 @@ static void ao_exit(xine_audio_port_t *this_gen) { static uint32_t ao_get_capabilities (xine_audio_port_t *this_gen) { aos_t *this = (aos_t *) this_gen; uint32_t result; - + if (this->grab_only) { return AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO ; @@ -1758,7 +1758,7 @@ static uint32_t ao_get_capabilities (xine_audio_port_t *this_gen) { inc_num_driver_actions(this); pthread_mutex_lock( &this->driver_lock ); dec_num_driver_actions(this); - result=this->driver->get_capabilities(this->driver); + result=this->driver->get_capabilities(this->driver); pthread_mutex_unlock( &this->driver_lock ); } return result; @@ -1772,25 +1772,25 @@ static int ao_get_property (xine_audio_port_t *this_gen, int property) { case AO_PROP_COMPRESSOR: ret = this->compression_factor_max*100; break; - + case AO_PROP_BUFS_IN_FIFO: ret = this->audio_loop_running ? this->out_fifo->num_buffers : -1; break; - + case AO_PROP_NUM_STREAMS: pthread_mutex_lock(&this->streams_lock); ret = xine_list_size(this->streams); pthread_mutex_unlock(&this->streams_lock); break; - + case AO_PROP_AMP: ret = this->amp_factor*100; break; - + case AO_PROP_AMP_MUTE: ret = this->amp_mute; break; - + case AO_PROP_EQ_30HZ: case AO_PROP_EQ_60HZ: case AO_PROP_EQ_125HZ: @@ -1800,14 +1800,14 @@ static int ao_get_property (xine_audio_port_t *this_gen, int property) { case AO_PROP_EQ_2000HZ: case AO_PROP_EQ_4000HZ: case AO_PROP_EQ_8000HZ: - case AO_PROP_EQ_16000HZ: + case AO_PROP_EQ_16000HZ: ret = (100.0 * this->eq_gain[property - AO_PROP_EQ_30HZ]) / (1 << FP_FRBITS) ; break; case AO_PROP_DISCARD_BUFFERS: ret = this->discard_buffers; break; - + case AO_PROP_CLOCK_SPEED: ret = this->current_speed; break; @@ -1835,7 +1835,7 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value ret = this->compression_factor_max*100; break; - + case AO_PROP_AMP: this->amp_factor = (double) value / 100.0; @@ -1860,13 +1860,13 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value case AO_PROP_EQ_2000HZ: case AO_PROP_EQ_4000HZ: case AO_PROP_EQ_8000HZ: - case AO_PROP_EQ_16000HZ: + case AO_PROP_EQ_16000HZ: { int min_gain, max_gain, i; this->eq_gain[property - AO_PROP_EQ_30HZ] = EQ_REAL(((float)value / 100.0)) ; - + /* calc pregain, find out if any gain != 0.0 - enable eq if that is the case */ min_gain = EQ_REAL(0.0); max_gain = EQ_REAL(0.0); @@ -1876,7 +1876,7 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value if (this->eq_gain[i] > max_gain) max_gain = this->eq_gain[i]; } - + lprintf ("eq min_gain=%d, max_gain=%d\n", min_gain, max_gain); this->do_equ = ((min_gain != EQ_REAL(0.0)) || (max_gain != EQ_REAL(0.0))); @@ -1884,22 +1884,22 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value ret = value; } break; - + case AO_PROP_DISCARD_BUFFERS: /* recursive discard buffers setting */ if(value) this->discard_buffers++; else this->discard_buffers--; - + ret = this->discard_buffers; - + /* discard buffers here because we have no output thread */ if (this->grab_only && this->discard_buffers) { audio_buffer_t *buf; - + pthread_mutex_lock(&this->out_fifo->mutex); - + while ((buf = this->out_fifo->first)) { lprintf ("flushing out frame\n"); buf = fifo_remove_int (this->out_fifo, 1); @@ -1940,7 +1940,7 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value if( this->slow_fast_audio ) ao_update_resample_factor(this); break; - + default: if (!this->grab_only) { /* Let the sound driver lock it's own mixer */ @@ -1986,7 +1986,7 @@ static void ao_flush (xine_audio_port_t *this_gen) { pthread_mutex_lock(&this->flush_audio_driver_lock); this->discard_buffers++; this->flush_audio_driver++; - + /* do not try this in paused mode */ while( this->flush_audio_driver && this->clock->speed != XINE_SPEED_PAUSE) { struct timeval tv; @@ -2025,7 +2025,7 @@ static int ao_status (xine_audio_port_t *this_gen, xine_stream_t *stream, xine_stream_t *cur; int ret = 0; xine_list_iterator_t ite; - + pthread_mutex_lock(&this->streams_lock); for (ite = xine_list_front(this->streams); ite; ite = xine_list_next(this->streams, ite)) { @@ -2039,8 +2039,8 @@ static int ao_status (xine_audio_port_t *this_gen, xine_stream_t *stream, } } pthread_mutex_unlock(&this->streams_lock); - - return ret; + + return ret; } static void ao_update_av_sync_method(void *this_gen, xine_cfg_entry_t *entry) { @@ -2049,7 +2049,7 @@ static void ao_update_av_sync_method(void *this_gen, xine_cfg_entry_t *entry) { lprintf ("av_sync_method = %d\n", entry->num_value); this->av_sync_method_conf = entry->num_value; - + switch (this->av_sync_method_conf) { case 0: this->resample_sync_method = 0; @@ -2066,7 +2066,7 @@ static void ao_update_av_sync_method(void *this_gen, xine_cfg_entry_t *entry) { xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, int grab_only) { - + config_values_t *config = xine->config; aos_t *this; int i, err; @@ -2082,7 +2082,7 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, this->clock = xine->clock; this->current_speed = xine->clock->speed; this->streams = xine_list_new(); - + /* warning: driver_lock is a recursive mutex. it must NOT be * used with neither pthread_cond_wait() or pthread_cond_timedwait() */ @@ -2106,13 +2106,13 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, this->ao.flush = ao_flush; this->ao.status = ao_status; - this->num_driver_actions = 0; + this->num_driver_actions = 0; this->audio_loop_running = 0; this->grab_only = grab_only; this->flush_audio_driver = 0; this->discard_buffers = 0; this->zero_space = calloc (1, ZERO_BUF_SIZE * 4 * 6); /* MAX as 32bit, 6 channels. */ - + pthread_mutex_init( &this->current_speed_lock, NULL ); pthread_mutex_init( &this->flush_audio_driver_lock, NULL ); pthread_cond_init( &this->flush_audio_driver_reached, NULL ); @@ -2148,7 +2148,7 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, "an external decoder in digital form."), 20, ao_update_av_sync_method, this); config->update_num(config,"audio.synchronization.av_sync_method",this->av_sync_method_conf); - + this->resample_conf = config->register_enum (config, "audio.synchronization.resample_mode", 0, resample_modes, _("enable resampling"), @@ -2175,7 +2175,7 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, "a fixed offset here to compensate.\nThe unit of " "the value is one PTS tick, which is the 90000th " "part of a second."), 10, NULL, NULL); - + this->slow_fast_audio = config->register_bool (config, "audio.synchronization.slow_fast_audio", 0, @@ -2227,12 +2227,12 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, buf->mem = calloc (1, AUDIO_BUF_SIZE); buf->mem_size = AUDIO_BUF_SIZE; buf->extra_info = malloc(sizeof(extra_info_t)); - + fifo_append (this->free_fifo, buf); } memset (this->last_sample, 0, sizeof (this->last_sample)); - + /* buffers used for audio conversions */ for (i=0; i<2; i++) { @@ -2251,13 +2251,13 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, */ if(this->driver){ int vol; - - vol = config->register_range (config, "audio.volume.mixer_volume", - 50, 0, 100, _("startup audio volume"), + + vol = config->register_range (config, "audio.volume.mixer_volume", + 50, 0, 100, _("startup audio volume"), _("The overall audio volume set at xine startup."), 10, NULL, NULL); - + if(config->register_bool (config, "audio.volume.remember_volume", 0, - _("restore volume level at startup"), + _("restore volume level at startup"), _("If disabled, xine will not modify any mixer settings at startup."), 10, NULL, NULL)) { int prop = 0; @@ -2266,34 +2266,34 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, prop = AO_PROP_MIXER_VOL; else if((ao_get_capabilities(&this->ao)) & AO_CAP_PCM_VOL) prop = AO_PROP_PCM_VOL; - + ao_set_property(&this->ao, prop, vol); } - } - + } + if (!this->grab_only) { /* * start output thread */ - this->audio_loop_running = 1; - + this->audio_loop_running = 1; + pthread_attr_init(&pth_attrs); pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM); this->audio_thread_created = 1; if ((err = pthread_create (&this->audio_thread, &pth_attrs, ao_loop, this)) != 0) { - + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_out: can't create thread (%s)\n", strerror(err)); - xprintf (this->xine, XINE_VERBOSITY_LOG, + xprintf (this->xine, XINE_VERBOSITY_LOG, _("audio_out: sorry, this should not happen. please restart xine.\n")); _x_abort(); - + } else xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_out: thread created\n"); - + pthread_attr_destroy(&pth_attrs); } diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h index 5f4420363..832c65a9e 100644 --- a/src/xine-engine/audio_out.h +++ b/src/xine-engine/audio_out.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 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 @@ -48,9 +48,9 @@ typedef struct ao_driver_s ao_driver_t; struct ao_driver_s { - /* + /* * - * find out what output modes + capatilities are supported by + * find out what output modes + capatilities are supported by * this plugin (constants for the bit vector to return see above) * * See AO_CAP_* bellow. @@ -58,7 +58,7 @@ struct ao_driver_s { uint32_t (*get_capabilities) (ao_driver_t *); /* - * open the driver and make it ready to receive audio data + * open the driver and make it ready to receive audio data * buffers may be flushed(!) * * return value: 0 : failure, >0 : output sample rate @@ -74,21 +74,21 @@ struct ao_driver_s { */ int (*bytes_per_frame)(ao_driver_t *self_gen); - /* return the delay is frames measured by + /* return the delay is frames measured by * looking at pending samples in the audio output device */ int (*delay)(ao_driver_t *self_gen); - /* + /* * return gap tolerance (in pts) needed for this driver */ int (*get_gap_tolerance) (ao_driver_t *self_gen); /* * write audio data to audio output device - * return value: + * return value: * >0 => audio samples were processed ok - * 0 => audio samples were not yet processed, + * 0 => audio samples were not yet processed, * call write_audio_data with the _same_ samples again */ int (*write)(ao_driver_t *, @@ -152,9 +152,9 @@ struct audio_buffer_s { int64_t vpts; uint32_t frame_header_count; uint32_t first_access_unit; - + /* extra info coming from input or demuxers */ - extra_info_t *extra_info; + extra_info_t *extra_info; xine_stream_t *stream; /* stream that send that buffer */ @@ -179,7 +179,7 @@ struct xine_audio_port_s { int (*get_property) (xine_audio_port_t *, int property); int (*set_property) (xine_audio_port_t *, int property, int value); - /* open audio driver for audio output + /* open audio driver for audio output * return value: 0:failure, >0:output sample rate */ /* when you are not a full-blown stream, but still need to open the port @@ -188,7 +188,7 @@ struct xine_audio_port_s { uint32_t bits, uint32_t rate, int mode); /* - * get a piece of memory for audio data + * get a piece of memory for audio data */ audio_buffer_t * (*get_buffer) (xine_audio_port_t *); @@ -218,7 +218,7 @@ struct xine_audio_port_s { * Flush audio_out fifo. */ void (*flush) (xine_audio_port_t *); - + /* * Check if port is opened for this stream and get parameters. * The stream can be anonymous. @@ -236,14 +236,14 @@ struct audio_driver_class_s { * open a new instance of this plugin class */ ao_driver_t* (*open_plugin) (audio_driver_class_t *, const void *data); - + /* * return short, human readable identifier for this plugin class */ char* (*get_identifier) (audio_driver_class_t *); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ char* (*get_description) (audio_driver_class_t *); @@ -255,7 +255,7 @@ struct audio_driver_class_s { void (*dispose) (audio_driver_class_t *); }; -/* +/* * this initiates the audio_out sync routines * found in ./src/xine-engine/audio_out.c */ @@ -331,7 +331,7 @@ int _x_ao_channels2mode( int channels ) XINE_PROTECTED; /* audio device control ops */ #define AO_CTRL_PLAY_PAUSE 0 #define AO_CTRL_PLAY_RESUME 1 -#define AO_CTRL_FLUSH_BUFFERS 2 +#define AO_CTRL_FLUSH_BUFFERS 2 /* above that value audio frames are discarded */ #define AO_MAX_GAP 15000 diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index 81711de49..22390459e 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -9,7 +9,7 @@ * 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 @@ -27,7 +27,7 @@ * - master will wait for connections on specified port, accepting new clients. * - several xine clients may connect to the server as "slaves", using mrl: * slave://master_address:port - * - streams played on master will appear on every slave. + * - streams played on master will appear on every slave. * if master is not meant to use video/audio devices it may be started with * 'xine -V none -A none' */ @@ -73,7 +73,7 @@ struct broadcaster_s { int port; /* server port */ int msock; /* master network socket */ xine_list_t *connections; /* active connections */ - + pthread_t manager_thread; pthread_mutex_t lock; @@ -87,21 +87,21 @@ static int sock_check_opened(int socket) { fd_set readfds, writefds, exceptfds; int retval; struct timeval timeout; - + for(;;) { - FD_ZERO(&readfds); - FD_ZERO(&writefds); + FD_ZERO(&readfds); + FD_ZERO(&writefds); FD_ZERO(&exceptfds); FD_SET(socket, &exceptfds); - - timeout.tv_sec = 0; + + timeout.tv_sec = 0; timeout.tv_usec = 0; - + retval = select(socket + 1, &readfds, &writefds, &exceptfds, &timeout); - + if(retval == -1 && (errno != EAGAIN && errno != EINTR)) return 0; - + if (retval != -1) return 1; } @@ -115,21 +115,21 @@ static int sock_check_opened(int socket) { static int sock_data_write(xine_t *xine, int socket, char *buf, int len) { ssize_t size; int wlen = 0; - + if((socket < 0) || (buf == NULL)) return -1; - + if(!sock_check_opened(socket)) return -1; - + while(len) { size = write(socket, buf, len); - + if(size <= 0) { xprintf(xine, XINE_VERBOSITY_DEBUG, "broadcaster: error writing to socket %d\n",socket); return -1; } - + len -= size; wlen += size; buf += size; @@ -142,20 +142,20 @@ static int XINE_FORMAT_PRINTF(3, 4) sock_string_write(xine_t *xine, int socket, char *msg, ...) { char buf[_BUFSIZ]; va_list args; - + va_start(args, msg); vsnprintf(buf, _BUFSIZ - 1, msg, args); va_end(args); - + /* Each line sent is '\n' terminated */ if((buf[strlen(buf)] == '\0') && (buf[strlen(buf) - 1] != '\n')) strcat(buf, "\n"); - + return sock_data_write(xine, socket, buf, strlen(buf)); } /* - * this is the most important broadcaster function. + * this is the most important broadcaster function. * it sends data to every connected client (slaves). */ static void broadcaster_data_write(broadcaster_t *this, char *buf, int len) { @@ -165,9 +165,9 @@ static void broadcaster_data_write(broadcaster_t *this, char *buf, int len) { while (ite) { int *psock = xine_list_get_value(this->connections, ite); - + ite = xine_list_next(this->connections, ite); - + /* in case of failure remove from list */ if( sock_data_write(this->stream->xine, *psock, buf, len) < 0 ) { @@ -184,15 +184,15 @@ static void XINE_FORMAT_PRINTF(2, 3) broadcaster_string_write(broadcaster_t *this, char *msg, ...) { char buf[_BUFSIZ]; va_list args; - + va_start(args, msg); vsnprintf(buf, _BUFSIZ - 1, msg, args); va_end(args); - + /* Each line sent is '\n' terminated */ if((buf[strlen(buf)] == '\0') && (buf[strlen(buf) - 1] != '\n')) strcat(buf, "\n"); - + broadcaster_data_write(this, buf, strlen(buf)); } @@ -209,40 +209,40 @@ static void *manager_loop (void *this_gen) { socklen_t alen; /* from-address length */ fd_set rfds; /* read file descriptor set */ fd_set efds; /* exception descriptor set */ - + while( this->running ) { FD_ZERO(&rfds); FD_SET(this->msock, &rfds); FD_ZERO(&efds); FD_SET(this->msock, &efds); - + if (select(this->msock+1, &rfds, (fd_set *)0, &efds, (struct timeval *)0) > 0) { - + pthread_mutex_lock( &this->lock ); - + if (FD_ISSET(this->msock, &rfds)) { int ssock; alen = sizeof(fsin.in); - + ssock = accept(this->msock, &(fsin.sa), &alen); if (ssock >= 0) { /* identification string, helps demuxer probing */ if( sock_string_write(this->stream->xine, ssock,"master xine v1") > 0 ) { int *psock = malloc(sizeof(int)); *psock = ssock; - - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: new connection socket %d\n", *psock); xine_list_push_back(this->connections, psock); } } } - + pthread_mutex_unlock( &this->lock ); } } - + return NULL; } @@ -253,7 +253,7 @@ static void *manager_loop (void *this_gen) { */ static void send_buf (broadcaster_t *this, char *from, buf_element_t *buf) { int i; - + /* ignore END buffers since they would stop the slavery */ if( buf->type == BUF_CONTROL_END ) return; @@ -272,7 +272,7 @@ static void send_buf (broadcaster_t *this, char *from, buf_element_t *buf) { broadcaster_data_write(this, buf->decoder_info_ptr[i], buf->decoder_info[i]); } } - + broadcaster_string_write(this, "buffer fifo=%s size=%d type=%u pts=%"PRId64" disc=%"PRId64" flags=%u", from, buf->size, buf->type, buf->pts, buf->disc_off, buf->decoder_flags ); @@ -306,7 +306,7 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) struct sockaddr sa; } servAddr; int msock, err; - + msock = socket(PF_INET, SOCK_STREAM, 0); if( msock < 0 ) { @@ -324,7 +324,7 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) } listen(msock,QLEN); - + signal( SIGPIPE, SIG_IGN ); this = calloc(1, sizeof(broadcaster_t)); @@ -332,23 +332,23 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) this->stream = stream; this->msock = msock; this->connections = xine_list_new(); - + pthread_mutex_init (&this->lock, NULL); - + stream->video_fifo->register_put_cb(stream->video_fifo, video_put_cb, this); if(stream->audio_fifo) stream->audio_fifo->register_put_cb(stream->audio_fifo, audio_put_cb, this); - + this->running = 1; if ((err = pthread_create (&this->manager_thread, NULL, manager_loop, (void *)this)) != 0) { - xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: can't create new thread (%s)\n", strerror(err)); _x_abort(); } - - return this; + + return this; } void _x_close_broadcaster(broadcaster_t *this) @@ -357,15 +357,15 @@ void _x_close_broadcaster(broadcaster_t *this) pthread_cancel(this->manager_thread); pthread_join(this->manager_thread,NULL); close(this->msock); - + if (this->stream->video_fifo) this->stream->video_fifo->unregister_put_cb(this->stream->video_fifo, video_put_cb); if(this->stream->audio_fifo) this->stream->audio_fifo->unregister_put_cb(this->stream->audio_fifo, audio_put_cb); - + xine_list_iterator_t ite; - + while ( (ite = xine_list_front(this->connections)) ) { int *psock = xine_list_get_value(this->connections, ite); xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: closing socket %d\n", *psock); @@ -382,5 +382,5 @@ void _x_close_broadcaster(broadcaster_t *this) int _x_get_broadcaster_port(broadcaster_t *this) { - return this->port; + return this->port; } diff --git a/src/xine-engine/broadcaster.h b/src/xine-engine/broadcaster.h index b59d33349..0cd416cac 100644 --- a/src/xine-engine/broadcaster.h +++ b/src/xine-engine/broadcaster.h @@ -7,7 +7,7 @@ * 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 diff --git a/src/xine-engine/bswap.h b/src/xine-engine/bswap.h index 635c6ae3a..f58648728 100644 --- a/src/xine-engine/bswap.h +++ b/src/xine-engine/bswap.h @@ -23,7 +23,7 @@ #include "config.h" -#define always_inline inline +#define always_inline inline #include "ffmpeg_bswap.h" @@ -98,7 +98,7 @@ ( (uint32_t)(unsigned char)(ch1) << 8 ) | \ ( (uint32_t)(unsigned char)(ch2) << 16 ) | \ ( (uint32_t)(unsigned char)(ch3) << 24 ) ) - + #ifdef WORDS_BIGENDIAN #define ME_FOURCC BE_FOURCC #else diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c index 417fee745..77c0abc9d 100644 --- a/src/xine-engine/buffer.c +++ b/src/xine-engine/buffer.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2004 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 @@ -64,7 +64,7 @@ static void buffer_pool_free (buf_element_t *element) { fprintf(stderr, _("xine-lib: buffer.c: There has been a fatal error: TOO MANY FREE's\n")); _x_abort(); } - + pthread_cond_signal (&this->buffer_pool_cond_not_empty); pthread_mutex_unlock (&this->buffer_pool_mutex); @@ -104,7 +104,7 @@ static buf_element_t *buffer_pool_alloc (fifo_buffer_t *this) { memset(buf->decoder_info, 0, sizeof(buf->decoder_info)); memset(buf->decoder_info_ptr, 0, sizeof(buf->decoder_info_ptr)); _x_extra_info_reset( buf->extra_info ); - + return buf; } @@ -151,7 +151,7 @@ static buf_element_t *buffer_pool_try_alloc (fifo_buffer_t *this) { */ static void fifo_buffer_put (fifo_buffer_t *fifo, buf_element_t *element) { int i; - + pthread_mutex_lock (&fifo->mutex); for(i = 0; fifo->put_cb[i]; i++) @@ -177,7 +177,7 @@ static void fifo_buffer_put (fifo_buffer_t *fifo, buf_element_t *element) { */ static void dummy_fifo_buffer_put (fifo_buffer_t *fifo, buf_element_t *element) { int i; - + pthread_mutex_lock (&fifo->mutex); for(i = 0; fifo->put_cb[i]; i++) @@ -444,7 +444,7 @@ static void fifo_unregister_alloc_cb (fifo_buffer_t *this, this->alloc_cb_data[j] = this->alloc_cb_data[j+1]; } } - } + } pthread_mutex_unlock(&this->mutex); } @@ -465,7 +465,7 @@ static void fifo_unregister_put_cb (fifo_buffer_t *this, this->put_cb_data[j] = this->put_cb_data[j+1]; } } - } + } pthread_mutex_unlock(&this->mutex); } @@ -486,7 +486,7 @@ static void fifo_unregister_get_cb (fifo_buffer_t *this, this->get_cb_data[j] = this->get_cb_data[j+1]; } } - } + } pthread_mutex_unlock(&this->mutex); } diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index e0866f549..42302b30f 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -1,8 +1,8 @@ /* * Copyright (C) 2000-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 @@ -108,7 +108,7 @@ extern "C" { #define BUF_VIDEO_WMV8 0x02140000 #define BUF_VIDEO_MSVC 0x02150000 #define BUF_VIDEO_DV 0x02160000 -#define BUF_VIDEO_REAL 0x02170000 +#define BUF_VIDEO_REAL 0x02170000 #define BUF_VIDEO_VP31 0x02180000 #define BUF_VIDEO_H263 0x02190000 #define BUF_VIDEO_3IVX 0x021A0000 @@ -209,7 +209,7 @@ extern "C" { #define BUF_AUDIO_VOXWARE 0x030c0000 #define BUF_AUDIO_ACELPNET 0x030d0000 #define BUF_AUDIO_AAC 0x030e0000 -#define BUF_AUDIO_DNET 0x030f0000 +#define BUF_AUDIO_DNET 0x030f0000 #define BUF_AUDIO_VIVOG723 0x03100000 #define BUF_AUDIO_DK3ADPCM 0x03110000 #define BUF_AUDIO_DK4ADPCM 0x03120000 @@ -227,10 +227,10 @@ extern "C" { #define BUF_AUDIO_GSM610 0x031E0000 #define BUF_AUDIO_EA_ADPCM 0x031F0000 #define BUF_AUDIO_WMAV2 0x03200000 -#define BUF_AUDIO_COOK 0x03210000 -#define BUF_AUDIO_ATRK 0x03220000 -#define BUF_AUDIO_14_4 0x03230000 -#define BUF_AUDIO_28_8 0x03240000 +#define BUF_AUDIO_COOK 0x03210000 +#define BUF_AUDIO_ATRK 0x03220000 +#define BUF_AUDIO_14_4 0x03230000 +#define BUF_AUDIO_28_8 0x03240000 #define BUF_AUDIO_SIPRO 0x03250000 #define BUF_AUDIO_WMAV3 0x03260000 #define BUF_AUDIO_INTERPLAY 0x03270000 @@ -284,7 +284,7 @@ typedef struct extra_info_s extra_info_t; * to output frames (past decoder). new data must be added after the existing * fields for backward compatibility. */ - + struct extra_info_s { int input_normpos; /* remember where this buf came from in @@ -293,10 +293,10 @@ struct extra_info_s { int input_time; /* time offset in miliseconds from * beginning of stream */ uint32_t frame_number; /* number of current frame if known */ - + int seek_count; /* internal engine use */ - int64_t vpts; /* set on output layers only */ - + int64_t vpts; /* set on output layers only */ + int invalid; /* do not use this extra info to update anything */ int total_time; /* duration in miliseconds of the stream */ }; @@ -322,7 +322,7 @@ struct buf_element_s { uint32_t decoder_flags; /* stuff like keyframe, is_header ... see below */ /* additional decoder flags and other dec-spec. stuff */ - uint32_t decoder_info[BUF_NUM_DEC_INFO]; + uint32_t decoder_info[BUF_NUM_DEC_INFO]; /* pointers to dec-spec. stuff */ void *decoder_info_ptr[BUF_NUM_DEC_INFO]; @@ -369,7 +369,7 @@ struct buf_element_s { * xine_waveformatex is actually optional since the most important * information for audio init is available from decoder_info[]. * note: BUF_FLAG_HEADER must also be set. */ -#define BUF_FLAG_STDHEADER 0x0400 +#define BUF_FLAG_STDHEADER 0x0400 /* decoder_info[1] carries numerator for display aspect ratio * decoder_info[2] carries denominator for display aspect ratio */ @@ -456,7 +456,7 @@ struct buf_element_s { * four length bytes at the beginning * decoder_info_ptr[2] = pointer to ImageDescription atom, starting with * the codec fourcc - * Some Quicktime decoders need information contained within the + * Some Quicktime decoders need information contained within the * ImageDescription atom inside a Quicktime file's stsd atom. This * special buffer carries the ImageDescription atom from the QT demuxer * to an A/V decoder. @@ -489,7 +489,7 @@ struct buf_element_s { * In a BUF_SPECIAL_SPU_DVD_SUBTYPE: * decoder_info[1] = BUF_SPECIAL_SPU_DVD_SUBTYPE * decoder_info[2] = subtype - * decoder_info[3] = + * decoder_info[3] = * This buffer is pass SPU subtypes from DVDs */ #define BUF_SPECIAL_SPU_DVD_SUBTYPE 8 @@ -529,7 +529,7 @@ struct spu_dvb_descriptor_s long comp_page_id; long aux_page_id; } ; - + typedef struct palette_entry_s palette_entry_t; struct palette_entry_s { @@ -661,7 +661,7 @@ typedef struct XINE_PACKED { int32_t biClrImportant; } xine_bmiheader; -/* this is xine version of WAVEFORMATEX +/* this is xine version of WAVEFORMATEX * (the same comments from xine_bmiheader) */ typedef struct XINE_PACKED { diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c index b7571d1d7..51e688f7e 100644 --- a/src/xine-engine/buffer_types.c +++ b/src/xine-engine/buffer_types.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-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 @@ -20,7 +20,7 @@ * * contents: * - * buffer types management. + * buffer types management. * convert FOURCC and audioformattag to BUF_xxx defines */ @@ -270,7 +270,7 @@ static const video_db_t video_db[] = { "Raw RGB" }, { - { + { /* is this right? copied from demux_qt: else if (!strncasecmp (video, "yuv2", 4)) this->video_type = BUF_VIDEO_YUY2; @@ -885,7 +885,7 @@ static const audio_db_t audio_db[] = { }, { { - 0x02, + 0x02, ME_FOURCC('m', 's', 0, 0x02), 0 }, @@ -909,7 +909,7 @@ static const audio_db_t audio_db[] = { "MS GSM" }, { - { + { /* these formattags are used by Vorbis ACM encoder and supported by NanDub, a variant of VirtualDub. */ 0x674f, 0x676f, 0x6750, 0x6770, 0x6751, 0x6771, @@ -1018,7 +1018,7 @@ static const audio_db_t audio_db[] = { ME_FOURCC('M', 'P', '4', 'A'), ME_FOURCC('r', 'a', 'a', 'c'), ME_FOURCC('r', 'a', 'c', 'p'), - ME_FOURCC('A', 'A', 'C', ' '), + ME_FOURCC('A', 'A', 'C', ' '), 0 }, BUF_AUDIO_AAC, @@ -1187,7 +1187,7 @@ static uint32_t cached_buf_type=0; if( fourcc_int == cached_fourcc ) return cached_buf_type; - + for( i = 0; video_db[i].buf_type; i++ ) { for( j = 0; video_db[i].fourcc[j]; j++ ) { if( fourcc_int == video_db[i].fourcc[j] ) { @@ -1202,9 +1202,9 @@ static uint32_t cached_buf_type=0; const char * _x_buf_video_name( uint32_t buf_type ) { int i; - + buf_type &= 0xffff0000; - + for( i = 0; video_db[i].buf_type; i++ ) { if( buf_type == video_db[i].buf_type ) { return video_db[i].name; @@ -1221,7 +1221,7 @@ static uint32_t cached_buf_type=0; if( formattag == cached_formattag ) return cached_buf_type; - + for( i = 0; audio_db[i].buf_type; i++ ) { for( j = 0; audio_db[i].formattag[j]; j++ ) { if( formattag == audio_db[i].formattag[j] ) { @@ -1236,9 +1236,9 @@ static uint32_t cached_buf_type=0; const char * _x_buf_audio_name( uint32_t buf_type ) { int i; - + buf_type &= 0xffff0000; - + for( i = 0; audio_db[i].buf_type; i++ ) { if( buf_type == audio_db[i].buf_type ) { return audio_db[i].name; @@ -1252,7 +1252,7 @@ void _x_bmiheader_le2me( xine_bmiheader *bih ) { /* OBS: fourcc must be read using machine endianness * so don't play with biCompression here! */ - + bih->biSize = le2me_32(bih->biSize); bih->biWidth = le2me_32(bih->biWidth); bih->biHeight = le2me_32(bih->biHeight); @@ -1266,7 +1266,7 @@ void _x_bmiheader_le2me( xine_bmiheader *bih ) { } void _x_waveformatex_le2me( xine_waveformatex *wavex ) { - + wavex->wFormatTag = le2me_16(wavex->wFormatTag); wavex->nChannels = le2me_16(wavex->nChannels); wavex->nSamplesPerSec = le2me_32(wavex->nSamplesPerSec); diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 81acab348..8b274a801 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -225,7 +225,7 @@ static int config_section_enum(const char *sect) { NULL }; int i = 0; - + while (known_section[i]) if (strcmp(sect, known_section[i++]) == 0) return i; @@ -234,7 +234,7 @@ static int config_section_enum(const char *sect) { static void config_key_split(const char *key, char **base, char **section, char **subsect, char **name) { char *parse; - + *base = strdup(key); if ((parse = strchr(*base, '.'))) { *section = *base; @@ -259,10 +259,10 @@ static void config_insert(config_values_t *this, cfg_entry_t *new_entry) { cfg_entry_t *cur, *prev; char *new_base, *new_section, *new_subsect, *new_name; char *cur_base, *cur_section, *cur_subsect, *cur_name; - + /* extract parts of the new key */ config_key_split(new_entry->key, &new_base, &new_section, &new_subsect, &new_name); - + /* search right position */ cur_base = NULL; for (cur = this->first, prev = NULL; cur; prev = cur, cur = cur->next) { @@ -270,7 +270,7 @@ static void config_insert(config_values_t *this, cfg_entry_t *new_entry) { if (cur_base) free(cur_base); config_key_split(cur->key, &cur_base, &cur_section, &cur_subsect, &cur_name); - + /* sort by section name */ if (!new_section && cur_section) break; if ( new_section && !cur_section) continue; @@ -302,14 +302,14 @@ static void config_insert(config_values_t *this, cfg_entry_t *new_entry) { if (cmp < 0) break; if (cmp > 0) continue; } - + break; } if (new_base) free(new_base); if (cur_base) free(cur_base); - + new_entry->next = cur; if (!cur) this->last = new_entry; @@ -330,7 +330,7 @@ static cfg_entry_t *XINE_MALLOC config_add (config_values_t *this, const char *k entry->unknown_value = NULL; entry->str_value = NULL; entry->exp_level = exp_level; - + config_insert(this, entry); lprintf ("add entry key=%s\n", key); @@ -397,7 +397,7 @@ static void config_lookup_entry_int (config_values_t *this, const char *key, *prev = *entry; *entry = (*entry)->next; } - + if (*entry) { free(tmp); return; @@ -420,11 +420,11 @@ static void config_lookup_entry_int (config_values_t *this, const char *key, static cfg_entry_t *config_lookup_entry(config_values_t *this, const char *key) { cfg_entry_t *entry, *prev; - + pthread_mutex_lock(&this->config_lock); config_lookup_entry_int(this, key, &entry, &prev); pthread_mutex_unlock(&this->config_lock); - + return entry; } @@ -525,7 +525,7 @@ static cfg_entry_t *config_register_string_internal (config_values_t *this, /* set string */ entry->type = XINE_CONFIG_TYPE_STRING; - + if (entry->unknown_value) entry->str_value = strdup(entry->unknown_value); else @@ -756,7 +756,7 @@ static int config_register_enum (config_values_t *this, entry->num_value = config_parse_enum (entry->unknown_value, (const char **)values); else entry->num_value = def_value; - + /* fill out rest of struct */ entry->num_default = def_value; @@ -806,7 +806,7 @@ static void config_shallow_copy(xine_cfg_entry_t *dest, cfg_entry_t *src) static void config_update_num (config_values_t *this, const char *key, int value) { - + cfg_entry_t *entry; entry = this->lookup_entry (this, key); @@ -835,13 +835,13 @@ static void config_update_num (config_values_t *this, xine_cfg_entry_t cb_entry; config_shallow_copy(&cb_entry, entry); - + /* it is safe to enter the callback from within a locked context * because we use a recursive mutex. */ entry->callback (entry->callback_data, &cb_entry); } - + pthread_mutex_unlock(&this->config_lock); } @@ -863,7 +863,7 @@ static void config_update_string (config_values_t *this, return; } - + /* if an enum is updated with a string, we convert the string to * its index and use update number */ if (entry->type == XINE_CONFIG_TYPE_ENUM) { @@ -887,7 +887,7 @@ static void config_update_string (config_values_t *this, xine_cfg_entry_t cb_entry; config_shallow_copy(&cb_entry, entry); - + /* it is safe to enter the callback from within a locked context * because we use a recursive mutex. */ @@ -929,7 +929,7 @@ void xine_config_load (xine_t *xine, const char *filename) { if (line[0] == '#') continue; - + if (line[0] == '.') { if (strncmp(line, ".version:", 9) == 0) { sscanf(line + 9, "%d", &this->current_version); @@ -1002,32 +1002,32 @@ void xine_config_save (xine_t *xine, const char *filename) { unlink (temp); if (stat(temp, &backup_stat) != 0) { - + lprintf("backing up configfile to %s\n", temp); f_backup = fopen(temp, "w"); f_config = fopen(filename, "r"); - + if (f_config && f_backup && (stat(filename, &config_stat) == 0)) { char *buf = NULL; size_t rlen; - + buf = (char *) malloc(config_stat.st_size + 1); if((rlen = fread(buf, 1, config_stat.st_size, f_config)) && ((off_t)rlen == config_stat.st_size)) { (void) fwrite(buf, 1, rlen, f_backup); } free(buf); - + fclose(f_config); fclose(f_backup); stat(temp, &backup_stat); - + if (config_stat.st_size == backup_stat.st_size) backup = 1; else unlink(temp); - - } + + } else { if (f_config) @@ -1040,17 +1040,17 @@ void xine_config_save (xine_t *xine, const char *filename) { } } - + if (!backup && (stat(filename, &config_stat) == 0)) { xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: backing up configfile to %s failed\n"), temp); xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: your configuration will not be saved\n")); return; } - + lprintf ("writing config file to %s\n", filename); f_config = fopen(filename, "w"); - + if (f_config) { cfg_entry_t *entry; @@ -1141,7 +1141,7 @@ void xine_config_save (xine_t *xine, const char *filename) { entry = entry->next; } pthread_mutex_unlock(&this->config_lock); - + if (fclose(f_config) != 0) { xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: writing configuration to %s failed\n"), filename); xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: removing possibly broken config file %s\n"), filename); @@ -1152,7 +1152,7 @@ void xine_config_save (xine_t *xine, const char *filename) { backup = 0; } } - + if (backup) unlink(temp); } @@ -1284,13 +1284,13 @@ int _x_config_change_opt(config_values_t *config, const char *opt) { free(key); return -1; } - + switch(entry->type) { case XINE_CONFIG_TYPE_STRING: config->update_string(config, key, value); handled = 1; break; - + case XINE_CONFIG_TYPE_RANGE: case XINE_CONFIG_TYPE_ENUM: case XINE_CONFIG_TYPE_NUM: @@ -1298,13 +1298,13 @@ int _x_config_change_opt(config_values_t *config, const char *opt) { config->update_num(config, key, (atoi(value))); handled = 1; break; - + case XINE_CONFIG_TYPE_UNKNOWN: entry->unknown_value = strdup(value); handled = 1; break; } - + free(key); return handled; } diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h index e1dca7b18..4622f87fe 100644 --- a/src/xine-engine/configfile.h +++ b/src/xine-engine/configfile.h @@ -38,11 +38,11 @@ extern "C" { #define CONFIG_FILE_VERSION 2 /* - * config entries above this experience + * config entries above this experience * level must never be changed from MRL */ #define XINE_CONFIG_SECURITY 30 - + typedef struct cfg_entry_s cfg_entry_t; typedef struct config_values_s config_values_t; @@ -190,7 +190,7 @@ struct config_values_s { * mutex for modification to the config */ pthread_mutex_t config_lock; - + /* * current config file's version number */ diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index 98b2e3fd3..bbc130988 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -50,7 +50,7 @@ #include <winsock.h> #endif -/* +/* * Flush audio and video buffers. It is called from demuxers on * seek/stop, and may be useful when user input changes a stream and * xine-lib has cached buffers that have yet to be played. @@ -62,10 +62,10 @@ void _x_demux_flush_engine (xine_stream_t *stream) { buf_element_t *buf; - + if( stream->gapless_switch ) return; - + stream->xine->port_ticket->acquire(stream->xine->port_ticket, 1); /* only flush/discard output ports on master streams */ @@ -77,23 +77,23 @@ void _x_demux_flush_engine (xine_stream_t *stream) { stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 1); } } - + stream->video_fifo->clear(stream->video_fifo); stream->audio_fifo->clear(stream->audio_fifo); - - pthread_mutex_lock(&stream->demux_mutex); + + pthread_mutex_lock(&stream->demux_mutex); buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf->type = BUF_CONTROL_RESET_DECODER; stream->video_fifo->put (stream->video_fifo, buf); - + buf = stream->audio_fifo->buffer_pool_alloc (stream->audio_fifo); buf->type = BUF_CONTROL_RESET_DECODER; stream->audio_fifo->put (stream->audio_fifo, buf); - - pthread_mutex_unlock(&stream->demux_mutex); - /* on seeking we must wait decoder fifos to process before doing flush. + pthread_mutex_unlock(&stream->demux_mutex); + + /* on seeking we must wait decoder fifos to process before doing flush. * otherwise we flush too early (before the old data has left decoders) */ _x_demux_control_headers_done (stream); @@ -102,7 +102,7 @@ void _x_demux_flush_engine (xine_stream_t *stream) { video_overlay_manager_t *ovl = stream->video_out->get_overlay_manager(stream->video_out); ovl->flush_events(ovl); } - + /* only flush/discard output ports on master streams */ if( stream->master == stream ) { if (stream->video_out) { @@ -115,7 +115,7 @@ void _x_demux_flush_engine (xine_stream_t *stream) { stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 0); } } - + stream->xine->port_ticket->release(stream->xine->port_ticket, 1); } @@ -151,8 +151,8 @@ static struct timespec _x_compute_interval(unsigned int millisecs) { void _x_demux_control_newpts( xine_stream_t *stream, int64_t pts, uint32_t flags ) { buf_element_t *buf; - - pthread_mutex_lock(&stream->demux_mutex); + + pthread_mutex_lock(&stream->demux_mutex); buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf->type = BUF_CONTROL_NEWPTS; @@ -166,7 +166,7 @@ void _x_demux_control_newpts( xine_stream_t *stream, int64_t pts, uint32_t flags buf->disc_off = pts; stream->audio_fifo->put (stream->audio_fifo, buf); - pthread_mutex_unlock(&stream->demux_mutex); + pthread_mutex_unlock(&stream->demux_mutex); } /* avoid ao_loop being stuck in a pthread_cond_wait, waiting for data; @@ -201,7 +201,7 @@ void _x_demux_control_headers_done (xine_stream_t *stream) { /* we use demux_action_pending to wake up sleeping spu decoders */ stream->demux_action_pending = 1; - + /* allocate the buffers before grabbing the lock to prevent cyclic wait situations */ buf_video = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf_audio = stream->audio_fifo->buffer_pool_alloc (stream->audio_fifo); @@ -219,8 +219,8 @@ void _x_demux_control_headers_done (xine_stream_t *stream) { } else { header_count_audio = 0; } - - pthread_mutex_lock(&stream->demux_mutex); + + pthread_mutex_lock(&stream->demux_mutex); buf_video->type = BUF_CONTROL_HEADERS_DONE; stream->video_fifo->put (stream->video_fifo, buf_video); @@ -228,24 +228,24 @@ void _x_demux_control_headers_done (xine_stream_t *stream) { buf_audio->type = BUF_CONTROL_HEADERS_DONE; stream->audio_fifo->put (stream->audio_fifo, buf_audio); - pthread_mutex_unlock(&stream->demux_mutex); + pthread_mutex_unlock(&stream->demux_mutex); unsigned int max_iterations = 0; - while ((stream->header_count_audio < header_count_audio) || + while ((stream->header_count_audio < header_count_audio) || (stream->header_count_video < header_count_video)) { lprintf ("waiting for headers. v:%d %d a:%d %d\n", stream->header_count_video, header_count_video, - stream->header_count_audio, header_count_audio); - - struct timespec ts = _x_compute_interval(1000); + stream->header_count_audio, header_count_audio); + + struct timespec ts = _x_compute_interval(1000); int ret_wait; /* use timedwait to workaround buggy pthread broadcast implementations */ ret_wait = pthread_cond_timedwait (&stream->counter_changed, &stream->counter_lock, &ts); if (ret_wait == ETIMEDOUT && demux_unstick_ao_loop (stream) && ++max_iterations > 4) { - xine_log(stream->xine, + xine_log(stream->xine, XINE_LOG_MSG,_("Stuck in _x_demux_control_headers_done(). Taking the emergency exit\n")); stream->emergency_brake = 1; break; @@ -254,7 +254,7 @@ void _x_demux_control_headers_done (xine_stream_t *stream) { stream->demux_action_pending = 0; pthread_cond_signal(&stream->demux_resume); - + lprintf ("headers processed.\n"); pthread_mutex_unlock (&stream->counter_lock); @@ -265,7 +265,7 @@ void _x_demux_control_start( xine_stream_t *stream ) { buf_element_t *buf; uint32_t flags = (stream->gapless_switch) ? BUF_FLAG_GAPLESS_SW : 0; - pthread_mutex_lock(&stream->demux_mutex); + pthread_mutex_lock(&stream->demux_mutex); buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf->type = BUF_CONTROL_START; @@ -277,14 +277,14 @@ void _x_demux_control_start( xine_stream_t *stream ) { buf->decoder_flags = flags; stream->audio_fifo->put (stream->audio_fifo, buf); - pthread_mutex_unlock(&stream->demux_mutex); + pthread_mutex_unlock(&stream->demux_mutex); } void _x_demux_control_end( xine_stream_t *stream, uint32_t flags ) { buf_element_t *buf; - pthread_mutex_lock(&stream->demux_mutex); + pthread_mutex_lock(&stream->demux_mutex); buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf->type = BUF_CONTROL_END; @@ -296,26 +296,26 @@ void _x_demux_control_end( xine_stream_t *stream, uint32_t flags ) { buf->decoder_flags = flags; stream->audio_fifo->put (stream->audio_fifo, buf); - pthread_mutex_unlock(&stream->demux_mutex); + pthread_mutex_unlock(&stream->demux_mutex); } void _x_demux_control_nop( xine_stream_t *stream, uint32_t flags ) { buf_element_t *buf; - pthread_mutex_lock(&stream->demux_mutex); + pthread_mutex_lock(&stream->demux_mutex); buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf->type = BUF_CONTROL_NOP; buf->decoder_flags = flags; stream->video_fifo->put (stream->video_fifo, buf); - + buf = stream->audio_fifo->buffer_pool_alloc (stream->audio_fifo); buf->type = BUF_CONTROL_NOP; buf->decoder_flags = flags; stream->audio_fifo->put (stream->audio_fifo, buf); - pthread_mutex_unlock(&stream->demux_mutex); + pthread_mutex_unlock(&stream->demux_mutex); } static void *demux_loop (void *stream_gen) { @@ -330,7 +330,7 @@ static void *demux_loop (void *stream_gen) { pthread_mutex_lock( &stream->demux_lock ); stream->emergency_brake = 0; - + /* do-while needed to seek after demux finished */ do { @@ -349,7 +349,7 @@ static void *demux_loop (void *stream_gen) { gettimeofday(&tv, NULL); ts.tv_sec = tv.tv_sec; ts.tv_nsec = (tv.tv_usec + 100000) * 1000; - + pthread_cond_timedwait (&stream->demux_resume, &stream->demux_lock, &ts); } } @@ -398,7 +398,7 @@ static void *demux_loop (void *stream_gen) { /* demux_thread_running is zero if demux loop has been stopped by user */ non_user = stream->demux_thread_running; stream->demux_thread_running = 0; - + _x_demux_control_end(stream, non_user); lprintf ("loop finished, end buffer sent\n"); @@ -409,7 +409,7 @@ static void *demux_loop (void *stream_gen) { struct timespec ts; unsigned int max_iterations = 0; int ret_wait; - while ((stream->finished_count_audio < finished_count_audio) || + while ((stream->finished_count_audio < finished_count_audio) || (stream->finished_count_video < finished_count_video)) { lprintf ("waiting for finisheds.\n"); ts = _x_compute_interval(1000); @@ -423,7 +423,7 @@ static void *demux_loop (void *stream_gen) { } } pthread_mutex_unlock (&stream->counter_lock); - + _x_handle_stream_end(stream, non_user); return NULL; } @@ -431,14 +431,14 @@ static void *demux_loop (void *stream_gen) { int _x_demux_start_thread (xine_stream_t *stream) { int err; - + lprintf ("start thread called\n"); - + stream->demux_action_pending = 1; pthread_mutex_lock( &stream->demux_lock ); stream->demux_action_pending = 0; pthread_cond_signal(&stream->demux_resume); - + if( !stream->demux_thread_running ) { if (stream->demux_thread_created) { @@ -454,17 +454,17 @@ int _x_demux_start_thread (xine_stream_t *stream) { _x_abort(); } } - + pthread_mutex_unlock( &stream->demux_lock ); return 0; } int _x_demux_stop_thread (xine_stream_t *stream) { - + void *p; - + lprintf ("stop thread called\n"); - + stream->demux_action_pending = 1; pthread_mutex_lock( &stream->demux_lock ); stream->demux_thread_running = 0; @@ -478,12 +478,12 @@ int _x_demux_stop_thread (xine_stream_t *stream) { pthread_mutex_unlock( &stream->demux_lock ); lprintf ("joining thread %ld\n", stream->demux_thread ); - + if( stream->demux_thread_created ) { pthread_join (stream->demux_thread, &p); stream->demux_thread_created = 0; } - + /* * Wake up xine_play if it's waiting for a frame */ @@ -621,7 +621,7 @@ int _x_action_pending (xine_stream_t *stream) { * * the other ones help enforcing that demuxers provide the information * they have about the stream, so things like the GUI slider bar can - * work as expected. + * work as expected. */ void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size, int64_t pts, uint32_t type, uint32_t decoder_flags, @@ -669,10 +669,10 @@ void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size, * * If reading fails, -1 is returned */ -int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, - int size, int64_t pts, uint32_t type, - uint32_t decoder_flags, off_t input_normpos, - int input_time, int total_time, +int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, + int size, int64_t pts, uint32_t type, + uint32_t decoder_flags, off_t input_normpos, + int input_time, int total_time, uint32_t frame_number) { buf_element_t *buf; @@ -694,7 +694,7 @@ int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, if(input->read(input, buf->content, buf->size) < buf->size) { buf->free_buffer(buf); - return -1; + return -1; } size -= buf->size; @@ -710,7 +710,7 @@ int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, fifo->put (fifo, buf); } - + return 0; } @@ -737,7 +737,7 @@ void _x_demux_send_mrl_reference (xine_stream_t *stream, int alternative, event.data_length = offsetof (xine_mrl_reference_data_ext_t, mrl) + mrl_len + strlen (title) + 2; data.e = event.data = malloc (event.data_length); - + data.e->alternative = alternative; data.e->start_time = start_time; data.e->duration = duration; diff --git a/src/xine-engine/events.c b/src/xine-engine/events.c index f79187682..cf35f96b4 100644 --- a/src/xine-engine/events.c +++ b/src/xine-engine/events.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 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 @@ -94,7 +94,7 @@ void xine_event_send (xine_stream_t *stream, const xine_event_t *event) { cevent->data = NULL; } gettimeofday (&cevent->tv, NULL); - + pthread_mutex_lock (&queue->lock); xine_list_push_back (queue->events, cevent); pthread_cond_signal (&queue->new_event); @@ -135,7 +135,7 @@ void xine_event_dispose_queue (xine_event_queue_t *queue) { xine_event_t *qevent; xine_event_queue_t *q; xine_list_iterator_t ite; - + pthread_mutex_lock (&stream->event_queues_lock); ite = xine_list_front (stream->event_queues); @@ -144,7 +144,7 @@ void xine_event_dispose_queue (xine_event_queue_t *queue) { if ( ite ) { do { q = xine_list_get_value (stream->event_queues, ite); - + if ( q == queue ) break; } while( (ite = xine_list_next (stream->event_queues, ite)) ); @@ -160,17 +160,17 @@ void xine_event_dispose_queue (xine_event_queue_t *queue) { xine_list_remove (stream->event_queues, ite); pthread_mutex_unlock (&stream->event_queues_lock); - /* - * send quit event + /* + * send quit event */ qevent = (xine_event_t *)malloc(sizeof(xine_event_t)); - + qevent->type = XINE_EVENT_QUIT; qevent->stream = stream; qevent->data = NULL; qevent->data_length = 0; gettimeofday (&qevent->tv, NULL); - + pthread_mutex_lock (&queue->lock); xine_list_push_back (queue->events, qevent); pthread_cond_signal (&queue->new_event); @@ -179,15 +179,15 @@ void xine_event_dispose_queue (xine_event_queue_t *queue) { /* * join listener thread, if any */ - + if (queue->listener_thread) { void *p; pthread_join (*queue->listener_thread, &p); free (queue->listener_thread); } - + /* - * clean up pending events + * clean up pending events */ while ( (event = xine_event_get (queue)) ) { @@ -233,7 +233,7 @@ static void *listener_loop (void *queue_gen) { } -void xine_event_create_listener_thread (xine_event_queue_t *queue, +void xine_event_create_listener_thread (xine_event_queue_t *queue, xine_event_listener_cb_t callback, void *user_data) { int err; diff --git a/src/xine-engine/info_helper.c b/src/xine-engine/info_helper.c index 6ce9bcd38..e45336d98 100644 --- a/src/xine-engine/info_helper.c +++ b/src/xine-engine/info_helper.c @@ -40,7 +40,7 @@ /* ******************* Stream Info *************************** */ /* - * Compare stream_info, private and public values, + * Compare stream_info, private and public values, * return 1 if it's identical, otherwirse 0. */ static int stream_info_is_identical(xine_stream_t *stream, int info) { @@ -105,7 +105,7 @@ uint32_t _x_stream_info_get(xine_stream_t *stream, int info) { pthread_mutex_lock(&stream->info_mutex); stream_info = stream->stream_info[info]; pthread_mutex_unlock(&stream->info_mutex); - + return stream_info; } @@ -120,7 +120,7 @@ uint32_t _x_stream_info_get_public(xine_stream_t *stream, int info) { if(info_valid(info) && (!stream_info_is_identical(stream, info))) stream_info = stream->stream_info_public[info] = stream->stream_info[info]; pthread_mutex_unlock(&stream->info_mutex); - + return stream_info; } @@ -137,7 +137,7 @@ static void meta_info_chomp(char *str) { if (!len) return; i = len - 1; - + while ((i >= 0) && ((unsigned char)str[i] <= 32)) { str[i] = 0; i--; @@ -145,13 +145,13 @@ static void meta_info_chomp(char *str) { } /* - * Compare stream_info, public and private values, + * Compare stream_info, public and private values, * return 1 if it's identical, otherwise 0. */ static int meta_info_is_identical(xine_stream_t *stream, int info) { - + if((!(stream->meta_info_public[info] && stream->meta_info[info])) || - ((stream->meta_info_public[info] && stream->meta_info[info]) && + ((stream->meta_info_public[info] && stream->meta_info[info]) && strcmp(stream->meta_info_public[info], stream->meta_info[info]))) return 0; @@ -175,7 +175,7 @@ static int meta_valid(int info) { */ static void meta_info_set_unlocked_utf8(xine_stream_t *stream, int info, const char *value) { if(meta_valid(info)) { - + if(stream->meta_info[info]) free(stream->meta_info[info]); @@ -275,7 +275,7 @@ static void meta_info_set_unlocked_encoding(xine_stream_t *stream, int info, con } } #endif - + meta_info_set_unlocked_utf8(stream, info, value); } @@ -349,7 +349,7 @@ void _x_meta_info_n_set(xine_stream_t *stream, int info, const char *buf, int le pthread_mutex_lock(&stream->meta_mutex); if(meta_valid(info) && len) { char *str = strndup(buf, len); - + meta_info_set_unlocked(stream, info, str); free(str); } @@ -367,7 +367,7 @@ void _x_meta_info_set_multi(xine_stream_t *stream, int info, ...) { char *args[1025]; char *buf; size_t n, len; - + len = n = 0; va_start(ap, info); @@ -377,32 +377,32 @@ void _x_meta_info_set_multi(xine_stream_t *stream, int info, ...) { n++; } va_end(ap); - + args[n] = NULL; - + if(len) { char *p, *meta; - + p = meta = (char *) malloc(len + 1); - + n = 0; while(args[n]) { strcpy(meta, args[n]); meta += strlen(args[n]) + 1; n++; } - + *meta = '\0'; if(stream->meta_info[info]) free(stream->meta_info[info]); - + stream->meta_info[info] = p; - + if(stream->meta_info[info] && strlen(stream->meta_info[info])) meta_info_chomp(stream->meta_info[info]); } - + } pthread_mutex_unlock(&stream->meta_mutex); } @@ -412,11 +412,11 @@ void _x_meta_info_set_multi(xine_stream_t *stream, int info, ...) { */ const char *_x_meta_info_get(xine_stream_t *stream, int info) { const char *meta_info = NULL; - + pthread_mutex_lock(&stream->meta_mutex); meta_info = stream->meta_info[info]; pthread_mutex_unlock(&stream->meta_mutex); - + return meta_info; } @@ -430,13 +430,13 @@ const char *_x_meta_info_get_public(xine_stream_t *stream, int info) { meta_info = stream->meta_info_public[info]; if(meta_valid(info) && (!meta_info_is_identical(stream, info))) { meta_info_public_reset_unlocked(stream, info); - + if(stream->meta_info[info]) stream->meta_info_public[info] = strdup(stream->meta_info[info]); meta_info = stream->meta_info_public[info]; } pthread_mutex_unlock(&stream->meta_mutex); - + return meta_info; } diff --git a/src/xine-engine/info_helper.h b/src/xine-engine/info_helper.h index d4123ba2b..666b94f08 100644 --- a/src/xine-engine/info_helper.h +++ b/src/xine-engine/info_helper.h @@ -20,7 +20,7 @@ * stream metainfo helper functions * hide some xine engine details from demuxers and reduce code duplication * - * $id$ + * $id$ */ #ifndef INFO_HELPER_H diff --git a/src/xine-engine/input_cache.c b/src/xine-engine/input_cache.c index 4eb524af6..e761fed38 100644 --- a/src/xine-engine/input_cache.c +++ b/src/xine-engine/input_cache.c @@ -19,7 +19,7 @@ * * Buffered Input Plugin (request optimizer). * - * The goal of this input plugin is to reduce + * The goal of this input plugin is to reduce * the number of calls to the real input plugin. */ @@ -58,7 +58,7 @@ typedef struct { } cache_input_plugin_t; -/* +/* * read data from input plugin and write it into file */ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { @@ -128,13 +128,13 @@ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { /* readahead bytes */ main_read = this->main_input_plugin->read(this->main_input_plugin, this->buf, this->buf_size); this->main_read_call++; - + if( main_read >= 0 ) { this->buf_len = main_read; - + if (len > this->buf_len) len = this->buf_len; - + if (len) { xine_fast_memcpy(buf + read_len, this->buf, len); this->buf_pos = len; @@ -148,7 +148,7 @@ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { /* direct read */ main_read = this->main_input_plugin->read(this->main_input_plugin, buf + read_len, len); this->main_read_call++; - + if( main_read >= 0 ) read_len += main_read; else @@ -156,7 +156,7 @@ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { read_len = main_read; } } - + return read_len; } @@ -190,7 +190,7 @@ static buf_element_t *cache_plugin_read_block(input_plugin_t *this_gen, fifo_buf buf = fifo->buffer_pool_alloc (fifo); if (buf) { buf->type = BUF_DEMUX_BLOCK; - + assert(todo <= buf->max_size); read_len = cache_plugin_read (this_gen, buf->content, todo); buf->size = read_len; @@ -226,11 +226,11 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi case SEEK_CUR: rel_offset = offset; break; - + case SEEK_SET: rel_offset = offset - cur_pos; break; - + default: /* invalid origin - main input should know better */ cur_pos = this->main_input_plugin->seek(this->main_input_plugin, offset, origin); @@ -238,16 +238,16 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi this->main_seek_call++; return cur_pos; } - + new_buf_pos = (off_t)this->buf_pos + rel_offset; lprintf("buf_len: %d, rel_offset=%"PRId64", new_buf_pos=%"PRId64"\n", - this->buf_len, rel_offset, new_buf_pos); - + this->buf_len, rel_offset, new_buf_pos); + if ((new_buf_pos < 0) || (new_buf_pos >= this->buf_len)) { if( origin == SEEK_SET ) cur_pos = this->main_input_plugin->seek(this->main_input_plugin, offset, origin); else - cur_pos = this->main_input_plugin->seek(this->main_input_plugin, + cur_pos = this->main_input_plugin->seek(this->main_input_plugin, offset - (this->buf_len - this->buf_pos), origin); this->buf_len = this->buf_pos = 0; this->main_seek_call++; @@ -262,7 +262,7 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi static off_t cache_plugin_seek_time(input_plugin_t *this_gen, int time_offset, int origin) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; off_t cur_pos; - + lprintf("time_offset: %d, origin: %d\n", time_offset, origin); this->seek_call++; @@ -275,7 +275,7 @@ static off_t cache_plugin_seek_time(input_plugin_t *this_gen, int time_offset, i static off_t cache_plugin_get_current_pos(input_plugin_t *this_gen) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; off_t cur_pos; - + cur_pos = this->main_input_plugin->get_current_pos(this->main_input_plugin); if( this->buf_len ) { if( cur_pos >= (this->buf_len - this->buf_pos) ) @@ -290,7 +290,7 @@ static off_t cache_plugin_get_current_pos(input_plugin_t *this_gen) { static int cache_plugin_get_current_time(input_plugin_t *this_gen) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; int cur_time; - + cur_time = this->main_input_plugin->get_current_time(this->main_input_plugin); return cur_time; @@ -314,7 +314,7 @@ static const char* cache_plugin_get_mrl (input_plugin_t *this_gen) { return this->main_input_plugin->get_mrl(this->main_input_plugin); } -static int cache_plugin_get_optional_data (input_plugin_t *this_gen, +static int cache_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; @@ -322,8 +322,8 @@ static int cache_plugin_get_optional_data (input_plugin_t *this_gen, this->main_input_plugin, data, data_type); } -/* - * dispose main input plugin and self +/* + * dispose main input plugin and self */ static void cache_plugin_dispose(input_plugin_t *this_gen) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; @@ -341,8 +341,8 @@ static void cache_plugin_dispose(input_plugin_t *this_gen) { } -/* - * create self instance, +/* + * create self instance, */ input_plugin_t *_x_cache_plugin_get_instance (xine_stream_t *stream, int readahead_size) { cache_input_plugin_t *this; @@ -359,7 +359,7 @@ input_plugin_t *_x_cache_plugin_get_instance (xine_stream_t *stream, int readahe this = calloc(1, sizeof(cache_input_plugin_t)); if (!this) return NULL; - + this->main_input_plugin = main_plugin; this->stream = stream; diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c index 8db7eaaf5..faeaae62d 100644 --- a/src/xine-engine/input_rip.c +++ b/src/xine-engine/input_rip.c @@ -20,12 +20,12 @@ * Rip Input Plugin for catching streams * * It saves raw data into file as go from input plugins. - * + * * Usage: * * - activation: * xine stream_mrl#save:file.raw - * + * * - it's possible speeder saving streams in the xine without playing: * xine stream_mrl#save:file.raw\;noaudio\;novideo */ @@ -95,7 +95,7 @@ static off_t min_off(off_t a, off_t b) { return a <= b ? a : b; } -/* +/* * read data from input plugin and write it into file */ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { @@ -123,7 +123,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { npreview = 0; nread = min_off(this->savepos - this->curpos, len); } - + /* size to write into file */ nwrite = len - npreview - nread; /* size to read from file */ @@ -149,7 +149,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { lprintf("%s => returned %"PRId64"" CLR_RST "\n", retlen == nread_orig + nwrite ? "" : CLR_FAIL, retlen); if (retlen < 0) { - xine_log(this->stream->xine, XINE_LOG_MSG, + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: reading by input plugin failed\n")); return -1; } @@ -163,10 +163,10 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { } this->savepos += nwrite; lprintf(" => saved %"PRId64" bytes\n", nwrite); - } else + } else nwrite = 0; } - + this->curpos += (npreview + nread + nwrite); return npreview + nread + nwrite; @@ -191,7 +191,7 @@ static uint32_t rip_plugin_get_capabilities(input_plugin_t *this_gen) { uint32_t caps; caps = this->main_input_plugin->get_capabilities(this->main_input_plugin); - + if (this->regular) caps |= INPUT_CAP_SEEKABLE; @@ -199,11 +199,11 @@ static uint32_t rip_plugin_get_capabilities(input_plugin_t *this_gen) { return caps; } -/* +/* * read a block of data from input plugin and write it into file * * This rip plugin returns block unchanged from main input plugin. But special - * cases are reading over preview or reading already saved data - it returns + * cases are reading over preview or reading already saved data - it returns * own allocated block. */ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo) { @@ -230,7 +230,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe npreview = 0; nread = min_off(this->savepos - this->curpos, todo); } - + /* size to write into file */ nwrite = todo - npreview - nread; /* size to read from file */ @@ -249,7 +249,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe lprintf(" => get %"PRId64" bytes from the preview (block)\n", npreview); memcpy(buf->content, &this->preview[this->curpos], npreview); } - + /* re-reading from the file */ if (nread_file) { lprintf(" => read %"PRId64" bytes from the file (block)\n", nread_file); @@ -286,17 +286,17 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe if (retlen > nread_orig) { nwrite = retlen - nread_orig; if (fwrite(buf->content + this->savepos - this->curpos, nwrite, 1, this->file) != 1) { - xine_log(this->stream->xine, XINE_LOG_MSG, + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: error writing to file %" PRIdMAX " bytes: %s\n"), (intmax_t)(retlen - nread_orig), strerror(errno)); return NULL; } this->savepos += nwrite; lprintf(" => saved %"PRId64" bytes\n", nwrite); - } else + } else nwrite = 0; } - + this->curpos += (npreview + nread + nwrite); buf->size = npreview + nread + nwrite; @@ -323,11 +323,11 @@ static off_t rip_seek_original(rip_input_plugin_t *this, off_t reqpos) { return pos; } - + /* * seek in RIP - * - * If we are seeking back and we can read from saved file, + * + * If we are seeking back and we can read from saved file, * position of original input plugin isn't changed. */ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) { @@ -339,7 +339,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) double interval = 0; lprintf("seek, offset %"PRId64", origin %d (curpos %"PRId64", savepos %"PRId64")\n", offset, origin, this->curpos, this->savepos); - + switch (origin) { case SEEK_SET: newpos = offset; break; case SEEK_CUR: newpos = this->curpos + offset; break; @@ -376,7 +376,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) if ((pos = rip_seek_original(this, reqpos)) == -1) return -1; if (pos == reqpos) this->curpos = newpos; } - + return this->curpos; } @@ -393,7 +393,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) if ((pos = rip_seek_original(this, this->savepos)) == -1) return -1; if (pos > this->savepos) xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: %" PRIdMAX " bytes dropped\n"), + _("input_rip: %" PRIdMAX " bytes dropped\n"), (intmax_t)(pos - this->savepos)); } } @@ -425,13 +425,13 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) } lprintf(" => new position %"PRId64"\n", this->curpos); - + return this->curpos; } static off_t rip_plugin_seek_time(input_plugin_t *this_gen, int time_offset, int origin) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; - + lprintf("seek_time, time_offset: %d, origin: %d\n", time_offset, origin); return this->main_input_plugin->seek_time(this->main_input_plugin, time_offset, origin); @@ -451,13 +451,13 @@ static off_t rip_plugin_get_current_pos(input_plugin_t *this_gen) { lprintf(CLR_FAIL "position: computed = %"PRId64", input plugin = %"PRId64"" CLR_RST "\n", this->curpos, pos); } #endif - + return this->curpos; } static int rip_plugin_get_current_time(input_plugin_t *this_gen) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; - + return this->main_input_plugin->get_current_time(this->main_input_plugin); } @@ -484,7 +484,7 @@ static const char* rip_plugin_get_mrl (input_plugin_t *this_gen) { return this->main_input_plugin->get_mrl(this->main_input_plugin); } -static int rip_plugin_get_optional_data (input_plugin_t *this_gen, +static int rip_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; @@ -494,11 +494,11 @@ static int rip_plugin_get_optional_data (input_plugin_t *this_gen, return this->preview_size; } else return this->main_input_plugin->get_optional_data( - this->main_input_plugin, data, data_type); + this->main_input_plugin, data, data_type); } -/* - * dispose main input plugin and self +/* + * dispose main input plugin and self */ static void rip_plugin_dispose(input_plugin_t *this_gen) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; @@ -540,8 +540,8 @@ static int dir_file_concat(char *target, size_t maxlen, const char *dir, const c } -/* - * create self instance, +/* + * create self instance, * target file for writing stream is specified in 'data' */ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *filename) { @@ -571,7 +571,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f #ifndef SAVING_ALWAYS_PERMIT if ( main_plugin->get_capabilities(main_plugin) & INPUT_CAP_RIP_FORBIDDEN ) { - xine_log(stream->xine, XINE_LOG_MSG, + xine_log(stream->xine, XINE_LOG_MSG, _("input_rip: ripping/caching of this source is not permitted!\n")); _x_message(stream, XINE_MSG_SECURITY, _("xine is not allowed to save from this source. (possibly copyrighted material?)"), NULL); @@ -592,7 +592,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f fnc = strdup(filename); target_basename = basename(fnc); - dir_file_concat(target, MAX_TARGET_LEN, stream->xine->save_path, + dir_file_concat(target, MAX_TARGET_LEN, stream->xine->save_path, target_basename); strcpy(target_no, target); @@ -621,7 +621,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f lprintf("target file: %s\n", target_no); if ((this->file = fopen(target_no, mode)) == NULL) { - xine_log(this->stream->xine, XINE_LOG_MSG, + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: error opening file %s: %s\n"), target_no, strerror(errno)); free(this); return NULL; @@ -639,7 +639,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f this->preview_size = buf->size; this->preview = malloc(this->preview_size); memcpy(this->preview, buf->content, this->preview_size); - + buf->free_buffer(buf); } else { this->preview = malloc(MAX_PREVIEW_SIZE); @@ -651,7 +651,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f if (this->preview && this->preview_size) { if (fwrite(this->preview, this->preview_size, 1, this->file) != 1) { - xine_log(this->stream->xine, XINE_LOG_MSG, + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: error writing to file %" PRIdMAX " bytes: %s\n"), (intmax_t)(this->preview_size), strerror(errno)); fclose(this->file); diff --git a/src/xine-engine/io_helper.c b/src/xine-engine/io_helper.c index c3654c762..b06c47709 100644 --- a/src/xine-engine/io_helper.c +++ b/src/xine-engine/io_helper.c @@ -53,14 +53,14 @@ static int _x_io_tcp_connect_ipv4(xine_stream_t *stream, const char *host, int p struct hostent *h; int i, s; - + h = gethostbyname(host); if (h == NULL) { _x_message(stream, XINE_MSG_UNKNOWN_HOST, "unable to resolve", host, NULL); return -1; } - s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (s == -1) { _x_message(stream, XINE_MSG_CONNECTION_REFUSED, "failed to create socket", strerror(errno), NULL); return -1; @@ -88,12 +88,12 @@ static int _x_io_tcp_connect_ipv4(xine_stream_t *stream, const char *host, int p for (i = 0; h->h_addr_list[i]; i++) { struct in_addr ia; struct sockaddr_in sin; - + memcpy (&ia, h->h_addr_list[i], 4); sin.sin_family = AF_INET; sin.sin_addr = ia; sin.sin_port = htons(port); - + #ifndef WIN32 if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) { #else @@ -106,7 +106,7 @@ static int _x_io_tcp_connect_ipv4(xine_stream_t *stream, const char *host, int p close(s); continue; } - + return s; } return -1; @@ -122,10 +122,10 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) { struct addrinfo hints, *res, *tmpaddr; int error; char strport[16]; - + memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; - hints.ai_family = PF_UNSPEC; + hints.ai_family = PF_UNSPEC; snprintf(strport, sizeof(strport), "%d", port); @@ -135,7 +135,7 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) { error = getaddrinfo(host, strport, &hints, &res); if (error) { - _x_message(stream, XINE_MSG_UNKNOWN_HOST, + _x_message(stream, XINE_MSG_UNKNOWN_HOST, "unable to resolve", host, NULL); return -1; } @@ -143,10 +143,10 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) { tmpaddr = res; while (tmpaddr) { - - s = socket(tmpaddr->ai_family, SOCK_STREAM, IPPROTO_TCP); + + s = socket(tmpaddr->ai_family, SOCK_STREAM, IPPROTO_TCP); if (s == -1) { - _x_message(stream, XINE_MSG_CONNECTION_REFUSED, + _x_message(stream, XINE_MSG_CONNECTION_REFUSED, "failed to create socket", strerror(errno), NULL); tmpaddr = tmpaddr->ai_next; continue; @@ -177,12 +177,12 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) { } #ifndef WIN32 - if (connect(s, tmpaddr->ai_addr, + if (connect(s, tmpaddr->ai_addr, tmpaddr->ai_addrlen)==-1 && errno != EINPROGRESS) { - + #else - if (connect(s, tmpaddr->ai_addr, - tmpaddr->ai_addrlen)==-1 && + if (connect(s, tmpaddr->ai_addr, + tmpaddr->ai_addrlen)==-1 && WSAGetLastError() != WSAEWOULDBLOCK) { if (stream) @@ -196,12 +196,12 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) { } else { return s; } - + tmpaddr = tmpaddr->ai_next; } _x_message(stream, XINE_MSG_CONNECTION_REFUSED, strerror(error), NULL); - + return -1; #endif } @@ -302,14 +302,14 @@ int _x_io_select (xine_stream_t *stream, int fd, int state, int timeout_msec) { */ int _x_io_tcp_connect_finish(xine_stream_t *stream, int fd, int timeout_msec) { int ret; - + ret = _x_io_select(stream, fd, XIO_WRITE_READY, timeout_msec); /* find out, if connection is successfull */ if (ret == XIO_READY) { socklen_t len = sizeof(int); int err; - + if ((getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&err, &len)) == -1) { _x_message(stream, XINE_MSG_CONNECTION_REFUSED, _("failed to get status of socket"), strerror(errno), NULL); return XIO_ERROR; @@ -346,14 +346,14 @@ static off_t xio_rw_abort(xine_stream_t *stream, int fd, int cmd, char *buf, off } else { timeout = 30000; /* 30K msecs = 30 secs */ } - + while (total < todo) { sret = _x_io_select(stream, fd, state, timeout); - + if (sret != XIO_READY) return -1; - + switch (cmd) { case XIO_FILE_READ: ret = read(fd, &buf[total], todo - total); @@ -403,7 +403,7 @@ static off_t xio_rw_abort(xine_stream_t *stream, int fd, int cmd, char *buf, off if (stream) xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "io_helper: WSAGetLastError() = %d\n", WSAGetLastError()); #endif - + return ret; } total += ret; diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 5128644da..9eb33f8ed 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -101,7 +101,7 @@ static const int plugin_iface_versions[] = { SPU_DECODER_IFACE_VERSION, AUDIO_OUT_IFACE_VERSION, VIDEO_OUT_DRIVER_IFACE_VERSION, - POST_PLUGIN_IFACE_VERSION + POST_PLUGIN_IFACE_VERSION }; static void _build_list_typed_plugins(plugin_catalog_t **catalog, xine_sarray_t *type) { @@ -112,7 +112,7 @@ static void _build_list_typed_plugins(plugin_catalog_t **catalog, xine_sarray_t list_size = xine_sarray_size (type); for (list_id = 0, i = 0; list_id < list_size; list_id++) { node = xine_sarray_get(type, list_id); - + /* add only unique ids to the list */ for ( j = 0; j < i; j++ ) { if( !strcmp((*catalog)->ids[j], node->info->id) ) @@ -157,9 +157,9 @@ static int get_decoder_priority(xine_t *this, plugin_node_t *node) { char key[80]; snprintf(key, sizeof(key), "engine.decoder_priorities.%s", node->info->id); - + entry = this->config->lookup_entry(this->config, key); - + if (entry && entry->num_value) /* user given priorities should definitely override defaults, so multiply them */ return entry->num_value * 100; @@ -258,14 +258,14 @@ static plugin_info_t *_get_cached_info (xine_t *this, node->file->filesize == filesize && node->file->filemtime == filemtime && !strcmp( node->file->filename, filename )) { - + return node->info; } - + /* skip previously returned items */ if( node->info == previous_info ) previous_info = NULL; - + } return NULL; } @@ -318,7 +318,7 @@ static void _insert_node (xine_t *this, _x_assert(list); _x_assert(info); if (info->API != api_version) { - xprintf(this, XINE_VERBOSITY_LOG, + xprintf(this, XINE_VERBOSITY_LOG, _("load_plugins: ignoring plugin %s, wrong iface version %d (should be %d)\n"), info->id, info->API, api_version); return; @@ -375,7 +375,7 @@ static void _insert_node (xine_t *this, decoder_new->supported_types = types; } entry->priority = decoder_new->priority = decoder_old->priority; - + snprintf(key, sizeof(key), "engine.decoder_priorities.%s", info->id); /* write the description on the heap because the config system * does not strdup() it, so we have to provide a different pointer @@ -397,23 +397,23 @@ static void _insert_node (xine_t *this, entry->info->special_info = decoder_new; break; - + case PLUGIN_POST: post_old = info->special_info; post_new = calloc(1, sizeof(post_info_t)); post_new->type = post_old->type; entry->info->special_info = post_new; break; - + case PLUGIN_DEMUX: demux_old = info->special_info; demux_new = calloc(1, sizeof(demuxer_info_t)); - + if (demux_old) { entry->priority = demux_new->priority = demux_old->priority; lprintf("demux: %s, priority: %d\n", info->id, entry->priority); } else { - xprintf(this, XINE_VERBOSITY_LOG, + xprintf(this, XINE_VERBOSITY_LOG, _("load_plugins: demuxer plugin %s does not provide a priority," " xine-lib will use the default priority.\n"), info->id); @@ -425,12 +425,12 @@ static void _insert_node (xine_t *this, case PLUGIN_INPUT: input_old = info->special_info; input_new = calloc(1, sizeof(input_info_t)); - + if (input_old) { entry->priority = input_new->priority = input_old->priority; lprintf("input: %s, priority: %d\n", info->id, entry->priority); } else { - xprintf(this, XINE_VERBOSITY_LOG, + xprintf(this, XINE_VERBOSITY_LOG, _("load_plugins: input plugin %s does not provide a priority," " xine-lib will use the default priority.\n"), info->id); @@ -491,7 +491,7 @@ static void _register_plugins_internal(xine_t *this, plugin_file_t *file, plugin else xine_log (this, XINE_LOG_PLUGIN, _("load_plugins: static plugin found\n")); - + if (this->plugin_catalog->plugin_count >= PLUGIN_MAX || (this->plugin_catalog->decoder_count >= DECODER_MAX && info->type >= PLUGIN_AUDIO_DECODER && info->type <= PLUGIN_SPU_DECODER)) { @@ -525,7 +525,7 @@ static void _register_plugins_internal(xine_t *this, plugin_file_t *file, plugin } this->plugin_catalog->plugin_count++; } - + /* get next info */ if( file && !file->lib_handle ) { lprintf("get cached info\n"); @@ -563,7 +563,7 @@ static void collect_plugins(xine_t *this, char *path){ while ((pEntry = readdir (dir)) != NULL) { void *lib = NULL; plugin_info_t *info = NULL; - + struct stat statbuffer; size_t d_len = strlen(pEntry->d_name); @@ -616,7 +616,7 @@ static void collect_plugins(xine_t *this, char *path){ if(!info && (lib = dlopen (str, RTLD_LAZY | RTLD_GLOBAL)) == NULL) { const char *error = dlerror(); /* too noisy -- but good to catch unresolved references */ - xprintf(this, XINE_VERBOSITY_LOG, + xprintf(this, XINE_VERBOSITY_LOG, _("load_plugins: cannot open plugin lib %s:\n%s\n"), str, error); } else { @@ -659,14 +659,14 @@ static void collect_plugins(xine_t *this, char *path){ * generic 2nd stage plugin loader */ -static inline int _plugin_info_equal(const plugin_info_t *a, +static inline int _plugin_info_equal(const plugin_info_t *a, const plugin_info_t *b) { - if (a->type != b->type || + if (a->type != b->type || a->API != b->API || strcasecmp(a->id, b->id) || a->version != b->version) return 0; - + switch (a->type & PLUGIN_TYPE_MASK) { case PLUGIN_VIDEO_OUT: /* FIXME: Could special_info be NULL? */ @@ -675,11 +675,11 @@ static inline int _plugin_info_equal(const plugin_info_t *a, ((vo_info_t*)b->special_info)->visual_type); } break; - + default: break; } - + return 1; } @@ -722,7 +722,7 @@ static int _load_plugin_class(xine_t *this, info++; } lprintf("plugin not found\n"); - + } else { xine_log (this, XINE_LOG_PLUGIN, _("load_plugins: Yikes! %s doesn't contain plugin info.\n"), filename); @@ -790,9 +790,9 @@ static void _load_required_plugins(xine_t *this, xine_sarray_t *list) { list_size = xine_sarray_size(list); while (list_id < list_size) { plugin_node_t *node = xine_sarray_get(list, list_id); - + if( (node->info->type & PLUGIN_MUST_PRELOAD) && !node->plugin_class ) { - + lprintf("preload plugin %s from %s\n", node->info->id, node->file->filename); if (! _load_plugin_class (this, node, NULL)) { @@ -831,7 +831,7 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { const vo_info_t *vo_info; const ao_info_t *ao_info; const post_info_t *post_info; - + int i; int list_id = 0; int list_size; @@ -848,20 +848,20 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { fprintf(fp, "api=%d\n", node->info->API ); fprintf(fp, "id=%s\n", node->info->id ); fprintf(fp, "version=%lu\n", (unsigned long) node->info->version ); - + switch (node->info->type & PLUGIN_TYPE_MASK){ - + case PLUGIN_VIDEO_OUT: vo_info = node->info->special_info; fprintf(fp, "visual_type=%d\n", vo_info->visual_type ); fprintf(fp, "vo_priority=%d\n", vo_info->priority ); break; - + case PLUGIN_AUDIO_OUT: ao_info = node->info->special_info; fprintf(fp, "ao_priority=%d\n", ao_info->priority ); break; - + case PLUGIN_AUDIO_DECODER: case PLUGIN_VIDEO_DECODER: case PLUGIN_SPU_DECODER: @@ -878,7 +878,7 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { demuxer_info = node->info->special_info; fprintf(fp, "demuxer_priority=%d\n", demuxer_info->priority); break; - + case PLUGIN_INPUT: input_info = node->info->special_info; fprintf(fp, "input_priority=%d\n", input_info->priority); @@ -888,8 +888,8 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { post_info = node->info->special_info; fprintf(fp, "post_type=%lu\n", (unsigned long)post_info->type); break; - } - + } + fprintf(fp, "\n"); list_id++; } @@ -914,13 +914,13 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { char line[1024]; char *value; int version_ok = 0; - + node = NULL; file = NULL; while (fgets (line, 1023, fp)) { if (line[0] == '#') continue; - + if( (value = strchr(line, '\r')) || (value = strchr(line, '\n')) ) *value = (char) 0; /* eliminate any cr/lf */ @@ -957,7 +957,7 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { if( i == CACHE_CATALOG_VERSION ) version_ok = 1; else - return; + return; } } else if (node) { if( !strcmp("size",line) ) { @@ -969,19 +969,19 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { } else if( !strcmp("type",line) ) { sscanf(value," %d",&i); node->info->type = i; - + switch (node->info->type & PLUGIN_TYPE_MASK){ - + case PLUGIN_VIDEO_OUT: node->info->special_info = vo_info = calloc(1, sizeof(vo_info_t)); break; - + case PLUGIN_AUDIO_OUT: node->info->special_info = ao_info = calloc(1, sizeof(ao_info_t)); break; - + case PLUGIN_DEMUX: node->info->special_info = demuxer_info = calloc(1, sizeof(demuxer_info_t)); @@ -998,13 +998,13 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { node->info->special_info = decoder_info = calloc(1, sizeof(decoder_info_t)); break; - + case PLUGIN_POST: node->info->special_info = post_info = calloc(1, sizeof(post_info_t)); break; - } - + } + } else if( !strcmp("api",line) ) { sscanf(value," %d",&i); node->info->API = i; @@ -1018,7 +1018,7 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { vo_info->visual_type = i; } else if( !strcmp("supported_types",line) && decoder_info ) { char *s; - + for( s = value, i = 0; s && sscanf(s," %lu",&lu) > 0; i++ ) { s = strchr(s+1, ' '); } @@ -1049,7 +1049,7 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { } } } - + if( node ) { xine_sarray_add (plugins, node); } @@ -1067,10 +1067,10 @@ static void save_catalog (xine_t *this) { const char *dirname = CACHE_CATALOG_DIR; const char *const homedir = xine_get_homedir(); - + asprintf(&cachefile, "%s/%s", homedir, relname); asprintf(&cachefile_new, "%s.new", cachefile); - + /* make sure homedir (~/.xine) exists */ asprintf(&dirfile, "%s/%s", homedir, dirname); mkdir (dirfile, 0755); @@ -1078,7 +1078,7 @@ static void save_catalog (xine_t *this) { if( (fp = fopen(cachefile_new,"w")) != NULL ) { int i; - + fprintf(fp, "# this file is automatically created by xine, do not edit.\n\n"); fprintf(fp, "cache_catalog_version=%d\n\n", CACHE_CATALOG_VERSION); @@ -1116,11 +1116,11 @@ static void save_catalog (xine_t *this) { static void load_cached_catalog (xine_t *this) { FILE *fp; - char *cachefile; + char *cachefile; const char *relname = CACHE_CATALOG_FILE; - + asprintf(&cachefile, "%s/%s", xine_get_homedir(), relname); - + if( (fp = fopen(cachefile,"r")) != NULL ) { load_plugin_list (fp, this->plugin_catalog->cache_list); fclose(fp); @@ -1147,7 +1147,7 @@ void _x_scan_plugins (xine_t *this) { char *homedir, *pluginpath; xine_list_t *plugindirs = xine_list_new (); xine_list_iterator_t iter; - + lprintf("_x_scan_plugins()\n"); if (this == NULL || this->config == NULL) { @@ -1202,7 +1202,7 @@ void _x_scan_plugins (xine_t *this) { free(homedir); save_catalog (this); - + load_required_plugins (this); map_decoders (this); @@ -1232,7 +1232,7 @@ input_plugin_t *_x_find_input_plugin (xine_stream_t *stream, const char *mrl) { plugin->node = node; break; } - } + } } pthread_mutex_unlock (&catalog->lock); @@ -1438,7 +1438,7 @@ demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const cha if (strcasecmp(node->info->id, last_demux_name) == 0) { last_demux = node; } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugin: probing '%s' (method %d)...\n", node->info->id, stream->content_detection_method ); if (node->plugin_class || _load_plugin_class(xine, node, NULL)) { if ((plugin = ((demux_class_t *)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) { @@ -1546,7 +1546,7 @@ const char *const *xine_get_browsable_input_plugin_ids(xine_t *this) { for (list_id = 0; list_id < list_size; list_id++) { input_class_t *ic; - + node = xine_sarray_get(catalog->plugin_lists[PLUGIN_INPUT - 1], list_id); if (node->plugin_class || _load_plugin_class(this, node, NULL)) { @@ -1605,7 +1605,7 @@ vo_driver_t *_x_load_video_output_plugin(xine_t *this, if (id && !strcasecmp(id, "auto")) id = NULL; - + pthread_mutex_lock (&catalog->lock); list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]); @@ -1653,7 +1653,7 @@ xine_video_port_t *xine_open_video_driver (xine_t *this, } port = _x_vo_new_port(this, driver, 0); - + return port; } @@ -1692,7 +1692,7 @@ xine_video_port_t *xine_new_framegrab_video_port (xine_t *this) { } port = _x_vo_new_port(this, driver, 1); - + return port; } @@ -1702,7 +1702,7 @@ xine_video_port_t *xine_new_framegrab_video_port (xine_t *this) { const char *const *xine_list_audio_output_plugins (xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_AUDIO_OUT - 1]); pthread_mutex_unlock (&catalog->lock); @@ -1712,7 +1712,7 @@ const char *const *xine_list_audio_output_plugins (xine_t *xine) { const char *const *xine_list_video_output_plugins (xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]); pthread_mutex_unlock (&catalog->lock); @@ -1725,7 +1725,7 @@ const char *const *xine_list_video_output_plugins_typed(xine_t *xine, uint64_t t plugin_catalog_t *catalog = xine->plugin_catalog; plugin_node_t *node; int list_id, list_size, i; - + pthread_mutex_lock (&catalog->lock); list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]); @@ -1812,7 +1812,7 @@ xine_audio_port_t *xine_open_audio_driver (xine_t *this, const char *id, if (id && !strcasecmp(id, "auto") ) id = NULL; - + pthread_mutex_lock (&catalog->lock); driver = NULL; @@ -1838,13 +1838,13 @@ xine_audio_port_t *xine_open_audio_driver (xine_t *this, const char *id, } pthread_mutex_unlock (&catalog->lock); - + if (!driver) { if (id) xprintf (this, XINE_VERBOSITY_LOG, _("load_plugins: failed to load audio output plugin <%s>\n"), id); else - xprintf (this, XINE_VERBOSITY_LOG, + xprintf (this, XINE_VERBOSITY_LOG, _("load_plugins: audio output auto-probing didn't find any usable audio driver.\n")); return NULL; } @@ -1902,7 +1902,7 @@ char **xine_get_autoplay_mrls (xine_t *this, const char *plugin_id, if (node->plugin_class || _load_plugin_class (this, node, NULL)) { ic = (input_class_t *) node->plugin_class; - + if (!ic->get_autoplay_list) return NULL; @@ -1936,7 +1936,7 @@ xine_mrl_t **xine_get_browse_mrls (xine_t *this, const char *plugin_id, if (node->plugin_class || _load_plugin_class (this, node, NULL)) { ic = (input_class_t *) node->plugin_class; - + if (!ic->get_dir) return NULL; @@ -1968,7 +1968,7 @@ video_decoder_t *_x_get_video_decoder (xine_stream_t *stream, uint8_t stream_typ if (!node->plugin_class && !_load_plugin_class (stream->xine, node, NULL)) { /* remove non working plugin from catalog */ - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: plugin %s failed to init its class.\n", node->info->id); for (j = i + 1; j < PLUGINS_PER_TYPE; j++) catalog->video_decoder_map[stream_type][j - 1] = @@ -1984,9 +1984,9 @@ video_decoder_t *_x_get_video_decoder (xine_stream_t *stream, uint8_t stream_typ inc_node_ref(node); vd->node = node; xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "load_plugins: plugin %s will be used for video streamtype %02x.\n", + "load_plugins: plugin %s will be used for video streamtype %02x.\n", node->info->id, stream_type); - + break; } else { /* remove non working plugin from catalog */ @@ -2039,7 +2039,7 @@ audio_decoder_t *_x_get_audio_decoder (xine_stream_t *stream, uint8_t stream_typ if (!node->plugin_class && !_load_plugin_class (stream->xine, node, NULL)) { /* remove non working plugin from catalog */ - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: plugin %s failed to init its class.\n", node->info->id); for (j = i + 1; j < PLUGINS_PER_TYPE; j++) catalog->audio_decoder_map[stream_type][j - 1] = @@ -2055,7 +2055,7 @@ audio_decoder_t *_x_get_audio_decoder (xine_stream_t *stream, uint8_t stream_typ inc_node_ref(node); ad->node = node; xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "load_plugins: plugin %s will be used for audio streamtype %02x.\n", + "load_plugins: plugin %s will be used for audio streamtype %02x.\n", node->info->id, stream_type); break; } else { @@ -2095,11 +2095,11 @@ int _x_decoder_available (xine_t *xine, uint32_t buftype) if ( (buftype & 0xFF000000) == BUF_VIDEO_BASE ) { if( catalog->video_decoder_map[stream_type][0] ) return 1; - } else + } else if ( (buftype & 0xFF000000) == BUF_AUDIO_BASE ) { if( catalog->audio_decoder_map[stream_type][0] ) return 1; - } else + } else if ( (buftype & 0xFF000000) == BUF_SPU_BASE ) { if( catalog->spu_decoder_map[stream_type][0] ) return 1; @@ -2126,7 +2126,7 @@ static void _display_file_plugin_list (xine_list_t *list, plugin_file_t *file) { #endif static void _unload_unref_plugins(xine_t *this, xine_sarray_t *list) { - + plugin_node_t *node; int list_id, list_size; @@ -2164,7 +2164,7 @@ void xine_plugins_garbage_collector(xine_t *self) { pthread_mutex_lock (&catalog->lock); for(i = 0; i < PLUGIN_TYPE_MAX; i++) { _unload_unref_plugins(self, self->plugin_catalog->plugin_lists[i]); - } + } #if 0 { @@ -2226,7 +2226,7 @@ spu_decoder_t *_x_get_spu_decoder (xine_stream_t *stream, uint8_t stream_type) { inc_node_ref(node); sd->node = node; xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "load_plugins: plugin %s will be used for spu streamtype %02x.\n", + "load_plugins: plugin %s will be used for spu streamtype %02x.\n", node->info->id, stream_type); break; } else { @@ -2260,7 +2260,7 @@ void _x_free_spu_decoder (xine_stream_t *stream, spu_decoder_t *sd) { const char *const *xine_list_demuxer_plugins(xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_DEMUX - 1]); pthread_mutex_unlock (&catalog->lock); @@ -2270,7 +2270,7 @@ const char *const *xine_list_demuxer_plugins(xine_t *xine) { const char *const *xine_list_input_plugins(xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_INPUT - 1]); pthread_mutex_unlock (&catalog->lock); @@ -2280,7 +2280,7 @@ const char *const *xine_list_input_plugins(xine_t *xine) { const char *const *xine_list_spu_plugins(xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_SPU_DECODER - 1]); pthread_mutex_unlock (&catalog->lock); @@ -2290,7 +2290,7 @@ const char *const *xine_list_spu_plugins(xine_t *xine) { const char *const *xine_list_audio_decoder_plugins(xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_AUDIO_DECODER - 1]); pthread_mutex_unlock (&catalog->lock); @@ -2300,7 +2300,7 @@ const char *const *xine_list_audio_decoder_plugins(xine_t *xine) { const char *const *xine_list_video_decoder_plugins(xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_VIDEO_DECODER - 1]); pthread_mutex_unlock (&catalog->lock); @@ -2310,7 +2310,7 @@ const char *const *xine_list_video_decoder_plugins(xine_t *xine) { const char *const *xine_list_post_plugins(xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_POST - 1]); pthread_mutex_unlock (&catalog->lock); @@ -2323,7 +2323,7 @@ const char *const *xine_list_post_plugins_typed(xine_t *xine, int type) { plugin_node_t *node; int i; int list_id, list_size; - + pthread_mutex_lock (&catalog->lock); i = 0; @@ -2378,25 +2378,25 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, plugin_node_t *node; post_plugin_t *post = NULL; int list_id, list_size; - + if( !name ) return NULL; - + pthread_mutex_lock(&catalog->lock); - + list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_POST - 1]); for (list_id = 0; list_id < list_size; list_id++) { node = xine_sarray_get (catalog->plugin_lists[PLUGIN_POST - 1], list_id); - + if (strcmp(node->info->id, name) == 0) { - + if (!node->plugin_class && !_load_plugin_class(xine, node, NULL)) { xprintf(xine, XINE_VERBOSITY_DEBUG, "load_plugins: requested post plugin %s failed to load\n", name); break; } - + post = ((post_class_t *)node->plugin_class)->open_plugin(node->plugin_class, inputs, audio_target, video_target); @@ -2405,12 +2405,12 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, xine_post_out_t *output; xine_list_iterator_t ite; int i; - + post->running_ticket = xine->port_ticket; post->xine = xine; post->node = node; inc_node_ref(node); - + /* init the lists of announced connections */ i = 0; ite = xine_list_front(post->input); @@ -2428,7 +2428,7 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, ite = xine_list_next (post->input, ite); } post->input_ids[i] = NULL; - + i = 0; ite = xine_list_front (post->output); while (ite) { @@ -2445,10 +2445,10 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, ite = xine_list_next (post->output, ite); } post->output_ids[i] = NULL; - + /* copy the post plugin type to the public part */ post->xine_post.type = ((post_info_t *)node->info->special_info)->type; - + break; } else { xprintf(xine, XINE_VERBOSITY_DEBUG, @@ -2457,9 +2457,9 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, } } } - + pthread_mutex_unlock(&catalog->lock); - + if(post) return &post->xine_post; else { @@ -2501,7 +2501,7 @@ static char *_x_concatenate_with_string(char const **strings, size_t count, char } /* get a list of file extensions for file types supported by xine - * the list is separated by spaces + * the list is separated by spaces * * the pointer returned can be free()ed when no longer used */ char *xine_get_file_extensions (xine_t *self) { @@ -2529,7 +2529,7 @@ char *xine_get_file_extensions (xine_t *self) { /* create output string */ char *const result = _x_concatenate_with_string(extensions, list_size, " ", len); free(extensions); - + /* Drop the last whitespace */ result[len-1] = '\0'; @@ -2552,7 +2552,7 @@ char *xine_get_mime_types (xine_t *self) { /* calc length of output string and create an array of strings to concatenate */ - size_t len = 0; + size_t len = 0; const int list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]); const char **mimetypes = calloc(list_size, sizeof(char*)); @@ -2613,7 +2613,7 @@ static void dispose_plugin_list (xine_sarray_t *list) { int list_id, list_size; if (list) { - + list_size = xine_sarray_size (list); for (list_id = 0; list_id < list_size; list_id++) { @@ -2634,12 +2634,12 @@ static void dispose_plugin_list (xine_sarray_t *list) { decoder_info = (decoder_info_t *)node->info->special_info; free (decoder_info->supported_types); - + default: free ((void *)node->info->special_info); break; } - + /* free info structure and string copies */ free (node->info->id); free (node->info); diff --git a/src/xine-engine/lrb.c b/src/xine-engine/lrb.c index 6f8ac8479..89d4b2654 100644 --- a/src/xine-engine/lrb.c +++ b/src/xine-engine/lrb.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 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 @@ -29,7 +29,7 @@ lrb_t *lrb_new (int max_num_entries, fifo_buffer_t *fifo) { lrb_t *this; - + this = calloc(1, sizeof(lrb_t)); this->max_num_entries = max_num_entries; @@ -42,7 +42,7 @@ lrb_t *lrb_new (int max_num_entries, } void lrb_drop (lrb_t *this) { - + buf_element_t *buf = this->oldest; _x_assert(buf); @@ -67,7 +67,7 @@ void lrb_add (lrb_t *this, buf_element_t *buf) { } else { - if (this->cur_num_entries >= this->max_num_entries) + if (this->cur_num_entries >= this->max_num_entries) lrb_drop (this); buf->next = NULL; @@ -94,7 +94,7 @@ void lrb_feedback (lrb_t *this, fifo_buffer_t *fifo) { if (!fifo->last) fifo->last = buf; - + fifo->fifo_size++; pthread_cond_signal (&fifo->not_empty); @@ -114,6 +114,6 @@ void lrb_feedback (lrb_t *this, fifo_buffer_t *fifo) { } void lrb_flush (lrb_t *this) { - while (this->cur_num_entries) + while (this->cur_num_entries) lrb_drop (this); } diff --git a/src/xine-engine/lrb.h b/src/xine-engine/lrb.h index 491ae8843..f64e50eab 100644 --- a/src/xine-engine/lrb.h +++ b/src/xine-engine/lrb.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2001-2003 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 diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index eb9abb84a..a4058bce8 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 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 @@ -46,7 +46,7 @@ #define MAX_AUDIO_DELTA 1600 #define AUDIO_SAMPLE_NUM 32768 -#define WRAP_THRESHOLD 120000 +#define WRAP_THRESHOLD 120000 #define MAX_NUM_WRAP_DIFF 10 #define MAX_SCR_PROVIDERS 10 #define VIDEO_DRIFT_TOLERANCE 45000 @@ -63,7 +63,7 @@ /* * **************************************** - * primary SCR plugin: + * primary SCR plugin: * unix System Clock Reference * **************************************** */ @@ -88,19 +88,19 @@ static void unixscr_set_pivot (unixscr_t *this) { struct timeval tv; int64_t pts; - double pts_calc; + double pts_calc; xine_monotonic_clock(&tv, NULL); pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor; pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6; pts = this->cur_pts + pts_calc; -/* This next part introduces a one off inaccuracy - * to the scr due to rounding tv to pts. +/* This next part introduces a one off inaccuracy + * to the scr due to rounding tv to pts. */ this->cur_time.tv_sec=tv.tv_sec; this->cur_time.tv_usec=tv.tv_usec; - this->cur_pts=pts; + this->cur_pts=pts; return ; } @@ -141,7 +141,7 @@ static void unixscr_start (scr_plugin_t *scr, int64_t start_vpts) { this->cur_pts = start_vpts; pthread_mutex_unlock (&this->lock); - + unixscr_set_speed (&this->scr, XINE_FINE_SPEED_NORMAL); } @@ -150,16 +150,16 @@ static int64_t unixscr_get_current (scr_plugin_t *scr) { struct timeval tv; int64_t pts; - double pts_calc; + double pts_calc; pthread_mutex_lock (&this->lock); xine_monotonic_clock(&tv, NULL); - + pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor; pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6; pts = this->cur_pts + pts_calc; - + pthread_mutex_unlock (&this->lock); return pts; @@ -176,7 +176,7 @@ static scr_plugin_t *XINE_MALLOC unixscr_init () { unixscr_t *this; this = calloc(1, sizeof(unixscr_t)); - + this->scr.interface_version = 3; this->scr.get_priority = unixscr_get_priority; this->scr.set_fine_speed = unixscr_set_speed; @@ -184,15 +184,15 @@ static scr_plugin_t *XINE_MALLOC unixscr_init () { this->scr.start = unixscr_start; this->scr.get_current = unixscr_get_current; this->scr.exit = unixscr_exit; - + pthread_mutex_init (&this->lock, NULL); - + unixscr_set_speed (&this->scr, XINE_SPEED_PAUSE); lprintf("xine-scr_init complete\n"); return &this->scr; } - + /* * **************************************** @@ -208,7 +208,7 @@ static void metronom_start_clock (metronom_clock_t *this, int64_t pts) { for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++) if (*scr) (*scr)->start(*scr, pts); - + this->speed = XINE_FINE_SPEED_NORMAL; } @@ -243,7 +243,7 @@ static int metronom_set_speed (metronom_clock_t *this, int speed) { int true_speed; true_speed = this->scr_master->set_fine_speed (this->scr_master, speed); - + this->speed = true_speed; for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++) @@ -267,33 +267,33 @@ static int64_t metronom_got_spu_packet (metronom_t *this, int64_t pts) { int64_t vpts; pthread_mutex_lock (&this->lock); - + if (this->master) { metronom_t *master = this->master; - + pthread_mutex_lock(&this->master->lock); pthread_mutex_unlock(&this->lock); - + this->vpts_offset = this->master->vpts_offset; this->spu_offset = this->master->spu_offset; - + /* no recursion, please */ this->master = NULL; vpts = master->got_spu_packet(this, pts); this->master = master; - + pthread_mutex_unlock(&this->master->lock); return vpts; } vpts = pts + this->vpts_offset + this->spu_offset; - + /* no vpts going backwards please */ if( vpts < this->spu_vpts ) vpts = this->spu_vpts; - + this->spu_vpts = vpts; - + pthread_mutex_unlock (&this->lock); return vpts; } @@ -353,7 +353,7 @@ static void metronom_handle_discontinuity (metronom_t *this, int type, this->vpts_offset = this->video_vpts - disc_off; break; } - + this->last_video_pts = 0; this->last_audio_pts = 0; } @@ -368,18 +368,18 @@ static void metronom_handle_video_discontinuity (metronom_t *this, int type, pthread_mutex_unlock(&this->lock); return; } - + this->video_discontinuity_count++; pthread_cond_signal (&this->video_discontinuity_reached); - + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video discontinuity #%d, type is %d, disc_off %" PRId64 "\n", this->video_discontinuity_count, type, disc_off); - + if (this->have_audio) { while (this->audio_discontinuity_count < this->video_discontinuity_count) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "waiting for audio discontinuity #%d\n", + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "waiting for audio discontinuity #%d\n", this->video_discontinuity_count); pthread_cond_wait (&this->audio_discontinuity_reached, &this->lock); @@ -399,15 +399,15 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { int64_t vpts; int64_t pts = img->pts; int64_t diff; - + pthread_mutex_lock (&this->lock); if (this->master) { metronom_t *master = this->master; - + pthread_mutex_lock(&this->master->lock); pthread_mutex_unlock(&this->lock); - + if (!this->discontinuity_handled_count) { /* we are not initialized yet */ if (this->master->video_vpts > this->master->audio_vpts) @@ -420,15 +420,15 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { this->force_video_jump = 1; this->discontinuity_handled_count++; } - + this->vpts_offset = this->master->vpts_offset; this->av_offset = this->master->av_offset; - + /* no recursion, please */ this->master = NULL; master->got_video_frame(this, img); this->master = master; - + pthread_mutex_unlock(&this->master->lock); return; } @@ -459,23 +459,23 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { } this->img_cpt = 0; this->last_video_pts = pts; - - + + /* * compare predicted (this->video_vpts) and given (pts+vpts_offset) * pts values - hopefully they will be the same * if not, for small diffs try to interpolate * for big diffs: jump */ - + vpts = pts + this->vpts_offset; if (this->video_mode == VIDEO_PREDICTION_MODE) { - + diff = this->video_vpts - vpts; lprintf("video diff is %" PRId64 " (predicted %" PRId64 ", given %" PRId64 ")\n", diff, this->video_vpts, vpts); - + if ((abs (diff) > VIDEO_DRIFT_TOLERANCE) || (this->force_video_jump)) { this->force_video_jump = 0; @@ -489,7 +489,7 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { this->video_drift = diff; this->video_drift_step = diff / 30; /* this will fix video drift with a constant compensation each - frame for about 1 second of video. */ + frame for about 1 second of video. */ if (diff) lprintf("video drift, drift is %" PRId64 "\n", this->video_drift); } @@ -503,7 +503,7 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { if (this->video_mode == VIDEO_PREDICTION_MODE) { lprintf("video vpts for %10"PRId64" : %10"PRId64" (duration:%d drift:%" PRId64 " step:%" PRId64 ")\n", - pts, this->video_vpts, img->duration, this->video_drift, this->video_drift_step ); + pts, this->video_vpts, img->duration, this->video_drift, this->video_drift_step ); if (this->video_drift * this->video_drift_step > 0) { img->duration -= this->video_drift_step; @@ -516,7 +516,7 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { * this->video_vpts is used as the next frame vpts if next frame pts=0 */ this->video_vpts += this->img_duration; - + pthread_mutex_unlock (&this->lock); } @@ -524,7 +524,7 @@ static void metronom_handle_audio_discontinuity (metronom_t *this, int type, int64_t disc_off) { pthread_mutex_lock (&this->lock); - + if (this->master) { /* slaves are currently not allowed to set discontinuities */ pthread_mutex_unlock(&this->lock); @@ -533,19 +533,19 @@ static void metronom_handle_audio_discontinuity (metronom_t *this, int type, this->audio_discontinuity_count++; pthread_cond_signal (&this->audio_discontinuity_reached); - + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio discontinuity #%d, type is %d, disc_off %" PRId64 "\n", this->audio_discontinuity_count, type, disc_off); if (this->have_video) { - + /* next_vpts_offset, in_discontinuity is handled in expect_video_discontinuity */ while ( this->audio_discontinuity_count > this->discontinuity_handled_count ) { - - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "waiting for in_discontinuity update #%d\n", + + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "waiting for in_discontinuity update #%d\n", this->audio_discontinuity_count); - + pthread_cond_wait (&this->video_discontinuity_reached, &this->lock); } } else { @@ -554,11 +554,11 @@ static void metronom_handle_audio_discontinuity (metronom_t *this, int type, this->audio_samples = 0; this->audio_drift_step = 0; - + pthread_mutex_unlock (&this->lock); } -static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, +static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, int nsamples) { int64_t vpts; @@ -568,34 +568,34 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, lprintf("AUDIO pts from last= %" PRId64 "\n", pts-this->last_audio_pts); pthread_mutex_lock (&this->lock); - + if (this->master) { metronom_t *master = this->master; - + pthread_mutex_lock(&this->master->lock); pthread_mutex_unlock(&this->lock); - + if (!this->discontinuity_handled_count) { /* we are not initialized yet */ if (this->master->video_vpts > this->master->audio_vpts) this->video_vpts = this->audio_vpts = this->master->video_vpts; else this->video_vpts = this->audio_vpts = this->master->audio_vpts; - this->audio_vpts_rmndr = 0; + this->audio_vpts_rmndr = 0; /* when being attached to the first master, do not drift into * his vpts values but adopt at once */ this->force_audio_jump = 1; this->force_video_jump = 1; this->discontinuity_handled_count++; } - + this->vpts_offset = this->master->vpts_offset; - + /* no recursion, please */ this->master = NULL; vpts = master->got_audio_samples(this, pts, nsamples); this->master = master; - + pthread_mutex_unlock(&this->master->lock); return vpts; } @@ -609,7 +609,7 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, if((abs(diff) > AUDIO_DRIFT_TOLERANCE) || (this->force_audio_jump)) { this->force_audio_jump = 0; this->audio_vpts = vpts; - this->audio_vpts_rmndr = 0; + this->audio_vpts_rmndr = 0; this->audio_drift_step = 0; xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio jump, diff=%" PRId64 "\n", diff); } else { @@ -619,15 +619,15 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, diff *= AUDIO_SAMPLE_NUM; diff /= this->audio_samples * 4; - + /* drift_step is not allowed to change rate by more than 25% */ if( diff > this->pts_per_smpls/4 ) - diff = this->pts_per_smpls/4; + diff = this->pts_per_smpls/4; if( diff < -this->pts_per_smpls/4 ) diff = -this->pts_per_smpls/4; - + this->audio_drift_step = diff; - + lprintf("audio_drift = %" PRId64 ", pts_per_smpls = %" PRId64 "\n", diff, this->pts_per_smpls); } } @@ -635,12 +635,12 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, } vpts = this->audio_vpts; - /* drift here is caused by streams where nominal sample rate differs from + /* drift here is caused by streams where nominal sample rate differs from * the rate of which pts increments. fixing the audio_vpts won't do us any * good because sound card won't play it faster or slower just because * we want. however, adding the error to the vpts_offset will force video * to change it's frame rate to keep in sync with us. - * + * * Since we are using integer division below, it can happen that we lose * precision for the calculated duration in vpts for each audio buffer * (< 1 PTS, e.g. 0.25 PTS during playback of most DVDs with LPCM audio). @@ -658,7 +658,7 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, } this->audio_samples += nsamples; this->vpts_offset += nsamples * this->audio_drift_step / AUDIO_SAMPLE_NUM; - + lprintf("audio vpts for %10"PRId64" : %10"PRId64"\n", pts, vpts); pthread_mutex_unlock (&this->lock); @@ -669,7 +669,7 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, static void metronom_set_option (metronom_t *this, int option, int64_t value) { pthread_mutex_lock (&this->lock); - + if (this->master) { /* pass the option on to the master */ this->master->set_option(this->master, option, value); @@ -725,7 +725,7 @@ static void metronom_clock_set_option (metronom_clock_t *this, } static int64_t metronom_get_option (metronom_t *this, int option) { - + if (this->master) return this->master->get_option(this->master, option); @@ -756,7 +756,7 @@ static int64_t metronom_clock_get_option (metronom_clock_t *this, int option) { static void metronom_set_master(metronom_t *this, metronom_t *master) { metronom_t *old_master = this->master; - + pthread_mutex_lock(&this->lock); /* someone might currently be copying values from the old master, * so we need his lock too */ @@ -774,7 +774,7 @@ static scr_plugin_t* get_master_scr(metronom_clock_t *this) { /* find the SCR provider with the highest priority */ for (i=0; i<MAX_SCR_PROVIDERS; i++) if (this->scr_list[i]) { scr_plugin_t *scr = this->scr_list[i]; - + if (maxprio < scr->get_priority(scr)) { select = i; maxprio = scr->get_priority(scr); @@ -791,7 +791,7 @@ static int metronom_register_scr (metronom_clock_t *this, scr_plugin_t *scr) { int i; if (scr->interface_version != 3) { - xprintf(this->xine, XINE_VERBOSITY_NONE, + xprintf(this->xine, XINE_VERBOSITY_NONE, "wrong interface version for scr provider!\n"); return -1; } @@ -813,19 +813,19 @@ static void metronom_unregister_scr (metronom_clock_t *this, scr_plugin_t *scr) /* never unregister scr_list[0]! */ for (i=1; i<MAX_SCR_PROVIDERS; i++) - if (this->scr_list[i] == scr) + if (this->scr_list[i] == scr) break; if (i >= MAX_SCR_PROVIDERS) return; /* Not found */ - + this->scr_list[i] = NULL; time = this->get_current_time(this); - + /* master could have been adjusted, others must follow now */ for (i=0; i<MAX_SCR_PROVIDERS; i++) if (this->scr_list[i]) this->scr_list[i]->adjust(this->scr_list[i], time); - + this->scr_master = get_master_scr(this); } @@ -835,13 +835,13 @@ static int metronom_sync_loop (metronom_clock_t *this) { struct timespec ts; scr_plugin_t** scr; int64_t pts; - + while (this->thread_running) { /* synchronise every 5 seconds */ pthread_mutex_lock (&this->lock); pts = this->scr_master->get_current(this->scr_master); - + for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++) if (*scr && *scr != this->scr_master) (*scr)->adjust(*scr, pts); @@ -869,7 +869,7 @@ static void metronom_clock_exit (metronom_clock_t *this) { scr_plugin_t** scr; this->thread_running = 0; - + pthread_mutex_lock (&this->lock); pthread_cond_signal (&this->cancel); pthread_mutex_unlock (&this->lock); @@ -904,7 +904,7 @@ metronom_t * _x_metronom_init (int have_video, int have_audio, xine_t *xine) { this->xine = xine; this->master = NULL; - + pthread_mutex_init (&this->lock, NULL); this->prebuffer = PREBUFFER_PTS_OFFSET; @@ -913,7 +913,7 @@ metronom_t * _x_metronom_init (int have_video, int have_audio, xine_t *xine) { this->vpts_offset = 0; /* initialize video stuff */ - + this->video_vpts = this->prebuffer; this->video_drift = 0; this->video_drift_step = 0; @@ -924,8 +924,8 @@ metronom_t * _x_metronom_init (int have_video, int have_audio, xine_t *xine) { this->img_cpt = 0; this->last_video_pts = 0; this->last_audio_pts = 0; - - + + /* initialize audio stuff */ this->have_video = have_video; @@ -934,7 +934,7 @@ metronom_t * _x_metronom_init (int have_video, int have_audio, xine_t *xine) { this->audio_vpts_rmndr = 0; this->audio_discontinuity_count = 0; pthread_cond_init (&this->audio_discontinuity_reached, NULL); - + return this; } @@ -944,7 +944,7 @@ metronom_clock_t *_x_metronom_clock_init(xine_t *xine) { metronom_clock_t *this = calloc(1, sizeof(metronom_clock_t)); int err; - + this->set_option = metronom_clock_set_option; this->get_option = metronom_clock_get_option; this->start_clock = metronom_start_clock; @@ -956,19 +956,19 @@ metronom_clock_t *_x_metronom_clock_init(xine_t *xine) this->register_scr = metronom_register_scr; this->unregister_scr = metronom_unregister_scr; this->exit = metronom_clock_exit; - + this->xine = xine; this->scr_adjustable = 1; this->scr_list = calloc(MAX_SCR_PROVIDERS, sizeof(void*)); this->register_scr(this, unixscr_init()); - + pthread_mutex_init (&this->lock, NULL); pthread_cond_init (&this->cancel, NULL); - + this->thread_running = 1; if ((err = pthread_create(&this->sync_thread, NULL, - (void*(*)(void*)) metronom_sync_loop, this)) != 0) + (void*(*)(void*)) metronom_sync_loop, this)) != 0) xprintf(this->xine, XINE_VERBOSITY_NONE, "cannot create sync thread (%s)\n", strerror(err)); diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h index c7a594d89..946aa0991 100644 --- a/src/xine-engine/metronom.h +++ b/src/xine-engine/metronom.h @@ -1,30 +1,30 @@ -/* +/* * Copyright (C) 2000-2004 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 * * metronom: general pts => virtual calculation/assoc - * + * * virtual pts: unit 1/90000 sec, always increasing * can be used for synchronization * video/audio frame with same pts also have same vpts * but pts is likely to differ from vpts * - * the basic idea is: + * the basic idea is: * video_pts + video_wrap_offset = video_vpts * audio_pts + audio_wrap_offset = audio_vpts * @@ -67,8 +67,8 @@ typedef struct scr_plugin_s scr_plugin_t; #define PREBUFFER_PTS_OFFSET 12000 /* see below */ -#define DISC_STREAMSTART 0 -#define DISC_RELATIVE 1 +#define DISC_STREAMSTART 0 +#define DISC_RELATIVE 1 #define DISC_ABSOLUTE 2 #define DISC_STREAMSEEK 3 @@ -91,9 +91,9 @@ struct metronom_s { * * this function will also update video_wrap_offset if a discontinuity * is detected (read the comentaries below about discontinuities). - * + * */ - + void (*got_video_frame) (metronom_t *self, vo_frame_t *frame); /* @@ -109,8 +109,8 @@ struct metronom_s { * */ - int64_t (*got_audio_samples) (metronom_t *self, int64_t pts, - int nsamples); + int64_t (*got_audio_samples) (metronom_t *self, int64_t pts, + int nsamples); /* * called by SPU decoder whenever a packet is delivered to it @@ -134,7 +134,7 @@ struct metronom_s { * * DISC_STREAMSTART : new stream starts, expect pts values to start * from zero immediately - * DISC_RELATIVE : typically a wrap-around, expect pts with + * DISC_RELATIVE : typically a wrap-around, expect pts with * a specified offset from the former ones soon * DISC_ABSOLUTE : typically a new menu stream (nav packets) * pts will start from given value soon @@ -152,7 +152,7 @@ struct metronom_s { */ void (*set_option) (metronom_t *self, int option, int64_t value); int64_t (*get_option) (metronom_t *self, int option); - + /* * set a master metronom * this is currently useful to sync independently generated streams @@ -160,7 +160,7 @@ struct metronom_s { * metronom */ void (*set_master) (metronom_t *self, metronom_t *master); - + void (*exit) (metronom_t *self); #ifdef METRONOM_INTERNAL @@ -168,7 +168,7 @@ struct metronom_s { * metronom internal stuff */ xine_t *xine; - + metronom_t *master; int64_t pts_per_smpls; @@ -182,7 +182,7 @@ struct metronom_s { int64_t video_drift; int64_t video_drift_step; - + int audio_samples; int64_t audio_drift_step; @@ -293,9 +293,9 @@ struct metronom_clock_s { #ifdef METRONOM_CLOCK_INTERNAL void (*exit) (metronom_clock_t *self); - + xine_t *xine; - + scr_plugin_t *scr_master; scr_plugin_t **scr_list; pthread_t sync_thread; @@ -310,7 +310,7 @@ struct metronom_clock_s { int dummy10; int dummy11; #endif - + int speed; #ifdef METRONOM_CLOCK_INTERNAL @@ -337,8 +337,8 @@ struct scr_plugin_s int (*get_priority) (scr_plugin_t *self); - /* - * set/get clock speed + /* + * set/get clock speed * * for speed constants see xine_internal.h * returns actual speed diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index af8286831..94fc969bd 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2005 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 @@ -113,7 +113,7 @@ struct osd_font_s { uint16_t size; uint16_t num_fontchars; uint16_t loaded; -}; +}; #ifdef HAVE_FT2 struct osd_ft2context_s { @@ -147,27 +147,27 @@ static inline void osd_free_ft2 (osd_object_t *osd __attr_unused) {} */ static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width, int height) { - + osd_object_t *osd; - - pthread_mutex_lock (&this->osd_mutex); - + + pthread_mutex_lock (&this->osd_mutex); + osd = calloc(1, sizeof(osd_object_t)); osd->renderer = this; osd->next = this->osds; this->osds = osd; - + osd->width = width; osd->height = height; osd->area = calloc(width, height); - + osd->x1 = width; osd->y1 = height; osd->x2 = 0; osd->y2 = 0; - memcpy(osd->color, textpalettes_color[0], sizeof(textpalettes_color[0])); - memcpy(osd->trans, textpalettes_trans[0], sizeof(textpalettes_trans[0])); + memcpy(osd->color, textpalettes_color[0], sizeof(textpalettes_color[0])); + memcpy(osd->trans, textpalettes_trans[0], sizeof(textpalettes_trans[0])); osd->handle = -1; @@ -175,11 +175,11 @@ static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width osd->cd = (iconv_t)-1; osd->encoding = NULL; #endif - - pthread_mutex_unlock (&this->osd_mutex); + + pthread_mutex_unlock (&this->osd_mutex); lprintf("osd=%p size: %dx%d\n", osd, width, height); - + return osd; } @@ -196,7 +196,7 @@ static int _osd_hide (osd_object_t *osd, int64_t vpts); * the object is not changed. there may be subsequent drawing on it. */ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { - + osd_renderer_t *this = osd->renderer; video_overlay_manager_t *ovl_manager; rle_elem_t rle, *rle_p=0; @@ -204,21 +204,21 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { uint8_t *c; lprintf("osd=%p vpts=%"PRId64"\n", osd, vpts); - + this->stream->xine->port_ticket->acquire(this->stream->xine->port_ticket, 1); - + ovl_manager = this->stream->video_out->get_overlay_manager(this->stream->video_out); - + if( osd->handle < 0 ) { if( (osd->handle = ovl_manager->get_handle(ovl_manager, 0)) == -1 ) { this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1); return 0; } } - - pthread_mutex_lock (&this->osd_mutex); - - /* clip update area to allowed range */ + + pthread_mutex_lock (&this->osd_mutex); + + /* clip update area to allowed range */ if(osd->x1 > osd->width) osd->x1 = osd->width; if(osd->x2 > osd->width) @@ -232,13 +232,13 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { if(osd->y1 < 0) osd->y1 = 0; if(osd->y2 < 0) osd->y2 = 0; -#ifdef DEBUG_RLE +#ifdef DEBUG_RLE lprintf("osd_show %p rle starts\n", osd); -#endif +#endif /* check if osd is valid (something drawn on it) */ if( osd->x2 > osd->x1 && osd->y2 > osd->y1 ) { - + this->event.object.handle = osd->handle; memset( this->event.object.overlay, 0, sizeof(*this->event.object.overlay) ); @@ -247,25 +247,25 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { this->event.object.overlay->y = osd->display_y + osd->y1; this->event.object.overlay->width = osd->x2 - osd->x1; this->event.object.overlay->height = osd->y2 - osd->y1; - + 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; this->event.object.overlay->hili_right = this->event.object.overlay->width; - + /* 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 = + 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++ ) { -#ifdef DEBUG_RLE +#ifdef DEBUG_RLE lprintf("osd_show %p y = %d: ", osd, y); -#endif +#endif c = osd->area + y * osd->width + osd->x1; /* initialize a rle object with the first pixel's color */ @@ -275,17 +275,17 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { /* 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 +#ifdef DEBUG_RLE lprintf("(%d, %d), ", rle.len, rle.color); #endif *rle_p++ = rle; - this->event.object.overlay->num_rle++; + this->event.object.overlay->num_rle++; rle.color = *c; rle.len = 1; } else { rle.len++; - } + } } #ifdef DEBUG_RLE lprintf("(%d, %d)\n", rle.len, rle.color); @@ -297,12 +297,12 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { 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)); - + + 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; ovl_manager->add_event(ovl_manager, (void *)&this->event); @@ -310,10 +310,10 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { /* osd empty - hide it */ _osd_hide(osd, vpts); } - pthread_mutex_unlock (&this->osd_mutex); - + pthread_mutex_unlock (&this->osd_mutex); + this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1); - + return 1; } @@ -335,24 +335,24 @@ static int osd_show_unscaled (osd_object_t *osd, int64_t vpts) { * send event to hide osd at given pts (0=now) * the object is not changed. there may be subsequent drawing on it. */ -static int _osd_hide (osd_object_t *osd, int64_t vpts) { +static int _osd_hide (osd_object_t *osd, int64_t vpts) { osd_renderer_t *this = osd->renderer; video_overlay_manager_t *ovl_manager; - + lprintf("osd=%p vpts=%"PRId64"\n",osd, vpts); - + if( osd->handle < 0 ) return 0; - + this->event.object.handle = osd->handle; - + /* not really needed this, but good pratice to clean it up */ memset( this->event.object.overlay, 0, sizeof(this->event.object.overlay) ); - + this->event.event_type = OVERLAY_EVENT_HIDE; this->event.vpts = vpts; - + ovl_manager = this->stream->video_out->get_overlay_manager(this->stream->video_out); ovl_manager->add_event(ovl_manager, (void *)&this->event); @@ -398,14 +398,14 @@ static void osd_clear (osd_object_t *osd) { static void osd_point (osd_object_t *osd, int x, int y, int color) { uint8_t *c; - + lprintf("osd=%p (%d x %d)\n", osd, x, y); - + if (x < 0 || x >= osd->width) return; if (y < 0 || y >= osd->height) return; - + /* update clipping area */ osd->x1 = MIN(osd->x1, x); osd->x2 = MAX(osd->x2, (x + 1)); @@ -422,14 +422,14 @@ static void osd_point (osd_object_t *osd, int x, int y, int color) { static void osd_line (osd_object_t *osd, int x1, int y1, int x2, int y2, int color) { - + uint8_t *c; int dx, dy, t, inc, d, inc1, inc2; int swap_x = 0; int swap_y = 0; lprintf("osd=%p (%d,%d)-(%d,%d)\n",osd, x1,y1, x2,y2 ); - + /* sort line */ if (x2 < x1) { t = x1; @@ -444,7 +444,7 @@ static void osd_line (osd_object_t *osd, swap_y = 1; } - /* clip line */ + /* clip line */ if (x1 < 0) { y1 = y1 + (y2-y1) * -x1 / (x2-x1); x1 = 0; @@ -461,19 +461,19 @@ static void osd_line (osd_object_t *osd, x2 = x1 + (x2-x1) * (osd->height-y1) / (y2-y1); y2 = osd->height; } - + if (x1 >= osd->width || y1 >= osd->height) return; - + /* update clipping area */ osd->x1 = MIN( osd->x1, x1 ); osd->x2 = MAX( osd->x2, x2 ); osd->y1 = MIN( osd->y1, y1 ); osd->y2 = MAX( osd->y2, y2 ); - + dx = x2 - x1; dy = y2 - y1; - + /* unsort line */ if (swap_x) { t = x1; @@ -492,7 +492,7 @@ static void osd_line (osd_object_t *osd, t = x2; x2 = x1; x1 = t; t = y2; y2 = y1; y1 = t; } - + if( y2 > y1 ) inc = 1; else inc = -1; inc1 = 2*dy; @@ -500,11 +500,11 @@ static void osd_line (osd_object_t *osd, inc2 = 2*(dy-dx); c = osd->area + y1 * osd->width + x1; - + while(x1<x2) { *c++ = color; - + x1++; if( d<0 ) { d+=inc1; @@ -529,8 +529,8 @@ static void osd_line (osd_object_t *osd, c = osd->area + y1 * osd->width + x1; while(y1<y2) { - *c = color; - + *c = color; + c += osd->width; y1++; if( d<0 ) { @@ -555,17 +555,17 @@ static void osd_filled_rect (osd_object_t *osd, int x, y, dx, dy; lprintf("osd=%p (%d,%d)-(%d,%d)\n",osd, x1,y1, x2,y2 ); - + /* sort rectangle */ x = MIN( x1, x2 ); dx = MAX( x1, x2 ); y = MIN( y1, y2 ); dy = MAX( y1, y2 ); - + /* clip rectangle */ if (x >= osd->width || y >= osd->height) return; - + if (x < 0) { dx += x; x = 0; @@ -577,7 +577,7 @@ static void osd_filled_rect (osd_object_t *osd, dx = MIN( dx, osd->width ); dy = MIN( dy, osd->height ); - + /* update clipping area */ osd->x1 = MIN( osd->x1, x ); osd->x2 = MAX( osd->x2, dx ); @@ -603,7 +603,7 @@ static void osd_set_palette(osd_object_t *osd, const uint32_t *color, const uint } /* - * set on existing text palette + * set on existing text palette * (-1 to set user specified palette) */ @@ -622,7 +622,7 @@ static void osd_set_text_palette(osd_object_t *osd, int palette_number, memcpy(&osd->color[color_base], textpalettes_color[palette_number], sizeof(textpalettes_color[palette_number])); memcpy(&osd->trans[color_base], textpalettes_trans[palette_number], - sizeof(textpalettes_trans[palette_number])); + sizeof(textpalettes_trans[palette_number])); } @@ -658,7 +658,7 @@ static uint16_t gzread_i16(gzFile *fp) { } /* - load bitmap font into osd engine + load bitmap font into osd engine */ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { @@ -666,7 +666,7 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { gzFile *fp; osd_font_t *font = NULL; int i, ret = 0; - + lprintf("name=%s\n", filename ); /* load quick & dirt font format */ @@ -677,36 +677,36 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { gzread(fp, font->name, sizeof(font->name) ); font->version = gzread_i16(fp); - + if( font->version == FONT_VERSION ) { - + font->size = gzread_i16(fp); font->num_fontchars = gzread_i16(fp); font->loaded = 1; - + font->fontchar = malloc( sizeof(osd_fontchar_t) * font->num_fontchars ); - + lprintf("font '%s' chars=%d\n", font->name, font->num_fontchars); - + /* load all characters */ for( i = 0; i < font->num_fontchars; i++ ) { font->fontchar[i].code = gzread_i16(fp); font->fontchar[i].width = gzread_i16(fp); font->fontchar[i].height = gzread_i16(fp); font->fontchar[i].bmp = malloc(font->fontchar[i].width*font->fontchar[i].height); - if( gzread(fp, font->fontchar[i].bmp, + if( gzread(fp, font->fontchar[i].bmp, font->fontchar[i].width*font->fontchar[i].height) <= 0 ) break; } - + /* check if all expected characters were loaded */ if( i == font->num_fontchars ) { osd_font_t *known_font; ret = 1; - + lprintf("font '%s' loaded\n",font->name); - - /* check if font is already known to us */ + + /* check if font is already known to us */ known_font = this->fonts; while( known_font ) { if( !strcasecmp(known_font->name,font->name) && @@ -714,16 +714,16 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { break; known_font = known_font->next; } - + if( !known_font ) { - + /* new font, add it to list */ font->filename = strdup(filename); font->next = this->fonts; this->fonts = font; - + } else { - + if( !known_font->loaded ) { /* the font was preloaded before. * add loaded characters to the existing entry. @@ -734,7 +734,7 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { known_font->fontchar = font->fontchar; free(font); } else { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("font '%s-%d' already loaded, weird.\n"), font->name, font->size); while( --i >= 0 ) { free(font->fontchar[i].bmp); @@ -742,13 +742,13 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { free(font->fontchar); free(font); } - + } } else { - + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("font '%s' loading failed (%d < %d)\n") ,font->name, i, font->num_fontchars); - + while( --i >= 0 ) { free(font->fontchar[i].bmp); } @@ -774,13 +774,13 @@ static int osd_renderer_unload_font(osd_renderer_t *this, char *fontname ) { osd_font_t *font, *last; osd_object_t *osd; int i, ret = 0; - + lprintf("font '%s'\n", fontname); pthread_mutex_lock (&this->osd_mutex); osd = this->osds; - while( osd ) { + while( osd ) { if( !strcasecmp(osd->font->name, fontname) ) osd->font = NULL; osd = osd->next; @@ -792,14 +792,14 @@ static int osd_renderer_unload_font(osd_renderer_t *this, char *fontname ) { if ( !strcasecmp(font->name,fontname) ) { free( font->filename ); - + if( font->loaded ) { for( i = 0; i < font->num_fontchars; i++ ) { free( font->fontchar[i].bmp ); } free( font->fontchar ); } - + if( last ) last->next = font->next; else @@ -835,7 +835,7 @@ static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int FT_Done_Face (osd->ft2->face); osd->ft2->face = NULL; } - + #ifdef HAVE_FONTCONFIG do { FcPattern *pat = NULL, *match = NULL; @@ -848,7 +848,7 @@ static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int match = FcFontMatch(NULL, pat, &result); FcPatternDestroy(pat); - + if ( ! match ) { FcFontSetDestroy(fs); xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG, @@ -878,7 +878,7 @@ static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int /* try load font from current directory */ if ( !FT_New_Face(osd->ft2->library, fontname, 0, &osd->ft2->face) ) goto end; - + /* try load font from home directory */ snprintf(pathname, 1024, "%s/.xine/fonts/%s", xine_get_homedir(), fontname); if ( !FT_New_Face(osd->ft2->library, pathname, 0, &osd->ft2->face) ) @@ -889,7 +889,7 @@ static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int if ( !FT_New_Face(osd->ft2->library, pathname, 0, &osd->ft2->face) ) goto end; - xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG, + xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG, _("osd: error loading font %s with ft2\n"), fontname); } @@ -913,11 +913,11 @@ static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int set the font of osd object */ -static int osd_set_font( osd_object_t *osd, const char *fontname, int size) { +static int osd_set_font( osd_object_t *osd, const char *fontname, int size) { int ret = 1; lprintf("osd=%p font '%s'\n", osd, fontname); - + pthread_mutex_lock (&osd->renderer->osd_mutex); #ifdef HAVE_FT2 @@ -932,7 +932,7 @@ static int osd_set_font( osd_object_t *osd, const char *fontname, int size) { font = osd->renderer->fonts; while( font ) { - if( !strcasecmp(font->name, fontname) && (size>=font->size) + if( !strcasecmp(font->name, fontname) && (size>=font->size) && (best<font->size)) { ret = 1; osd->font = font; @@ -948,7 +948,7 @@ static int osd_set_font( osd_object_t *osd, const char *fontname, int size) { ret = osd_renderer_load_font(osd->renderer, osd->font->filename); if(!ret) osd->font = NULL; - } + } } pthread_mutex_unlock (&osd->renderer->osd_mutex); @@ -978,29 +978,29 @@ static int osd_search(osd_fontchar_t *array, size_t n, uint16_t code) { if (array[right].code == code) return right; - else + else return ALIAS_CHARACTER_FONT < n ? ALIAS_CHARACTER_FONT : n; #else size_t i; - + for( i = 0; i < n; i++ ) { if( font->fontchar[i].code == unicode ) break; } - if (i < n) + if (i < n) return i; - else + else return ALIAS_CHARACTER_FONT < n ? ALIAS_CHARACTER_FONT : n; #endif } #ifdef HAVE_ICONV -/* - * get next unicode value +/* + * get next unicode value */ -static uint16_t osd_iconv_getunicode(xine_t *xine, +static uint16_t osd_iconv_getunicode(xine_t *xine, iconv_t cd, const char *encoding, ICONV_CONST char **inbuf, size_t *inbytesleft) { uint16_t unicode; @@ -1052,7 +1052,7 @@ static void osd_free_encoding(osd_object_t *osd) { /* - * set encoding of text + * set encoding of text * * NULL ... no conversion (iso-8859-1) * "" ... locale encoding @@ -1117,7 +1117,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, #endif lprintf("osd=%p (%d,%d) \"%s\"\n", osd, x1, y1, text); - + /* some sanity checks for the color indices */ if( color_base < 0 ) color_base = 0; @@ -1133,7 +1133,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, #ifdef HAVE_FT2 if (osd->ft2) proceed = 1; #endif - + if (proceed == 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: font isn't defined\n")); pthread_mutex_unlock(&this->osd_mutex); @@ -1146,10 +1146,10 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, inbuf = text; inbytesleft = strlen(text); - + while( inbytesleft ) { #ifdef HAVE_ICONV - unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding, + unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding, (ICONV_CONST char **)&inbuf, &inbytesleft); #else unicode = inbuf[0]; @@ -1207,7 +1207,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, while (s < src + slot->bitmap.width) { if ((d >= dst) && (d < dst + osd->width) && *s) *d = (uint8_t)(*s/25) + (uint8_t) color_base; - + d++; s++; } @@ -1226,15 +1226,15 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, #endif i = osd_search(font->fontchar, font->num_fontchars, unicode); - - lprintf("font '%s' [%d, U+%04X == U+%04X] %dx%d -> %d,%d\n", font->name, i, - unicode, font->fontchar[i].code, font->fontchar[i].width, + + lprintf("font '%s' [%d, U+%04X == U+%04X] %dx%d -> %d,%d\n", font->name, i, + unicode, font->fontchar[i].code, font->fontchar[i].width, font->fontchar[i].height, x1, y1); - + if ( i != font->num_fontchars ) { dst = osd->area + y1 * osd->width; src = font->fontchar[i].bmp; - + for( y = 0; y < font->fontchar[i].height; y++ ) { uint8_t *s = src; uint8_t *d = dst + x1; @@ -1246,7 +1246,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, while (s < src + font->fontchar[i].width) { if((d >= dst) && (d < dst + osd->width) && (*s > 1)) /* skip drawing transparency */ *d = *s + (uint8_t) color_base; - + d++; s++; } @@ -1254,12 +1254,12 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, dst += osd->width; } x1 += font->fontchar[i].width - (font->fontchar[i].width * FONT_OVERLAP); - + if( x1 > osd->x2 ) osd->x2 = x1; - if( y1 + font->fontchar[i].height > osd->y2 ) + if( y1 + font->fontchar[i].height > osd->y2 ) osd->y2 = y1 + font->fontchar[i].height; } - + #ifdef HAVE_FT2 } /* !(osd->ft2) */ #endif @@ -1291,7 +1291,7 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in #endif lprintf("osd=%p \"%s\"\n", osd, text); - + pthread_mutex_lock (&this->osd_mutex); { @@ -1301,7 +1301,7 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in #ifdef HAVE_FT2 if (osd->ft2) proceed = 1; #endif - + if (proceed == 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: font isn't defined\n")); pthread_mutex_unlock(&this->osd_mutex); @@ -1314,10 +1314,10 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in inbuf = text; inbytesleft = strlen(text); - + while( inbytesleft ) { #ifdef HAVE_ICONV - unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding, + unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding, (ICONV_CONST char **)&inbuf, &inbytesleft); #else unicode = inbuf[0]; @@ -1408,7 +1408,7 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) { int len; len = strlen (entry->d_name); - + if ( (len > 12) && !strncmp (&entry->d_name[len-12], ".xinefont.gz", 12)) { s = strdup(entry->d_name); @@ -1419,15 +1419,15 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) { *p++ = '\0'; font = calloc(1, sizeof(osd_font_t) ); - + strncpy(font->name, s, sizeof(font->name)); font->size = atoi(p); - lprintf("font '%s' size %d is preloaded\n", + lprintf("font '%s' size %d is preloaded\n", font->name, font->size); asprintf (&font->filename, "%s/%s", path, entry->d_name); - + font->next = this->fonts; this->fonts = font; } @@ -1444,30 +1444,30 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) { */ static void osd_free_object (osd_object_t *osd_to_close) { - + osd_renderer_t *this = osd_to_close->renderer; video_overlay_manager_t *ovl_manager; osd_object_t *osd, *last; if( osd_to_close->handle >= 0 ) { osd_hide(osd_to_close,0); - + this->event.object.handle = osd_to_close->handle; - + /* not really needed this, but good pratice to clean it up */ memset( this->event.object.overlay, 0, sizeof(this->event.object.overlay) ); this->event.event_type = OVERLAY_EVENT_FREE_HANDLE; this->event.vpts = 0; - + this->stream->xine->port_ticket->acquire(this->stream->xine->port_ticket, 1); ovl_manager = this->stream->video_out->get_overlay_manager(this->stream->video_out); ovl_manager->add_event(ovl_manager, (void *)&this->event); this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1); - + osd_to_close->handle = -1; /* handle will be freed */ } - - pthread_mutex_lock (&this->osd_mutex); + + pthread_mutex_lock (&this->osd_mutex); last = NULL; osd = this->osds; @@ -1477,7 +1477,7 @@ static void osd_free_object (osd_object_t *osd_to_close) { osd_free_ft2 (osd); osd_free_encoding(osd); - + if( last ) last->next = osd->next; else @@ -1489,7 +1489,7 @@ static void osd_free_object (osd_object_t *osd_to_close) { last = osd; osd = osd->next; } - pthread_mutex_unlock (&this->osd_mutex); + pthread_mutex_unlock (&this->osd_mutex); } static void osd_renderer_close (osd_renderer_t *this) { @@ -1547,7 +1547,7 @@ static void osd_draw_bitmap(osd_object_t *osd, uint8_t *bitmap, } static uint32_t osd_get_capabilities (osd_object_t *osd) { - + osd_renderer_t *this = osd->renderer; uint32_t capabilities = 0; @@ -1560,8 +1560,8 @@ static uint32_t osd_get_capabilities (osd_object_t *osd) { VO_CAP_UNSCALED_OVERLAY) capabilities |= XINE_OSD_CAP_UNSCALED; this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1); - - return capabilities; + + return capabilities; } @@ -1574,7 +1574,7 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) { osd_renderer_t *this; char str[1024]; - this = calloc(1, sizeof(osd_renderer_t)); + this = calloc(1, sizeof(osd_renderer_t)); this->stream = stream; this->event.object.overlay = calloc(1, sizeof(vo_overlay_t)); @@ -1592,13 +1592,13 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) { this->textpalette = this->stream->xine->config->register_enum (this->stream->xine->config, "ui.osd.text_palette", 0, - textpalettes_str, + textpalettes_str, _("palette (foreground-border-background) to use for subtitles and OSD"), _("The palette for on-screen-display and some subtitle formats that do " "not specify any colouring themselves. The palettes are listed in the " "form: foreground-border-background."), 10, update_text_palette, this); - + /* * set up function pointer */ diff --git a/src/xine-engine/osd.h b/src/xine-engine/osd.h index 70193a2ea..768fcb418 100644 --- a/src/xine-engine/osd.h +++ b/src/xine-engine/osd.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 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 @@ -48,11 +48,11 @@ struct osd_object_s { int width, height; /* work area dimentions */ uint8_t *area; /* work area */ int display_x,display_y; /* where to display it in screen */ - + /* clipping box inside work area */ int x1, y1; int x2, y2; - + uint32_t color[OVL_PALETTE_SIZE]; /* color lookup table */ uint8_t trans[OVL_PALETTE_SIZE]; /* mixer key table */ @@ -62,7 +62,7 @@ struct osd_object_s { iconv_t cd; /* iconv handle of encoding */ char *encoding; /* name of encoding */ #endif - + osd_font_t *font; osd_ft2context_t *ft2; }; @@ -102,17 +102,17 @@ struct osd_renderer_s { */ int (*hide) (osd_object_t *osd, int64_t vpts ); - /* + /* * draw point. */ void (*point) (osd_object_t *osd, int x, int y, int color); - + /* * Bresenham line implementation on osd object */ void (*line) (osd_object_t *osd, int x1, int y1, int x2, int y2, int color ); - + /* * filled rectangle */ @@ -125,7 +125,7 @@ struct osd_renderer_s { void (*set_palette) (osd_object_t *osd, const uint32_t *color, const uint8_t *trans ); /* - * set on existing text palette + * set on existing text palette * (-1 to set used specified palette) * * color_base specifies the first color index to use for this text @@ -136,11 +136,11 @@ struct osd_renderer_s { */ void (*set_text_palette) (osd_object_t *osd, int palette_number, int color_base ); - + /* * get palette (color and transparency) */ - void (*get_palette) (osd_object_t *osd, uint32_t *color, + void (*get_palette) (osd_object_t *osd, uint32_t *color, uint8_t *trans); /* @@ -167,20 +167,20 @@ struct osd_renderer_s { * no \n yet * * The text is assigned the colors starting at the index specified by - * color_base up to the size of the text palette. + * color_base up to the size of the text palette. * * Use OSD_TEXT1, OSD_TEXT2, ... for some preasssigned color indices. */ - int (*render_text) (osd_object_t *osd, int x1, int y1, + int (*render_text) (osd_object_t *osd, int x1, int y1, const char *text, int color_base); /* * get width and height of how text will be renderized */ - int (*get_text_size) (osd_object_t *osd, const char *text, + int (*get_text_size) (osd_object_t *osd, const char *text, int *width, int *height); - /* + /* * close osd rendering engine * loaded fonts are unloaded * osd objects are closed @@ -191,7 +191,7 @@ struct osd_renderer_s { * clear an osd object (empty drawing area) */ void (*clear) (osd_object_t *osd ); - + /* * paste a bitmap with optional palette mapping */ @@ -210,7 +210,7 @@ struct osd_renderer_s { * see xine.h for defined XINE_OSD_CAP_ values. */ uint32_t (*get_capabilities) (osd_object_t *osd); - + /* private stuff */ pthread_mutex_t osd_mutex; @@ -218,7 +218,7 @@ struct osd_renderer_s { osd_object_t *osds; /* instances of osd */ osd_font_t *fonts; /* loaded fonts */ int textpalette; /* default textpalette */ - + xine_stream_t *stream; }; @@ -230,7 +230,7 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) XINE_MALLOC; /* - * The size of a text palette + * The size of a text palette */ #define TEXT_PALETTE_SIZE 11 @@ -251,29 +251,29 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) XINE_MALLOC; #define OSD_TEXT9 (8 * TEXT_PALETTE_SIZE) #define OSD_TEXT10 (9 * TEXT_PALETTE_SIZE) -/* +/* * Defined palettes for rendering osd text * (more can be added later) - */ + */ #define NUMBER_OF_TEXT_PALETTES 4 #define TEXTPALETTE_WHITE_BLACK_TRANSPARENT 0 #define TEXTPALETTE_WHITE_NONE_TRANSPARENT 1 #define TEXTPALETTE_WHITE_NONE_TRANSLUCID 2 #define TEXTPALETTE_YELLOW_BLACK_TRANSPARENT 3 - + #ifdef __OSD_C__ - + /* This text descriptions are used for config screen */ static const char *textpalettes_str[NUMBER_OF_TEXT_PALETTES+1] = { "white-black-transparent", "white-none-transparent", "white-none-translucid", - "yellow-black-transparent", + "yellow-black-transparent", NULL}; -/* +/* Palette entries as used by osd fonts: 0: not used by font, always transparent @@ -284,10 +284,10 @@ static const char *textpalettes_str[NUMBER_OF_TEXT_PALETTES+1] = { 6: font border. if the font is to be displayed without border this will probably be adjusted to font background or near. 7-9: transition between border and foreground - 10: font color (foreground) + 10: font color (foreground) */ -/* +/* The palettes below were made by hand, ie, i just throw values that seemed to do the transitions i wanted. This can surelly be improved a lot. [Miguel] diff --git a/src/xine-engine/plugin_catalog.h b/src/xine-engine/plugin_catalog.h index a28321760..010ec53bb 100644 --- a/src/xine-engine/plugin_catalog.h +++ b/src/xine-engine/plugin_catalog.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 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 @@ -60,16 +60,16 @@ typedef struct { struct plugin_catalog_s { xine_sarray_t *plugin_lists[PLUGIN_TYPE_MAX]; - + xine_sarray_t *cache_list; xine_list_t *file_list; plugin_node_t *audio_decoder_map[DECODER_MAX][PLUGINS_PER_TYPE]; plugin_node_t *video_decoder_map[DECODER_MAX][PLUGINS_PER_TYPE]; plugin_node_t *spu_decoder_map[DECODER_MAX][PLUGINS_PER_TYPE]; - + const char *ids[PLUGIN_MAX]; - + /* memory block for the decoder priority config entry descriptions */ char *prio_desc[DECODER_MAX]; diff --git a/src/xine-engine/post.c b/src/xine-engine/post.c index aa182d627..276934788 100644 --- a/src/xine-engine/post.c +++ b/src/xine-engine/post.c @@ -1,23 +1,23 @@ /* * Copyright (C) 2000-2004 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 */ - + /* * some helper functions for post plugins */ @@ -41,7 +41,7 @@ void _x_post_init(post_plugin_t *post, int num_audio_inputs, int num_video_input static uint32_t post_video_get_capabilities(xine_video_port_t *port_gen) { post_video_port_t *port = (post_video_port_t *)port_gen; uint32_t caps; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); caps = port->original_port->get_capabilities(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -50,7 +50,7 @@ static uint32_t post_video_get_capabilities(xine_video_port_t *port_gen) { static void post_video_open(xine_video_port_t *port_gen, xine_stream_t *stream) { post_video_port_t *port = (post_video_port_t *)port_gen; - + _x_post_rewire(port->post); _x_post_inc_usage(port); if (port->port_lock) pthread_mutex_lock(port->port_lock); @@ -59,31 +59,31 @@ static void post_video_open(xine_video_port_t *port_gen, xine_stream_t *stream) port->stream = stream; } -static vo_frame_t *post_video_get_frame(xine_video_port_t *port_gen, uint32_t width, +static vo_frame_t *post_video_get_frame(xine_video_port_t *port_gen, uint32_t width, uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; - + _x_post_rewire(port->post); if (port->port_lock) pthread_mutex_lock(port->port_lock); frame = port->original_port->get_frame(port->original_port, width, height, ratio, format, flags); if (port->port_lock) pthread_mutex_unlock(port->port_lock); - + if (frame && (!port->intercept_frame || port->intercept_frame(port, frame))) { _x_post_inc_usage(port); if (port->frame_lock) pthread_mutex_lock(port->frame_lock); frame = _x_post_intercept_video_frame(frame, port); if (port->frame_lock) pthread_mutex_unlock(port->frame_lock); } - + return frame; } static vo_frame_t *post_video_get_last_frame(xine_video_port_t *port_gen) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); frame = port->original_port->get_last_frame(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -92,15 +92,15 @@ static vo_frame_t *post_video_get_last_frame(xine_video_port_t *port_gen) { static void post_video_enable_ovl(xine_video_port_t *port_gen, int ovl_enable) { post_video_port_t *port = (post_video_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->enable_ovl(port->original_port, ovl_enable); if (port->port_lock) pthread_mutex_unlock(port->port_lock); } - + static void post_video_close(xine_video_port_t *port_gen, xine_stream_t *stream) { post_video_port_t *port = (post_video_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->close(port->original_port, stream); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -110,7 +110,7 @@ static void post_video_close(xine_video_port_t *port_gen, xine_stream_t *stream) static void post_video_exit(xine_video_port_t *port_gen) { post_video_port_t *port = (post_video_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->exit(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -119,11 +119,11 @@ static void post_video_exit(xine_video_port_t *port_gen) { static video_overlay_manager_t *post_video_get_overlay_manager(xine_video_port_t *port_gen) { post_video_port_t *port = (post_video_port_t *)port_gen; video_overlay_manager_t *manager; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); manager = port->original_port->get_overlay_manager(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); - + if (port->intercept_ovl && port->intercept_ovl(port)) { if (manager && !port->original_manager) /* this is the first access to overlay manager */ @@ -138,7 +138,7 @@ static video_overlay_manager_t *post_video_get_overlay_manager(xine_video_port_t static void post_video_flush(xine_video_port_t *port_gen) { post_video_port_t *port = (post_video_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->flush(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -148,7 +148,7 @@ static int post_video_status(xine_video_port_t *port_gen, xine_stream_t *stream, int *width, int *height, int64_t *img_duration) { post_video_port_t *port = (post_video_port_t *)port_gen; int status; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); status = port->original_port->status(port->original_port, stream, width, height, img_duration); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -158,7 +158,7 @@ static int post_video_status(xine_video_port_t *port_gen, xine_stream_t *stream, static int post_video_get_property(xine_video_port_t *port_gen, int property) { post_video_port_t *port = (post_video_port_t *)port_gen; int prop; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); prop = port->original_port->get_property(port->original_port, property); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -168,7 +168,7 @@ static int post_video_get_property(xine_video_port_t *port_gen, int property) { static int post_video_set_property(xine_video_port_t *port_gen, int property, int value) { post_video_port_t *port = (post_video_port_t *)port_gen; int val; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); val = port->original_port->set_property(port->original_port, property, value); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -183,21 +183,21 @@ static int post_video_rewire(xine_post_out_t *output_gen, void *data) { post_plugin_t *this = output->post; int64_t img_duration; int width, height; - + if (!new_port) return 0; - + this->running_ticket->revoke(this->running_ticket, 1); - + if (input_port->original_port->status(input_port->original_port, input_port->stream, &width, &height, &img_duration)) { (new_port->open) (new_port, input_port->stream); input_port->original_port->close(input_port->original_port, input_port->stream); } input_port->original_port = new_port; - + this->running_ticket->issue(this->running_ticket, 1); - + return 1; } @@ -205,10 +205,10 @@ static int post_video_rewire(xine_post_out_t *output_gen, void *data) { post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_port_t *original, post_in_t **input, post_out_t **output) { post_video_port_t *port = calloc(1, sizeof(post_video_port_t)); - + if (!port) return NULL; - + port->new_port.get_capabilities = post_video_get_capabilities; port->new_port.open = post_video_open; port->new_port.get_frame = post_video_get_frame; @@ -222,15 +222,15 @@ post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_ port->new_port.get_property = post_video_get_property; port->new_port.set_property = post_video_set_property; port->new_port.driver = original->driver; - + port->original_port = original; port->new_frame = &port->frame_storage; port->new_manager = &port->manager_storage; port->post = post; - + pthread_mutex_init(&port->usage_lock, NULL); pthread_mutex_init(&port->free_frames_lock, NULL); - + if (input) { *input = calloc(1, sizeof(post_in_t)); if (!*input) return port; @@ -240,7 +240,7 @@ post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_ (*input)->post = post; xine_list_push_back(post->input, *input); } - + if (output) { *output = calloc(1, sizeof(post_out_t)); if (!*output) return port; @@ -252,7 +252,7 @@ post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_ (*output)->user_data = port; xine_list_push_back(post->output, *output); } - + return port; } @@ -260,7 +260,7 @@ post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_ /* dummy intercept functions for frames */ static void post_frame_free(vo_frame_t *vo_img) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); if (--vo_img->lock_counter == 0) { /* this frame is free */ @@ -279,7 +279,7 @@ static void post_frame_free(vo_frame_t *vo_img) { static void post_frame_proc_slice(vo_frame_t *vo_img, uint8_t **src) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); _x_post_frame_copy_down(vo_img, vo_img->next); vo_img->next->proc_slice(vo_img->next, src); @@ -289,7 +289,7 @@ static void post_frame_proc_slice(vo_frame_t *vo_img, uint8_t **src) { static void post_frame_proc_frame(vo_frame_t *vo_img) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); _x_post_frame_copy_down(vo_img, vo_img->next); vo_img->next->proc_frame(vo_img->next); @@ -299,7 +299,7 @@ static void post_frame_proc_frame(vo_frame_t *vo_img) { static void post_frame_field(vo_frame_t *vo_img, int which_field) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); _x_post_frame_copy_down(vo_img, vo_img->next); vo_img->next->field(vo_img->next, which_field); @@ -310,7 +310,7 @@ static void post_frame_field(vo_frame_t *vo_img, int which_field) { static int post_frame_draw(vo_frame_t *vo_img, xine_stream_t *stream) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); int skip; - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); _x_post_frame_copy_down(vo_img, vo_img->next); skip = vo_img->next->draw(vo_img->next, stream); @@ -321,7 +321,7 @@ static int post_frame_draw(vo_frame_t *vo_img, xine_stream_t *stream) { static void post_frame_lock(vo_frame_t *vo_img) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); _x_post_frame_copy_down(vo_img, vo_img->next); vo_img->lock_counter++; @@ -332,7 +332,7 @@ static void post_frame_lock(vo_frame_t *vo_img) { static void post_frame_dispose(vo_frame_t *vo_img) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); vo_img = _x_post_restore_video_frame(vo_img, port); vo_img->dispose(vo_img); @@ -343,7 +343,7 @@ static void post_frame_dispose(vo_frame_t *vo_img) { vo_frame_t *_x_post_intercept_video_frame(vo_frame_t *frame, post_video_port_t *port) { vo_frame_t *new_frame; - + /* get a free frame slot */ pthread_mutex_lock(&port->free_frames_lock); if (port->free_frame_slots) { @@ -353,14 +353,14 @@ vo_frame_t *_x_post_intercept_video_frame(vo_frame_t *frame, post_video_port_t * new_frame = calloc(1, sizeof(vo_frame_t)); } pthread_mutex_unlock(&port->free_frames_lock); - + /* make a copy and attach the original */ xine_fast_memcpy(new_frame, frame, sizeof(vo_frame_t)); new_frame->next = frame; if (new_frame->stream) _x_refcounter_inc(new_frame->stream->refcounter); - + /* modify the frame with the intercept functions */ new_frame->port = &port->new_port; new_frame->proc_frame = @@ -377,7 +377,7 @@ vo_frame_t *_x_post_intercept_video_frame(vo_frame_t *frame, post_video_port_t * port->new_frame->free ? port->new_frame->free : post_frame_free; new_frame->dispose = port->new_frame->dispose ? port->new_frame->dispose : post_frame_dispose; - + if (!port->new_frame->draw) { /* draw will most likely modify the frame, so the decoder * should only request preprocessing when there is no new draw */ @@ -386,17 +386,17 @@ vo_frame_t *_x_post_intercept_video_frame(vo_frame_t *frame, post_video_port_t * if (frame->proc_slice && !new_frame->proc_slice) new_frame->proc_slice = post_frame_proc_slice; } - + return new_frame; } vo_frame_t *_x_post_restore_video_frame(vo_frame_t *frame, post_video_port_t *port) { /* the first attched context is the original frame */ vo_frame_t *original = frame->next; - + /* propagate any changes */ _x_post_frame_copy_down(frame, original); - + if (frame->stream) _x_refcounter_dec(frame->stream->refcounter); @@ -405,7 +405,7 @@ vo_frame_t *_x_post_restore_video_frame(vo_frame_t *frame, post_video_port_t *po frame->next = port->free_frame_slots; port->free_frame_slots = frame; pthread_mutex_unlock(&port->free_frames_lock); - + return original; } @@ -446,7 +446,7 @@ void _x_post_frame_copy_up(vo_frame_t *to, vo_frame_t *from) { to->vpts = from->vpts; to->duration = from->duration; to->stream = from->stream; - + if (to->extra_info != from->extra_info) _x_extra_info_merge(to->extra_info, from->extra_info); } @@ -462,14 +462,14 @@ void _x_post_frame_u_turn(vo_frame_t *frame, xine_stream_t *stream) { if (stream) { _x_extra_info_merge(frame->extra_info, stream->video_decoder_extra_info); stream->metronom->got_video_frame(stream->metronom, frame); - } + } } /* dummy intercept functions that just pass the call on to the original overlay manager */ static void post_overlay_init(video_overlay_manager_t *ovl_gen) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); port->original_manager->init(port->original_manager); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -477,7 +477,7 @@ static void post_overlay_init(video_overlay_manager_t *ovl_gen) { static void post_overlay_dispose(video_overlay_manager_t *ovl_gen) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); port->original_manager->dispose(port->original_manager); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -486,7 +486,7 @@ static void post_overlay_dispose(video_overlay_manager_t *ovl_gen) { static int32_t post_overlay_get_handle(video_overlay_manager_t *ovl_gen, int object_type) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); int32_t handle; - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); handle = port->original_manager->get_handle(port->original_manager, object_type); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -495,7 +495,7 @@ static int32_t post_overlay_get_handle(video_overlay_manager_t *ovl_gen, int obj static void post_overlay_free_handle(video_overlay_manager_t *ovl_gen, int32_t handle) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); port->original_manager->free_handle(port->original_manager, handle); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -504,7 +504,7 @@ static void post_overlay_free_handle(video_overlay_manager_t *ovl_gen, int32_t h static int32_t post_overlay_add_event(video_overlay_manager_t *ovl_gen, void *event) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); int32_t result; - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); result = port->original_manager->add_event(port->original_manager, event); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -513,7 +513,7 @@ static int32_t post_overlay_add_event(video_overlay_manager_t *ovl_gen, void *ev static void post_overlay_flush_events(video_overlay_manager_t *ovl_gen) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); port->original_manager->flush_events(port->original_manager); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -522,17 +522,17 @@ static void post_overlay_flush_events(video_overlay_manager_t *ovl_gen) { static int post_overlay_redraw_needed(video_overlay_manager_t *ovl_gen, int64_t vpts) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); int redraw; - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); redraw = port->original_manager->redraw_needed(port->original_manager, vpts); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); return redraw; } -static void post_overlay_multiple_overlay_blend(video_overlay_manager_t *ovl_gen, int64_t vpts, +static void post_overlay_multiple_overlay_blend(video_overlay_manager_t *ovl_gen, int64_t vpts, vo_driver_t *output, vo_frame_t *vo_img, int enabled) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); port->original_manager->multiple_overlay_blend(port->original_manager, vpts, output, vo_img, enabled); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -556,7 +556,7 @@ void _x_post_intercept_overlay_manager(video_overlay_manager_t *original, post_v port->new_manager->redraw_needed = post_overlay_redraw_needed; if (!port->new_manager->multiple_overlay_blend) port->new_manager->multiple_overlay_blend = post_overlay_multiple_overlay_blend; - + port->original_manager = original; } @@ -565,7 +565,7 @@ void _x_post_intercept_overlay_manager(video_overlay_manager_t *original, post_v static uint32_t post_audio_get_capabilities(xine_audio_port_t *port_gen) { post_audio_port_t *port = (post_audio_port_t *)port_gen; uint32_t caps; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); caps = port->original_port->get_capabilities(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -575,7 +575,7 @@ static uint32_t post_audio_get_capabilities(xine_audio_port_t *port_gen) { static int post_audio_get_property(xine_audio_port_t *port_gen, int property) { post_audio_port_t *port = (post_audio_port_t *)port_gen; int prop; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); prop = port->original_port->get_property(port->original_port, property); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -585,7 +585,7 @@ static int post_audio_get_property(xine_audio_port_t *port_gen, int property) { static int post_audio_set_property(xine_audio_port_t *port_gen, int property, int value) { post_audio_port_t *port = (post_audio_port_t *)port_gen; int val; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); val = port->original_port->set_property(port->original_port, property, value); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -596,7 +596,7 @@ static int post_audio_open(xine_audio_port_t *port_gen, xine_stream_t *stream, uint32_t bits, uint32_t rate, int mode) { post_audio_port_t *port = (post_audio_port_t *)port_gen; int result; - + _x_post_rewire(port->post); _x_post_inc_usage(port); if (port->port_lock) pthread_mutex_lock(port->port_lock); @@ -612,7 +612,7 @@ static int post_audio_open(xine_audio_port_t *port_gen, xine_stream_t *stream, static audio_buffer_t *post_audio_get_buffer(xine_audio_port_t *port_gen) { post_audio_port_t *port = (post_audio_port_t *)port_gen; audio_buffer_t *buf; - + _x_post_rewire(port->post); if (port->port_lock) pthread_mutex_lock(port->port_lock); buf = port->original_port->get_buffer(port->original_port); @@ -623,15 +623,15 @@ static audio_buffer_t *post_audio_get_buffer(xine_audio_port_t *port_gen) { static void post_audio_put_buffer(xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { post_audio_port_t *port = (post_audio_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->put_buffer(port->original_port, buf, stream); if (port->port_lock) pthread_mutex_unlock(port->port_lock); } - + static void post_audio_close(xine_audio_port_t *port_gen, xine_stream_t *stream) { post_audio_port_t *port = (post_audio_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->close(port->original_port, stream); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -641,7 +641,7 @@ static void post_audio_close(xine_audio_port_t *port_gen, xine_stream_t *stream) static void post_audio_exit(xine_audio_port_t *port_gen) { post_audio_port_t *port = (post_audio_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->exit(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -665,7 +665,7 @@ static int post_audio_control(xine_audio_port_t *port_gen, int cmd, ...) { static void post_audio_flush(xine_audio_port_t *port_gen) { post_audio_port_t *port = (post_audio_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->flush(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -675,7 +675,7 @@ static int post_audio_status(xine_audio_port_t *port_gen, xine_stream_t *stream, uint32_t *bits, uint32_t *rate, int *mode) { post_audio_port_t *port = (post_audio_port_t *)port_gen; int result; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); result = port->original_port->status(port->original_port, stream, bits, rate, mode); *bits = port->bits; @@ -693,31 +693,31 @@ static int post_audio_rewire(xine_post_out_t *output_gen, void *data) { post_plugin_t *this = output->post; uint32_t bits, rate; int mode; - + if (!new_port) return 0; - + this->running_ticket->revoke(this->running_ticket, 1); - + if (input_port->original_port->status(input_port->original_port, input_port->stream, &bits, &rate, &mode)) { (new_port->open) (new_port, input_port->stream, bits, rate, mode); input_port->original_port->close(input_port->original_port, input_port->stream); } input_port->original_port = new_port; - + this->running_ticket->issue(this->running_ticket, 1); - + return 1; } post_audio_port_t *_x_post_intercept_audio_port(post_plugin_t *post, xine_audio_port_t *original, post_in_t **input, post_out_t **output) { post_audio_port_t *port = calloc(1, sizeof(post_audio_port_t)); - + if (!port) return NULL; - + port->new_port.open = post_audio_open; port->new_port.get_buffer = post_audio_get_buffer; port->new_port.put_buffer = post_audio_put_buffer; @@ -729,12 +729,12 @@ post_audio_port_t *_x_post_intercept_audio_port(post_plugin_t *post, xine_audio_ port->new_port.control = post_audio_control; port->new_port.flush = post_audio_flush; port->new_port.status = post_audio_status; - + port->original_port = original; port->post = post; - + pthread_mutex_init(&port->usage_lock, NULL); - + if (input) { *input = calloc(1, sizeof(post_in_t)); if (!*input) return port; @@ -744,7 +744,7 @@ post_audio_port_t *_x_post_intercept_audio_port(post_plugin_t *post, xine_audio_ (*input)->post = post; xine_list_push_back(post->input, *input); } - + if (output) { *output = calloc(1, sizeof(post_out_t)); if (!*output) return port; @@ -756,14 +756,14 @@ post_audio_port_t *_x_post_intercept_audio_port(post_plugin_t *post, xine_audio_ (*output)->user_data = port; xine_list_push_back(post->output, *output); } - + return port; } int _x_post_dispose(post_plugin_t *this) { int i, in_use = 0; - + /* acquire all usage locks */ for (i = 0; this->xine_post.audio_input[i]; i++) { post_audio_port_t *port = (post_audio_port_t *)this->xine_post.audio_input[i]; @@ -773,11 +773,11 @@ int _x_post_dispose(post_plugin_t *this) { post_video_port_t *port = (post_video_port_t *)this->xine_post.video_input[i]; pthread_mutex_lock(&port->usage_lock); } - + /* we can set this witout harm, because it is always checked with * usage lock held */ this->dispose_pending = 1; - + /* check counters */ for (i = 0; this->xine_post.audio_input[i]; i++) { post_audio_port_t *port = (post_audio_port_t *)this->xine_post.audio_input[i]; @@ -793,7 +793,7 @@ int _x_post_dispose(post_plugin_t *this) { break; } } - + /* free the locks */ for (i = 0; this->xine_post.audio_input[i]; i++) { post_audio_port_t *port = (post_audio_port_t *)this->xine_post.audio_input[i]; @@ -803,20 +803,20 @@ int _x_post_dispose(post_plugin_t *this) { post_video_port_t *port = (post_video_port_t *)this->xine_post.video_input[i]; pthread_mutex_unlock(&port->usage_lock); } - + if (!in_use) { xine_post_in_t *input; xine_post_out_t *output; xine_list_iterator_t ite; - + /* we can really dispose it */ - + free(this->xine_post.audio_input); free(this->xine_post.video_input); /* these were allocated in the plugin loader */ free(this->input_ids); free(this->output_ids); - + for (ite = xine_list_front(this->input); ite; ite = xine_list_next(this->input, ite)) { input = xine_list_get_value(this->input, ite); @@ -825,16 +825,16 @@ int _x_post_dispose(post_plugin_t *this) { { post_video_port_t *port = (post_video_port_t *)input->data; vo_frame_t *first, *second; - + pthread_mutex_destroy(&port->usage_lock); pthread_mutex_destroy(&port->free_frames_lock); - + second = NULL; for (first = port->free_frame_slots; first; second = first, first = first->next) free(second); free(second); - + free(port); free(input); } @@ -842,9 +842,9 @@ int _x_post_dispose(post_plugin_t *this) { case XINE_POST_DATA_AUDIO: { post_audio_port_t *port = (post_audio_port_t *)input->data; - + pthread_mutex_destroy(&port->usage_lock); - + free(port); free(input); } @@ -867,18 +867,18 @@ int _x_post_dispose(post_plugin_t *this) { break; } } - + xine_list_delete(this->input); xine_list_delete(this->output); - + /* since the plugin loader does not know, when the plugin gets disposed, * we have to handle the reference counter here */ pthread_mutex_lock(&this->xine->plugin_catalog->lock); ((plugin_node_t *)this->node)->ref--; pthread_mutex_unlock(&this->xine->plugin_catalog->lock); - + return 1; } - + return 0; } diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h index b06c7930a..d37c52908 100644 --- a/src/xine-engine/post.h +++ b/src/xine-engine/post.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 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 @@ -53,14 +53,14 @@ struct post_class_s { post_plugin_t* (*open_plugin) (post_class_t *this, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); - + /* * return short, human readable identifier for this plugin class */ char* (*get_identifier) (post_class_t *this); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ char* (*get_description) (post_class_t *this); @@ -76,25 +76,25 @@ struct post_plugin_s { /* public part of the plugin */ xine_post_t xine_post; - + /* * the connections announced by the plugin * the plugin must fill these with xine_post_{in,out}_t on init */ xine_list_t *input; xine_list_t *output; - + /* * close down, free all resources */ void (*dispose) (post_plugin_t *this); - + /* has dispose been called */ int dispose_pending; - + /* plugins don't have to init the stuff below */ - - /* + + /* * the running ticket * * the plugin must assure to check for ticket revocation in @@ -105,11 +105,11 @@ struct post_plugin_s { * the running ticket is assigned to you by the engine */ xine_ticket_t *running_ticket; - + /* this is needed by the engine to decrement the reference counter * on disposal of the plugin, but since this is useful, we expose it */ xine_t *xine; - + /* used when the user requests a list of all inputs/outputs */ const char **input_ids; const char **output_ids; @@ -125,10 +125,10 @@ struct post_in_s { /* public part of the input */ xine_post_in_t xine_in; - + /* backward reference so that you have access to the post plugin */ post_plugin_t *post; - + /* you can fill this to your liking */ void *user_data; }; @@ -137,10 +137,10 @@ struct post_out_s { /* public part of the output */ xine_post_out_t xine_out; - + /* backward reference so that you have access to the post plugin */ post_plugin_t *post; - + /* you can fill this to your liking */ void *user_data; }; @@ -164,52 +164,52 @@ struct post_video_port_s { /* the new public port with replaced function pointers */ xine_video_port_t new_port; - + /* the original port to call its functions from inside yours */ xine_video_port_t *original_port; - + /* if you want to decide yourself, whether a given frame should * be intercepted, fill in this function; get_frame() acts as * a template method and asks your function; return a boolean; * the default is to intercept all frames */ int (*intercept_frame)(post_video_port_t *self, vo_frame_t *frame); - + /* the new frame function pointers */ vo_frame_t *new_frame; - + /* if you want to decide yourself, whether the overlay manager should * be intercepted, fill in this function; get_overlay_manager() acts as * a template method and asks your function; return a boolean; * the default is _not_ to intercept the overlay manager */ int (*intercept_ovl)(post_video_port_t *self); - + /* the new public overlay manager with replaced function pointers */ video_overlay_manager_t *new_manager; - + /* the original manager to call its functions from inside yours */ video_overlay_manager_t *original_manager; - + /* usage counter: how many objects are floating around that need * these pointers to exist */ int usage_count; pthread_mutex_t usage_lock; - + /* the stream we are being fed by; NULL means no stream is connected; * this may be an anonymous stream */ xine_stream_t *stream; - + /* point to a mutex here, if you need some synchronization */ pthread_mutex_t *port_lock; pthread_mutex_t *frame_lock; pthread_mutex_t *manager_lock; - + /* backward reference so that you have access to the post plugin * when the call only gives you the port */ post_plugin_t *post; - + /* you can fill this to your liking */ void *user_data; - + #ifdef POST_INTERNAL /* some of the above members are to be directly included here, but * adding the structures would mean that post_video_port_t becomes @@ -217,13 +217,13 @@ struct post_video_port_s { * above and have them point into the memory provided here; * note that the overlay manager needs to be first so that we can * reconstruct the post_video_port_t* from overlay manager calls */ - + /* any change here requires a change in _x_post_ovl_manager_to_port() * below! */ - + video_overlay_manager_t manager_storage; vo_frame_t frame_storage; - + /* this is used to keep a linked list of free vo_frame_t's */ vo_frame_t *free_frame_slots; pthread_mutex_t free_frames_lock; @@ -283,31 +283,31 @@ struct post_audio_port_s { /* the new public port with replaced function pointers */ xine_audio_port_t new_port; - + /* the original port to call its functions from inside yours */ xine_audio_port_t *original_port; - + /* usage counter: how many objects are floating around that need * these pointers to exist */ int usage_count; pthread_mutex_t usage_lock; - + /* the stream we are being fed by; NULL means no stream is connected; * this may be an anonymous stream */ xine_stream_t *stream; - + /* some values remembered by port->open() */ uint32_t bits; uint32_t rate; uint32_t mode; - + /* point to a mutex here, if you need some synchronization */ pthread_mutex_t *port_lock; - + /* backward reference so that you have access to the post plugin * when the call only gives you the port */ post_plugin_t *post; - + /* you can fill this to your liking */ void *user_data; }; @@ -369,7 +369,7 @@ do { \ } while(0) -/* macros to create parameter descriptors */ +/* macros to create parameter descriptors */ #define START_PARAM_DESCR( param_t ) \ static param_t temp_s; \ diff --git a/src/xine-engine/refcounter.c b/src/xine-engine/refcounter.c index 384bdf5ed..23da4bdbc 100644 --- a/src/xine-engine/refcounter.c +++ b/src/xine-engine/refcounter.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 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 @@ -27,7 +27,7 @@ /* #define LOG */ - + #include "xine_internal.h" #include "refcounter.h" @@ -53,7 +53,7 @@ int _x_refcounter_inc(refcounter_t *refcounter) _x_abort(); res = ++refcounter->count; pthread_mutex_unlock(&refcounter->lock); - + return res; } @@ -68,7 +68,7 @@ int _x_refcounter_dec(refcounter_t *refcounter) lprintf("calling destructor of object %p\n", refcounter->object); refcounter->destructor(refcounter->object); } - + return res; } diff --git a/src/xine-engine/refcounter.h b/src/xine-engine/refcounter.h index b3ddd71fc..f157d8b6c 100644 --- a/src/xine-engine/refcounter.h +++ b/src/xine-engine/refcounter.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 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 diff --git a/src/xine-engine/resample.c b/src/xine-engine/resample.c index 43911c401..dcf14a215 100644 --- a/src/xine-engine/resample.c +++ b/src/xine-engine/resample.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 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 @@ -30,7 +30,7 @@ /* contributed by paul flinders */ void _x_audio_out_resample_mono(int16_t *last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) { unsigned int osample; @@ -54,11 +54,11 @@ void _x_audio_out_resample_mono(int16_t *last_sample, int s2; int16_t os; uint32_t t = isample&0xffff; - + /* don't "optimize" the (isample >> 16)*2 to (isample >> 15) */ s1 = input_samples[(isample >> 16)]; s2 = input_samples[(isample >> 16)+1]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[osample] = os; @@ -68,7 +68,7 @@ void _x_audio_out_resample_mono(int16_t *last_sample, } void _x_audio_out_resample_stereo(int16_t *last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) { unsigned int osample; @@ -93,17 +93,17 @@ void _x_audio_out_resample_stereo(int16_t *last_sample, int s2; int16_t os; uint32_t t = isample&0xffff; - + /* don't "optimize" the (isample >> 16)*2 to (isample >> 15) */ s1 = input_samples[(isample >> 16)*2]; s2 = input_samples[(isample >> 16)*2+2]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[osample * 2] = os; s1 = input_samples[(isample >> 16)*2+1]; s2 = input_samples[(isample >> 16)*2+3]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 2 )+1] = os; isample += istep; @@ -113,7 +113,7 @@ void _x_audio_out_resample_stereo(int16_t *last_sample, void _x_audio_out_resample_4channel(int16_t *last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) { unsigned int osample; @@ -140,29 +140,29 @@ void _x_audio_out_resample_4channel(int16_t *last_sample, int s2; int16_t os; uint32_t t = isample&0xffff; - + /* don't "optimize" the (isample >> 16)*2 to (isample >> 15) */ s1 = input_samples[(isample >> 16)*4]; s2 = input_samples[(isample >> 16)*4+4]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[osample * 4] = os; s1 = input_samples[(isample >> 16)*4+1]; s2 = input_samples[(isample >> 16)*4+5]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 4 )+1] = os; s1 = input_samples[(isample >> 16)*4+2]; s2 = input_samples[(isample >> 16)*4+6]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 4 )+2] = os; s1 = input_samples[(isample >> 16)*4+3]; s2 = input_samples[(isample >> 16)*4+7]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 4 )+3] = os; @@ -173,7 +173,7 @@ void _x_audio_out_resample_4channel(int16_t *last_sample, void _x_audio_out_resample_5channel(int16_t *last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) { unsigned int osample; @@ -201,35 +201,35 @@ void _x_audio_out_resample_5channel(int16_t *last_sample, int s2; int16_t os; uint32_t t = isample&0xffff; - + /* don't "optimize" the (isample >> 16)*2 to (isample >> 15) */ s1 = input_samples[(isample >> 16)*5]; s2 = input_samples[(isample >> 16)*5+5]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[osample * 5] = os; s1 = input_samples[(isample >> 16)*5+1]; s2 = input_samples[(isample >> 16)*5+6]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 5 )+1] = os; s1 = input_samples[(isample >> 16)*5+2]; s2 = input_samples[(isample >> 16)*5+7]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 5 )+2] = os; s1 = input_samples[(isample >> 16)*5+3]; s2 = input_samples[(isample >> 16)*5+8]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 5 )+3] = os; s1 = input_samples[(isample >> 16)*5+4]; s2 = input_samples[(isample >> 16)*5+9]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 5 )+4] = os; @@ -240,7 +240,7 @@ void _x_audio_out_resample_5channel(int16_t *last_sample, void _x_audio_out_resample_6channel(int16_t *last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) { unsigned int osample; @@ -269,41 +269,41 @@ void _x_audio_out_resample_6channel(int16_t *last_sample, int s2; int16_t os; uint32_t t = isample&0xffff; - + /* don't "optimize" the (isample >> 16)*2 to (isample >> 15) */ s1 = input_samples[(isample >> 16)*6]; s2 = input_samples[(isample >> 16)*6+6]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[osample * 6] = os; s1 = input_samples[(isample >> 16)*6+1]; s2 = input_samples[(isample >> 16)*6+7]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 6 )+1] = os; s1 = input_samples[(isample >> 16)*6+2]; s2 = input_samples[(isample >> 16)*6+8]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 6 )+2] = os; s1 = input_samples[(isample >> 16)*6+3]; s2 = input_samples[(isample >> 16)*6+9]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 6 )+3] = os; s1 = input_samples[(isample >> 16)*6+4]; s2 = input_samples[(isample >> 16)*6+10]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 6 )+4] = os; s1 = input_samples[(isample >> 16)*6+5]; s2 = input_samples[(isample >> 16)*6+11]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 6 )+5] = os; @@ -312,48 +312,48 @@ void _x_audio_out_resample_6channel(int16_t *last_sample, memcpy (last_sample, &input_samples[in_samples*6-6], 6 * sizeof (last_sample[0])); } -void _x_audio_out_resample_8to16(int8_t* input_samples, +void _x_audio_out_resample_8to16(int8_t* input_samples, int16_t* output_samples, uint32_t samples) { while( samples-- ) { int16_t os; - + os = *input_samples++; os = (os - 0x80) << 8; *output_samples++ = os; } } -void _x_audio_out_resample_16to8(int16_t* input_samples, +void _x_audio_out_resample_16to8(int16_t* input_samples, int8_t* output_samples, uint32_t samples) { while( samples-- ) { int16_t os; - + os = *input_samples++; os = (os >> 8) + 0x80; *output_samples++ = os; } } -void _x_audio_out_resample_monotostereo(int16_t* input_samples, +void _x_audio_out_resample_monotostereo(int16_t* input_samples, int16_t* output_samples, uint32_t frames) { while( frames-- ) { int16_t os; - + os = *input_samples++; *output_samples++ = os; *output_samples++ = os; } } -void _x_audio_out_resample_stereotomono(int16_t* input_samples, +void _x_audio_out_resample_stereotomono(int16_t* input_samples, int16_t* output_samples, uint32_t frames) { while( frames-- ) { int16_t os; - + os = (*input_samples++)>>1; os += (*input_samples++)>>1; *output_samples++ = os; diff --git a/src/xine-engine/resample.h b/src/xine-engine/resample.h index 40b4de486..842434cf0 100644 --- a/src/xine-engine/resample.h +++ b/src/xine-engine/resample.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 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 @@ -28,35 +28,35 @@ #define RESAMPLE_MAX_CHANNELS 6 void _x_audio_out_resample_stereo(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; void _x_audio_out_resample_mono(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; void _x_audio_out_resample_4channel(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; void _x_audio_out_resample_5channel(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; void _x_audio_out_resample_6channel(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; -void _x_audio_out_resample_8to16(int8_t* input_samples, +void _x_audio_out_resample_8to16(int8_t* input_samples, int16_t* output_samples, uint32_t samples) XINE_PROTECTED; -void _x_audio_out_resample_16to8(int16_t* input_samples, +void _x_audio_out_resample_16to8(int16_t* input_samples, int8_t* output_samples, uint32_t samples) XINE_PROTECTED; -void _x_audio_out_resample_monotostereo(int16_t* input_samples, +void _x_audio_out_resample_monotostereo(int16_t* input_samples, int16_t* output_samples, uint32_t frames) XINE_PROTECTED; -void _x_audio_out_resample_stereotomono(int16_t* input_samples, +void _x_audio_out_resample_stereotomono(int16_t* input_samples, int16_t* output_samples, uint32_t frames) XINE_PROTECTED; - + #endif diff --git a/src/xine-engine/scratch.c b/src/xine-engine/scratch.c index 980af2f71..39bb5927a 100644 --- a/src/xine-engine/scratch.c +++ b/src/xine-engine/scratch.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 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 @@ -85,14 +85,14 @@ static char **scratch_get_content (scratch_buffer_t *this) { static void scratch_dispose (scratch_buffer_t *this) { int i; - + pthread_mutex_lock (&this->lock); for(i = 0; i < this->num_lines; i++ ) { free(this->ordered[i]); free(this->lines[i]); } - + free (this->lines); free (this->ordered); diff --git a/src/xine-engine/scratch.h b/src/xine-engine/scratch.h index c45af198f..c0c927b97 100644 --- a/src/xine-engine/scratch.h +++ b/src/xine-engine/scratch.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2006 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 diff --git a/src/xine-engine/spu_decoder.h b/src/xine-engine/spu_decoder.h index 66ab5e54a..4897a32a2 100644 --- a/src/xine-engine/spu_decoder.h +++ b/src/xine-engine/spu_decoder.h @@ -4,7 +4,7 @@ * Copyright (C) James Courtier-Dutton James@superbug.demon.co.uk - July 2001 * * This file is part of xine, a unix 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 @@ -14,10 +14,10 @@ * 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, + * the Free Software Foundation, * */ @@ -47,30 +47,30 @@ struct spu_decoder_class_s { * open a new instance of this plugin class */ spu_decoder_t* (*open_plugin) (spu_decoder_class_t *this, xine_stream_t *stream); - + /* * return short, human readable identifier for this plugin class */ char* (*get_identifier) (spu_decoder_class_t *this); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ char* (*get_description) (spu_decoder_class_t *this); - + /* * free all class-related resources */ void (*dispose) (spu_decoder_class_t *this); }; - - + + struct spu_decoder_s { /* * decode data from buf and feed the overlay to overlay manager - */ + */ void (*decode_data) (spu_decoder_t *this, buf_element_t *buf); /* @@ -78,7 +78,7 @@ struct spu_decoder_s { * SPU data not related to recently decoded data) */ void (*reset) (spu_decoder_t *this); - + /* * inform decoder that a time reference discontinuity has happened. * that is, it must forget any currently held pts value diff --git a/src/xine-engine/tvmode.c b/src/xine-engine/tvmode.c index 099bdb808..1d6660f4f 100644 --- a/src/xine-engine/tvmode.c +++ b/src/xine-engine/tvmode.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 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 diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index d3c9e0d34..0756fc5b2 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2005 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 @@ -45,13 +45,13 @@ static void update_spu_decoder (xine_stream_t *stream, int type) { int streamtype = (type>>16) & 0xFF; - + if( stream->spu_decoder_streamtype != streamtype || !stream->spu_decoder_plugin ) { - + if (stream->spu_decoder_plugin) _x_free_spu_decoder (stream, stream->spu_decoder_plugin); - + stream->spu_decoder_streamtype = streamtype; stream->spu_decoder_plugin = _x_get_spu_decoder (stream, streamtype); @@ -63,27 +63,27 @@ int _x_spu_decoder_sleep(xine_stream_t *stream, int64_t next_spu_vpts) { int64_t time, wait; int thread_vacant = 1; - + /* we wait until one second before the next SPU is due */ next_spu_vpts -= 90000; - + do { if (next_spu_vpts) time = stream->xine->clock->get_current_time(stream->xine->clock); else time = 0; - + /* wait in pieces of one half second */ if (next_spu_vpts - time < SPU_SLEEP_INTERVAL) wait = next_spu_vpts - time; else wait = SPU_SLEEP_INTERVAL; - + if (wait > 0) xine_usec_sleep(wait * 11); - + if (stream->xine->port_ticket->ticket_revoked) stream->xine->port_ticket->renew(stream->xine->port_ticket, 0); - + /* never wait, if we share the thread with a video decoder */ thread_vacant = !stream->video_decoder_plugin; /* we have to return if video out calls for the decoder */ @@ -92,9 +92,9 @@ int _x_spu_decoder_sleep(xine_stream_t *stream, int64_t next_spu_vpts) /* we have to return if the demuxer needs us to release a buffer */ if (thread_vacant) thread_vacant = !stream->demux_action_pending; - + } while (wait == SPU_SLEEP_INTERVAL && thread_vacant); - + return thread_vacant; } @@ -117,7 +117,7 @@ static void *video_decoder_loop (void *stream_gen) { */ nice(-1); #endif /* WIN32 */ - + if (prof_video_decode == -1) prof_video_decode = xine_profiler_allocate_slot ("video decoder"); if (prof_spu_decode == -1) @@ -125,15 +125,15 @@ static void *video_decoder_loop (void *stream_gen) { while (running) { - lprintf ("getting buffer...\n"); + lprintf ("getting buffer...\n"); buf = stream->video_fifo->get (stream->video_fifo); - + _x_extra_info_merge( stream->video_decoder_extra_info, buf->extra_info ); stream->video_decoder_extra_info->seek_count = stream->video_seek_count; - - lprintf ("got buffer 0x%08x\n", buf->type); - + + lprintf ("got buffer 0x%08x\n", buf->type); + switch (buf->type & 0xffff0000) { case BUF_CONTROL_HEADERS_DONE: pthread_mutex_lock (&stream->counter_lock); @@ -143,34 +143,34 @@ static void *video_decoder_loop (void *stream_gen) { break; case BUF_CONTROL_START: - + /* decoder dispose might call port functions */ running_ticket->acquire(running_ticket, 0); - + if (stream->video_decoder_plugin) { _x_free_video_decoder (stream, stream->video_decoder_plugin); stream->video_decoder_plugin = NULL; } - + if (stream->spu_decoder_plugin) { _x_free_spu_decoder (stream, stream->spu_decoder_plugin); stream->spu_decoder_plugin = NULL; stream->spu_track_map_entries = 0; } - + running_ticket->release(running_ticket, 0); - + if( !(buf->decoder_flags & BUF_FLAG_GAPLESS_SW) ) - stream->metronom->handle_video_discontinuity (stream->metronom, + stream->metronom->handle_video_discontinuity (stream->metronom, DISC_STREAMSTART, 0); - + buftype_unknown = 0; break; case BUF_CONTROL_SPU_CHANNEL: { xine_event_t ui_event; - + /* We use widescreen spu as the auto selection, because widescreen * display is common. SPU decoders can choose differently if it suits * them. */ @@ -179,7 +179,7 @@ static void *video_decoder_loop (void *stream_gen) { stream->spu_channel_pan_scan = buf->decoder_info[2]; if (stream->spu_channel_user == -1) stream->spu_channel = stream->spu_channel_auto; - + /* Inform UI of SPU channel changes */ ui_event.type = XINE_EVENT_UI_CHANNELS_CHANGED; ui_event.data_length = 0; @@ -189,7 +189,7 @@ static void *video_decoder_loop (void *stream_gen) { break; case BUF_CONTROL_END: - + /* flush decoder frames if stream finished naturally (non-user stop) */ if( buf->decoder_flags ) { running_ticket->acquire(running_ticket, 0); @@ -210,12 +210,12 @@ static void *video_decoder_loop (void *stream_gen) { */ while(1) { int num_bufs, num_streams; - + running_ticket->acquire(running_ticket, 0); num_bufs = stream->video_out->get_property(stream->video_out, VO_PROP_BUFS_IN_FIFO); num_streams = stream->video_out->get_property(stream->video_out, VO_PROP_NUM_STREAMS); running_ticket->release(running_ticket, 0); - + if( num_bufs > 0 && num_streams == 1 && !stream->early_finish_event && stream->master == stream ) xine_usec_sleep (10000); @@ -229,7 +229,7 @@ static void *video_decoder_loop (void *stream_gen) { stream->finished_count_video++; - lprintf ("reached end marker # %d\n", + lprintf ("reached end marker # %d\n", stream->finished_count_video); pthread_cond_broadcast (&stream->counter_changed); @@ -246,7 +246,7 @@ static void *video_decoder_loop (void *stream_gen) { pthread_cond_timedwait (&stream->counter_changed, &stream->counter_lock, &ts); } } - + pthread_mutex_unlock (&stream->counter_lock); /* Wake up xine_play if it's waiting for a frame */ @@ -261,7 +261,7 @@ static void *video_decoder_loop (void *stream_gen) { case BUF_CONTROL_QUIT: /* decoder dispose might call port functions */ running_ticket->acquire(running_ticket, 0); - + if (stream->video_decoder_plugin) { _x_free_video_decoder (stream, stream->video_decoder_plugin); stream->video_decoder_plugin = NULL; @@ -297,7 +297,7 @@ static void *video_decoder_loop (void *stream_gen) { running_ticket->release(running_ticket, 0); } break; - + case BUF_CONTROL_DISCONTINUITY: lprintf ("discontinuity ahead\n"); @@ -309,11 +309,11 @@ static void *video_decoder_loop (void *stream_gen) { stream->video_decoder_plugin->discontinuity (stream->video_decoder_plugin); running_ticket->release(running_ticket, 0); } - + stream->metronom->handle_video_discontinuity (stream->metronom, DISC_RELATIVE, buf->disc_off); break; - + case BUF_CONTROL_NEWPTS: lprintf ("new pts %"PRId64"\n", buf->disc_off); @@ -325,14 +325,14 @@ static void *video_decoder_loop (void *stream_gen) { stream->video_decoder_plugin->discontinuity (stream->video_decoder_plugin); running_ticket->release(running_ticket, 0); } - + if (buf->decoder_flags & BUF_FLAG_SEEK) { stream->metronom->handle_video_discontinuity (stream->metronom, DISC_STREAMSEEK, buf->disc_off); } else { stream->metronom->handle_video_discontinuity (stream->metronom, DISC_ABSOLUTE, buf->disc_off); - } + } break; - + case BUF_CONTROL_AUDIO_CHANNEL: { xine_event_t ui_event; @@ -345,7 +345,7 @@ static void *video_decoder_loop (void *stream_gen) { case BUF_CONTROL_NOP: break; - + default: if ( (buf->type & 0xFF000000) == BUF_VIDEO_BASE ) { @@ -354,43 +354,43 @@ static void *video_decoder_loop (void *stream_gen) { break; xine_profiler_start_count (prof_video_decode); - + running_ticket->acquire(running_ticket, 0); - + /* - printf ("video_decoder: got package %d, decoder_info[0]:%d\n", + printf ("video_decoder: got package %d, decoder_info[0]:%d\n", buf, buf->decoder_info[0]); - */ - + */ + streamtype = (buf->type>>16) & 0xFF; - + if( buf->type != buftype_unknown && (stream->video_decoder_streamtype != streamtype || !stream->video_decoder_plugin) ) { - + if (stream->video_decoder_plugin) { _x_free_video_decoder (stream, stream->video_decoder_plugin); } - + stream->video_decoder_streamtype = streamtype; stream->video_decoder_plugin = _x_get_video_decoder (stream, streamtype); - + _x_stream_info_set(stream, XINE_STREAM_INFO_VIDEO_HANDLED, (stream->video_decoder_plugin != NULL)); } if (stream->video_decoder_plugin) - stream->video_decoder_plugin->decode_data (stream->video_decoder_plugin, buf); - - if (buf->type != buftype_unknown && + stream->video_decoder_plugin->decode_data (stream->video_decoder_plugin, buf); + + if (buf->type != buftype_unknown && !_x_stream_info_get(stream, XINE_STREAM_INFO_VIDEO_HANDLED)) { - xine_log (stream->xine, XINE_LOG_MSG, + xine_log (stream->xine, XINE_LOG_MSG, _("video_decoder: no plugin available to handle '%s'\n"), _x_buf_video_name( buf->type ) ); - + if( !_x_meta_info_get(stream, XINE_META_INFO_VIDEOCODEC)) _x_meta_info_set_utf8(stream, XINE_META_INFO_VIDEOCODEC, _x_buf_video_name( buf->type )); - + buftype_unknown = buf->type; - + /* fatal error - dispose plugin */ if (stream->video_decoder_plugin) { _x_free_video_decoder (stream, stream->video_decoder_plugin); @@ -401,7 +401,7 @@ static void *video_decoder_loop (void *stream_gen) { if (running_ticket->ticket_revoked) running_ticket->renew(running_ticket, 0); running_ticket->release(running_ticket, 0); - + xine_profiler_stop_count (prof_video_decode); } else if ( (buf->type & 0xFF000000) == BUF_SPU_BASE ) { @@ -414,15 +414,15 @@ static void *video_decoder_loop (void *stream_gen) { xine_profiler_start_count (prof_spu_decode); running_ticket->acquire(running_ticket, 0); - + update_spu_decoder(stream, buf->type); /* update track map */ i = 0; - while ( (i<stream->spu_track_map_entries) && (stream->spu_track_map[i]<buf->type) ) + while ( (i<stream->spu_track_map_entries) && (stream->spu_track_map[i]<buf->type) ) i++; - + if ( (i==stream->spu_track_map_entries) || (stream->spu_track_map[i] != buf->type) ) { xine_event_t ui_event; @@ -458,15 +458,15 @@ static void *video_decoder_loop (void *stream_gen) { if (running_ticket->ticket_revoked) running_ticket->renew(running_ticket, 0); running_ticket->release(running_ticket, 0); - + xine_profiler_stop_count (prof_spu_decode); } else if (buf->type != buftype_unknown) { - xine_log (stream->xine, XINE_LOG_MSG, + xine_log (stream->xine, XINE_LOG_MSG, _("video_decoder: error, unknown buffer type: %08x\n"), buf->type ); buftype_unknown = buf->type; } - + break; } @@ -478,13 +478,13 @@ static void *video_decoder_loop (void *stream_gen) { } int _x_video_decoder_init (xine_stream_t *stream) { - + if (stream->video_out == NULL) { stream->video_fifo = _x_dummy_fifo_buffer_new (5, 8192); stream->spu_track_map_entries = 0; return 1; } else { - + pthread_attr_t pth_attrs; struct sched_param pth_params; int err, num_buffers; @@ -495,7 +495,7 @@ int _x_video_decoder_init (xine_stream_t *stream) { * We provide buffers of 8k size instead of 2k for demuxers sending * larger chunks. */ - + num_buffers = stream->xine->config->register_num (stream->xine->config, "engine.buffers.video_num_buffers", 500, @@ -505,15 +505,15 @@ int _x_video_decoder_init (xine_stream_t *stream) { "mean smoother playback for unreliable inputs, but " "also increased latency and memory consumption."), 20, NULL, NULL); - + stream->video_fifo = _x_fifo_buffer_new (num_buffers, 8192); if (stream->video_fifo == NULL) { xine_log(stream->xine, XINE_LOG_MSG, "video_decoder: can't allocated video fifo\n"); return 0; } - + stream->spu_track_map_entries = 0; - + pthread_attr_init(&pth_attrs); pthread_attr_getschedparam(&pth_attrs, &pth_params); pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER); @@ -529,7 +529,7 @@ int _x_video_decoder_init (xine_stream_t *stream) { pthread_attr_destroy(&pth_attrs); return 0; } - + pthread_attr_destroy(&pth_attrs); } return 1; @@ -561,7 +561,7 @@ void _x_video_decoder_shutdown (xine_stream_t *stream) { lprintf ("shutdown...4\n"); } - + stream->video_fifo->dispose (stream->video_fifo); stream->video_fifo = NULL; } diff --git a/src/xine-engine/video_decoder.h b/src/xine-engine/video_decoder.h index 7b13159a3..f7068cc13 100644 --- a/src/xine-engine/video_decoder.h +++ b/src/xine-engine/video_decoder.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 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 @@ -47,14 +47,14 @@ struct video_decoder_class_s { * open a new instance of this plugin class */ video_decoder_t* (*open_plugin) (video_decoder_class_t *this, xine_stream_t *stream); - + /* * return short, human readable identifier for this plugin class */ char* (*get_identifier) (video_decoder_class_t *this); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ char* (*get_description) (video_decoder_class_t *this); @@ -69,8 +69,8 @@ struct video_decoder_class_s { struct video_decoder_s { /* - * decode data from buf and feed decoded frames to - * video output + * decode data from buf and feed decoded frames to + * video output */ void (*decode_data) (video_decoder_t *this, buf_element_t *buf); @@ -79,13 +79,13 @@ struct video_decoder_s { * video data not related to recently decoded data) */ void (*reset) (video_decoder_t *this); - + /* * inform decoder that a time reference discontinuity has happened. * that is, it must forget any currently held pts value */ void (*discontinuity) (video_decoder_t *this); - + /* * flush out any frames that are still stored in the decoder */ @@ -94,7 +94,7 @@ struct video_decoder_s { /* * close down, free all resources */ - void (*dispose) (video_decoder_t *this); + void (*dispose) (video_decoder_t *this); void *node; /*used by plugin loader */ diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index be062cc5d..1ecd59225 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 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 @@ -57,10 +57,10 @@ #define FIRST_FRAME_POLL_DELAY 3000 #define FIRST_FRAME_MAX_POLL 10 /* poll n times at most */ -/* experimental optimization: try to allocate frames from free queue +/* experimental optimization: try to allocate frames from free queue * in the same format as requested (avoid unnecessary free/alloc in * vo driver). up to 25% less cpu load using deinterlace with film mode. - */ + */ #define EXPERIMENTAL_FRAME_QUEUE_OPTIMIZATION 1 static vo_frame_t * crop_frame( xine_video_port_t *this_gen, vo_frame_t *img ); @@ -77,7 +77,7 @@ typedef struct { } img_buf_fifo_t; typedef struct { - + xine_video_port_t vo; /* public part */ vo_driver_t *driver; @@ -86,7 +86,7 @@ typedef struct { metronom_clock_t *clock; xine_list_t *streams; pthread_mutex_t streams_lock; - + img_buf_fifo_t *free_img_buf_queue; img_buf_fifo_t *display_img_buf_queue; @@ -105,7 +105,7 @@ typedef struct { uint32_t redraw_needed:3; int discard_frames; - + pthread_t video_thread; int num_frames_delivered; @@ -118,7 +118,7 @@ typedef struct { int warn_threshold_exceeded; /* pts value when decoder delivered last video frame */ - int64_t last_delivery_pts; + int64_t last_delivery_pts; video_overlay_manager_t *overlay_source; @@ -215,7 +215,7 @@ static vo_frame_t *vo_remove_from_img_buf_queue_int (img_buf_fifo_t *queue, int img = img->next; i++; } - + if( width && height ) { if( !img ) { if( queue->num_buffers == 1 && !blocking && queue->num_buffers_max > 8) { @@ -263,7 +263,7 @@ static vo_frame_t *vo_remove_from_img_buf_queue_int (img_buf_fifo_t *queue, int if( img == queue->last ) queue->last = previous; } - + img->next = NULL; if (!queue->first) { queue->last = NULL; @@ -272,7 +272,7 @@ static vo_frame_t *vo_remove_from_img_buf_queue_int (img_buf_fifo_t *queue, int queue->num_buffers--; } } - + return img; } @@ -303,7 +303,7 @@ static vo_frame_t *vo_remove_from_img_buf_queue_nonblock (img_buf_fifo_t *queue, * functions to maintain lock_counter */ static void vo_frame_inc_lock (vo_frame_t *img) { - + pthread_mutex_lock (&img->mutex); img->lock_counter++; @@ -312,11 +312,11 @@ static void vo_frame_inc_lock (vo_frame_t *img) { } static void vo_frame_dec_lock (vo_frame_t *img) { - + pthread_mutex_lock (&img->mutex); img->lock_counter--; - if (!img->lock_counter) { + if (!img->lock_counter) { vos_t *this = (vos_t *) img->port; if (img->stream) _x_refcounter_dec(img->stream->refcounter); @@ -333,11 +333,11 @@ static void vo_frame_driver_proc(vo_frame_t *img) img->proc_frame(img); } if (img->proc_called) return; - + if (img->proc_slice) { int height = img->height; uint8_t* src[3]; - + switch (img->format) { case XINE_IMGFMT_YV12: src[0] = img->base[0]; @@ -362,7 +362,7 @@ static void vo_frame_driver_proc(vo_frame_t *img) } /* - * + * * functions called by video decoder: * * get_frame => alloc frame for rendering @@ -393,7 +393,7 @@ static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen, /* some decoders report strange ratios */ if (ratio <= 0.0) ratio = (double)width / (double)height; - + pthread_mutex_lock (&img->mutex); img->lock_counter = 1; img->width = width; @@ -418,11 +418,11 @@ static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen, /* let driver ensure this image has the right format */ - this->driver->update_frame_format (this->driver, img, width, height, + this->driver->update_frame_format (this->driver, img, width, height, ratio, format, flags); pthread_mutex_unlock (&img->mutex); - + lprintf ("get_frame (%d x %d) done\n", width, height); return img; @@ -439,11 +439,11 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { /* handle anonymous streams like NULL for easy checking */ if (stream == XINE_ANON_STREAM) stream = NULL; - + img->stream = stream; this->current_width = img->width; this->current_height = img->height; - + if (stream) { _x_refcounter_inc(stream->refcounter); _x_extra_info_merge( img->extra_info, stream->video_decoder_extra_info ); @@ -465,13 +465,13 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { this->num_frames_delivered++; diff = pic_vpts - cur_vpts; - + /* avoid division by zero */ if( img->duration <= 0 ) duration = DEFAULT_FRAME_DURATION; else duration = img->duration; - + /* Frame dropping slow start: * The engine starts to drop frames if there are less than frame_drop_limit * frames in advance. There might be a problem just after a seek because @@ -497,7 +497,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { if (this->display_img_buf_queue->num_buffers >= this->frame_drop_limit || frames_to_skip < 0) frames_to_skip = 0; - + /* Do not drop frames immediately, but remember this as suggestion and give * decoder a further chance to supply frames. * This avoids unnecessary frame drops in situations where there is only @@ -515,7 +515,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { lprintf ("delivery diff : %" PRId64 ", current vpts is %" PRId64 ", %d frames to skip\n", diff, cur_vpts, frames_to_skip); - + } else { frames_to_skip = 0; @@ -528,18 +528,18 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { if (!img->bad_frame) { - + int img_already_locked = 0; xine_list_iterator_t ite; - + /* add cropping requested by frontend */ img->crop_left += this->crop_left; img->crop_right += this->crop_right; img->crop_top += this->crop_top; img->crop_bottom += this->crop_bottom; - + /* perform cropping when vo driver does not support it */ - if( (img->crop_left || img->crop_top || + if( (img->crop_left || img->crop_top || img->crop_right || img->crop_bottom) && (this->grab_only || !(this->driver->get_capabilities (this->driver) & VO_CAP_CROP)) ) { @@ -556,11 +556,11 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { img->crop_bottom = 0; } } - + /* do not call proc_*() for frames that will be dropped */ if( !frames_to_skip && !img->proc_called ) vo_frame_driver_proc(img); - + /* * put frame into FIFO-Buffer */ @@ -594,7 +594,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { if (!img_already_locked) vo_frame_inc_lock( img ); vo_append_to_img_buf_queue (this->display_img_buf_queue, img); - + } else { lprintf ("bad_frame\n"); @@ -626,7 +626,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { /* make sure threshold has being consistently exceeded - 5 times in a row * (that is, this is not just a small burst of dropped frames). */ - send_event = (this->warn_threshold_exceeded == 5 && + send_event = (this->warn_threshold_exceeded == 5 && !this->warn_threshold_event_sent); this->warn_threshold_event_sent = send_event; @@ -635,7 +635,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { ite = xine_list_next(this->streams, ite)) { stream = xine_list_get_value(this->streams, ite); if (stream == XINE_ANON_STREAM) continue; - _x_stream_info_set(stream, XINE_STREAM_INFO_SKIPPED_FRAMES, + _x_stream_info_set(stream, XINE_STREAM_INFO_SKIPPED_FRAMES, 1000 * this->num_frames_skipped / this->num_frames_delivered); _x_stream_info_set(stream, XINE_STREAM_INFO_DISCARDED_FRAMES, 1000 * this->num_frames_discarded / this->num_frames_delivered); @@ -663,8 +663,8 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { if( this->num_frames_skipped || this->num_frames_discarded ) { xine_log(this->xine, XINE_LOG_MSG, - _("%d frames delivered, %d frames skipped, %d frames discarded\n"), - this->num_frames_delivered, + _("%d frames delivered, %d frames skipped, %d frames discarded\n"), + this->num_frames_delivered, this->num_frames_skipped, this->num_frames_discarded); } @@ -672,7 +672,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { this->num_frames_discarded = 0; this->num_frames_skipped = 0; } - + return frames_to_skip; } @@ -682,9 +682,9 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { * */ -/* duplicate_frame(): this function is used to keep playing frames - * while video is still or player paused. - * +/* duplicate_frame(): this function is used to keep playing frames + * while video is still or player paused. + * * frame allocation inside vo loop is dangerous: * we must never wait for a free frame -> deadlock condition. * to avoid deadlocks we don't use vo_remove_from_img_buf_queue() @@ -709,7 +709,7 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) { else { this->free_img_buf_queue->num_buffers--; } - + pthread_mutex_lock (&dupl->mutex); dupl->lock_counter = 1; dupl->width = img->width; @@ -726,16 +726,16 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) { dupl->crop_bottom = img->crop_bottom; dupl->overlay_offset_x = img->overlay_offset_x; dupl->overlay_offset_y = img->overlay_offset_y; - - this->driver->update_frame_format (this->driver, dupl, dupl->width, dupl->height, + + this->driver->update_frame_format (this->driver, dupl, dupl->width, dupl->height, dupl->ratio, dupl->format, dupl->flags); pthread_mutex_unlock (&dupl->mutex); - + if (dupl->proc_duplicate_frame_data) { dupl->proc_duplicate_frame_data(dupl,img); } else { - + switch (img->format) { case XINE_IMGFMT_YV12: yv12_to_yv12( @@ -761,8 +761,8 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) { img->width, img->height); break; } - } - + } + dupl->bad_frame = 0; dupl->pts = 0; dupl->vpts = 0; @@ -773,10 +773,10 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) { dupl->stream = NULL; memcpy( dupl->extra_info, img->extra_info, sizeof(extra_info_t) ); - + /* delay frame processing for now, we might not even need it (eg. frame will be discarded) */ /* vo_frame_driver_proc(dupl); */ - + return dupl; } @@ -789,7 +789,7 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { int duration; pthread_mutex_lock(&this->display_img_buf_queue->mutex); - + img = this->display_img_buf_queue->first; /* @@ -806,7 +806,7 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { /* * before displaying the first frame without - * "metronom prebuffering" we should make sure it's + * "metronom prebuffering" we should make sure it's * not used as a decoder reference anymore. */ if( img->lock_counter == 1 ) { @@ -828,21 +828,21 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { duration = DEFAULT_FRAME_DURATION; } else duration = img->duration; - + pts = img->vpts; diff = cur_vpts - pts; - + if (diff > duration || this->discard_frames) { - + if( !this->discard_frames ) { xine_log(this->xine, XINE_LOG_MSG, _("video_out: throwing away image with pts %" PRId64 " because it's too old (diff : %" PRId64 ").\n"), pts, diff); this->num_frames_discarded++; } - + img = vo_remove_from_img_buf_queue_int (this->display_img_buf_queue, 1, 0, 0, 0, 0, 0); - + if (img->stream) { pthread_mutex_lock( &img->stream->current_extra_info_lock ); _x_extra_info_merge( img->stream->current_extra_info, img->extra_info ); @@ -851,21 +851,21 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { /* when flushing frames, keep the first one as backup */ if( this->discard_frames ) { - + if (!this->img_backup) { this->img_backup = img; } else { vo_frame_dec_lock( img ); - } - + } + } else { /* - * last frame? back it up for + * last frame? back it up for * still frame creation */ - + if (!this->display_img_buf_queue->first) { - + if (this->img_backup) { lprintf("overwriting frame backup\n"); @@ -875,20 +875,20 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { lprintf("possible still frame (old)\n"); this->img_backup = img; - - /* wait 4 frames before drawing this one. + + /* wait 4 frames before drawing this one. this allow slower systems to recover. */ - this->redraw_needed = 4; + this->redraw_needed = 4; } else { vo_frame_dec_lock( img ); } } img = this->display_img_buf_queue->first; - + } else break; } - + pthread_mutex_unlock(&this->display_img_buf_queue->mutex); } @@ -897,16 +897,16 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { */ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, int64_t *next_frame_vpts) { - + vo_frame_t *img; pthread_mutex_lock(&this->display_img_buf_queue->mutex); - + img = this->display_img_buf_queue->first; *next_frame_vpts = 0; - /* + /* * still frame detection: */ @@ -931,11 +931,11 @@ 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); } - + return img; } else { - + if( this->redraw_needed ) this->redraw_needed--; @@ -967,13 +967,13 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, vo_frame_dec_lock( this->img_backup ); this->img_backup = NULL; } - - /* - * last frame? make backup for possible still image + + /* + * last frame? make backup for possible still image */ pthread_mutex_lock( &this->free_img_buf_queue->mutex ); if (img && !img->next) { - + if (!img->stream || _x_stream_info_get(img->stream, XINE_STREAM_INFO_VIDEO_HAS_STILL) || !img->stream->video_fifo || @@ -989,7 +989,7 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, /* * remove frame from display queue and show it */ - + 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); @@ -997,7 +997,7 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, } } -static void overlay_and_display_frame (vos_t *this, +static void overlay_and_display_frame (vos_t *this, vo_frame_t *img, int64_t vpts) { xine_stream_t *stream; xine_list_iterator_t ite; @@ -1009,19 +1009,19 @@ static void overlay_and_display_frame (vos_t *this, */ if(!img->proc_called ) vo_frame_driver_proc(img); - + if (img->stream) { int64_t diff; pthread_mutex_lock( &img->stream->current_extra_info_lock ); diff = img->extra_info->vpts - img->stream->current_extra_info->vpts; - if ((diff > 3000) || (diff<-300000)) + if ((diff > 3000) || (diff<-300000)) _x_extra_info_merge( img->stream->current_extra_info, img->extra_info ); pthread_mutex_unlock( &img->stream->current_extra_info_lock ); } if (this->overlay_source) { - this->overlay_source->multiple_overlay_blend (this->overlay_source, - vpts, + this->overlay_source->multiple_overlay_blend (this->overlay_source, + vpts, this->driver, img, this->video_loop_running && this->overlay_enabled); } @@ -1034,7 +1034,7 @@ static void overlay_and_display_frame (vos_t *this, this->last_frame = img; this->driver->display_frame (this->driver, img); - + /* * Wake up xine_play if it's waiting for a frame */ @@ -1054,16 +1054,16 @@ static void overlay_and_display_frame (vos_t *this, pthread_mutex_unlock(&this->streams_lock); } - this->redraw_needed = 0; + this->redraw_needed = 0; } static void check_redraw_needed (vos_t *this, int64_t vpts) { if (this->overlay_source) { if( this->overlay_source->redraw_needed (this->overlay_source, vpts) ) - this->redraw_needed = 1; + this->redraw_needed = 1; } - + if( this->driver->redraw_needed (this->driver) ) this->redraw_needed = 1; } @@ -1071,36 +1071,36 @@ static void check_redraw_needed (vos_t *this, int64_t vpts) { /* special loop for paused mode * needed to update screen due overlay changes, resize, window * movement, brightness adjusting etc. - */ + */ static void paused_loop( vos_t *this, int64_t vpts ) { vo_frame_t *img; - + pthread_mutex_lock( &this->free_img_buf_queue->mutex ); /* prevent decoder thread from allocating new frames */ this->free_img_buf_queue->locked_for_read = 1; - + while (this->clock->speed == XINE_SPEED_PAUSE && this->video_loop_running) { - + /* we need at least one free frame to keep going */ if( this->display_img_buf_queue->first && !this->free_img_buf_queue->first ) { - + img = vo_remove_from_img_buf_queue (this->display_img_buf_queue); img->next = NULL; this->free_img_buf_queue->first = img; this->free_img_buf_queue->last = img; this->free_img_buf_queue->num_buffers = 1; } - + /* set img_backup to play the same frame several times */ if( this->display_img_buf_queue->first && !this->img_backup ) { this->img_backup = vo_remove_from_img_buf_queue (this->display_img_buf_queue); this->redraw_needed = 1; } - + check_redraw_needed( this, vpts ); - + if( this->redraw_needed && this->img_backup ) { img = duplicate_frame (this, this->img_backup ); if( img ) { @@ -1109,16 +1109,16 @@ static void paused_loop( vos_t *this, int64_t vpts ) pthread_mutex_unlock( &this->free_img_buf_queue->mutex ); overlay_and_display_frame (this, img, vpts); pthread_mutex_lock( &this->free_img_buf_queue->mutex ); - } + } } - + pthread_mutex_unlock( &this->free_img_buf_queue->mutex ); xine_usec_sleep (20000); pthread_mutex_lock( &this->free_img_buf_queue->mutex ); } - + this->free_img_buf_queue->locked_for_read = 0; - + if( this->free_img_buf_queue->first ) pthread_cond_signal (&this->free_img_buf_queue->not_empty); pthread_mutex_unlock( &this->free_img_buf_queue->mutex ); @@ -1131,7 +1131,7 @@ static void *video_out_loop (void *this_gen) { vos_t *this = (vos_t *) this_gen; int64_t next_frame_vpts = 0; int64_t usec_to_sleep; - + #ifndef WIN32 /* nice(-value) will fail silently for normal users. * however when running as root this may provide smoother @@ -1145,7 +1145,7 @@ static void *video_out_loop (void *this_gen) { * here it is - the heart of xine (or rather: one of the hearts * of xine) : the video output loop */ - + lprintf ("loop starting...\n"); while ( this->video_loop_running ) { @@ -1185,7 +1185,7 @@ static void *video_out_loop (void *this_gen) { diff = vpts - this->last_delivery_pts; if (diff > 30000 && !this->display_img_buf_queue->first) { xine_list_iterator_t ite; - + pthread_mutex_lock(&this->streams_lock); for (ite = xine_list_front(this->streams); ite; ite = xine_list_next(this->streams, ite)) { @@ -1193,9 +1193,9 @@ static void *video_out_loop (void *this_gen) { if (stream == XINE_ANON_STREAM) continue; if (stream->video_decoder_plugin && stream->video_fifo) { buf_element_t *buf; - + lprintf ("flushing current video decoder plugin\n"); - + buf = stream->video_fifo->buffer_pool_try_alloc (stream->video_fifo); if( buf ) { buf->type = BUF_CONTROL_FLUSH_DECODER; @@ -1215,12 +1215,12 @@ static void *video_out_loop (void *this_gen) { next_frame_vpts = img->vpts + img->duration; } /* else next_frame_vpts is returned by get_next_frame */ - + lprintf ("next_frame_vpts is %" PRId64 "\n", next_frame_vpts); - + do { vpts = this->clock->get_current_time (this->clock); - + if (this->clock->speed == XINE_SPEED_PAUSE) paused_loop (this, vpts); @@ -1237,11 +1237,11 @@ static void *video_out_loop (void *this_gen) { usec_to_sleep = MAX_USEC_TO_SLEEP; lprintf ("%" PRId64 " usec to sleep at master vpts %" PRId64 "\n", usec_to_sleep, vpts); - + if ( (next_frame_vpts - vpts) > 2*90000 ) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out: vpts/clock error, next_vpts=%" PRId64 " cur_vpts=%" PRId64 "\n", next_frame_vpts,vpts); - + if (usec_to_sleep > 0) xine_usec_sleep (usec_to_sleep); @@ -1254,7 +1254,7 @@ static void *video_out_loop (void *this_gen) { /* * throw away undisplayed frames */ - + pthread_mutex_lock(&this->display_img_buf_queue->mutex); img = this->display_img_buf_queue->first; while (img) { @@ -1297,9 +1297,9 @@ int xine_get_next_video_frame (xine_video_port_t *this_gen, xine_usec_sleep (5000); continue; } - + /* FIXME: ugly, use conditions and locks instead? */ - + pthread_mutex_lock(&this->display_img_buf_queue->mutex); img = this->display_img_buf_queue->first; if (!img) { @@ -1316,7 +1316,7 @@ int xine_get_next_video_frame (xine_video_port_t *this_gen, /* * remove frame from display queue and show it */ - + 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); @@ -1335,7 +1335,7 @@ int xine_get_next_video_frame (xine_video_port_t *this_gen, return 1; } -void xine_free_video_frame (xine_video_port_t *port, +void xine_free_video_frame (xine_video_port_t *port, xine_video_frame_t *frame) { vo_frame_t *img = (vo_frame_t *) frame->xine_frame; @@ -1377,7 +1377,7 @@ static void vo_close (xine_video_port_t *this_gen, xine_stream_t *stream) { this->overlay_source->flush_events (this->overlay_source); this->video_opened = 0; - + /* unregister stream */ pthread_mutex_lock(&this->streams_lock); for (ite = xine_list_front(this->streams); ite; @@ -1400,17 +1400,17 @@ static int vo_get_property (xine_video_port_t *this_gen, int property) { case VO_PROP_DISCARD_FRAMES: ret = this->discard_frames; break; - + case VO_PROP_BUFS_IN_FIFO: ret = this->video_loop_running ? this->display_img_buf_queue->num_buffers : -1; break; - + case VO_PROP_NUM_STREAMS: pthread_mutex_lock(&this->streams_lock); ret = xine_list_size(this->streams); pthread_mutex_unlock(&this->streams_lock); break; - + /* * handle XINE_PARAM_xxx properties (convert from driver's range) */ @@ -1426,7 +1426,7 @@ static int vo_get_property (xine_video_port_t *this_gen, int property) { case XINE_PARAM_VO_CROP_BOTTOM: ret = this->crop_bottom; break; - + case XINE_PARAM_VO_HUE: case XINE_PARAM_VO_SATURATION: case XINE_PARAM_VO_CONTRAST: @@ -1444,12 +1444,12 @@ static int vo_get_property (xine_video_port_t *this_gen, int property) { if (range_v > 0) ret = ((v-min_v) * 65536 + 32768) / range_v; - else + else ret = 0; pthread_mutex_unlock( &this->driver_lock ); } break; - + default: pthread_mutex_lock( &this->driver_lock ); ret = this->driver->get_property(this->driver, property & 0xffffff); @@ -1463,7 +1463,7 @@ static int vo_set_property (xine_video_port_t *this_gen, int property, int value int ret; switch (property) { - + case VO_PROP_DISCARD_FRAMES: /* recursive discard frames setting */ pthread_mutex_lock(&this->display_img_buf_queue->mutex); @@ -1473,19 +1473,19 @@ static int vo_set_property (xine_video_port_t *this_gen, int property, int value this->discard_frames--; pthread_mutex_unlock(&this->display_img_buf_queue->mutex); ret = this->discard_frames; - + /* discard buffers here because we have no output thread */ if (this->grab_only && this->discard_frames) { vo_frame_t *img; - + pthread_mutex_lock(&this->display_img_buf_queue->mutex); - + while ((img = this->display_img_buf_queue->first)) { - + lprintf ("flushing out frame\n"); - + img = vo_remove_from_img_buf_queue_int (this->display_img_buf_queue, 1, 0, 0, 0, 0, 0); - + vo_frame_dec_lock (img); } pthread_mutex_unlock(&this->display_img_buf_queue->mutex); @@ -1515,32 +1515,32 @@ static int vo_set_property (xine_video_port_t *this_gen, int property, int value value = 0; ret = this->crop_bottom = value; break; - + case XINE_PARAM_VO_HUE: case XINE_PARAM_VO_SATURATION: case XINE_PARAM_VO_CONTRAST: case XINE_PARAM_VO_BRIGHTNESS: if (!this->grab_only) { int v, min_v, max_v, range_v; - + pthread_mutex_lock( &this->driver_lock ); - + this->driver->get_property_min_max (this->driver, - property & 0xffffff, - &min_v, &max_v); - + property & 0xffffff, + &min_v, &max_v); + range_v = max_v - min_v + 1; - + v = (value * range_v + (range_v/2)) / 65536 + min_v; - + this->driver->set_property(this->driver, property & 0xffffff, v); pthread_mutex_unlock( &this->driver_lock ); ret = value; } else ret = 0; break; - - + + default: if (!this->grab_only) { pthread_mutex_lock( &this->driver_lock ); @@ -1574,7 +1574,7 @@ static int vo_status (xine_video_port_t *this_gen, xine_stream_t *stream, } } pthread_mutex_unlock(&this->streams_lock); - + return ret; } @@ -1619,7 +1619,7 @@ static void vo_exit (xine_video_port_t *this_gen) { if (this->overlay_source) { this->overlay_source->dispose (this->overlay_source); } - + xine_list_delete(this->streams); pthread_mutex_destroy(&this->streams_lock); @@ -1635,7 +1635,7 @@ static vo_frame_t *vo_get_last_frame (xine_video_port_t *this_gen) { } /* - * overlay stuff + * overlay stuff */ static video_overlay_manager_t *vo_get_overlay_manager (xine_video_port_t *this_gen) { @@ -1645,7 +1645,7 @@ static video_overlay_manager_t *vo_get_overlay_manager (xine_video_port_t *this_ static void vo_enable_overlay (xine_video_port_t *this_gen, int overlay_enabled) { vos_t *this = (vos_t *) this_gen; - + if (overlay_enabled) { /* we always ENable ... */ this->overlay_enabled = 1; @@ -1678,7 +1678,7 @@ static void vo_flush (xine_video_port_t *this_gen) { pthread_mutex_lock(&this->display_img_buf_queue->mutex); this->discard_frames++; pthread_mutex_unlock(&this->display_img_buf_queue->mutex); - + /* do not try this in paused mode */ while(this->clock->speed != XINE_SPEED_PAUSE) { pthread_mutex_lock(&this->display_img_buf_queue->mutex); @@ -1688,7 +1688,7 @@ static void vo_flush (xine_video_port_t *this_gen) { break; xine_usec_sleep (20000); /* pthread_cond_t could be used here */ } - + pthread_mutex_lock(&this->display_img_buf_queue->mutex); this->discard_frames--; pthread_mutex_unlock(&this->display_img_buf_queue->mutex); @@ -1703,29 +1703,29 @@ static vo_frame_t * crop_frame( xine_video_port_t *this_gen, vo_frame_t *img ) { vo_frame_t *dupl; dupl = vo_get_frame ( this_gen, - img->width - img->crop_left - img->crop_right, + img->width - img->crop_left - img->crop_right, img->height - img->crop_top - img->crop_bottom, img->ratio, img->format, img->flags | VO_BOTH_FIELDS); - + dupl->progressive_frame = img->progressive_frame; dupl->repeat_first_field = img->repeat_first_field; dupl->top_field_first = img->top_field_first; dupl->overlay_offset_x = img->overlay_offset_x; dupl->overlay_offset_y = img->overlay_offset_y; - + switch (img->format) { case XINE_IMGFMT_YV12: yv12_to_yv12( /* Y */ - img->base[0] + img->crop_top * img->pitches[0] + + img->base[0] + img->crop_top * img->pitches[0] + img->crop_left, img->pitches[0], dupl->base[0], dupl->pitches[0], /* U */ - img->base[1] + img->crop_top/2 * img->pitches[1] + + img->base[1] + img->crop_top/2 * img->pitches[1] + img->crop_left/2, img->pitches[1], dupl->base[1], dupl->pitches[1], /* V */ - img->base[2] + img->crop_top/2 * img->pitches[2] + + img->base[2] + img->crop_top/2 * img->pitches[2] + img->crop_left/2, img->pitches[2], dupl->base[2], dupl->pitches[2], /* width x height */ @@ -1742,7 +1742,7 @@ static vo_frame_t * crop_frame( xine_video_port_t *this_gen, vo_frame_t *img ) { dupl->width, dupl->height); break; } - + dupl->bad_frame = 0; dupl->pts = img->pts; dupl->vpts = img->vpts; @@ -1755,10 +1755,10 @@ static vo_frame_t * crop_frame( xine_video_port_t *this_gen, vo_frame_t *img ) { if (img->stream) _x_refcounter_inc(img->stream->refcounter); memcpy( dupl->extra_info, img->extra_info, sizeof(extra_info_t) ); - + /* delay frame processing for now, we might not even need it (eg. frame will be discarded) */ /* vo_frame_driver_proc(dupl); */ - + return dupl; } @@ -1777,10 +1777,10 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon this->clock = xine->clock; this->driver = driver; this->streams = xine_list_new(); - + pthread_mutex_init(&this->streams_lock, NULL); pthread_mutex_init(&this->driver_lock, NULL ); - + this->vo.open = vo_open; this->vo.get_frame = vo_get_frame; this->vo.get_last_frame = vo_get_last_frame; @@ -1804,7 +1804,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon this->last_frame = NULL; this->img_backup = NULL; - + this->overlay_source = _x_video_overlay_new_manager(xine); this->overlay_source->init (this->overlay_source); this->overlay_enabled = 1; @@ -1826,7 +1826,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon num_frame_buffers = i; /* we need at least 5 frames */ - if (num_frame_buffers<5) + if (num_frame_buffers<5) num_frame_buffers = 5; /* Choose a frame_drop_limit which matches num_frame_buffers. @@ -1858,7 +1858,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon img->proc_duplicate_frame_data = NULL; img->id = i; - + img->port = &this->vo; img->free = vo_frame_dec_lock; img->lock = vo_frame_inc_lock; @@ -1870,13 +1870,13 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon img); } - this->warn_skipped_threshold = + this->warn_skipped_threshold = xine->config->register_num (xine->config, "engine.performance.warn_skipped_threshold", 10, _("percentage of skipped frames to tolerate"), _("When more than this percentage of frames are not shown, because they " "were not decoded in time, xine sends a notification."), 20, NULL, NULL); - this->warn_discarded_threshold = + this->warn_discarded_threshold = xine->config->register_num (xine->config, "engine.performance.warn_discarded_threshold", 10, _("percentage of discarded frames to tolerate"), _("When more than this percentage of frames are not shown, because they " @@ -1903,10 +1903,10 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon this->video_loop_running = 1; this->video_opened = 0; this->grab_only = 0; - + pthread_attr_init(&pth_attrs); pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM); - + if ((err = pthread_create (&this->video_thread, &pth_attrs, video_out_loop, this)) != 0) { @@ -1918,7 +1918,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon } else xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out: thread created\n"); - + pthread_attr_destroy(&pth_attrs); } diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 9a2ba06c6..b1a517565 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -1,24 +1,24 @@ /* * Copyright (C) 2000-2004 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 * * - * xine version of video_out.h + * xine version of video_out.h * * vo_frame : frame containing yuv data and timing info, * transferred between video_decoder and video_output @@ -47,7 +47,7 @@ extern "C" { #endif -typedef struct vo_frame_s vo_frame_t; +typedef struct vo_frame_s vo_frame_t; typedef struct vo_driver_s vo_driver_t; typedef struct video_driver_class_s video_driver_class_t; typedef struct vo_overlay_s vo_overlay_t; @@ -80,7 +80,7 @@ struct vo_frame_s { /* tell video driver that the decoder starts a new field */ void (*field) (vo_frame_t *vo_img, int which_field); - /* append this frame to the display queue, + /* append this frame to the display queue, returns number of frames to skip if decoder is late */ /* when the frame does not originate from a stream, it is legal to pass an anonymous stream */ int (*draw) (vo_frame_t *vo_img, xine_stream_t *stream); @@ -108,7 +108,7 @@ struct vo_frame_s { /* yv12 (planar) base[0]: y, base[1]: u, base[2]: v */ /* yuy2 (interleaved) base[0]: yuyv..., base[1]: --, base[2]: -- */ - uint8_t *base[3]; + uint8_t *base[3]; int pitches[3]; /* info that can be used for interlaced output (e.g. tv-out) */ @@ -119,13 +119,13 @@ struct vo_frame_s { */ int progressive_frame; int picture_coding_type; - + /* cropping to be done */ int crop_left, crop_right, crop_top, crop_bottom; /* extra info coming from input or demuxers */ - extra_info_t *extra_info; - + extra_info_t *extra_info; + /* additional information to be able to duplicate frames: */ int width, height; double ratio; /* aspect ratio */ @@ -134,7 +134,7 @@ struct vo_frame_s { int drawn; /* used by decoder, frame has already been drawn */ int flags; /* remember the frame flags */ int proc_called; /* track use of proc_*() methods */ - + /* Used to carry private data for accelerated plugins.*/ void *accel_data; @@ -142,18 +142,18 @@ struct vo_frame_s { xine_video_port_t *port; vo_driver_t *driver; xine_stream_t *stream; - + /* displacement for overlays */ int overlay_offset_x, overlay_offset_y; - - /* + + /* * that part is used only by video_out.c for frame management * obs: changing anything here will require recompiling vo drivers */ struct vo_frame_s *next; int lock_counter; pthread_mutex_t mutex; /* protect access to lock_count */ - + int id; /* debugging - track this frame */ int is_first; }; @@ -173,8 +173,8 @@ struct xine_video_port_s { * (e.g. you are a post plugin) it is legal to pass an anonymous stream */ void (*open) (xine_video_port_t *self, xine_stream_t *stream); - /* - * get_frame - allocate an image buffer from display driver + /* + * get_frame - allocate an image buffer from display driver * * params : width == width of video to display. * height == height of video to display. @@ -182,16 +182,16 @@ struct xine_video_port_s { * format == FOURCC descriptor of image format * flags == field/prediction flags */ - vo_frame_t* (*get_frame) (xine_video_port_t *self, uint32_t width, - uint32_t height, double ratio, + vo_frame_t* (*get_frame) (xine_video_port_t *self, uint32_t width, + uint32_t height, double ratio, int format, int flags); /* retrieves the last displayed frame (useful for taking snapshots) */ vo_frame_t* (*get_last_frame) (xine_video_port_t *self); - + /* overlay stuff */ void (*enable_ovl) (xine_video_port_t *self, int ovl_enable); - + /* get overlay manager */ video_overlay_manager_t* (*get_overlay_manager) (xine_video_port_t *self); @@ -204,11 +204,11 @@ struct xine_video_port_s { */ int (*get_property) (xine_video_port_t *self, int property); int (*set_property) (xine_video_port_t *self, int property, int value); - + /* return true if port is opened for this stream, stream can be anonymous */ - int (*status) (xine_video_port_t *self, xine_stream_t *stream, + int (*status) (xine_video_port_t *self, xine_stream_t *stream, int *width, int *height, int64_t *img_duration); - + /* video driver is no longer used by decoder => close */ /* when you are not a full-blown stream, but still need to close the port * (e.g. you are a post plugin) it is legal to pass an anonymous stream */ @@ -231,9 +231,9 @@ struct xine_video_port_s { #define VO_PROP_BRIGHTNESS 5 #define VO_PROP_COLORKEY 6 #define VO_PROP_AUTOPAINT_COLORKEY 7 -#define VO_PROP_ZOOM_X 8 -#define VO_PROP_PAN_SCAN 9 -#define VO_PROP_TVMODE 10 +#define VO_PROP_ZOOM_X 8 +#define VO_PROP_PAN_SCAN 9 +#define VO_PROP_TVMODE 10 #define VO_PROP_MAX_NUM_FRAMES 11 #define VO_PROP_ZOOM_Y 13 #define VO_PROP_DISCARD_FRAMES 14 /* not used by drivers */ @@ -299,7 +299,7 @@ struct vo_driver_s { */ vo_frame_t* (*alloc_frame) (vo_driver_t *self); - /* + /* * check if the given image fullfills the format specified * (re-)allocate memory if necessary */ @@ -330,7 +330,7 @@ struct vo_driver_s { * these can be used by the gui directly: */ int (*get_property) (vo_driver_t *self, int property); - int (*set_property) (vo_driver_t *self, + int (*set_property) (vo_driver_t *self, int property, int value); void (*get_property_min_max) (vo_driver_t *self, int property, int *min, int *max); @@ -345,7 +345,7 @@ struct vo_driver_s { void *data); /* check if a redraw is needed (due to resize) - * this is only used for still frames, normal video playback + * this is only used for still frames, normal video playback * must call that inside display_frame() function. */ int (*redraw_needed) (vo_driver_t *self); @@ -354,7 +354,7 @@ struct vo_driver_s { * free all resources, close driver */ void (*dispose) (vo_driver_t *self); - + void *node; /* needed by plugin_loader */ }; @@ -364,14 +364,14 @@ struct video_driver_class_s { * open a new instance of this plugin class */ vo_driver_t* (*open_plugin) (video_driver_class_t *self, const void *visual); - + /* * return short, human readable identifier for this plugin class */ char* (*get_identifier) (video_driver_class_t *self); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ char* (*get_description) (video_driver_class_t *self); @@ -397,7 +397,7 @@ struct vo_overlay_s { int y; /* y start of subpicture area */ int width; /* width of subpicture area */ int height; /* height of subpicture area */ - + 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 */ @@ -410,7 +410,7 @@ struct vo_overlay_s { uint32_t hili_color[OVL_PALETTE_SIZE]; uint8_t hili_trans[OVL_PALETTE_SIZE]; int hili_rgb_clut; /* true if clut was converted to rgb */ - + int unscaled; /* true if it should be blended unscaled */ }; @@ -423,20 +423,20 @@ struct vo_overlay_s { */ struct video_overlay_manager_s { void (*init) (video_overlay_manager_t *this_gen); - + void (*dispose) (video_overlay_manager_t *this_gen); - + int32_t (*get_handle) (video_overlay_manager_t *this_gen, int object_type ); - + void (*free_handle) (video_overlay_manager_t *this_gen, int32_t handle); - + int32_t (*add_event) (video_overlay_manager_t *this_gen, void *event); - + void (*flush_events) (video_overlay_manager_t *this_gen ); - + int (*redraw_needed) (video_overlay_manager_t *this_gen, int64_t vpts ); - - void (*multiple_overlay_blend) (video_overlay_manager_t *this_gen, int64_t vpts, + + void (*multiple_overlay_blend) (video_overlay_manager_t *this_gen, int64_t vpts, vo_driver_t *output, vo_frame_t *vo_img, int enabled); }; diff --git a/src/xine-engine/video_overlay.c b/src/xine-engine/video_overlay.c index b88f10c11..3216950e8 100644 --- a/src/xine-engine/video_overlay.c +++ b/src/xine-engine/video_overlay.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2006 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 @@ -51,15 +51,15 @@ typedef struct video_overlay_showing_s { typedef struct video_overlay_s { video_overlay_manager_t video_overlay; - + xine_t *xine; - pthread_mutex_t events_mutex; + pthread_mutex_t events_mutex; video_overlay_events_t events[MAX_EVENTS]; - pthread_mutex_t objects_mutex; + pthread_mutex_t objects_mutex; video_overlay_object_t objects[MAX_OBJECTS]; pthread_mutex_t showing_mutex; - video_overlay_showing_t showing[MAX_SHOWING]; + video_overlay_showing_t showing[MAX_SHOWING]; int showing_changed; } video_overlay_t; @@ -67,24 +67,24 @@ typedef struct video_overlay_s { static void add_showing_handle( video_overlay_t *this, int32_t handle ) { int i; - + pthread_mutex_lock( &this->showing_mutex ); this->showing_changed++; - + for( i = 0; i < MAX_SHOWING; i++ ) if( this->showing[i].handle == handle ) break; /* already showing */ - + if( i == MAX_SHOWING ) { for( i = 0; i < MAX_SHOWING && this->showing[i].handle >= 0; i++ ) ; - + if( i != MAX_SHOWING ) this->showing[i].handle = handle; else xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: error: no showing slots available\n"); } - + pthread_mutex_unlock( &this->showing_mutex ); } @@ -94,13 +94,13 @@ static void remove_showing_handle( video_overlay_t *this, int32_t handle ) pthread_mutex_lock( &this->showing_mutex ); this->showing_changed++; - + for( i = 0; i < MAX_SHOWING; i++ ) { if( this->showing[i].handle == handle ) { this->showing[i].handle = -1; } } - + pthread_mutex_unlock( &this->showing_mutex ); } @@ -110,34 +110,34 @@ static void remove_events_handle( video_overlay_t *this, int32_t handle, int loc if( lock ) pthread_mutex_lock( &this->events_mutex ); - + this_event=0; do { last_event=this_event; this_event=this->events[last_event].next_event; - - while( this_event && + + while( this_event && this->events[this_event].event->object.handle == handle ) { /* remove event from pts list */ this->events[last_event].next_event= this->events[this_event].next_event; - /* free its overlay */ - if( this->events[this_event].event->object.overlay ) { + /* free its overlay */ + if( this->events[this_event].event->object.overlay ) { if( this->events[this_event].event->object.overlay->rle ) free( this->events[this_event].event->object.overlay->rle ); free(this->events[this_event].event->object.overlay); this->events[this_event].event->object.overlay = NULL; } - + /* mark as free */ this->events[this_event].next_event = 0; this->events[this_event].event->event_type = OVERLAY_EVENT_NULL; - + this_event=this->events[last_event].next_event; } } while ( this_event ); - + if( lock ) pthread_mutex_unlock( &this->events_mutex ); } @@ -149,35 +149,35 @@ static void remove_events_handle( video_overlay_t *this, int32_t handle, int loc static int32_t video_overlay_get_handle(video_overlay_manager_t *this_gen, int object_type ) { video_overlay_t *this = (video_overlay_t *) this_gen; int n; - + pthread_mutex_lock( &this->objects_mutex ); - + for( n=0; n < MAX_OBJECTS && this->objects[n].handle > -1; n++ ) ; - + if (n == MAX_OBJECTS) { n = -1; } else { this->objects[n].handle = n; this->objects[n].object_type = object_type; } - + pthread_mutex_unlock( &this->objects_mutex ); return n; } -/* +/* free a handle from the object pool (internal function) */ static void internal_video_overlay_free_handle(video_overlay_t *this, int32_t handle) { - + pthread_mutex_lock( &this->objects_mutex ); if( this->objects[handle].overlay ) { if( this->objects[handle].overlay->rle ) free( this->objects[handle].overlay->rle ); free( this->objects[handle].overlay ); - this->objects[handle].overlay = NULL; + this->objects[handle].overlay = NULL; } this->objects[handle].handle = -1; @@ -199,7 +199,7 @@ static void video_overlay_free_handle(video_overlay_manager_t *this_gen, int32_t static void video_overlay_reset (video_overlay_t *this) { int i; - + pthread_mutex_lock (&this->events_mutex); for (i=0; i < MAX_EVENTS; i++) { if (this->events[i].event == NULL) { @@ -212,17 +212,17 @@ static void video_overlay_reset (video_overlay_t *this) { #endif } this->events[i].event->event_type = 0; /* Empty slot */ - this->events[i].next_event = 0; + this->events[i].next_event = 0; } pthread_mutex_unlock (&this->events_mutex); - + for( i = 0; i < MAX_SHOWING; i++ ) this->showing[i].handle = -1; - + for (i=0; i < MAX_OBJECTS; i++) { internal_video_overlay_free_handle(this, i); } - + this->showing_changed = 0; } @@ -234,7 +234,7 @@ static void video_overlay_init (video_overlay_manager_t *this_gen) { pthread_mutex_init (&this->events_mutex,NULL); pthread_mutex_init (&this->objects_mutex,NULL); pthread_mutex_init (&this->showing_mutex,NULL); - + video_overlay_reset(this); } @@ -256,13 +256,13 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void uint32_t last_event,this_event,new_event; pthread_mutex_lock (&this->events_mutex); - + /* We skip the 0 entry because that is used as a pointer to the first event.*/ /* Find a free event slot */ - for( new_event = 1; new_event<MAX_EVENTS && + for( new_event = 1; new_event<MAX_EVENTS && this->events[new_event].event->event_type > 0; new_event++ ) ; - + if (new_event < MAX_EVENTS) { /* Find position in event queue to be added. */ this_event=0; @@ -274,7 +274,7 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void this->events[last_event].next_event=new_event; this->events[new_event].next_event=this_event; - + /* memcpy everything except the actual image */ if ( this->events[new_event].event == NULL ) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: error: event slot is NULL!\n"); @@ -287,7 +287,7 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void if ( this->events[new_event].event->object.overlay ) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: add_event: event->object.overlay was not freed!\n"); } - + if( event->object.overlay ) { int i; for(i = 0; i < OVL_PALETTE_SIZE; i++) { @@ -298,7 +298,7 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void } this->events[new_event].event->object.overlay = calloc(1, sizeof(vo_overlay_t)); - xine_fast_memcpy(this->events[new_event].event->object.overlay, + xine_fast_memcpy(this->events[new_event].event->object.overlay, event->object.overlay, sizeof(vo_overlay_t)); /* We took the callers rle and data, therefore it will be our job to free it */ @@ -311,9 +311,9 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay:No spare subtitle event slots\n"); new_event = -1; } - + pthread_mutex_unlock (&this->events_mutex); - + return new_event; } @@ -335,7 +335,7 @@ static void video_overlay_print_overlay( vo_overlay_t *ovl ) { printf ("video_overlay: \thili_trans [%d %d %d %d]\n", ovl->hili_trans[0], ovl->hili_trans[1], ovl->hili_trans[2], ovl->hili_trans[3]); return; -} +} #endif /* @@ -347,9 +347,9 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { int32_t handle; uint32_t this_event; int processed = 0; - + pthread_mutex_lock (&this->events_mutex); - + this_event=this->events[0].next_event; while ( this_event && (vpts > this->events[this_event].event->vpts || vpts == 0) ) { @@ -375,21 +375,21 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { */ remove_showing_handle(this,handle); internal_video_overlay_free_handle(this, handle); - + this->objects[handle].handle = handle; if( this->objects[handle].overlay ) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: error: object->overlay was not freed!\n"); } - this->objects[handle].overlay = + this->objects[handle].overlay = this->events[this_event].event->object.overlay; - this->objects[handle].pts = + this->objects[handle].pts = this->events[this_event].event->object.pts; this->events[this_event].event->object.overlay = NULL; - + add_showing_handle( this, handle ); } break; - + case OVERLAY_EVENT_HIDE: #ifdef LOG_DEBUG printf ("video_overlay: HIDE SPU NOW\n"); @@ -399,17 +399,17 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { if( this->events[this_event].event->object.overlay->rle != NULL ) free( this->events[this_event].event->object.overlay->rle ); free(this->events[this_event].event->object.overlay); - this->events[this_event].event->object.overlay = NULL; + this->events[this_event].event->object.overlay = NULL; } remove_showing_handle( this, handle ); break; - + case OVERLAY_EVENT_FREE_HANDLE: #ifdef LOG_DEBUG printf ("video_overlay: FREE SPU NOW\n"); #endif /* free any overlay associated with this event */ - if( this->events[this_event].event->object.overlay != NULL) { + if( this->events[this_event].event->object.overlay != NULL) { if( this->events[this_event].event->object.overlay->rle != NULL ) free( this->events[this_event].event->object.overlay->rle ); free(this->events[this_event].event->object.overlay); @@ -423,7 +423,7 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { internal_video_overlay_free_handle( this, handle ); break; - + case OVERLAY_EVENT_MENU_BUTTON: /* mixes palette and copy clip coords */ #ifdef LOG_DEBUG @@ -433,10 +433,10 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { /* This code drops buttons, where the button PTS derived from the NAV * packet on DVDs does not match the SPU PTS. Practical experience shows, * that this is not necessary and causes problems with some DVDs */ - if ( (this->events[this_event].event->object.pts != + if ( (this->events[this_event].event->object.pts != this->objects[handle].pts) ) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "video_overlay:MENU BUTTON DROPPED menu pts=%lld spu pts=%lld\n", + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_overlay:MENU BUTTON DROPPED menu pts=%lld spu pts=%lld\n", this->events[this_event].event->object.pts, this->objects[handle].pts); break; @@ -446,7 +446,7 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { (this->objects[handle].overlay) ) { vo_overlay_t *overlay = this->objects[handle].overlay; vo_overlay_t *event_overlay = this->events[this_event].event->object.overlay; - + #ifdef LOG_DEBUG printf ("video_overlay:overlay present\n"); #endif @@ -477,84 +477,84 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { free( this->events[this_event].event->object.overlay->rle ); this->events[this_event].event->object.overlay->rle = NULL; } - + if (this->events[this_event].event->object.overlay != NULL) { free (this->events[this_event].event->object.overlay); this->events[this_event].event->object.overlay = NULL; } break; - + default: xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: unhandled event type\n"); break; } - - this->events[0].next_event = this->events[this_event].next_event; + + this->events[0].next_event = this->events[this_event].next_event; this->events[this_event].next_event = 0; this->events[this_event].event->event_type = 0; - + this_event=this->events[0].next_event; } - + pthread_mutex_unlock (&this->events_mutex); return processed; } - -/* This is called from video_out.c + +/* This is called from video_out.c * must call output->overlay_blend for each active overlay. */ -static void video_overlay_multiple_overlay_blend (video_overlay_manager_t *this_gen, int64_t vpts, +static void video_overlay_multiple_overlay_blend (video_overlay_manager_t *this_gen, int64_t vpts, vo_driver_t *output, vo_frame_t *vo_img, int enabled) { video_overlay_t *this = (video_overlay_t *) this_gen; int i; int32_t handle; - /* Look at next events, if current video vpts > first event on queue, process the event - * else just continue + /* Look at next events, if current video vpts > first event on queue, process the event + * else just continue */ video_overlay_event( this, vpts ); - - /* Scan through 5 entries and display any present. + + /* Scan through 5 entries and display any present. */ pthread_mutex_lock( &this->showing_mutex ); if( output->overlay_begin ) output->overlay_begin(output, vo_img, this->showing_changed); - + for( i = 0; enabled && output->overlay_blend && i < MAX_SHOWING; i++ ) { - handle=this->showing[i].handle; + handle=this->showing[i].handle; if (handle >= 0 ) { output->overlay_blend(output, vo_img, this->objects[handle].overlay); } } - + if( output->overlay_end ) output->overlay_end(output, vo_img); - + this->showing_changed = 0; - + pthread_mutex_unlock( &this->showing_mutex ); } -/* this should be called on stream end or stop to make sure every +/* this should be called on stream end or stop to make sure every hide event is processed. */ static void video_overlay_flush_events(video_overlay_manager_t *this_gen ) { video_overlay_t *this = (video_overlay_t *) this_gen; - + video_overlay_event( this, 0 ); } -/* this is called from video_out.c on still frames to check +/* this is called from video_out.c on still frames to check if a redraw is needed. */ static int video_overlay_redraw_needed(video_overlay_manager_t *this_gen, int64_t vpts ) { video_overlay_t *this = (video_overlay_t *) this_gen; - + video_overlay_event( this, vpts ); return this->showing_changed; } @@ -575,7 +575,7 @@ static void video_overlay_dispose(video_overlay_manager_t *this_gen) { free (this->events[i].event); } } - + for (i=0; i < MAX_OBJECTS; i++) internal_video_overlay_free_handle(this, i); diff --git a/src/xine-engine/video_overlay.h b/src/xine-engine/video_overlay.h index 01f3a2a3a..f2deb8a2b 100644 --- a/src/xine-engine/video_overlay.h +++ b/src/xine-engine/video_overlay.h @@ -2,17 +2,17 @@ * Copyright (C) 2000-2003 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 @@ -50,7 +50,7 @@ #define OVL_PALETTE_SIZE 256 typedef struct vo_buttons_s { - int32_t type; /* 0:Button not valid, + int32_t type; /* 0:Button not valid, 1:Button Valid, no auto_action, 2:Button Valid, auto_action. */ @@ -61,10 +61,10 @@ typedef struct vo_buttons_s { int32_t hili_bottom; int32_t hili_left; int32_t hili_right; - int32_t up; - int32_t down; - int32_t left; - int32_t right; + int32_t up; + int32_t down; + int32_t left; + int32_t right; uint32_t select_color[OVL_PALETTE_SIZE]; uint8_t select_trans[OVL_PALETTE_SIZE]; xine_event_t select_event; @@ -74,7 +74,7 @@ typedef struct vo_buttons_s { int32_t hili_rgb_clut; /* true if clut was converted to rgb*/ /* FIXME: Probably not needed ^^^ */ } vo_buttons_t; - + typedef struct video_overlay_object_s { int32_t handle; /* Used to match Show and Hide events. */ uint32_t object_type; /* 0=Subtitle, 1=Menu */ diff --git a/src/xine-engine/vo_scale.c b/src/xine-engine/vo_scale.c index 8d84c32da..e2b7ac9e4 100644 --- a/src/xine-engine/vo_scale.c +++ b/src/xine-engine/vo_scale.c @@ -7,7 +7,7 @@ * 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 @@ -53,14 +53,14 @@ void _x_vo_scale_compute_ideal_size (vo_scale_t *this) { this->video_pixel_aspect = this->gui_pixel_aspect; } else { - - /* + + /* * aspect ratio */ - + image_ratio = (double) (this->delivered_width - (this->crop_left + this->crop_right)) / (double) (this->delivered_height - (this->crop_top + this->crop_bottom)); - + switch (this->user_ratio) { case XINE_VO_ASPECT_AUTO: desired_ratio = this->delivered_ratio; @@ -80,7 +80,7 @@ void _x_vo_scale_compute_ideal_size (vo_scale_t *this) { } this->video_pixel_aspect = desired_ratio / image_ratio; - + _x_assert(this->gui_pixel_aspect != 0.0); if (fabs (this->video_pixel_aspect / this->gui_pixel_aspect - 1.0) @@ -89,7 +89,7 @@ void _x_vo_scale_compute_ideal_size (vo_scale_t *this) { } #if 0 - + /* onefield_xv divide by 2 the number of lines */ if (this->deinterlace_enabled && (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) @@ -107,17 +107,17 @@ void _x_vo_scale_compute_ideal_size (vo_scale_t *this) { */ void _x_vo_scale_compute_output_size (vo_scale_t *this) { - + int cropped_width, cropped_height; double x_factor, y_factor, aspect; - + cropped_width = this->delivered_width - (this->crop_left + this->crop_right); - cropped_height = this->delivered_height - (this->crop_top + this->crop_bottom); + cropped_height = this->delivered_height - (this->crop_top + this->crop_bottom); aspect = this->video_pixel_aspect / this->gui_pixel_aspect; x_factor = (double) this->gui_width / (double) (cropped_width * aspect); y_factor = (double) (this->gui_height * aspect) / (double) cropped_height; - + if (this->scaling_disabled) { this->output_width = cropped_width; @@ -128,8 +128,8 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { } else { if ( this->support_zoom ) { - - /* zoom behaviour: + + /* zoom behaviour: * - window size never changes due zooming * - output image shall be increased whenever there are * black borders to use. @@ -138,7 +138,7 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { if (((double)this->gui_width - (double)cropped_width * y_factor) < ((double)this->gui_height - (double)cropped_height * x_factor)) { this->output_width = this->gui_width; this->displayed_width = (double)cropped_width / this->zoom_factor_x + 0.5; - + this->output_height = (double)cropped_height * x_factor + 0.5; if( this->output_height * this->zoom_factor_y <= this->gui_height ) { this->displayed_height = cropped_height; @@ -151,7 +151,7 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { } else { this->output_height = this->gui_height; this->displayed_height = (double)cropped_height / this->zoom_factor_y + 0.5; - + this->output_width = (double)cropped_width * y_factor + 0.5; if( this->output_width * this->zoom_factor_x <= this->gui_width ) { this->displayed_width = cropped_width; @@ -162,7 +162,7 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { this->output_width = this->gui_width; } } - + } else { if (((double)this->gui_width - (double)cropped_width * y_factor) < ((double)this->gui_height - (double)cropped_height * x_factor)) { this->output_width = (double) this->gui_width; @@ -174,27 +174,27 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { this->displayed_width = cropped_width; this->displayed_height = cropped_height; } - } - + } + /* make sure displayed values are sane, that is, we are not trying to display * something outside the delivered image. may happen when zoom < 100%. */ if( this->displayed_width > this->delivered_width ) { - this->output_width = (double) this->output_width * + this->output_width = (double) this->output_width * this->delivered_width / this->displayed_width + 0.5; this->displayed_width = this->delivered_width; } if( this->displayed_height > this->delivered_height ) { - this->output_height = (double) this->output_height * + this->output_height = (double) this->output_height * this->delivered_height / this->displayed_height + 0.5; this->displayed_height = this->delivered_height; } - + this->output_xoffset = (this->gui_width - this->output_width) * this->output_horizontal_position + this->gui_x; this->output_yoffset = (this->gui_height - this->output_height) * this->output_vertical_position + this->gui_y; - + this->displayed_xoffset = ((cropped_width - this->displayed_width) / 2) + this->crop_left; this->displayed_yoffset = ((cropped_height - this->displayed_height) / 2) + this->crop_top; @@ -219,8 +219,8 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { /* no top/bottom borders */ this->border[0].w = this->border[0].h = 0; this->border[1].w = this->border[1].h = 0; - } - + } + if (this->output_width < this->gui_width) { /* left */ this->border[2].x = 0; @@ -252,10 +252,10 @@ int _x_vo_scale_redraw_needed (vo_scale_t *this) { _x_assert(this->frame_output_cb); if ( ! this->frame_output_cb ) return 0; - + this->frame_output_cb (this->user_data, - this->delivered_width - (this->crop_left + this->crop_right), - this->delivered_height - (this->crop_top + this->crop_bottom), + this->delivered_width - (this->crop_left + this->crop_right), + this->delivered_height - (this->crop_top + this->crop_bottom), this->video_pixel_aspect, &gui_x, &gui_y, &gui_width, &gui_height, &gui_pixel_aspect, &gui_win_x, &gui_win_y ); @@ -277,7 +277,7 @@ int _x_vo_scale_redraw_needed (vo_scale_t *this) { } else ret = this->force_redraw; - + this->force_redraw = 0; return ret; } @@ -306,7 +306,7 @@ void _x_vo_scale_translate_gui2video(vo_scale_t *this, * translate output area coordianates into the delivered area * coordiantes. */ - + x = x * this->displayed_width / this->output_width + this->displayed_xoffset; y = y * this->displayed_height / this->output_height + this->displayed_yoffset; } @@ -343,21 +343,21 @@ char *_x_vo_scale_aspect_ratio_name(int a) { */ static void vo_scale_horizontal_pos_changed(void *data, xine_cfg_entry_t *entry) { vo_scale_t *this = (vo_scale_t *)data; - + this->output_horizontal_position = entry->num_value / 100.0; this->force_redraw = 1; } static void vo_scale_vertical_pos_changed(void *data, xine_cfg_entry_t *entry) { vo_scale_t *this = (vo_scale_t *)data; - + this->output_vertical_position = entry->num_value / 100.0; this->force_redraw = 1; } static void vo_scale_disable_scaling_changed(void *data, xine_cfg_entry_t *entry) { vo_scale_t *this = (vo_scale_t *)data; - + if (this->scaling_disabled < 2) { this->scaling_disabled = entry->num_value; this->force_redraw = 1; @@ -365,13 +365,13 @@ static void vo_scale_disable_scaling_changed(void *data, xine_cfg_entry_t *entry } -/* +/* * initialize rescaling struct */ - + void _x_vo_scale_init(vo_scale_t *this, int support_zoom, int scaling_disabled, config_values_t *config ) { - + memset( this, 0, sizeof(vo_scale_t) ); this->support_zoom = support_zoom; this->force_redraw = 1; @@ -380,13 +380,13 @@ void _x_vo_scale_init(vo_scale_t *this, int support_zoom, int scaling_disabled, this->gui_pixel_aspect = 1.0; this->user_ratio = XINE_VO_ASPECT_AUTO; this->delivered_ratio = 0.0; - + this->crop_left = 0; this->crop_right = 0; this->crop_top = 0; this->crop_bottom = 0; - - this->output_horizontal_position = + + this->output_horizontal_position = config->register_range(config, "video.output.horizontal_position", 50, 0, 100, _("horizontal image position in the output window"), _("If the video window's horizontal size is bigger than the actual image " diff --git a/src/xine-engine/vo_scale.h b/src/xine-engine/vo_scale.h index eb2607024..fe2594eeb 100644 --- a/src/xine-engine/vo_scale.h +++ b/src/xine-engine/vo_scale.h @@ -7,7 +7,7 @@ * 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 @@ -44,22 +44,22 @@ struct vo_scale_s { /* true if driver supports frame zooming */ int support_zoom; - + /* forces direct mapping between frame pixels and screen pixels */ int scaling_disabled; - + /* size / aspect ratio calculations */ - /* + /* * "delivered" size: * frame dimension / aspect as delivered by the decoder * used (among other things) to detect frame size changes * units: frame pixels */ - int delivered_width; - int delivered_height; + int delivered_width; + int delivered_height; double delivered_ratio; - + /* * required cropping: * units: frame pixels @@ -69,7 +69,7 @@ struct vo_scale_s { int crop_top; int crop_bottom; - /* + /* * displayed part of delivered images, * taking zoom into account * units: frame pixels @@ -93,7 +93,7 @@ struct vo_scale_s { int gui_x, gui_y; int gui_width, gui_height; int gui_win_x, gui_win_y; - + /* * video + display pixel aspect * One pixel of height 1 has this width @@ -113,11 +113,11 @@ struct vo_scale_s { int output_height; int output_xoffset; int output_yoffset; - + /* */ int force_redraw; - + /* gui callbacks */ @@ -125,13 +125,13 @@ struct vo_scale_s { void (*frame_output_cb) (void *user_data, int video_width, int video_height, double video_pixel_aspect, - int *dest_x, int *dest_y, + int *dest_x, int *dest_y, int *dest_width, int *dest_height, double *dest_pixel_aspect, int *win_x, int *win_y); - + void (*dest_size_cb) (void *user_data, - int video_width, int video_height, + int video_width, int video_height, double video_pixel_aspect, int *dest_width, int *dest_height, double *dest_pixel_aspect); @@ -145,10 +145,10 @@ struct vo_scale_s { */ double output_horizontal_position; double output_vertical_position; - + }; -typedef struct vo_scale_s vo_scale_t; +typedef struct vo_scale_s vo_scale_t; /* @@ -175,7 +175,7 @@ int _x_vo_scale_redraw_needed (vo_scale_t *self) XINE_PROTECTED; /* * */ - + void _x_vo_scale_translate_gui2video(vo_scale_t *self, int x, int y, int *vid_x, int *vid_y) XINE_PROTECTED; @@ -186,11 +186,11 @@ void _x_vo_scale_translate_gui2video(vo_scale_t *self, char *_x_vo_scale_aspect_ratio_name(int a) XINE_PROTECTED; -/* +/* * initialize rescaling struct */ - -void _x_vo_scale_init(vo_scale_t *self, int support_zoom, + +void _x_vo_scale_init(vo_scale_t *self, int support_zoom, int scaling_disabled, config_values_t *config ) XINE_PROTECTED; #ifdef __cplusplus diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index aebbffb39..9f63d793c 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2006 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 @@ -93,7 +93,7 @@ void _x_handle_stream_end (xine_stream_t *stream, int non_user) { * if they have called xine_stop explicitly, so only send * it if stream playback finished because of stream end reached */ - + xine_event_t event; event.data_length = 0; @@ -151,7 +151,7 @@ static int acquire_allowed_to_block(xine_ticket_t *this) { /* List too small. Realloc to larger size */ new_size = this->holder_thread_count * 2; lprintf("Reallocing from %d to %d entries\n", this->holder_thread_count, new_size); - + this->holder_threads = realloc(this->holder_threads, sizeof(*this->holder_threads) * new_size); memset(this->holder_threads + this->holder_thread_count, 0, this->holder_thread_count); @@ -160,15 +160,15 @@ static int acquire_allowed_to_block(xine_ticket_t *this) { this->holder_threads[this->holder_thread_count].holder = own_id; this->holder_thread_count = new_size; - return 1; + return 1; } - + static int ticket_acquire_internal(xine_ticket_t *this, int irrevocable, int nonblocking) { int must_wait = 0; pthread_mutex_lock(&this->lock); int allowed_to_block = acquire_allowed_to_block(this); - + if (this->ticket_revoked && !this->irrevocable_tickets) must_wait = !nonblocking; else if (this->atomic_revoke && !pthread_equal(this->atomic_revoker_thread, pthread_self())) @@ -182,12 +182,12 @@ static int ticket_acquire_internal(xine_ticket_t *this, int irrevocable, int non pthread_cond_wait(&this->issued, &this->lock); } - + this->tickets_granted++; if (irrevocable) this->irrevocable_tickets++; - - pthread_mutex_unlock(&this->lock); + + pthread_mutex_unlock(&this->lock); return 1; } @@ -202,7 +202,7 @@ static void ticket_acquire(xine_ticket_t *this, int irrevocable) { static int release_allowed_to_block(xine_ticket_t *this) { pthread_t own_id = pthread_self(); unsigned entry; - + for(entry = 0; entry < this->holder_thread_count; ++entry) { if(pthread_equal(this->holder_threads[entry].holder, own_id)) { this->holder_threads[entry].count--; @@ -218,18 +218,18 @@ static void ticket_release_internal(xine_ticket_t *this, int irrevocable, int no pthread_mutex_lock(&this->lock); int allowed_to_block = release_allowed_to_block(this); - + this->tickets_granted--; if (irrevocable) this->irrevocable_tickets--; - + if (this->ticket_revoked && !this->tickets_granted) pthread_cond_broadcast(&this->revoked); if (allowed_to_block) { if (this->ticket_revoked && !this->irrevocable_tickets && !nonblocking) pthread_cond_wait(&this->issued, &this->lock); } - + pthread_mutex_unlock(&this->lock); } @@ -244,17 +244,17 @@ static void ticket_release(xine_ticket_t *this, int irrevocable) { static void ticket_renew(xine_ticket_t *this, int irrevocable) { pthread_mutex_lock(&this->lock); - + this->tickets_granted--; - + _x_assert(this->ticket_revoked); if (!this->tickets_granted) pthread_cond_broadcast(&this->revoked); if (!this->irrevocable_tickets || !irrevocable) pthread_cond_wait(&this->issued, &this->lock); - + this->tickets_granted++; - + pthread_mutex_unlock(&this->lock); } @@ -263,12 +263,12 @@ static void ticket_issue(xine_ticket_t *this, int atomic) { if (!atomic) pthread_mutex_lock(&this->revoke_lock); pthread_mutex_lock(&this->lock); - + this->pending_revocations--; if (!this->pending_revocations) pthread_cond_broadcast(&this->issued); this->atomic_revoke = 0; - + pthread_mutex_unlock(&this->lock); pthread_mutex_unlock(&this->revoke_lock); } @@ -277,7 +277,7 @@ static void ticket_revoke(xine_ticket_t *this, int atomic) { pthread_mutex_lock(&this->revoke_lock); pthread_mutex_lock(&this->lock); - + this->pending_revocations++; this->ticket_revoked = 1; if (this->tickets_granted) @@ -288,7 +288,7 @@ static void ticket_revoke(xine_ticket_t *this, int atomic) { this->atomic_revoke = 1; this->atomic_revoker_thread = pthread_self(); } - + pthread_mutex_unlock(&this->lock); if (!atomic) pthread_mutex_unlock(&this->revoke_lock); @@ -300,15 +300,15 @@ static void ticket_dispose(xine_ticket_t *this) { pthread_mutex_destroy(&this->revoke_lock); pthread_cond_destroy(&this->issued); pthread_cond_destroy(&this->revoked); - + free(this); } static xine_ticket_t *XINE_MALLOC ticket_init(void) { xine_ticket_t *port_ticket; - + port_ticket = calloc(1, sizeof(xine_ticket_t)); - + port_ticket->acquire_nonblocking = ticket_acquire_nonblocking; port_ticket->acquire = ticket_acquire; port_ticket->release_nonblocking = ticket_release_nonblocking; @@ -319,12 +319,12 @@ static xine_ticket_t *XINE_MALLOC ticket_init(void) { port_ticket->dispose = ticket_dispose; port_ticket->holder_thread_count = XINE_MAX_TICKET_HOLDER_THREADS; port_ticket->holder_threads = calloc(XINE_MAX_TICKET_HOLDER_THREADS,sizeof(*port_ticket->holder_threads)); - + pthread_mutex_init(&port_ticket->lock, NULL); pthread_mutex_init(&port_ticket->revoke_lock, NULL); pthread_cond_init(&port_ticket->issued, NULL); pthread_cond_init(&port_ticket->revoked, NULL); - + return port_ticket; } @@ -335,25 +335,25 @@ static void set_speed_internal (xine_stream_t *stream, int speed) { if (old_speed != XINE_SPEED_PAUSE && speed == XINE_SPEED_PAUSE) /* get all decoder and post threads in a state where they agree to be blocked */ xine->port_ticket->revoke(xine->port_ticket, 0); - + if (old_speed == XINE_SPEED_PAUSE && speed != XINE_SPEED_PAUSE) /* all decoder and post threads may continue now */ xine->port_ticket->issue(xine->port_ticket, 0); - + if (old_speed != XINE_SPEED_PAUSE && speed == XINE_SPEED_PAUSE) /* set master clock so audio_out loop can pause in a safe place */ stream->xine->clock->set_fine_speed (stream->xine->clock, speed); - + /* see coment on audio_out loop about audio_paused */ if( stream->audio_out ) { xine->port_ticket->acquire(xine->port_ticket, 1); - + /* inform audio_out that speed has changed - he knows what to do */ stream->audio_out->set_property (stream->audio_out, AO_PROP_CLOCK_SPEED, speed); - + xine->port_ticket->release(xine->port_ticket, 1); } - + if (old_speed == XINE_SPEED_PAUSE || speed != XINE_SPEED_PAUSE) /* master clock is set after resuming the audio device (audio_out loop may continue) */ stream->xine->clock->set_fine_speed (stream->xine->clock, speed); @@ -406,18 +406,18 @@ void xine_stop (xine_stream_t *stream) { stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 1); stop_internal (stream); - + if (stream->slave && (stream->slave_affection & XINE_MASTER_SLAVE_STOP)) xine_stop(stream->slave); if (stream->video_out) - stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); + stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); if (stream->audio_out) stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 0); - + stream->xine->port_ticket->release(stream->xine->port_ticket, 1); stream->ignore_speed_change = 0; - + pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); } @@ -444,25 +444,25 @@ static void close_internal (xine_stream_t *stream) { pthread_mutex_unlock(&stream->speed_change_lock); stream->xine->port_ticket->acquire(stream->xine->port_ticket, 1); - + if (stream->audio_out) stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 1); if (stream->video_out) stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 1); } - + stop_internal( stream ); - + if( !gapless_switch ) { if (stream->video_out) - stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); + stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); if (stream->audio_out) stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 0); - + stream->xine->port_ticket->release(stream->xine->port_ticket, 1); stream->ignore_speed_change = 0; } - + if (stream->demux_plugin) { _x_free_demux_plugin(stream, stream->demux_plugin); stream->demux_plugin = NULL; @@ -524,14 +524,14 @@ static int stream_rewire_audio(xine_post_out_t *output, void *data) return 0; stream->xine->port_ticket->revoke(stream->xine->port_ticket, 1); - + if (stream->audio_out->status(stream->audio_out, stream, &bits, &rate, &mode)) { /* register our stream at the new output port */ (new_port->open) (new_port, stream, bits, rate, mode); stream->audio_out->close(stream->audio_out, stream); } stream->audio_out = new_port; - + stream->xine->port_ticket->issue(stream->xine->port_ticket, 1); return 1; @@ -543,19 +543,19 @@ static int stream_rewire_video(xine_post_out_t *output, void *data) xine_video_port_t *new_port = (xine_video_port_t *)data; int64_t img_duration; int width, height; - + if (!data) return 0; stream->xine->port_ticket->revoke(stream->xine->port_ticket, 1); - + if (stream->video_out->status(stream->video_out, stream, &width, &height, &img_duration)) { /* register our stream at the new output port */ (new_port->open) (new_port, stream); stream->video_out->close(stream->video_out, stream); } stream->video_out = new_port; - + stream->xine->port_ticket->issue(stream->xine->port_ticket, 1); return 1; @@ -611,24 +611,24 @@ xine_stream_t *xine_stream_new (xine_t *this, stream->video_driver = vo->driver; else stream->video_driver = NULL; - + stream->video_channel = 0; stream->video_decoder_plugin = NULL; stream->video_decoder_streamtype = -1; - stream->header_count_audio = 0; - stream->header_count_video = 0; - stream->finished_count_audio = 0; + stream->header_count_audio = 0; + stream->header_count_video = 0; + stream->finished_count_audio = 0; stream->finished_count_video = 0; stream->err = 0; stream->broadcaster = NULL; - + /* * initial master/slave */ stream->master = stream; stream->slave = NULL; stream->slave_is_subtitle = 0; - + /* * init mutexes and conditions */ @@ -663,7 +663,7 @@ xine_stream_t *xine_stream_new (xine_t *this, _x_meta_info_reset(stream, i); _x_meta_info_public_reset(stream, i); } - + /* * event queues */ @@ -734,12 +734,12 @@ xine_stream_t *xine_stream_new (xine_t *this, stream->video_source.type = XINE_POST_DATA_VIDEO; stream->video_source.data = stream; stream->video_source.rewire = stream_rewire_video; - + stream->audio_source.name = "audio source"; stream->audio_source.type = XINE_POST_DATA_AUDIO; stream->audio_source.data = stream; stream->audio_source.rewire = stream_rewire_audio; - + return stream; } @@ -749,7 +749,7 @@ void _x_mrl_unescape(char *mrl) { for (i = 0; i < len; i++) { if ((mrl[i]=='%') && (i<(len-2))) { unsigned int c; - + if (sscanf(&mrl[i + 1], "%02x", &c) == 1) { mrl[i]= (char)c; memmove(mrl + i + 1, mrl + i + 3, len - i - 3); @@ -809,7 +809,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { const char *stream_setup = NULL; const char *mrl_proto = NULL; int no_cache = 0; - + if (!mrl) { xprintf (stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); stream->err = XINE_ERROR_MALFORMED_MRL; @@ -841,23 +841,23 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { if (!mrl_proto[0] || mrl_proto[0] != ':' || mrl_proto[1] != '/') mrl_proto = NULL; } - + /* for raw filenames we must try every '#' checking if it is part of the filename */ if( !mrl_proto && stream_setup) { struct stat stat_buf; int res; - + while( stream_setup ) { char *raw_filename = strndup (mrl, stream_setup - mrl); - + res = stat(raw_filename, &stat_buf); free(raw_filename); - if( !res ) + if( !res ) break; stream_setup = strchr(stream_setup + 1, '#'); } } - + { char *input_source = strndup (mrl, stream_setup ? stream_setup - mrl : strlen (mrl)); @@ -866,7 +866,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { */ stream->input_plugin = _x_find_input_plugin (stream, input_source); free(input_source); - + if ( stream->input_plugin ) { int res; @@ -874,7 +874,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { stream->input_plugin->input_class->get_description(stream->input_plugin->input_class)); if (stream->input_plugin->input_class->eject_media) stream->eject_class = stream->input_plugin->input_class; - _x_meta_info_set_utf8(stream, XINE_META_INFO_INPUT_PLUGIN, + _x_meta_info_set_utf8(stream, XINE_META_INFO_INPUT_PLUGIN, (stream->input_plugin->input_class->get_identifier (stream->input_plugin->input_class))); res = (stream->input_plugin->open) (stream->input_plugin); @@ -893,7 +893,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { } } } - + if (!stream->input_plugin) { xine_log (stream->xine, XINE_LOG_MSG, _("xine: cannot find input plugin for MRL [%s]\n"),mrl); stream->err = XINE_ERROR_NO_INPUT_PLUGIN; @@ -961,7 +961,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { xine_log(stream->xine, XINE_LOG_MSG, _("xine: join rip input plugin\n")); input_saver = _x_rip_plugin_get_instance (stream, filename); free(filename); - + if( input_saver ) { stream->input_plugin = input_saver; } else { @@ -1139,7 +1139,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { if( xine_open( stream->slave, subtitle_mrl ) ) { xprintf (stream->xine, XINE_VERBOSITY_LOG, _("subtitle mrl opened '%s'\n"), subtitle_mrl); stream->slave->master = stream; - stream->slave_is_subtitle = 1; + stream->slave_is_subtitle = 1; } else { xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error opening subtitle mrl\n")); xine_dispose( stream->slave ); @@ -1338,9 +1338,9 @@ static int play_internal (xine_stream_t *stream, int start_pos, int start_time) /* set normal speed */ if (_x_get_speed(stream) != XINE_SPEED_NORMAL) set_speed_internal (stream, XINE_FINE_SPEED_NORMAL); - + stream->xine->port_ticket->acquire(stream->xine->port_ticket, 1); - + /* only flush/discard output ports on master streams */ if( stream->master == stream && !stream->gapless_switch) { /* discard audio/video buffers to get engine going and take the lock faster */ @@ -1349,26 +1349,26 @@ static int play_internal (xine_stream_t *stream, int start_pos, int start_time) if (stream->video_out) stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 1); } - + pthread_mutex_lock( &stream->demux_lock ); /* demux_lock taken. now demuxer is suspended */ stream->demux_action_pending = 0; pthread_cond_signal(&stream->demux_resume); - /* set normal speed again (now that demuxer/input pair is suspended) + /* set normal speed again (now that demuxer/input pair is suspended) * some input plugin may have changed speed by itself, we must ensure * the engine is not paused. */ if (_x_get_speed(stream) != XINE_SPEED_NORMAL) set_speed_internal (stream, XINE_FINE_SPEED_NORMAL); - + /* * start/seek demux */ /* seek to new position (no data is sent to decoders yet) */ demux_status = stream->demux_plugin->seek (stream->demux_plugin, - start_pos, start_time, + start_pos, start_time, stream->demux_thread_running); /* only flush/discard output ports on master streams */ @@ -1378,9 +1378,9 @@ static int play_internal (xine_stream_t *stream, int start_pos, int start_time) if (stream->video_out) stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); } - + stream->xine->port_ticket->release(stream->xine->port_ticket, 1); - + /* before resuming the demuxer, set first_frame_flag */ pthread_mutex_lock (&stream->first_frame_lock); stream->first_frame_flag = 2; @@ -1392,7 +1392,7 @@ static int play_internal (xine_stream_t *stream, int start_pos, int start_time) pthread_mutex_unlock( &stream->current_extra_info_lock ); demux_thread_running = stream->demux_thread_running; - + /* now resume demuxer thread if it is running already */ pthread_mutex_unlock( &stream->demux_lock ); @@ -1415,7 +1415,7 @@ static int play_internal (xine_stream_t *stream, int start_pos, int start_time) * see video_out.c */ wait_first_frame (stream); - + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "play_internal ...done\n"); return 1; @@ -1429,26 +1429,26 @@ int xine_play (xine_stream_t *stream, int start_pos, int start_time) { pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); stream->delay_finish_event = 0; - + ret = play_internal (stream, start_pos, start_time); if( stream->slave && (stream->slave_affection & XINE_MASTER_SLAVE_PLAY) ) xine_play (stream->slave, start_pos, start_time); - + stream->gapless_switch = 0; pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); - + return ret; } int xine_eject (xine_stream_t *stream) { - + int status; - if (!stream->eject_class) + if (!stream->eject_class) return 0; - + pthread_mutex_lock (&stream->frontend_lock); pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); @@ -1463,7 +1463,7 @@ int xine_eject (xine_stream_t *stream) { pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); - + return status; } @@ -1495,7 +1495,7 @@ static void xine_dispose_internal (xine_stream_t *stream) { pthread_mutex_unlock(&stream->xine->streams_lock); _x_refcounter_dispose(stream->refcounter); - + free (stream->current_extra_info); free (stream->video_decoder_extra_info); free (stream->audio_decoder_extra_info); @@ -1513,7 +1513,7 @@ void xine_dispose (xine_stream_t *stream) { xine_close(stream); if( stream->master != stream ) { - stream->master->slave = NULL; + stream->master->slave = NULL; } if( stream->slave && stream->slave->master == stream ) { stream->slave->master = NULL; @@ -1521,7 +1521,7 @@ void xine_dispose (xine_stream_t *stream) { if(stream->broadcaster) _x_close_broadcaster(stream->broadcaster); - + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "shutdown audio\n"); _x_audio_decoder_shutdown (stream); @@ -1553,13 +1553,13 @@ void xine_exit (xine_t *this) { if(this->clock) this->clock->exit (this->clock); - + if(this->config) this->config->dispose(this->config); if(this->port_ticket) this->port_ticket->dispose(this->port_ticket); - + #if defined(WIN32) WSACleanup(); #endif @@ -1617,7 +1617,7 @@ xine_t *xine_new (void) { #endif /* WIN32 */ this->verbosity = XINE_VERBOSITY_NONE; - + return this; } @@ -1671,10 +1671,10 @@ static void config_save_cb (void *this_gen, xine_cfg_entry_t *entry) { strcmp(entry->str_value, homedir_trail_slash) == 0)) { xine_stream_t *stream; xine_list_iterator_t ite; - + xine_log(this, XINE_LOG_MSG, _("xine: The specified save_dir \"%s\" might be a security risk.\n"), entry->str_value); - + pthread_mutex_lock(&this->streams_lock); if ( (ite = xine_list_front(this->streams)) ) { stream = xine_list_get_value(this->streams, ite); @@ -1682,7 +1682,7 @@ static void config_save_cb (void *this_gen, xine_cfg_entry_t *entry) { } pthread_mutex_unlock(&this->streams_lock); } - + free(homedir_trail_slash); this->save_path = entry->str_value; } @@ -1696,7 +1696,7 @@ void xine_init (xine_t *this) { */ pthread_mutex_init (&this->streams_lock, NULL); pthread_mutex_init (&this->log_lock, NULL); - + /* initialize color conversion tables and functions */ init_yuv_conversion(); @@ -1736,7 +1736,7 @@ void xine_init (xine_t *this) { * save directory */ this->save_path = this->config->register_filename ( - this->config, + this->config, "media.capture.save_dir", "", XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("directory for saving streams"), _("When using the stream save feature, files will be written only into this directory.\n" @@ -1744,7 +1744,7 @@ void xine_init (xine_t *this) { "can be used to fill files in it with arbitrary content. So you should be careful that " "the directory you specify is robust against any content in any file."), XINE_CONFIG_SECURITY, config_save_cb, this); - + /* * implicit configuration changes */ @@ -1784,7 +1784,7 @@ void xine_init (xine_t *this) { this->clock = _x_metronom_clock_init(this); this->clock->start_clock (this->clock, 0); - + /* * tickets */ @@ -1797,7 +1797,7 @@ void _x_select_spu_channel (xine_stream_t *stream, int channel) { stream->spu_channel_user = (channel >= -2 ? channel : -2); stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); - + switch (stream->spu_channel_user) { case -2: stream->spu_channel = -1; @@ -1817,7 +1817,7 @@ void _x_select_spu_channel (xine_stream_t *stream, int channel) { lprintf("set to %d\n",stream->spu_channel); stream->xine->port_ticket->release(stream->xine->port_ticket, 0); - + pthread_mutex_unlock (&stream->frontend_lock); } @@ -1877,10 +1877,10 @@ void _x_set_fine_speed (xine_stream_t *stream, int speed) { { if (speed <= XINE_SPEED_PAUSE) speed = XINE_SPEED_PAUSE; - + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "set_speed %d\n", speed); set_speed_internal (stream, speed); - + if (stream->slave && (stream->slave_affection & XINE_MASTER_SLAVE_SPEED)) set_speed_internal (stream->slave, speed); } @@ -1892,7 +1892,7 @@ int _x_get_fine_speed (xine_stream_t *stream) { } void _x_set_speed (xine_stream_t *stream, int speed) { - + if (speed > XINE_SPEED_FAST_4) speed = XINE_SPEED_FAST_4; @@ -1901,13 +1901,13 @@ void _x_set_speed (xine_stream_t *stream, int speed) { int _x_get_speed (xine_stream_t *stream) { int speed = _x_get_fine_speed (stream); - + /* - * ensure compatibility with old API, only valid XINE_SPEED_xxx + * ensure compatibility with old API, only valid XINE_SPEED_xxx * constants are allowed. XINE_SPEED_NORMAL may only be returned * if speed is exactly XINE_FINE_SPEED_NORMAL. */ - + if( speed <= XINE_SPEED_PAUSE ) return XINE_SPEED_PAUSE; if( speed <= XINE_SPEED_SLOW_4 * XINE_FINE_SPEED_NORMAL / XINE_SPEED_NORMAL ) @@ -1973,7 +1973,7 @@ 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); stream->xine->port_ticket->release(stream->xine->port_ticket, 0); - + if (!frame) { data->img_size = 0; return 0; @@ -1997,7 +1997,7 @@ static int _x_get_current_frame_data (xine_stream_t *stream, data->ratio_code = XINE_VO_ASPECT_ANAMORPHIC; else if (RATIO_LIKE(data->ratio_code, 21100)) data->ratio_code = XINE_VO_ASPECT_DVB; - + data->format = frame->format; data->interlaced = frame->progressive_frame ? 0 : (2 - frame->top_field_first); @@ -2017,7 +2017,7 @@ static int _x_get_current_frame_data (xine_stream_t *stream, default: if (data->img || (flags & XINE_FRAME_DATA_ALLOCATE_IMG)) { - xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine: error, snapshot function not implemented for format 0x%x\n", frame->format); _x_abort (); } @@ -2040,7 +2040,7 @@ static int _x_get_current_frame_data (xine_stream_t *stream, /* return used buffer size */ data->img_size = required_size; } - + if (data->img) { switch (frame->format) { @@ -2070,7 +2070,7 @@ static int _x_get_current_frame_data (xine_stream_t *stream, break; default: - xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine: error, snapshot function not implemented for format 0x%x\n", frame->format); _x_abort (); } @@ -2247,7 +2247,7 @@ static inline void check_log_alloc (xine_t *this, int buf) void xine_log (xine_t *this, int buf, const char *format, ...) { va_list argp; char buffer[SCRATCH_LINE_LEN_MAX]; - + check_log_alloc (this, buf); va_start (argp, format); @@ -2265,7 +2265,7 @@ void xine_log (xine_t *this, int buf, const char *format, ...) { this->log_cb (this->log_cb_user_data, buf); } -void xine_vlog(xine_t *this, int buf, const char *format, +void xine_vlog(xine_t *this, int buf, const char *format, va_list args) { check_log_alloc (this, buf); @@ -2318,13 +2318,13 @@ int _x_query_buffer_usage(xine_stream_t *stream, int *num_video_buffers, int *nu if (num_video_buffers) *num_video_buffers = (stream->video_fifo ? stream->video_fifo->size(stream->video_fifo) : 0); - + if (num_audio_buffers) *num_audio_buffers = (stream->audio_fifo ? stream->audio_fifo->size(stream->audio_fifo) : 0); - + if ((num_video_frames && stream->video_out) || (num_audio_frames && stream->audio_out)) { - + ticket_acquired = stream->xine->port_ticket->acquire_nonblocking(stream->xine->port_ticket, 1); } diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 0438aedfa..e39c19817 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 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 @@ -46,7 +46,7 @@ #include "demuxers/demux.h" #include "post.h" -/* +/* * version information / checking */ @@ -65,12 +65,12 @@ void xine_get_version (int *major, int *minor, int *sub) { } int xine_check_version(int major, int minor, int sub) { - - if((XINE_MAJOR > major) || - ((XINE_MAJOR == major) && (XINE_MINOR > minor)) || + + if((XINE_MAJOR > major) || + ((XINE_MAJOR == major) && (XINE_MINOR > minor)) || ((XINE_MAJOR == major) && (XINE_MINOR == minor) && (XINE_SUB >= sub))) return 1; - + return 0; } @@ -86,7 +86,7 @@ const char* xine_config_register_string (xine_t *self, int exp_level, xine_config_cb_t changed_cb, void *cb_data) { - + return self->config->register_string (self->config, key, def_value, @@ -107,7 +107,7 @@ const char* xine_config_register_filename (xine_t *self, int exp_level, xine_config_cb_t changed_cb, void *cb_data) { - + return self->config->register_filename (self->config, key, def_value, req_type, description, help, exp_level, @@ -128,7 +128,7 @@ int xine_config_register_range (xine_t *self, description, help, exp_level, changed_cb, cb_data); } - + int xine_config_register_enum (xine_t *self, const char *key, @@ -144,7 +144,7 @@ int xine_config_register_enum (xine_t *self, description, help, exp_level, changed_cb, cb_data); } - + int xine_config_register_num (xine_t *self, const char *key, @@ -155,7 +155,7 @@ int xine_config_register_num (xine_t *self, xine_config_cb_t changed_cb, void *cb_data) { return self->config->register_num (self->config, - key, def_value, + key, def_value, description, help, exp_level, changed_cb, cb_data); } @@ -170,11 +170,11 @@ int xine_config_register_bool (xine_t *self, xine_config_cb_t changed_cb, void *cb_data) { return self->config->register_bool (self->config, - key, def_value, + key, def_value, description, help, exp_level, changed_cb, cb_data); } - + /* * helper function: @@ -210,7 +210,7 @@ static int config_get_current_entry (xine_t *this, xine_cfg_entry_t *entry) { } /* - * get first config item + * get first config item */ int xine_config_get_first_entry (xine_t *this, xine_cfg_entry_t *entry) { int result; @@ -227,12 +227,12 @@ int xine_config_get_first_entry (xine_t *this, xine_cfg_entry_t *entry) { return result; } - + /* * get next config item (iterate through the items) * this will return NULL when called after returning the last item - */ + */ int xine_config_get_next_entry (xine_t *this, xine_cfg_entry_t *entry) { int result; config_values_t *config = this->config; @@ -243,7 +243,7 @@ int xine_config_get_next_entry (xine_t *this, xine_cfg_entry_t *entry) { pthread_mutex_unlock(&config->config_lock); return (xine_config_get_first_entry(this, entry)); } - + /* do not hand out unclaimed entries */ do { config->cur = config->cur->next; @@ -252,11 +252,11 @@ int xine_config_get_next_entry (xine_t *this, xine_cfg_entry_t *entry) { pthread_mutex_unlock(&config->config_lock); return result; -} - +} + /* - * search for a config entry by key + * search for a config entry by key */ int xine_config_lookup_entry (xine_t *this, const char *key, @@ -274,7 +274,7 @@ int xine_config_lookup_entry (xine_t *this, const char *key, return result; } - + /* * update a config entry (which was returned from lookup_entry() ) @@ -294,12 +294,12 @@ void xine_config_update_entry (xine_t *this, const xine_cfg_entry_t *entry) { break; default: - xprintf (this, XINE_VERBOSITY_DEBUG, + xprintf (this, XINE_VERBOSITY_DEBUG, "xine_interface: error, unknown config entry type %d\n", entry->type); _x_abort(); } } - + void xine_config_reset (xine_t *this) { @@ -326,7 +326,7 @@ void xine_config_reset (xine_t *this) { int xine_gui_send_vo_data (xine_stream_t *stream, int type, void *data) { - return stream->video_driver->gui_data_exchange (stream->video_driver, + return stream->video_driver->gui_data_exchange (stream->video_driver, type, data); } #endif @@ -334,7 +334,7 @@ int xine_gui_send_vo_data (xine_stream_t *stream, int xine_port_send_gui_data (xine_video_port_t *vo, int type, void *data) { - return vo->driver->gui_data_exchange (vo->driver, + return vo->driver->gui_data_exchange (vo->driver, type, data); } @@ -369,7 +369,7 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { _x_set_speed (stream, value); pthread_mutex_unlock (&stream->frontend_lock); break; - + case XINE_PARAM_FINE_SPEED: pthread_mutex_lock (&stream->frontend_lock); _x_set_fine_speed (stream, value); @@ -379,7 +379,7 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { case XINE_PARAM_AV_OFFSET: stream->metronom->set_option (stream->metronom, METRONOM_AV_OFFSET, value); break; - + case XINE_PARAM_SPU_OFFSET: stream->metronom->set_option (stream->metronom, METRONOM_SPU_OFFSET, value); break; @@ -417,14 +417,14 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { stream->audio_out->set_property (stream->audio_out, AO_PROP_MUTE_VOL, value); stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; - + case XINE_PARAM_AUDIO_COMPR_LEVEL: stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); if (stream->audio_out) stream->audio_out->set_property (stream->audio_out, AO_PROP_COMPRESSOR, value); stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; - + case XINE_PARAM_AUDIO_AMP_LEVEL: stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); if (stream->audio_out) { @@ -464,8 +464,8 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { case XINE_PARAM_EQ_16000HZ: stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); if (stream->audio_out) - stream->audio_out->set_property (stream->audio_out, - param - XINE_PARAM_EQ_30HZ + AO_PROP_EQ_30HZ, + stream->audio_out->set_property (stream->audio_out, + param - XINE_PARAM_EQ_30HZ + AO_PROP_EQ_30HZ, value); stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; @@ -495,15 +495,15 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { case XINE_PARAM_IGNORE_VIDEO: _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_VIDEO, value); break; - + case XINE_PARAM_IGNORE_AUDIO: _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_AUDIO, value); break; - + case XINE_PARAM_IGNORE_SPU: _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_SPU, value); break; - + case XINE_PARAM_METRONOM_PREBUFFER: stream->metronom->set_option(stream->metronom, METRONOM_PREBUFFER, value); break; @@ -516,26 +516,26 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { stream->broadcaster = NULL; } break; - + case XINE_PARAM_EARLY_FINISHED_EVENT: stream->early_finish_event = !!value; break; - + case XINE_PARAM_DELAY_FINISHED_EVENT: stream->delay_finish_event = value; break; - + case XINE_PARAM_GAPLESS_SWITCH: stream->gapless_switch = !!value; if( stream->gapless_switch && !stream->early_finish_event ) { xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "frontend possibly buggy: gapless_switch without early_finish_event\n"); } break; - + default: xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine_interface: unknown or deprecated stream param %d set\n", param); - } + } } int xine_get_param (xine_stream_t *stream, int param) { @@ -545,7 +545,7 @@ int xine_get_param (xine_stream_t *stream, int param) { case XINE_PARAM_SPEED: ret = _x_get_speed(stream); break; - + case XINE_PARAM_FINE_SPEED: ret = _x_get_fine_speed(stream); break; @@ -553,7 +553,7 @@ int xine_get_param (xine_stream_t *stream, int param) { case XINE_PARAM_AV_OFFSET: ret = stream->metronom->get_option (stream->metronom, METRONOM_AV_OFFSET); break; - + case XINE_PARAM_SPU_OFFSET: ret = stream->metronom->get_option (stream->metronom, METRONOM_SPU_OFFSET); break; @@ -576,7 +576,7 @@ int xine_get_param (xine_stream_t *stream, int param) { ret = -1; else ret = stream->audio_out->get_property (stream->audio_out, AO_PROP_MIXER_VOL); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_AUDIO_MUTE: @@ -585,7 +585,7 @@ int xine_get_param (xine_stream_t *stream, int param) { ret = -1; else ret = stream->audio_out->get_property (stream->audio_out, AO_PROP_MUTE_VOL); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_AUDIO_COMPR_LEVEL: @@ -594,7 +594,7 @@ int xine_get_param (xine_stream_t *stream, int param) { ret = -1; else ret = stream->audio_out->get_property (stream->audio_out, AO_PROP_COMPRESSOR); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_AUDIO_AMP_LEVEL: @@ -603,7 +603,7 @@ int xine_get_param (xine_stream_t *stream, int param) { ret = -1; else ret = stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_AUDIO_AMP_MUTE: @@ -612,7 +612,7 @@ int xine_get_param (xine_stream_t *stream, int param) { ret = -1; else ret = stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP_MUTE); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_EQ_30HZ: @@ -629,9 +629,9 @@ int xine_get_param (xine_stream_t *stream, int param) { if (!stream->audio_out) ret = -1; else - ret= stream->audio_out->get_property (stream->audio_out, + ret= stream->audio_out->get_property (stream->audio_out, param - XINE_PARAM_EQ_30HZ + AO_PROP_EQ_30HZ); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_VERBOSITY: @@ -655,17 +655,17 @@ int xine_get_param (xine_stream_t *stream, int param) { case XINE_PARAM_VO_CROP_BOTTOM: stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); ret = stream->video_out->get_property(stream->video_out, param); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; - + case XINE_PARAM_IGNORE_VIDEO: ret = _x_stream_info_get_public(stream, XINE_STREAM_INFO_IGNORE_VIDEO); break; - + case XINE_PARAM_IGNORE_AUDIO: ret = _x_stream_info_get_public(stream, XINE_STREAM_INFO_IGNORE_AUDIO); break; - + case XINE_PARAM_IGNORE_SPU: ret = _x_stream_info_get_public(stream, XINE_STREAM_INFO_IGNORE_SPU); break; @@ -673,22 +673,22 @@ int xine_get_param (xine_stream_t *stream, int param) { case XINE_PARAM_METRONOM_PREBUFFER: ret = stream->metronom->get_option(stream->metronom, METRONOM_PREBUFFER); break; - + case XINE_PARAM_BROADCASTER_PORT: if( stream->broadcaster ) ret = _x_get_broadcaster_port(stream->broadcaster); else ret = 0; break; - + case XINE_PARAM_EARLY_FINISHED_EVENT: ret = stream->early_finish_event; break; - + case XINE_PARAM_DELAY_FINISHED_EVENT: ret = stream->delay_finish_event; break; - + case XINE_PARAM_GAPLESS_SWITCH: ret = stream->gapless_switch; break; @@ -758,7 +758,7 @@ uint32_t xine_get_stream_info (xine_stream_t *stream, int info) { case XINE_STREAM_INFO_MAX_SPU_CHANNEL: return stream->spu_track_map_entries; - + default: xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine_interface: unknown or deprecated stream info %d requested\n", info); @@ -779,11 +779,11 @@ xine_osd_t *xine_osd_new(xine_stream_t *stream, int x, int y, int width, int hei uint32_t xine_osd_get_capabilities(xine_osd_t *this) { return this->osd.renderer->get_capabilities(&this->osd); -} +} void xine_osd_draw_point(xine_osd_t *this, int x, int y, int color) { this->osd.renderer->point(&this->osd, x, y, color); -} +} void xine_osd_draw_line(xine_osd_t *this, int x1, int y1, int x2, int y2, int color) { this->osd.renderer->line(&this->osd, x1, y1, x2, y2, color); @@ -871,7 +871,7 @@ const char *const *xine_post_list_outputs(xine_post_t *this_gen) { xine_post_in_t *xine_post_input(xine_post_t *this_gen, const char *name) { post_plugin_t *this = (post_plugin_t *)this_gen; xine_list_iterator_t ite; - + ite = xine_list_front(this->input); while (ite) { xine_post_in_t *input = xine_list_get_value(this->input, ite); @@ -885,7 +885,7 @@ xine_post_in_t *xine_post_input(xine_post_t *this_gen, const char *name) { xine_post_out_t *xine_post_output(xine_post_t *this_gen, const char *name) { post_plugin_t *this = (post_plugin_t *)this_gen; xine_list_iterator_t ite; - + ite = xine_list_front(this->output); while (ite) { xine_post_out_t *output = xine_list_get_value(this->output, ite); @@ -936,7 +936,7 @@ int xine_post_wire_audio_port(xine_post_out_t *source, xine_audio_port_t *ao) { } xine_post_out_t * xine_get_video_source(xine_stream_t *stream) { - return &stream->video_source; + return &stream->video_source; } xine_post_out_t * xine_get_audio_source(xine_stream_t *stream) { @@ -993,14 +993,14 @@ int _x_message(xine_stream_t *stream, int type, ...) { va_end(ap); args[n] = NULL; - + size += sizeof(xine_ui_message_data_t) + 1; data = calloc(1, size ); strcpy(data->compatibility.str, "Upgrade your frontend to see the error messages"); data->type = type; data->num_parameters = n; - + if( explanation ) { strcpy(data->messages, explanation); data->explanation = data->messages - (char *)data; @@ -1011,10 +1011,10 @@ int _x_message(xine_stream_t *stream, int type, ...) { } data->parameters = params - (char *)data; - + n = 0; *params = '\0'; - + while(args[n]) { strcpy(params, args[n]); params += strlen(args[n]) + 1; diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 945157fc2..7566c83e0 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2005 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 @@ -96,11 +96,11 @@ typedef struct xine_ticket_s xine_ticket_t; */ struct xine_s { - + config_values_t *config; plugin_catalog_t *plugin_catalog; - + int demux_strategy; char *save_path; @@ -111,7 +111,7 @@ struct xine_s { xine_list_t *streams; pthread_mutex_t streams_lock; - + metronom_clock_t *clock; #ifdef XINE_ENGINE_INTERNAL @@ -134,34 +134,34 @@ struct xine_ticket_s { * the ticket before any operation that might block * * you must never write to this member directly - */ + */ int ticket_revoked; - + /* apply for a ticket; between acquire and relese of an irrevocable * ticket (be sure to pair them properly!), it is guaranteed that you * will never be blocked by ticket revocation */ void (*acquire)(xine_ticket_t *self, int irrevocable); - + /* give a ticket back */ void (*release)(xine_ticket_t *self, int irrevocable); - + /* renew a ticket, when it has been revoked, see ticket_revoked above; * irrevocable must be set to one, if your thread might have acquired * irrevocable tickets you don't know of; set it to zero only when * you know that this is impossible */ void (*renew)(xine_ticket_t *self, int irrevocable); - + #ifdef XINE_ENGINE_INTERNAL /* allow handing out new tickets */ void (*issue)(xine_ticket_t *self, int atomic); - + /* revoke all tickets and deny new ones; * a pair of atomic revoke and issue cannot be interrupted by another * revocation or by other threads acquiring tickets */ void (*revoke)(xine_ticket_t *self, int atomic); - + /* behaves like acquire() but doesn't block the calling thread; when - * the thread would have been blocked, 0 is returned otherwise 1 + * the thread would have been blocked, 0 is returned otherwise 1 * this function acquires a ticket even if ticket revocation is active */ int (*acquire_nonblocking)(xine_ticket_t *self, int irrevocable); @@ -170,7 +170,7 @@ struct xine_ticket_s { void (*release_nonblocking)(xine_ticket_t *self, int irrevocable); void (*dispose)(xine_ticket_t *self); - + pthread_mutex_t lock; pthread_mutex_t revoke_lock; pthread_cond_t issued; @@ -209,28 +209,28 @@ struct xine_event_queue_s { */ struct xine_stream_s { - + /* reference to xine context */ xine_t *xine; - /* metronom instance used by current stream */ + /* metronom instance used by current stream */ metronom_t *metronom; - + /* demuxers use input_plugin to read data */ input_plugin_t *input_plugin; - + /* current content detection method, see METHOD_BY_xxx */ int content_detection_method; /* used by video decoders */ xine_video_port_t *video_out; - + /* demuxers send data to video decoders using this fifo */ fifo_buffer_t *video_fifo; - + /* used by audio decoders */ xine_audio_port_t *audio_out; - + /* demuxers send data to audio decoders using this fifo */ fifo_buffer_t *audio_fifo; @@ -243,10 +243,10 @@ struct xine_stream_s { /* input_dvd uses this one. is it possible to add helper functions instead? */ spu_decoder_t *spu_decoder_plugin; - + /* dxr3 use this one, should be possible to fix to use the port instead */ vo_driver_t *video_driver; - + /* these definitely should be made private! */ int audio_channel_auto; int spu_decoder_streamtype; @@ -254,10 +254,10 @@ struct xine_stream_s { int spu_channel_auto; int spu_channel_letterbox; int spu_channel; - + #ifdef XINE_ENGINE_INTERNAL /* these are private variables, plugins must not access them */ - + int status; /* lock controlling speed change access */ @@ -274,7 +274,7 @@ struct xine_stream_s { int video_decoder_streamtype; extra_info_t *video_decoder_extra_info; int video_channel; - + pthread_t audio_thread; int audio_thread_created; audio_decoder_t *audio_decoder_plugin; @@ -321,15 +321,15 @@ struct xine_stream_s { /* wait for headers sent / stream decoding finished */ pthread_mutex_t counter_lock; pthread_cond_t counter_changed; - int header_count_audio; - int header_count_video; - int finished_count_audio; - int finished_count_video; + int header_count_audio; + int header_count_video; + int finished_count_audio; + int finished_count_video; /* event mechanism */ xine_list_t *event_queues; pthread_mutex_t event_queues_lock; - + /* demux thread stuff */ pthread_t demux_thread; int demux_thread_created; @@ -345,14 +345,14 @@ struct xine_stream_s { xine_post_out_t video_source; xine_post_out_t audio_source; - + int slave_is_subtitle; /* ... and will be automaticaly disposed */ int slave_affection; /* what operations need to be propagated down to the slave? */ - + int err; - + broadcaster_t *broadcaster; - + refcounter_t *refcounter; int emergency_brake; /* something went really wrong and this stream must be @@ -412,11 +412,11 @@ void _x_extra_info_reset( extra_info_t *extra_info ) XINE_PROTECTED; void _x_extra_info_merge( extra_info_t *dst, extra_info_t *src ) XINE_PROTECTED; void _x_get_current_info (xine_stream_t *stream, extra_info_t *extra_info, int size) XINE_PROTECTED; - - + + /* demuxer helper functions from demux.c */ -/* +/* * Flush audio and video buffers. It is called from demuxers on * seek/stop, and may be useful when user input changes a stream and * xine-lib has cached buffers that have yet to be played. @@ -446,9 +446,9 @@ void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size, int input_normpos, int input_time, int total_time, uint32_t frame_number) XINE_PROTECTED; -int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, - int size, int64_t pts, uint32_t type, - uint32_t decoder_flags, off_t input_normpos, +int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, + int size, int64_t pts, uint32_t type, + uint32_t decoder_flags, off_t input_normpos, int input_time, int total_time, uint32_t frame_number) XINE_PROTECTED; @@ -461,7 +461,7 @@ void _x_demux_send_mrl_reference (xine_stream_t *stream, int alternative, */ void _x_mrl_unescape(char *mrl) XINE_PROTECTED; -/* +/* * plugin_loader functions * */ diff --git a/src/xine-engine/xine_plugin.h b/src/xine-engine/xine_plugin.h index 74e7523e9..3aa236ceb 100644 --- a/src/xine-engine/xine_plugin.h +++ b/src/xine-engine/xine_plugin.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 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 @@ -33,7 +33,7 @@ #define PLUGIN_VIDEO_OUT 7 #define PLUGIN_POST 8 -#define PLUGIN_TYPE_MAX PLUGIN_POST +#define PLUGIN_TYPE_MAX PLUGIN_POST /* this flag may be or'ed with type in order to force preloading the plugin. * very useful to register config items on xine initialization. diff --git a/src/xine-engine/xineintl.h b/src/xine-engine/xineintl.h index 113a033fa..bb9c006ef 100644 --- a/src/xine-engine/xineintl.h +++ b/src/xine-engine/xineintl.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2005 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 |