SOURCES: xine-lib-vdr.patch (NEW), xine-ui-vdr.patch (NEW) - VDR s...
luzik
luzik at pld-linux.org
Sat Aug 26 11:59:50 CEST 2006
Author: luzik Date: Sat Aug 26 09:59:49 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- VDR support for xine, taken from http://home.vrweb.de/~rnissl/vdr-xine-0.7.9.tgz
---- Files affected:
SOURCES:
xine-lib-vdr.patch (NONE -> 1.1) (NEW), xine-ui-vdr.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/xine-lib-vdr.patch
diff -u /dev/null SOURCES/xine-lib-vdr.patch:1.1
--- /dev/null Sat Aug 26 11:59:49 2006
+++ SOURCES/xine-lib-vdr.patch Sat Aug 26 11:59:44 2006
@@ -0,0 +1,4966 @@
+Index: xine-lib/configure.ac
+===================================================================
+RCS file: /cvsroot/xine/xine-lib/configure.ac,v
+retrieving revision 1.356
+diff -u -r1.356 configure.ac
+--- xine-lib/configure.ac 5 Feb 2006 13:59:45 -0000 1.356
++++ xine-lib/configure.ac 20 Mar 2006 21:11:58 -0000
+@@ -2351,6 +2351,7 @@
+ src/video_out/vidix/drivers/Makefile
+ src/xine-utils/Makefile
+ src/xine-engine/Makefile
++src/vdr/Makefile
+ win32/Makefile
+ win32/include/Makefile])
+ AC_CONFIG_COMMANDS([default],[[chmod +x ./misc/SlackBuild ./misc/build_rpms.sh ./misc/relchk.sh]],[[]])
+@@ -2406,7 +2407,7 @@
+ echo " - stdin_fifo - rtp"
+ echo " - http - mms"
+ echo " - pnm - rtsp"
+-echo " - dvb"
++echo " - dvb - vdr"
+ if test x"$external_dvdnav" = "xyes"; then
+ echo " - dvd (external libs)"
+ else
+@@ -2589,6 +2590,7 @@
+ echo " - eq - eq2"
+ echo " - boxblur - denoise3d"
+ echo " - unsharp - tvtime"
++echo " - vdr"
+ echo " * SFX:"
+ echo " - goom - oscope"
+ echo " - fftscope - mosaico"
+Index: xine-lib/src/Makefile.am
+===================================================================
+RCS file: /cvsroot/xine/xine-lib/src/Makefile.am,v
+retrieving revision 1.54
+diff -u -r1.54 Makefile.am
+--- xine-lib/src/Makefile.am 14 Jan 2005 15:24:08 -0000 1.54
++++ xine-lib/src/Makefile.am 20 Mar 2006 21:11:59 -0000
+@@ -30,4 +30,5 @@
+ libfaad \
+ libflac \
+ libmusepack \
+- post
++ post \
++ vdr
+Index: xine-lib/src/libmpeg2/decode.c
+===================================================================
+RCS file: /cvsroot/xine/xine-lib/src/libmpeg2/decode.c,v
+retrieving revision 1.130
+diff -u -r1.130 decode.c
+--- xine-lib/src/libmpeg2/decode.c 19 Feb 2006 15:05:07 -0000 1.130
++++ xine-lib/src/libmpeg2/decode.c 20 Mar 2006 21:12:02 -0000
+@@ -251,7 +251,7 @@
+ }
+
+ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code,
+- uint8_t * buffer)
++ uint8_t * buffer, int next_code)
+ {
+ picture_t * picture;
+ int is_frame_done;
+@@ -408,6 +408,11 @@
+ /* abort(); */
+ break;
+ }
++
++ /* according to ISO/IEC 13818-2, an extension start code will follow.
++ * Otherwise the stream follows ISO/IEC 11172-2 which means MPEG1 */
++ picture->mpeg1 = (next_code != 0xb5);
++
+ if (mpeg2dec->force_aspect) picture->aspect_ratio_information = mpeg2dec->force_aspect;
+
+ if (mpeg2dec->is_sequence_needed ) {
+@@ -589,45 +594,135 @@
+ return is_frame_done;
+ }
+
++static inline int find_start_code (mpeg2dec_t * mpeg2dec,
++ uint8_t ** current, uint8_t * limit)
++{
++ uint8_t * p;
++
++ if (*current >= limit)
++ return 0;
++ if (mpeg2dec->shift == 0x00000100)
++ return 1;
++
++ mpeg2dec->shift = (mpeg2dec->shift | *(*current)++) << 8;
++
++ if (*current >= limit)
++ return 0;
++ if (mpeg2dec->shift == 0x00000100)
++ return 1;
++
++ mpeg2dec->shift = (mpeg2dec->shift | *(*current)++) << 8;
++
++ if (*current >= limit)
++ return 0;
++ if (mpeg2dec->shift == 0x00000100)
++ return 1;
++
++ limit--;
++
++ if (*current >= limit) {
++ mpeg2dec->shift = (mpeg2dec->shift | *(*current)++) << 8;
++ return 0;
++ }
++
++ p = *current;
++
++ while (p < limit && (p = (uint8_t *)memchr(p, 0x01, limit - p))) {
++ if (p[-2] || p[-1])
++ p += 3;
++ else {
++ *current = ++p;
++ return 1;
++ }
++ }
++
++ *current = ++limit;
++ p = limit - 3;
++ mpeg2dec->shift = (mpeg2dec->shift | *p++) << 8;
++ mpeg2dec->shift = (mpeg2dec->shift | *p++) << 8;
++ mpeg2dec->shift = (mpeg2dec->shift | *p++) << 8;
++
++ return 0;
++}
++
+ static inline uint8_t * copy_chunk (mpeg2dec_t * mpeg2dec,
+ uint8_t * current, uint8_t * end)
+ {
+- uint32_t shift;
+- uint8_t * chunk_ptr;
+ uint8_t * limit;
+- uint8_t byte;
+
+- shift = mpeg2dec->shift;
+- chunk_ptr = mpeg2dec->chunk_ptr;
+- limit = current + (mpeg2dec->chunk_buffer + BUFFER_SIZE - chunk_ptr);
++ /* sequence end code 0xb7 doesn't have any data and there might be the case
++ * that no start code will follow this code for quite some time (e. g. in case
++ * of a still image.
++ * Therefore, return immediately with a chunk_size of 0. Setting code to 0xb4
++ * will eat up any trailing garbage next time.
++ */
++ if (mpeg2dec->code == 0xb7) {
++ mpeg2dec->code = 0xb4;
++ mpeg2dec->chunk_size = 0;
++ return current;
++ }
++
++ limit = current + (mpeg2dec->chunk_buffer + BUFFER_SIZE - mpeg2dec->chunk_ptr);
+ if (limit > end)
+ limit = end;
++#if 0
++ {
++ uint32_t shift = mpeg2dec->shift;
++ uint8_t * chunk_ptr = mpeg2dec->chunk_ptr;
+
+- while (1) {
++ while (1) {
+
+- byte = *current++;
+- if (shift != 0x00000100) {
+- shift = (shift | byte) << 8;
+- *chunk_ptr++ = byte;
+- if (current < limit)
+- continue;
+- if (current == end) {
+- mpeg2dec->chunk_ptr = chunk_ptr;
+- mpeg2dec->shift = shift;
+- return NULL;
+- } else {
+- /* we filled the chunk buffer without finding a start code */
+- mpeg2dec->code = 0xb4; /* sequence_error_code */
+- mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer;
+- return current;
++ uint8_t byte = *current++;
++ if (shift != 0x00000100) {
++ shift = (shift | byte) << 8;
++ *chunk_ptr++ = byte;
++ if (current < limit)
++ continue;
++ if (current == end) {
++ mpeg2dec->chunk_ptr = chunk_ptr;
++ mpeg2dec->shift = shift;
++ return NULL;
++ } else {
++ /* we filled the chunk buffer without finding a start code */
++ mpeg2dec->code = 0xb4; /* sequence_error_code */
++ mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer;
++ return current;
++ }
+ }
++ mpeg2dec->code = byte;
++ mpeg2dec->chunk_size = chunk_ptr - mpeg2dec->chunk_buffer - 3;
++ mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer;
++ mpeg2dec->shift = 0xffffff00;
++ return current;
+ }
+- mpeg2dec->code = byte;
+- mpeg2dec->chunk_size = chunk_ptr - mpeg2dec->chunk_buffer - 3;
++ }
++#else
++ {
++ uint8_t * data = current;
++ int found = find_start_code(mpeg2dec, ¤t, limit);
++ int bite = current - data;
++ if (bite) {
++ xine_fast_memcpy(mpeg2dec->chunk_ptr, data, bite);
++ mpeg2dec->chunk_ptr += bite;
++ }
++
++ if (found) {
++ mpeg2dec->code = *current++;
++ mpeg2dec->chunk_size = mpeg2dec->chunk_ptr - mpeg2dec->chunk_buffer - 3;
++ mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer;
++ mpeg2dec->shift = 0xffffff00;
++ return current;
++ }
++
++ if (current == end)
++ return NULL;
++
++ /* we filled the chunk buffer without finding a start code */
++ mpeg2dec->code = 0xb4; /* sequence_error_code */
+ mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer;
+- mpeg2dec->shift = 0xffffff00;
+ return current;
+ }
++#endif
+ }
+
+ int mpeg2_decode_data (mpeg2dec_t * mpeg2dec, uint8_t * current, uint8_t * end,
+@@ -648,12 +743,12 @@
+ if (pts)
+ mpeg2dec->pts = pts;
+
+- while (current != end) {
++ while (current != end || mpeg2dec->code == 0xb7) {
+ code = mpeg2dec->code;
+ current = copy_chunk (mpeg2dec, current, end);
+ if (current == NULL)
+ break;
+- ret += parse_chunk (mpeg2dec, code, mpeg2dec->chunk_buffer);
++ ret += parse_chunk (mpeg2dec, code, mpeg2dec->chunk_buffer, mpeg2dec->code);
+ }
+
+ libmpeg2_accel_frame_completion(&mpeg2dec->accel, mpeg2dec->frame_format,
+@@ -820,7 +915,7 @@
+ void mpeg2_find_sequence_header (mpeg2dec_t * mpeg2dec,
+ uint8_t * current, uint8_t * end){
+
+- uint8_t code;
++ uint8_t code, next_code;
+ picture_t *picture = mpeg2dec->picture;
+
+ mpeg2dec->seek_mode = 1;
+@@ -830,6 +925,7 @@
+ current = copy_chunk (mpeg2dec, current, end);
+ if (current == NULL)
+ return ;
++ next_code = mpeg2dec->code;
+
+ /* printf ("looking for sequence header... %02x\n", code); */
+
+@@ -840,6 +936,11 @@
+ printf ("libmpeg2: bad sequence header\n");
+ continue;
+ }
++
++ /* according to ISO/IEC 13818-2, an extension start code will follow.
++ * Otherwise the stream follows ISO/IEC 11172-2 which means MPEG1 */
++ picture->mpeg1 = (next_code != 0xb5);
++
+ if (mpeg2dec->force_aspect) picture->aspect_ratio_information = mpeg2dec->force_aspect;
+
+ if (mpeg2dec->is_sequence_needed) {
+Index: xine-lib/src/post/planar/expand.c
+===================================================================
+RCS file: /cvsroot/xine/xine-lib/src/post/planar/expand.c,v
+retrieving revision 1.15
+diff -u -r1.15 expand.c
+--- xine-lib/src/post/planar/expand.c 27 Jan 2006 07:46:14 -0000 1.15
++++ xine-lib/src/post/planar/expand.c 20 Mar 2006 21:12:04 -0000
+@@ -21,7 +21,8 @@
+ *
+ * expand video filter by James Stembridge 24/05/2003
+ * improved by Michael Roitzsch
+- *
++ * centre_crop_out_mode by Reinhard Nissl
++ *
+ * based on invert.c
+ *
+ */
+@@ -52,6 +53,11 @@
+ * This way, the decoder (or any other post plugin up the tree) will only
+ * see the frame area between the black bars and by that modify the
+ * enlarged version directly. No need for later copying.
++ *
++ * When centre_crop_out_mode is enabled, the plugin will detect the black
++ * bars to the left and right of the image and will then set up cropping
++ * to efficiently remove the black border around the 4:3 image, which the
++ * plugin would produce otherwise for this case.
+ */
+
+
+@@ -63,6 +69,7 @@
+ int enable_automatic_shift;
+ int overlay_y_offset;
+ double aspect;
++ int centre_cut_out_mode;
+ } expand_parameters_t;
+
+ START_PARAM_DESCR(expand_parameters_t)
+@@ -72,6 +79,8 @@
+ "manually shift the overlay vertically")
+ PARAM_ITEM(POST_PARAM_TYPE_DOUBLE, aspect, NULL, 1.0, 3.5, 0,
+ "target aspect ratio")
++PARAM_ITEM(POST_PARAM_TYPE_BOOL, centre_cut_out_mode, NULL, 0, 1, 0,
++ "cut out centered 4:3 image contained in 16:9 frame")
+ END_PARAM_DESCR(expand_param_descr)
+
+ typedef struct post_expand_s {
+@@ -83,6 +92,8 @@
+ int overlay_y_offset;
+ double aspect;
+ int top_bar_height;
++ int centre_cut_out_mode;
++ int cropping_active;
+ } post_expand_t;
+
+ /* plugin class functions */
+@@ -107,6 +118,9 @@
+ uint32_t height, double ratio,
+ int format, int flags);
+
++/* replaced vo_frame functions */
++static int expand_draw(vo_frame_t *frame, xine_stream_t *stream);
++
+ /* overlay manager intercept check */
+ static int expand_intercept_ovl(post_video_port_t *port);
+
+@@ -152,11 +166,14 @@
+ this->enable_automatic_shift = 0;
+ this->overlay_y_offset = 0;
+ this->aspect = 4.0 / 3.0;
++ this->centre_cut_out_mode = 0;
++ this->cropping_active = 0;
+
+ port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output);
+ port->new_port.get_frame = expand_get_frame;
+ port->intercept_ovl = expand_intercept_ovl;
+ port->new_manager->add_event = expand_overlay_add_event;
++ port->new_frame->draw = expand_draw;
+
+ input_param = &this->parameter_input;
+ input_param->name = "parameters";
+@@ -164,8 +181,8 @@
+ input_param->data = &post_api;
+ xine_list_push_back(this->post.input, input_param);
+
+- input->xine_in.name = "video";
+- output->xine_out.name = "expanded video";
++ input->xine_in.name = "video";
++ output->xine_out.name = "expanded video";
+
+ this->post.xine_post.video_input[0] = &port->new_port;
+
+@@ -212,6 +229,8 @@
+ this->enable_automatic_shift = param->enable_automatic_shift;
+ this->overlay_y_offset = param->overlay_y_offset;
+ this->aspect = param->aspect;
++ this->centre_cut_out_mode = param->centre_cut_out_mode;
++
+ return 1;
+ }
+
+@@ -223,6 +242,8 @@
+ param->enable_automatic_shift = this->enable_automatic_shift;
+ param->overlay_y_offset = this->overlay_y_offset;
+ param->aspect = this->aspect;
++ param->centre_cut_out_mode = this->centre_cut_out_mode;
++
+ return 1;
+ }
+
+@@ -236,6 +257,7 @@
+ " Enable_automatic_shift: Enable automatic overlay shifting\n"
+ " Overlay_y_offset: Manually shift the overlay vertically\n"
+ " aspect: The target aspect ratio (default 4:3)\n"
++ " Centre_cut_out_mode: extracts 4:3 image contained in 16:9 frame\n"
+ "\n"
+ );
+ }
+@@ -322,6 +344,10 @@
+
+ static int expand_intercept_ovl(post_video_port_t *port)
+ {
++ post_expand_t *this = (post_expand_t *)port->post;
++
++ if (this->centre_cut_out_mode && this->cropping_active) return 0;
++
+ /* we always intercept overlay manager */
+ return 1;
+ }
+@@ -350,3 +376,79 @@
+
+ return port->original_manager->add_event(port->original_manager, event_gen);
+ }
++
++
++static int is_pixel_black(vo_frame_t *frame, int x, int y)
++{
++ int Y = 0x00, Cr = 0x00, Cb = 0x00;
++
++ if (x < 0) x = 0;
++ if (x >= frame->width) x = frame->width - 1;
++ if (y < 0) y = 0;
++ if (y >= frame->height) y = frame->height - 1;
++
++ switch (frame->format)
++ {
++ case XINE_IMGFMT_YV12:
++ Y = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x);
++ Cr = *(frame->base[ 1 ] + frame->pitches[ 1 ] * y / 2 + x / 2);
++ Cb = *(frame->base[ 2 ] + frame->pitches[ 2 ] * y / 2 + x / 2);
++ break;
++
++ case XINE_IMGFMT_YUY2:
++ Y = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x * 2 + 0);
++ x &= ~1;
++ Cr = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x * 2 + 1);
++ Cb = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x * 2 + 3);
++ break;
++ }
++
++ return (Y == 0x10 && Cr == 0x80 && Cb == 0x80);
++}
++
++
++static int expand_draw(vo_frame_t *frame, xine_stream_t *stream)
++{
++ post_video_port_t *port = (post_video_port_t *)frame->port;
++ post_expand_t *this = (post_expand_t *)port->post;
++ int skip;
++
++ if (this->centre_cut_out_mode && !frame->bad_frame)
++ {
++ /* expected area of inner 4:3 image */
++ int centre_width = frame->width * (9 * 4) / (16 * 3);
++ int centre_left = (frame->width - centre_width ) / 2;
++
++ /* centre point for detecting a black frame */
++ int centre_x = frame->width / 2;
++ int centre_y = frame->height / 2;
++
++ /* ignore a black frame as it could lead to wrong results */
++ if (!is_pixel_black(frame, centre_x, centre_y))
++ {
++ /* coordinates for testing black border near the centre area */
++ int test_left = centre_left - 16;
++ int test_right = centre_left + 16 + centre_width;
++
++ /* enable cropping when these pixels are black */
++ this->cropping_active = is_pixel_black(frame, test_left, centre_y)
++ && is_pixel_black(frame, test_right, centre_y);
++ }
++
++ /* crop frame */
++ if (this->centre_cut_out_mode && this->cropping_active) {
++ frame->crop_left += centre_left;
++ frame->crop_right += centre_left;
++
++ /* get_frame() allocated an extra high frame */
++ frame->crop_top += (frame->next->height - frame->height) / 2;
++ frame->crop_bottom += (frame->next->height - frame->height) / 2;
++ }
++ }
++
++ _x_post_frame_copy_down(frame, frame->next);
++ skip = frame->next->draw(frame->next, stream);
++ _x_post_frame_copy_up(frame, frame->next);
++
++ return skip;
++}
+Index: xine-lib/src/xine-engine/audio_out.c
+===================================================================
+RCS file: /cvsroot/xine/xine-lib/src/xine-engine/audio_out.c,v
+retrieving revision 1.198
+diff -u -r1.198 audio_out.c
+--- xine-lib/src/xine-engine/audio_out.c 7 Mar 2006 08:03:22 -0000 1.198
++++ xine-lib/src/xine-engine/audio_out.c 20 Mar 2006 21:12:07 -0000
+@@ -1034,6 +1034,10 @@
+ }
+ }
+
++ if ((in_buf->vpts - cur_time) > 2*90000 )
++ xprintf(this->xine, XINE_VERBOSITY_DEBUG,
++ "audio_out: vpts/clock error, in_buf->vpts=%" PRId64 " cur_time=%" PRId64 "\n", in_buf->vpts, cur_time);
++
+ lprintf ("loop:pause: I feel sleepy (%d buffers).\n", this->out_fifo->num_buffers);
+ xine_usec_sleep (10000);
+ lprintf ("loop:pause: I wake up.\n");
+Index: xine-lib/src/xine-engine/demux.c
+===================================================================
+RCS file: /cvsroot/xine/xine-lib/src/xine-engine/demux.c,v
+retrieving revision 1.61
+diff -u -r1.61 demux.c
+--- xine-lib/src/xine-engine/demux.c 24 Jan 2006 22:25:34 -0000 1.61
++++ xine-lib/src/xine-engine/demux.c 20 Mar 2006 21:12:08 -0000
+@@ -85,6 +85,8 @@
+ stream->video_fifo->clear(stream->video_fifo);
+ stream->audio_fifo->clear(stream->audio_fifo);
+
++ 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);
+@@ -93,6 +95,8 @@
+ 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.
+ * otherwise we flush too early (before the old data has left decoders)
+ */
+@@ -124,6 +128,8 @@
+
+ buf_element_t *buf;
+
++ pthread_mutex_lock(&stream->demux_mutex);
++
+ buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo);
+ buf->type = BUF_CONTROL_NEWPTS;
+ buf->decoder_flags = flags;
+@@ -135,6 +141,8 @@
+ buf->decoder_flags = flags;
+ buf->disc_off = pts;
+ stream->audio_fifo->put (stream->audio_fifo, buf);
++
++ pthread_mutex_unlock(&stream->demux_mutex);
+ }
+
+ /* sync with decoder fifos, making sure everything gets processed */
+@@ -165,12 +173,16 @@
+ header_count_audio = 0;
+ }
+
++ pthread_mutex_lock(&stream->demux_mutex);
++
+ buf_video->type = BUF_CONTROL_HEADERS_DONE;
+ stream->video_fifo->put (stream->video_fifo, buf_video);
+
+ buf_audio->type = BUF_CONTROL_HEADERS_DONE;
+ stream->audio_fifo->put (stream->audio_fifo, buf_audio);
+
++ pthread_mutex_unlock(&stream->demux_mutex);
++
+ while ((stream->header_count_audio < header_count_audio) ||
+ (stream->header_count_video < header_count_video)) {
+ struct timeval tv;
+@@ -198,6 +210,8 @@
+
+ buf_element_t *buf;
+
++ pthread_mutex_lock(&stream->demux_mutex);
++
+ buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo);
+ buf->type = BUF_CONTROL_START;
+ stream->video_fifo->put (stream->video_fifo, buf);
+@@ -205,12 +219,16 @@
+ buf = stream->audio_fifo->buffer_pool_alloc (stream->audio_fifo);
+ buf->type = BUF_CONTROL_START;
+ stream->audio_fifo->put (stream->audio_fifo, buf);
++
++ 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);
++
+ buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_flags = flags;
<<Diff was trimmed, longer than 597 lines>>
More information about the pld-cvs-commit
mailing list