Update to stable, xine-lib-1.1.21.

from Brad (maintainer)
This commit is contained in:
ajacoutot 2012-06-10 07:35:30 +00:00
parent e46b52296a
commit 29f3695280
32 changed files with 111 additions and 4160 deletions

View File

@ -1,16 +1,15 @@
# $OpenBSD: Makefile,v 1.95 2012/06/09 08:41:16 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.96 2012/06/10 07:35:30 ajacoutot Exp $
SHARED_ONLY= Yes
COMMENT= multimedia decoding library
DISTNAME= xine-lib-1.1.20.1
REVISION= 8
DISTNAME= xine-lib-1.1.21
CATEGORIES= multimedia
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=xine/}
EXTRACT_SUFX= .tar.xz
SHARED_LIBS= xine 29.0
SHARED_LIBS= xine 29.1
HOMEPAGE= http://www.xine-project.org/
@ -35,9 +34,6 @@ XINEAPI_REV= 1.30
SUBST_VARS+= XINEAPI_REV
MODULES= devel/gettext
BUILD_DEPENDS= devel/libtool \
${MODGNU_AUTOCONF_DEPENDS} \
${MODGNU_AUTOMAKE_DEPENDS}
LIB_DEPENDS= audio/faad \
audio/flac \
audio/liba52 \
@ -58,13 +54,11 @@ LIB_DEPENDS= audio/faad \
graphics/libmng \
graphics/vcdimager
AUTOCONF_VERSION= 2.68
AUTOMAKE_VERSION= 1.11
USE_GMAKE= Yes
USE_LIBTOOL= Yes
USE_GROFF= Yes
CONFIGURE_STYLE= gnu
CONFIGURE_STYLE= autoconf
AUTOCONF_VERSION= 2.69
CONFIGURE_ARGS+=--disable-aalib \
--disable-dxr3 \
--disable-fb \
@ -98,13 +92,6 @@ CONFIGURE_ENV= CPPFLAGS="-I${X11BASE}/include -I${LOCALBASE}/include" \
NO_REGRESS= Yes
post-extract:
@perl -pi -e 's/\r\n/\n/g' ${WRKSRC}/src/demuxers/asfheader.c
post-patch:
@cd ${WRKSRC} && env AUTOCONF_VERSION=${AUTOCONF_VERSION} AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \
sh autogen.sh noconfig
post-install:
@find ${PREFIX}/lib/xine/plugins -name '*.a' -print | xargs rm

View File

@ -1,5 +1,5 @@
MD5 (xine-lib-1.1.20.1.tar.xz) = kPYZCExpK0r/IMj50SWRSA==
RMD160 (xine-lib-1.1.20.1.tar.xz) = 2yfk1wi5SFXXN20QseXPYNLlMtc=
SHA1 (xine-lib-1.1.20.1.tar.xz) = V3U3vzqlCnCMfkh+SASuPB+AN5Y=
SHA256 (xine-lib-1.1.20.1.tar.xz) = 5MdAkcioNlIsPIPAdHVEJKzJHhdNHYGO4NI/gXM3x8Q=
SIZE (xine-lib-1.1.20.1.tar.xz) = 5948420
MD5 (xine-lib-1.1.21.tar.xz) = 0BY9T512E/sFDFwiBZczNg==
RMD160 (xine-lib-1.1.21.tar.xz) = BdjBQGXFkf+hf2bnvh0YHlNoYdU=
SHA1 (xine-lib-1.1.21.tar.xz) = Ct8g71XSTyobSol05XrRvlEzsjY=
SHA256 (xine-lib-1.1.21.tar.xz) = PfNia+cjJsx6gGQWznCwdqtuA0t8rOkA3TgkQwjY64g=
SIZE (xine-lib-1.1.21.tar.xz) = 5929176

View File

@ -1,88 +0,0 @@
$OpenBSD: patch-autogen_sh,v 1.1 2012/04/08 07:37:25 ajacoutot Exp $
--- autogen.sh.orig Tue Oct 4 17:42:52 2011
+++ autogen.sh Sat Apr 7 14:22:42 2012
@@ -70,18 +70,7 @@ detect_autoconf() {
RETVAL=$?
NUM_RESULT=$#
RESULT_FILE=$3
- if [ $RETVAL -eq 0 -a $NUM_RESULT -eq 3 -a -f "$RESULT_FILE" ]; then
- AC="`autoconf --version | parse_version_no`"
- if [ `expr $AC` -ge "`echo $AUTOCONF_MIN | parse_version_no`" ]; then
- autoconf_ok=yes
- fi
- else
- echo
- echo "**Error**: You must have \`autoconf' >= $AUTOCONF_MIN installed to"
- echo " compile $PROG. Download the appropriate package"
- echo " for your distribution or source from ftp.gnu.org."
- exit 1
- fi
+ autoconf_ok=yes
}
run_autoheader () {
@@ -107,7 +96,9 @@ run_autoconf () {
echo $_echo_n " + Running autoconf: $_echo_c";
autoconf;
- sed -i -e '/gnu_ld/,/;;/ s/--rpath \${wl}/--rpath,/' configure
+ sed -e '/gnu_ld/,/;;/ s/--rpath \${wl}/--rpath,/' configure > configure.new
+ mv configure.new configure
+ chmod +x configure
echo "done."
}
@@ -120,12 +111,7 @@ try_libtool_executable() {
RETVAL=$?
NUM_RESULT=$#
RESULT_FILE=$3
- if [ $RETVAL -eq 0 -a $NUM_RESULT -eq 3 -a -f "$RESULT_FILE" ]; then
- LT="`$libtool --version | awk '{ print $4 }' | parse_version_no`"
- if [ `expr $LT` -ge "`echo $LIBTOOL_MIN | parse_version_no`" ]; then
- libtool_ok=yes
- fi
- fi
+ libtool_ok=yes
}
detect_libtool() {
@@ -168,18 +154,7 @@ detect_automake() {
RETVAL=$?
NUM_RESULT=$#
RESULT_FILE=$3
- if [ $RETVAL -eq 0 -a $NUM_RESULT -eq 3 -a -f "$RESULT_FILE" ]; then
- AM="`automake --version | parse_version_no`"
- if [ `expr $AM` -ge "`echo $AUTOMAKE_MIN | parse_version_no`" ]; then
- automake_ok=yes
- fi
- else
- echo
- echo "**Error**: You must have \`automake' >= $AUTOMAKE_MIN installed to"
- echo " compile $PROG. Download the appropriate package"
- echo " for your distribution or source from ftp.gnu.org."
- exit 1
- fi
+ automake_ok=yes
}
run_automake () {
@@ -206,18 +181,7 @@ detect_aclocal() {
RETVAL=$?
NUM_RESULT=$#
RESULT_FILE=$3
- if [ $RETVAL -eq 0 -a $NUM_RESULT -eq 3 -a -f "$RESULT_FILE" ]; then
- AC="`aclocal --version | parse_version_no`"
- if [ `expr $AC` -ge "`echo $AUTOMAKE_MIN | parse_version_no`" ]; then
- aclocal_ok=yes
- fi
- else
- echo
- echo "**Error**: You must have \`aclocal' >= $AUTOMAKE_MIN installed to"
- echo " compile $PROG. Download the appropriate package"
- echo " for your distribution or source from ftp.gnu.org."
- exit 1
- fi
+ aclocal_ok=yes
}
run_aclocal () {

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-configure_ac,v 1.12 2012/05/24 18:36:45 shadchin Exp $
$OpenBSD: patch-configure_ac,v 1.13 2012/06/10 07:35:30 ajacoutot Exp $
--- configure.ac.orig Sun Jan 1 12:30:52 2012
+++ configure.ac Sat Apr 7 13:58:35 2012
@@ -558,9 +558,9 @@ t q
@ -35,26 +35,3 @@ $OpenBSD: patch-configure_ac,v 1.12 2012/05/24 18:36:45 shadchin Exp $
AC_SUBST(MNG_LIBS)
else
have_libmng=no
@@ -1672,6 +1673,22 @@ else
no_gdkpixbuf=yes
fi
AM_CONDITIONAL(HAVE_GDK_PIXBUF, test "x$no_gdkpixbuf" != "xyes")
+
+dnl ---------------------------------------------
+dnl libbluray support
+dnl ---------------------------------------------
+AC_ARG_ENABLE([bluray],
+ AS_HELP_STRING([--disable-bluray], [Do not build BluRay support]),
+ [with_bluray=$enableval], [with_bluray=yes])
+
+if test "x$with_bluray" != "xno"; then
+ PKG_CHECK_MODULES([LIBBLURAY], [libbluray >= 0.2.1],
+ [have_libbluray=yes],
+ AC_MSG_RESULT(*** All of the libbluray dependent parts will be disabled ***))
+ AC_SUBST(LIBBLURAY_CFLAGS)
+ AC_SUBST(LIBBLURAY_LIBS)
+fi
+AM_CONDITIONAL(HAVE_LIBBLURAY, test "x$have_libbluray" = "xyes")
dnl ---------------------------------------------
dnl libsmbclient support

View File

@ -1,30 +0,0 @@
$OpenBSD: patch-src_audio_out_audio_file_out_c,v 1.3 2012/04/07 05:48:49 ajacoutot Exp $
Check for failed write.
--- src/audio_out/audio_file_out.c.orig Fri Feb 17 22:37:27 2012
+++ src/audio_out/audio_file_out.c Fri Feb 17 22:37:51 2012
@@ -274,10 +274,20 @@ static void ao_file_close(ao_driver_t *this_gen)
this->fname, this->bytes_written / 1024);
if (lseek(this->fd, 40, SEEK_SET) != -1) {
- write(this->fd, &len, 4);
+ if (write(this->fd, &len, 4) != 4) {
+ xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_file_out: Failed to write header to file '%s': %s\n",
+ this->fname, strerror(errno));
+ }
+
len = le2me_32(this->bytes_written + 0x24);
- if (lseek(this->fd, 4, SEEK_SET) != -1)
- write(this->fd, &len, 4);
+ if (lseek(this->fd, 4, SEEK_SET) != -1) {
+ if (write(this->fd, &len, 4) != 4) {
+ xprintf (this->xine, XINE_VERBOSITY_LOG,
+ "audio_file_out: Failed to write header to file '%s': %s\n",
+ this->fname, strerror(errno));
+ }
+ }
+
}
close(this->fd);

View File

@ -1,50 +0,0 @@
$OpenBSD: patch-src_combined_ffmpeg_ff_audio_decoder_c,v 1.4 2012/04/07 05:48:49 ajacoutot Exp $
Moved FFmpeg API version checks to single header.
--- src/combined/ffmpeg/ff_audio_decoder.c.orig Fri Feb 17 22:41:13 2012
+++ src/combined/ffmpeg/ff_audio_decoder.c Fri Feb 17 22:41:23 2012
@@ -43,15 +43,10 @@
#include "xineutils.h"
#include "bswap.h"
#include "ffmpeg_decoder.h"
+#include "ffmpeg_compat.h"
#define AUDIOBUFSIZE (64 * 1024)
-#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32)
-# define AVAUDIO 3
-#else
-# define AVAUDIO 2
-#endif
-
typedef struct {
audio_decoder_class_t decoder_class;
} ff_audio_class_t;
@@ -173,7 +168,7 @@ static void ff_audio_init_codec(ff_audio_decoder_t *th
* - DVB streams where multiple AAC LATM frames are packed to single PES
* - DVB streams where MPEG audio frames do not follow PES packet boundaries
*/
-#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 94)
+#if AVPARSE > 1
if (codec_type == BUF_AUDIO_AAC_LATM ||
codec_type == BUF_AUDIO_MPEG) {
@@ -356,7 +351,7 @@ static int ff_audio_decode(xine_t *xine,
int consumed;
int parser_consumed = 0;
-#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 94)
+#if AVPARSE > 1
if (parser_ctx) {
uint8_t *outbuf;
int outsize;
@@ -383,7 +378,7 @@ static int ff_audio_decode(xine_t *xine,
buf = outbuf;
size = outsize;
}
-#endif /* LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 94) */
+#endif /* AVPARSE > 1 */
#if AVAUDIO > 2
AVPacket avpkt;

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-src_combined_ffmpeg_ff_mpeg_parser_c,v 1.1 2012/06/09 08:41:16 ajacoutot Exp $
Fix MPEG2 parsing.
--- src/combined/ffmpeg/ff_mpeg_parser.c.orig Fri Jun 8 23:39:40 2012
+++ src/combined/ffmpeg/ff_mpeg_parser.c Fri Jun 8 23:40:08 2012
@@ -134,7 +134,7 @@ static int parse_chunk (mpeg_parser_t *parser, int cod
}
}
- is_frame_done = parser->in_slice && ((!next_code) || (next_code == 0xb7));
+ is_frame_done = parser->in_slice && ((!next_code) || (next_code >= 0xb0));
if (is_frame_done)
parser->in_slice = 0;

View File

@ -1,53 +1,10 @@
$OpenBSD: patch-src_combined_ffmpeg_ff_video_decoder_c,v 1.11 2012/06/09 08:41:16 ajacoutot Exp $
$OpenBSD: patch-src_combined_ffmpeg_ff_video_decoder_c,v 1.12 2012/06/10 07:35:30 ajacoutot Exp $
- Moved FFmpeg API version checks to single header.
- Frame garbage collector in ff_reset.
- Fix compile against recent FFmpeg.
- Fix multithreaded initialization with API change.
- Fix decoding of full range YUV420 H.264 videos.
- Enable direct rendering for H.264.
- Convert full range YUV to MPEG range.
- Fix cropping.
- Fix DR1 frame garbage collector when using multithreaded decoding.
- Fix U-plane conversion (YUVJ444P -> YUV420).
Enable direct rendering for H.264.
--- src/combined/ffmpeg/ff_video_decoder.c.orig Sat Dec 31 11:25:26 2011
+++ src/combined/ffmpeg/ff_video_decoder.c Fri Jun 8 23:38:14 2012
@@ -51,6 +51,8 @@
# include <libpostproc/postprocess.h>
#endif
+#include "ffmpeg_compat.h"
+
#define VIDEOBUFSIZE (128*1024)
#define SLICE_BUFFER_SIZE (1194*1024)
@@ -58,24 +60,6 @@
#define ENABLE_DIRECT_RENDERING
-#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32)
-# define AVVIDEO 2
-#else
-# define AVVIDEO 1
-# define pp_context pp_context_t
-# define pp_mode pp_mode_t
-#endif
-
-#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 112)
-# define DEPRECATED_AVCODEC_THREAD_INIT 1
-#endif
-
-/* reordered_opaque appeared in libavcodec 51.68.0 */
-#define AVCODEC_HAS_REORDERED_OPAQUE
-#if LIBAVCODEC_VERSION_INT < 0x334400
-# undef AVCODEC_HAS_REORDERED_OPAQUE
-#endif
-
typedef struct ff_video_decoder_s ff_video_decoder_t;
typedef struct ff_video_class_s {
@@ -85,6 +69,7 @@ typedef struct ff_video_class_s {
--- src/combined/ffmpeg/ff_video_decoder.c.orig Fri Jun 8 09:36:36 2012
+++ src/combined/ffmpeg/ff_video_decoder.c Sat Jun 9 20:29:04 2012
@@ -69,6 +69,7 @@ typedef struct ff_video_class_s {
int thread_count;
int8_t skip_loop_filter_enum;
int8_t choose_speed_over_accuracy;
@ -55,73 +12,16 @@ $OpenBSD: patch-src_combined_ffmpeg_ff_video_decoder_c,v 1.11 2012/06/09 08:41:1
xine_t *xine;
} ff_video_class_t;
@@ -146,14 +131,46 @@ struct ff_video_decoder_s {
@@ -95,7 +96,7 @@ struct ff_video_decoder_s {
uint8_t is_mpeg12:1;
uint8_t pp_available:1;
uint8_t yuv_init:1;
- uint8_t is_direct_rendering_disabled:1;
+ uint8_t is_direct_rendering_disabled:1; /* used only to avoid flooding log */
uint8_t cs_convert_init:1;
uint8_t assume_bad_field_picture:1;
yuv_planes_t yuv;
+#ifdef AVPaletteControl
AVPaletteControl palette_control;
+#endif
+ int color_matrix, full2mpeg;
+ unsigned char ytab[256], ctab[256];
+
#ifdef LOG
enum PixelFormat debug_fmt;
#endif
};
+static void ff_check_colorspace (ff_video_decoder_t *this) {
+ int i, cm;
+ cm = this->context->colorspace << 1;
+ /* ffmpeg bug: color_range not set by svq3 decoder */
+ i = this->context->pix_fmt;
+ if (cm && ((i == PIX_FMT_YUVJ420P) || (i == PIX_FMT_YUVJ444P) ||
+ (this->context->color_range == AVCOL_RANGE_JPEG)))
+ cm |= 1;
+
+ /* report changes of colorspyce and/or color range */
+ if (cm != this->color_matrix) {
+ this->color_matrix = cm;
+ xprintf (this->stream->xine, XINE_VERBOSITY_LOG,
+ "ffmpeg_video_dec: color matrix #%d\n", cm >> 1);
+
+ this->full2mpeg = 0;
+ if (cm & 1) {
+ /* sigh. fall back to manual conversion */
+ this->full2mpeg = 1;
+ for (i = 0; i < 256; i++) {
+ this->ytab[i] = (219 * i + 127) / 255 + 16;
+ this->ctab[i] = 112 * (i - 128) / 127 + 128;
+ }
+ }
+ }
+}
+
static void set_stream_info(ff_video_decoder_t *this) {
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->bih.biWidth);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->bih.biHeight);
@@ -168,6 +185,8 @@ static int get_buffer(AVCodecContext *context, AVFrame
int width = context->width;
int height = context->height;
+ ff_check_colorspace (this);
+
if (!this->bih.biWidth || !this->bih.biHeight) {
this->bih.biWidth = width;
this->bih.biHeight = height;
@@ -182,7 +201,8 @@ static int get_buffer(AVCodecContext *context, AVFrame
avcodec_align_dimensions(context, &width, &height);
- if( this->context->pix_fmt != PIX_FMT_YUV420P && this->context->pix_fmt != PIX_FMT_YUVJ420P ) {
+ if (this->full2mpeg || (this->context->pix_fmt != PIX_FMT_YUV420P &&
+ this->context->pix_fmt != PIX_FMT_YUVJ420P)) {
if (!this->is_direct_rendering_disabled) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("ffmpeg_video_dec: unsupported frame format, DR1 disabled.\n"));
@@ -214,6 +234,8 @@ static int get_buffer(AVCodecContext *context, AVFrame
@@ -241,6 +242,8 @@ static int get_buffer(AVCodecContext *context, AVFrame
}
}
@ -130,40 +30,7 @@ $OpenBSD: patch-src_combined_ffmpeg_ff_video_decoder_c,v 1.11 2012/06/09 08:41:1
img = this->stream->video_out->get_frame (this->stream->video_out,
width,
height,
@@ -234,7 +256,9 @@ static int get_buffer(AVCodecContext *context, AVFrame
/* We should really keep track of the ages of xine frames (see
* avcodec_default_get_buffer in libavcodec/utils.c)
* For the moment tell ffmpeg that every frame is new (age = bignumber) */
+#ifdef AVFRAMEAGE
av_frame->age = 256*256*256*64;
+#endif
av_frame->type= FF_BUFFER_TYPE_USER;
@@ -243,7 +267,7 @@ static int get_buffer(AVCodecContext *context, AVFrame
av_frame->reordered_opaque = context->reordered_opaque;
#endif
- xine_list_push_back(this->dr1_frames, av_frame);
+ xine_list_push_back(this->dr1_frames, img);
return 0;
}
@@ -260,10 +284,11 @@ static void release_buffer(struct AVCodecContext *cont
xine_list_iterator_t it;
- it = xine_list_find(this->dr1_frames, av_frame);
+ it = xine_list_find(this->dr1_frames, av_frame->opaque);
assert(it);
- if( it != NULL )
+ if( it != NULL ) {
xine_list_remove(this->dr1_frames, it);
+ }
} else {
avcodec_default_release_buffer(context, av_frame);
}
@@ -330,7 +355,7 @@ static void init_video_codec (ff_video_decoder_t *this
@@ -360,7 +363,7 @@ static void init_video_codec (ff_video_decoder_t *this
/* Some codecs (eg rv10) copy flags in init so it's necessary to set
* this flag here in case we are going to use direct rendering */
@ -172,39 +39,7 @@ $OpenBSD: patch-src_combined_ffmpeg_ff_video_decoder_c,v 1.11 2012/06/09 08:41:1
this->context->flags |= CODEC_FLAG_EMU_EDGE;
}
@@ -341,6 +366,13 @@ static void init_video_codec (ff_video_decoder_t *this
if (this->class->choose_speed_over_accuracy)
this->context->flags2 |= CODEC_FLAG2_FAST;
+#ifdef DEPRECATED_AVCODEC_THREAD_INIT
+ if (this->class->thread_count > 1) {
+ if (this->codec->id != CODEC_ID_SVQ3)
+ this->context->thread_count = this->class->thread_count;
+ }
+#endif
+
pthread_mutex_lock(&ffmpeg_lock);
if (avcodec_open (this->context, this->codec) < 0) {
pthread_mutex_unlock(&ffmpeg_lock);
@@ -368,14 +400,13 @@ static void init_video_codec (ff_video_decoder_t *this
}
}
+#ifndef DEPRECATED_AVCODEC_THREAD_INIT
if (this->class->thread_count > 1) {
if (this->codec->id != CODEC_ID_SVQ3
-#ifndef DEPRECATED_AVCODEC_THREAD_INIT
- && avcodec_thread_init(this->context, this->class->thread_count) != -1
-#endif
- )
+ && avcodec_thread_init(this->context, this->class->thread_count) != -1)
this->context->thread_count = this->class->thread_count;
}
+#endif
this->context->skip_loop_filter = skip_loop_filter_enum_values[this->class->skip_loop_filter_enum];
@@ -404,7 +435,7 @@ static void init_video_codec (ff_video_decoder_t *this
@@ -440,7 +443,7 @@ static void init_video_codec (ff_video_decoder_t *this
/* enable direct rendering by default */
this->output_format = XINE_IMGFMT_YV12;
#ifdef ENABLE_DIRECT_RENDERING
@ -213,7 +48,7 @@ $OpenBSD: patch-src_combined_ffmpeg_ff_video_decoder_c,v 1.11 2012/06/09 08:41:1
this->context->get_buffer = get_buffer;
this->context->release_buffer = release_buffer;
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
@@ -463,6 +494,12 @@ static void pp_quality_cb(void *user_data, xine_cfg_en
@@ -500,6 +503,12 @@ static void pp_quality_cb(void *user_data, xine_cfg_en
class->pp_quality = entry->num_value;
}
@ -226,242 +61,7 @@ $OpenBSD: patch-src_combined_ffmpeg_ff_video_decoder_c,v 1.11 2012/06/09 08:41:1
static void pp_change_quality (ff_video_decoder_t *this) {
this->pp_quality = this->class->pp_quality;
@@ -563,6 +600,8 @@ static void ff_convert_frame(ff_video_decoder_t *this,
printf ("frame format == %08x\n", this->debug_fmt = this->context->pix_fmt);
#endif
+ ff_check_colorspace (this);
+
dy = img->base[0];
du = img->base[1];
dv = img->base[2];
@@ -793,54 +832,92 @@ static void ff_convert_frame(ff_video_decoder_t *this,
} else {
- for (y = 0; y < this->bih.biHeight; y++) {
- xine_fast_memcpy (dy, sy, img->width);
+ int subsamph = (this->context->pix_fmt == PIX_FMT_YUV444P)
+ || (this->context->pix_fmt == PIX_FMT_YUVJ444P);
+ int subsampv = (this->context->pix_fmt != PIX_FMT_YUV420P)
+ && (this->context->pix_fmt != PIX_FMT_YUVJ420P);
- dy += img->pitches[0];
+ if (this->full2mpeg) {
- sy += this->av_frame->linesize[0];
- }
+ uint8_t *ytab = this->ytab;
+ uint8_t *ctab = this->ctab;
+ uint8_t *p, *q;
+ int x;
- for (y = 0; y < this->bih.biHeight / 2; y++) {
+ for (y = 0; y < this->bih.biHeight; y++) {
+ p = sy;
+ q = dy;
+ for (x = img->width; x > 0; x--) *q++ = ytab[*p++];
+ dy += img->pitches[0];
+ sy += this->av_frame->linesize[0];
- if (this->context->pix_fmt != PIX_FMT_YUV444P) {
+ }
- xine_fast_memcpy (du, su, img->width/2);
- xine_fast_memcpy (dv, sv, img->width/2);
+ for (y = 0; y < this->bih.biHeight / 2; y++) {
+ if (!subsamph) {
+ p = su, q = du;
+ for (x = img->width / 2; x > 0; x--) *q++ = ctab[*p++];
+ p = sv, q = dv;
+ for (x = img->width / 2; x > 0; x--) *q++ = ctab[*p++];
+ } else {
+ p = su, q = du;
+ for (x = img->width / 2; x > 0; x--) {*q++ = ctab[*p]; p += 2;}
+ p = sv, q = dv;
+ for (x = img->width / 2; x > 0; x--) {*q++ = ctab[*p]; p += 2;}
+ }
+ du += img->pitches[1];
+ dv += img->pitches[2];
+ if (subsampv) {
+ su += 2 * this->av_frame->linesize[1];
+ sv += 2 * this->av_frame->linesize[2];
+ } else {
+ su += this->av_frame->linesize[1];
+ sv += this->av_frame->linesize[2];
+ }
+ }
- } else {
+ } else {
- int x;
- uint8_t *src;
- uint8_t *dst;
+ for (y = 0; y < this->bih.biHeight; y++) {
+ xine_fast_memcpy (dy, sy, img->width);
+ dy += img->pitches[0];
+ sy += this->av_frame->linesize[0];
+ }
- /* subsample */
-
- src = su; dst = du;
- for (x=0; x<(img->width/2); x++) {
- *dst = *src;
- dst++;
- src += 2;
+ for (y = 0; y < this->bih.biHeight / 2; y++) {
+ if (!subsamph) {
+ xine_fast_memcpy (du, su, img->width/2);
+ xine_fast_memcpy (dv, sv, img->width/2);
+ } else {
+ int x;
+ uint8_t *src;
+ uint8_t *dst;
+ src = su;
+ dst = du;
+ for (x = 0; x < (img->width / 2); x++) {
+ *dst = *src;
+ dst++;
+ src += 2;
+ }
+ src = sv;
+ dst = dv;
+ for (x = 0; x < (img->width / 2); x++) {
+ *dst = *src;
+ dst++;
+ src += 2;
+ }
}
- src = sv; dst = dv;
- for (x=0; x<(img->width/2); x++) {
- *dst = *src;
- dst++;
- src += 2;
+ du += img->pitches[1];
+ dv += img->pitches[2];
+ if (subsampv) {
+ su += 2*this->av_frame->linesize[1];
+ sv += 2*this->av_frame->linesize[2];
+ } else {
+ su += this->av_frame->linesize[1];
+ sv += this->av_frame->linesize[2];
}
-
}
- du += img->pitches[1];
- dv += img->pitches[2];
-
- if (this->context->pix_fmt != PIX_FMT_YUV420P) {
- su += 2*this->av_frame->linesize[1];
- sv += 2*this->av_frame->linesize[2];
- } else {
- su += this->av_frame->linesize[1];
- sv += this->av_frame->linesize[2];
- }
}
}
}
@@ -1044,7 +1121,9 @@ static void ff_handle_special_buffer (ff_video_decoder
memcpy(this->context->extradata, buf->decoder_info_ptr[2],
buf->decoder_info[2]);
- } else if (buf->decoder_info[1] == BUF_SPECIAL_PALETTE) {
+ }
+#ifdef AVPaletteControl
+ else if (buf->decoder_info[1] == BUF_SPECIAL_PALETTE) {
unsigned int i;
palette_entry_t *demuxer_palette;
@@ -1063,7 +1142,9 @@ static void ff_handle_special_buffer (ff_video_decoder
}
decoder_palette->palette_changed = 1;
- } else if (buf->decoder_info[1] == BUF_SPECIAL_RV_CHUNK_TABLE) {
+ }
+#endif
+ else if (buf->decoder_info[1] == BUF_SPECIAL_RV_CHUNK_TABLE) {
int i;
lprintf("BUF_SPECIAL_RV_CHUNK_TABLE\n");
@@ -1549,8 +1630,8 @@ static void ff_handle_buffer (ff_video_decoder_t *this
img->duration = video_step_to_use;
/* additionally crop away the extra pixels due to adjusting frame size above */
- img->crop_right = this->crop_right + (img->width - this->bih.biWidth);
- img->crop_bottom = this->crop_bottom + (img->height - this->bih.biHeight);
+ img->crop_right = img->width - this->bih.biWidth;
+ img->crop_bottom = img->height - this->bih.biHeight;
/* transfer some more frame settings for deinterlacing */
img->progressive_frame = !this->av_frame->interlaced_frame;
@@ -1586,8 +1667,8 @@ static void ff_handle_buffer (ff_video_decoder_t *this
img->duration = video_step_to_use;
/* additionally crop away the extra pixels due to adjusting frame size above */
- img->crop_right = ((this->bih.biWidth <= 0) ? 0 : this->crop_right) + (img->width - this->bih.biWidth);
- img->crop_bottom = ((this->bih.biHeight <= 0) ? 0 : this->crop_bottom) + (img->height - this->bih.biHeight);
+ img->crop_right = this->bih.biWidth <= 0 ? 0 : (img->width - this->bih.biWidth);
+ img->crop_bottom = this->bih.biHeight <= 0 ? 0 : (img->height - this->bih.biHeight);
img->bad_frame = 1;
this->skipframes = img->draw(img, this->stream);
@@ -1663,8 +1744,22 @@ static void ff_reset (video_decoder_t *this_gen) {
this->size = 0;
if(this->context && this->decoder_ok)
+ {
+ xine_list_iterator_t it;
+
avcodec_flush_buffers(this->context);
+ /* frame garbage collector here - workaround for buggy ffmpeg codecs that
+ * don't release their DR1 frames */
+ while( (it = xine_list_front(this->dr1_frames)) != NULL )
+ {
+ vo_frame_t *img = (vo_frame_t *)xine_list_get_value(this->dr1_frames, it);
+ if (img)
+ img->free(img);
+ }
+ xine_list_clear(this->dr1_frames);
+ }
+
if (this->is_mpeg12)
mpeg_parser_reset(this->mpeg_parser);
@@ -1725,7 +1820,6 @@ static void ff_dispose (video_decoder_t *this_gen) {
if (this->decoder_ok) {
xine_list_iterator_t it;
- AVFrame *av_frame;
pthread_mutex_lock(&ffmpeg_lock);
avcodec_close (this->context);
@@ -1735,8 +1829,9 @@ static void ff_dispose (video_decoder_t *this_gen) {
* don't release their DR1 frames */
while( (it = xine_list_front(this->dr1_frames)) != NULL )
{
- av_frame = (AVFrame *)xine_list_get_value(this->dr1_frames, it);
- release_buffer(this->context, av_frame);
+ vo_frame_t *img = (vo_frame_t *)xine_list_get_value(this->dr1_frames, it);
+ if (img)
+ img->free(img);
}
this->stream->video_out->close(this->stream->video_out, this->stream);
@@ -1796,7 +1891,9 @@ static video_decoder_t *ff_video_open_plugin (video_de
this->av_frame = avcodec_alloc_frame();
this->context = avcodec_alloc_context();
this->context->opaque = this;
+#ifdef AVPaletteControl
this->context->palctrl = NULL;
+#endif
this->decoder_ok = 0;
this->decoder_init_mode = 1;
@@ -1888,6 +1985,12 @@ void *init_video_plugin (xine_t *xine, void *data) {
@@ -1984,6 +1993,12 @@ void *init_video_plugin (xine_t *xine, void *data) {
"Cheating may speed up decoding but can also lead to decoding artefacts.\n"
"A change of this setting will take effect with playing the next stream."),
10, choose_speed_over_accuracy_cb, this);

View File

@ -1,109 +0,0 @@
$OpenBSD: patch-src_combined_ffmpeg_ffmpeg_compat_h,v 1.1 2012/04/07 05:48:49 ajacoutot Exp $
- Moved FFmpeg API version checks to single header.
- avcodec_init(), avcodec_alloc_context() and avcodec_open() are depreated.
- Fixed pp_context and pp_mode.
- Fix compile against recent FFmpeg.
--- src/combined/ffmpeg/ffmpeg_compat.h.orig Fri Feb 17 23:31:14 2012
+++ src/combined/ffmpeg/ffmpeg_compat.h Fri Feb 17 23:31:07 2012
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2000-2012 the xine project
+ *
+ * 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
+ * (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
+ *
+ * Compability macros for various ffmpeg versions
+ */
+
+#ifndef XINE_AVCODEC_COMPAT_H
+#define XINE_AVCODEC_COMPAT_H
+
+#ifndef LIBAVCODEC_VERSION_MAJOR
+# error ffmpeg headers must be included first !
+#endif
+
+
+#if LIBAVCODEC_VERSION_MAJOR > 51
+# define bits_per_sample bits_per_coded_sample
+#endif
+
+#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32)
+#else
+# define pp_context pp_context_t
+# define pp_mode pp_mode_t
+#endif
+
+/* reordered_opaque appeared in libavcodec 51.68.0 */
+#define AVCODEC_HAS_REORDERED_OPAQUE
+#if LIBAVCODEC_VERSION_INT < 0x334400
+# undef AVCODEC_HAS_REORDERED_OPAQUE
+#endif
+
+/**/
+#if LIBAVCODEC_VERSION_MAJOR > 53 || (LIBAVCODEC_VERSION_MAJOR == 53 && LIBAVCODEC_VERSION_MINOR >= 8)
+# define avcodec_init() do {} while(0)
+#endif
+
+/* avcodec_alloc_context() */
+#if LIBAVCODEC_VERSION_MAJOR >= 54 || (LIBAVCODEC_VERSION_MAJOR == 53 && LIBAVCODEC_VERSION_MINOR >= 6)
+# define AVCONTEXT 3
+# define avcodec_alloc_context() avcodec_alloc_context3(NULL)
+#else
+# define AVCONTEXT 1
+#endif
+
+/* avcodec_open() */
+#if LIBAVCODEC_VERSION_MAJOR >= 54 || (LIBAVCODEC_VERSION_MAJOR == 53 && LIBAVCODEC_VERSION_MINOR >= 6)
+# define AVOPEN 2
+# define avcodec_open(ctx,codec) avcodec_open2(ctx, codec, NULL)
+#else
+# define AVOPEN 1
+#endif
+
+/* avcodec_thread_init() */
+#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 112)
+# define DEPRECATED_AVCODEC_THREAD_INIT 1
+#endif
+
+/* av_parser_parse() */
+#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 94)
+# define AVPARSE 2
+#else
+# define AVPARSE 1
+#endif
+
+/* avcodec_decode_video() */
+#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32)
+# define AVVIDEO 2
+#else
+# define AVVIDEO 1
+#endif
+
+/* avcodec_decode_audio() */
+#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32)
+# define AVAUDIO 3
+#else
+# define AVAUDIO 2
+#endif
+
+/* AVFrame.age */
+#if !(LIBAVCODEC_VERSION_MAJOR >= 53 && LIBAVCODEC_VERSION_MAJOR >= 28 && LIBAVCODEC_VERSION_MICRO >= 1)
+# define AVFRAMEAGE 1
+#endif
+
+#endif /* XINE_AVCODEC_COMPAT_H */

View File

@ -1,14 +0,0 @@
$OpenBSD: patch-src_combined_ffmpeg_ffmpeg_decoder_c,v 1.1 2012/04/07 05:48:49 ajacoutot Exp $
Moved FFmpeg API version checks to single header.
--- src/combined/ffmpeg/ffmpeg_decoder.c.orig Fri Feb 17 22:44:45 2012
+++ src/combined/ffmpeg/ffmpeg_decoder.c Fri Feb 17 22:44:54 2012
@@ -28,6 +28,7 @@
#include "xine_internal.h"
#include "ffmpeg_decoder.h"
+#include "ffmpeg_compat.h"
/*
* common initialisation

View File

@ -1,17 +0,0 @@
$OpenBSD: patch-src_combined_ffmpeg_ffmpeg_decoder_h,v 1.1 2012/04/07 05:48:49 ajacoutot Exp $
Moved FFmpeg API version checks to single header.
--- src/combined/ffmpeg/ffmpeg_decoder.h.orig Fri Feb 17 22:46:46 2012
+++ src/combined/ffmpeg/ffmpeg_decoder.h Fri Feb 17 22:46:49 2012
@@ -33,10 +33,6 @@
# include "../../libffmpeg/libavcodec/avcodec.h"
#endif
-#if LIBAVCODEC_VERSION_MAJOR > 51
-#define bits_per_sample bits_per_coded_sample
-#endif
-
typedef struct ff_codec_s {
uint32_t type;
enum CodecID id;

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-src_combined_ffmpeg_ffmpeg_encoder_c,v 1.1 2012/04/07 05:48:49 ajacoutot Exp $
Moved FFmpeg API version checks to single header.
--- src/combined/ffmpeg/ffmpeg_encoder.c.orig Fri Feb 17 22:48:30 2012
+++ src/combined/ffmpeg/ffmpeg_encoder.c Fri Feb 17 22:48:41 2012
@@ -46,6 +46,8 @@
# include "../../libffmpeg/libavcodec/avcodec.h"
#endif
+#include "ffmpeg_compat.h"
+
/* buffer size for encoded mpeg1 stream; will hold one intra frame
* at 640x480 typical sizes are <50 kB. 512 kB should be plenty */
#define DEFAULT_BUFFER_SIZE 512*1024

View File

@ -1,24 +0,0 @@
$OpenBSD: patch-src_demuxers_asfheader_c,v 1.3 2012/04/07 05:48:49 ajacoutot Exp $
Fix using uninitialized data.
--- src/demuxers/asfheader.c.orig Fri Feb 17 22:50:23 2012
+++ src/demuxers/asfheader.c Fri Feb 17 22:50:29 2012
@@ -358,7 +358,7 @@ exit_error:
static int asf_header_parse_stream_extended_properties(asf_header_t *header, uint8_t *buffer, int buffer_len) {
asf_reader_t reader;
uint32_t flags = 0;
- uint16_t stream_number;
+ uint16_t stream_number = 0;
int i;
int stream_id;
asf_stream_extension_t *asf_stream_extension;
@@ -532,7 +532,7 @@ static int asf_header_parse_metadata(asf_header_t *hea
for (i = 0; i < records_count; i++)
{
- uint16_t index, stream, name_len = 0, data_type;
+ uint16_t index, stream = 0, name_len = 0, data_type;
uint32_t data_len = 0;
int stream_id;

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-src_demuxers_demux_image_c,v 1.1 2012/06/10 07:35:30 ajacoutot Exp $
Add BMP support.
--- src/demuxers/demux_image.c.orig Sat Jun 9 21:15:05 2012
+++ src/demuxers/demux_image.c Sat Jun 9 21:16:57 2012
@@ -165,6 +165,7 @@ static demux_plugin_t *open_plugin (demux_class_t *cla
return NULL;
}
if (memcmp (header, "GIF", 3) == 0 /* GIF */
+ || memcmp (header, "BM", 2) == 0 /* BMP */
|| memcmp (header, "\377\330\377", 3) == 0 /* JPEG */
|| (_X_BE_16(&header[0]) == 0xffd8) /* another JPEG */
|| memcmp (header, "\x89PNG", 4) == 0) { /* PNG */
@@ -232,7 +233,7 @@ static const char *get_identifier (demux_class_t *this
}
static const char *get_extensions (demux_class_t *this_gen) {
- return "png gif jpg jpeg";
+ return "png gif jpg jpeg bmp";
}
static const char *get_mimetypes (demux_class_t *this_gen) {

View File

@ -1,7 +1,6 @@
$OpenBSD: patch-src_demuxers_demux_matroska_c,v 1.10 2012/06/09 08:41:16 ajacoutot Exp $
$OpenBSD: patch-src_demuxers_demux_matroska_c,v 1.11 2012/06/10 07:35:30 ajacoutot Exp $
- Fix Matroska header compression when using lacing (ex. multiple audio frames in one block).
- Add support for FLAC.
Add support for FLAC.
--- src/demuxers/demux_matroska.c.orig Thu Oct 13 16:18:39 2011
+++ src/demuxers/demux_matroska.c Fri Jun 8 22:48:36 2012
@ -17,17 +16,3 @@ $OpenBSD: patch-src_demuxers_demux_matroska_c,v 1.10 2012/06/09 08:41:16 ajacout
} else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_DTS)) {
lprintf("MATROSKA_CODEC_ID_A_DTS\n");
track->buf_type = BUF_AUDIO_DTS;
@@ -2049,6 +2054,13 @@ static int parse_block (demux_matroska_t *this, size_t
}
/* send each frame to the decoder */
for (i = 0; i <= lace_num; i++) {
+
+ if (headers_len) {
+ data -= headers_len;
+ xine_fast_memcpy(data, track->compress_settings, headers_len);
+ frame[i] += headers_len;
+ }
+
if (track->handle_content != NULL) {
track->handle_content((demux_plugin_t *)this, track,
decoder_flags,

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-src_demuxers_demux_mpc_c,v 1.1 2012/06/10 07:35:30 ajacoutot Exp $
Fix id3v2 tag check.
--- src/demuxers/demux_mpc.c.orig Sat Jun 9 21:40:38 2012
+++ src/demuxers/demux_mpc.c Sat Jun 9 21:41:00 2012
@@ -90,7 +90,7 @@ static int open_mpc_file(demux_mpc_t *this) {
/* TODO: non-seeking version */
if (INPUT_IS_SEEKABLE(this->input)) {
/* Check for id3v2 tag */
- if (id3v2_istag(this->header)) {
+ if (id3v2_istag(_X_BE_32(this->header))) {
lprintf("found id3v2 header\n");

View File

@ -1,172 +0,0 @@
$OpenBSD: patch-src_demuxers_demux_qt_c,v 1.17 2012/04/28 09:14:33 ajacoutot Exp $
- Made demux_ts send pts not dts even for reordered (b-framed) video.
- Fix demux_qt for the pts < dts case.
--- src/demuxers/demux_qt.c.orig Tue Oct 4 18:40:59 2011
+++ src/demuxers/demux_qt.c Thu Apr 26 14:33:18 2012
@@ -83,6 +83,7 @@ typedef unsigned int qt_atom;
#define STSC_ATOM QT_ATOM('s', 't', 's', 'c')
#define STCO_ATOM QT_ATOM('s', 't', 'c', 'o')
#define STTS_ATOM QT_ATOM('s', 't', 't', 's')
+#define CTTS_ATOM QT_ATOM('c', 't', 't', 's')
#define STSS_ATOM QT_ATOM('s', 't', 's', 's')
#define CO64_ATOM QT_ATOM('c', 'o', '6', '4')
@@ -165,6 +166,11 @@ typedef enum {
typedef struct {
int64_t offset;
unsigned int size;
+ /* pts actually is dts for reordered video. Edit list and frame
+ duration code relies on that, so keep the offset separately
+ until sending to video fifo.
+ Value is small enough for plain int. */
+ int ptsoffs;
int64_t pts;
int keyframe;
unsigned int media_id;
@@ -301,6 +307,10 @@ typedef struct {
unsigned int time_to_sample_count;
time_to_sample_table_t *time_to_sample_table;
+ /* pts to dts timeoffset to sample table */
+ unsigned int timeoffs_to_sample_count;
+ time_to_sample_table_t *timeoffs_to_sample_table;
+
} qt_trak;
typedef struct {
@@ -640,6 +650,7 @@ static void free_qt_info(qt_info *info) {
free(info->traks[i].sync_sample_table);
free(info->traks[i].sample_to_chunk_table);
free(info->traks[i].time_to_sample_table);
+ free(info->traks[i].timeoffs_to_sample_table);
free(info->traks[i].decoder_config);
for (j = 0; j < info->traks[i].stsd_atoms_count; j++) {
if (info->traks[i].type == MEDIA_AUDIO) {
@@ -981,6 +992,8 @@ static qt_error parse_trak_atom (qt_trak *trak,
trak->sample_to_chunk_table = NULL;
trak->time_to_sample_count = 0;
trak->time_to_sample_table = NULL;
+ trak->timeoffs_to_sample_count = 0;
+ trak->timeoffs_to_sample_table = NULL;
trak->frames = NULL;
trak->frame_count = 0;
trak->current_frame = 0;
@@ -1685,6 +1698,47 @@ static qt_error parse_trak_atom (qt_trak *trak,
trak->time_to_sample_table[j].duration);
}
trak->time_to_sample_table[j].count = 0; /* terminate with zero */
+
+ } else if (current_atom == CTTS_ATOM) {
+
+ /* TJ. this has the same format as stts. If present, duration here
+ means (pts - dts), while the corresponding stts defines dts. */
+
+ /* there should only be one of these atoms */
+ if (trak->timeoffs_to_sample_table
+ || current_atom_size < 12 || current_atom_size >= UINT_MAX) {
+ last_error = QT_HEADER_TROUBLE;
+ goto free_trak;
+ }
+
+ trak->timeoffs_to_sample_count = _X_BE_32(&trak_atom[i + 8]);
+
+ debug_atom_load(" qt ctts atom (timeoffset-to-sample atom): %d entries\n",
+ trak->timeoffs_to_sample_count);
+
+ if (trak->timeoffs_to_sample_count > (current_atom_size - 12) / 8) {
+ last_error = QT_HEADER_TROUBLE;
+ goto free_trak;
+ }
+
+ trak->timeoffs_to_sample_table = (time_to_sample_table_t *)calloc(
+ trak->timeoffs_to_sample_count+1, sizeof(time_to_sample_table_t));
+ if (!trak->timeoffs_to_sample_table) {
+ last_error = QT_NO_MEMORY;
+ goto free_trak;
+ }
+
+ /* load the pts to dts time offset to sample table */
+ for (j = 0; j < trak->timeoffs_to_sample_count; j++) {
+ trak->timeoffs_to_sample_table[j].count =
+ _X_BE_32(&trak_atom[i + 12 + j * 8 + 0]);
+ trak->timeoffs_to_sample_table[j].duration =
+ _X_BE_32(&trak_atom[i + 12 + j * 8 + 4]);
+ debug_atom_load(" %d: count = %d, duration = %d\n",
+ j, trak->timeoffs_to_sample_table[j].count,
+ trak->timeoffs_to_sample_table[j].duration);
+ }
+ trak->timeoffs_to_sample_table[j].count = 0; /* terminate with zero */
}
}
@@ -1700,6 +1754,7 @@ free_trak:
free(trak->sync_sample_table);
free(trak->sample_to_chunk_table);
free(trak->time_to_sample_table);
+ free(trak->timeoffs_to_sample_table);
free(trak->decoder_config);
if (trak->stsd_atoms) {
for (i = 0; i < trak->stsd_atoms_count; i++)
@@ -1853,6 +1908,8 @@ static qt_error build_frame_table(qt_trak *trak,
int64_t current_pts;
unsigned int pts_index;
unsigned int pts_index_countdown;
+ unsigned int ptsoffs_index;
+ unsigned int ptsoffs_index_countdown;
unsigned int audio_frame_counter = 0;
unsigned int edit_list_media_time;
int64_t edit_list_duration;
@@ -1887,6 +1944,10 @@ static qt_error build_frame_table(qt_trak *trak,
pts_index = 0;
pts_index_countdown =
trak->time_to_sample_table[pts_index].count;
+ /* used by reordered video */
+ ptsoffs_index = 0;
+ ptsoffs_index_countdown = trak->timeoffs_to_sample_count ?
+ trak->timeoffs_to_sample_table[ptsoffs_index].count : 0;
media_id_counts = calloc(trak->stsd_atoms_count, sizeof(int));
if (!media_id_counts)
@@ -1957,6 +2018,23 @@ static qt_error build_frame_table(qt_trak *trak,
trak->time_to_sample_table[pts_index].count;
}
+ /* offset pts for reordered video */
+ if (ptsoffs_index < trak->timeoffs_to_sample_count) {
+ /* TJ. this is 32 bit signed. All casts necessary for my gcc 4.5.0 */
+ int i = trak->timeoffs_to_sample_table[ptsoffs_index].duration;
+ if ((sizeof (int) > 4) && (i & 0x80000000))
+ i |= ~0xffffffffL;
+ trak->frames[frame_counter].ptsoffs = (int)90000 * i / (int)trak->timescale;
+ ptsoffs_index_countdown--;
+ /* time to refresh countdown? */
+ if (!ptsoffs_index_countdown) {
+ ptsoffs_index++;
+ ptsoffs_index_countdown =
+ trak->timeoffs_to_sample_table[ptsoffs_index].count;
+ }
+ } else
+ trak->frames[frame_counter].ptsoffs = 0;
+
samples_per_chunk--;
frame_counter++;
}
@@ -2051,6 +2129,7 @@ static qt_error build_frame_table(qt_trak *trak,
trak->frames[j].pts = audio_frame_counter;
trak->frames[j].pts *= 90000;
trak->frames[j].pts /= trak->timescale;
+ trak->frames[j].ptsoffs = 0;
/* fetch the alleged chunk size according to the QT header */
trak->frames[j].size =
@@ -2592,7 +2671,7 @@ static int demux_qt_send_chunk(demux_plugin_t *this_ge
buf->extra_info->input_normpos = (int)( (double) (video_trak->frames[i].offset - this->data_start)
* 65535 / this->data_size);
buf->extra_info->input_time = video_trak->frames[i].pts / 90;
- buf->pts = video_trak->frames[i].pts;
+ buf->pts = video_trak->frames[i].pts + (int64_t)video_trak->frames[i].ptsoffs;
buf->decoder_flags |= BUF_FLAG_FRAMERATE;
buf->decoder_info[0] = frame_duration;

View File

@ -1,888 +0,0 @@
$OpenBSD: patch-src_demuxers_demux_ts_c,v 1.5 2012/06/09 08:41:16 ajacoutot Exp $
Lots of fixes for the MPEG Transport Stream demuxer.
--- src/demuxers/demux_ts.c.orig Sat Dec 31 17:57:41 2011
+++ src/demuxers/demux_ts.c Fri Jun 8 23:41:41 2012
@@ -182,8 +182,6 @@
#define BUF_SIZE (NPKT_PER_READ * (PKT_SIZE + 4))
-#define MAX_PES_BUF_SIZE 2048
-
#define CORRUPT_PES_THRESHOLD 10
#define NULL_PID 0x1fff
@@ -250,9 +248,13 @@
HDMV_SPU_INTERACTIVE = 0x91,
HDMV_SPU_TEXT = 0x92,
+ /* pseudo tags */
+ STREAM_AUDIO_EAC3 = (DESCRIPTOR_EAC3 << 8),
+ STREAM_AUDIO_DTS = (DESCRIPTOR_DTS << 8),
+
} streamType;
-#define WRAP_THRESHOLD 270000
+#define WRAP_THRESHOLD 360000
#define PTS_AUDIO 0
#define PTS_VIDEO 1
@@ -285,13 +287,14 @@
typedef struct {
unsigned int pid;
fifo_buffer_t *fifo;
- uint32_t size;
uint32_t type;
int64_t pts;
buf_element_t *buf;
unsigned int counter;
uint16_t descriptor_tag; /* +0x100 for PES stream IDs (no available TS descriptor tag?) */
+ uint8_t keep; /* used by demux_ts_dynamic_pmt_*() */
int corrupted_pes;
+ int pes_bytes_left; /* butes left if PES packet size is known */
int input_normpos;
int input_time;
@@ -329,6 +332,7 @@ typedef struct {
fifo_buffer_t *video_fifo;
input_plugin_t *input;
+ unsigned int read_retries;
int status;
@@ -408,6 +412,169 @@ typedef struct {
config_values_t *config;
} demux_ts_class_t;
+static void reset_track_map(fifo_buffer_t *fifo)
+{
+ buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
+
+ buf->type = BUF_CONTROL_RESET_TRACK_MAP;
+ buf->decoder_info[1] = -1;
+
+ fifo->put (fifo, buf);
+}
+
+/* TJ. dynamic PMT support. The idea is:
+ First, reuse unchanged pids and add new ones.
+ Then, comb out those who are no longer referenced.
+ For example, the Kaffeine dvb frontend preserves original pids but only
+ sends the currently user selected ones, plus matching generated pat/pmt */
+
+static int demux_ts_dynamic_pmt_find (demux_ts_t *this,
+ int pid, int type, unsigned int descriptor_tag) {
+ unsigned int i;
+ demux_ts_media *m;
+ for (i = 0; i < this->media_num; i++) {
+ m = &this->media[i];
+ if ((m->pid == pid) && ((m->type & BUF_MAJOR_MASK) == type)) {
+ /* mark this media decriptor for reuse */
+ m->keep = 1;
+ return i;
+ }
+ }
+ if (i < MAX_PIDS) {
+ /* prepare new media descriptor */
+#ifdef LOG_DYNAMIC_PMT
+ char *name = "";
+ if (type == BUF_VIDEO_BASE) name = "video";
+ else if (type == BUF_AUDIO_BASE) name = "audio";
+ else if (type == BUF_SPU_BASE) name = "subtitle";
+ printf ("demux_ts: new %s pid %d\n", name, pid);
+#endif
+ m = &this->media[i];
+ if (type == BUF_AUDIO_BASE) {
+ /* allocate new audio track as well */
+ if (this->audio_tracks_count >= MAX_AUDIO_TRACKS) {
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "demux_ts: too many audio PIDs, ignoring pid %d\n", pid);
+ return -1;
+ }
+ m->type = type | this->audio_tracks_count;
+ this->audio_tracks[this->audio_tracks_count].pid = pid;
+ this->audio_tracks[this->audio_tracks_count].media_index = i;
+ this->audio_tracks_count++;
+ m->fifo = this->stream->audio_fifo;
+ } else {
+ m->type = type;
+ m->fifo = this->stream->video_fifo;
+ }
+ m->pid = pid;
+
+ if (m->buf) {
+ m->buf->free_buffer(m->buf);
+ m->buf = NULL;
+ }
+ m->counter = INVALID_CC;
+ m->corrupted_pes = 1;
+ m->pts = 0;
+
+ m->descriptor_tag = descriptor_tag;
+
+ m->keep = 1;
+ this->media_num++;
+ return i;
+ }
+ /* table full */
+ return -1;
+}
+
+static void demux_ts_dynamic_pmt_clean (demux_ts_t *this) {
+ int i, count = 0, tracks = 0, spus = 0;
+ /* densify media table */
+ for (i = 0; i < this->media_num; i++) {
+ demux_ts_media *m = &this->media[i];
+ int type = m->type & BUF_MAJOR_MASK;
+ int chan = m->type & 0xff;
+ if (m->keep) {
+ m->keep = 0;
+ if (type == BUF_VIDEO_BASE) {
+ /* adjust single video link */
+ this->videoMedia = count;
+ } else if (type == BUF_AUDIO_BASE) {
+ /* densify audio track table */
+ this->audio_tracks[chan].media_index = count;
+ if (chan > tracks) {
+ m->type = (m->type & ~0xff) | tracks;
+ this->audio_tracks[tracks] = this->audio_tracks[chan];
+ }
+ tracks++;
+ } else if (type == BUF_SPU_BASE) {
+ /* spu language table has already been rebuilt from scratch.
+ Adjust backlinks only */
+ while ((spus < this->spu_langs_count) && (this->spu_langs[spus].pid == m->pid)) {
+ this->spu_langs[spus].media_index = count;
+ spus++;
+ }
+ }
+ if (i > count) {
+ this->media[count] = *m;
+ m->buf = NULL;
+ m->pid = INVALID_PID;
+ }
+ count++;
+ } else {
+ /* drop this no longer needed media descriptor */
+#ifdef LOG_DYNAMIC_PMT
+ char *name = "";
+ if (type == BUF_VIDEO_BASE) name = "video";
+ else if (type == BUF_AUDIO_BASE) name = "audio";
+ else if (type == BUF_SPU_BASE) name = "subtitle";
+ printf ("demux_ts: dropped %s pid %d\n", name, m->pid);
+#endif
+ if (m->buf) {
+ m->buf->free_buffer (m->buf);
+ m->buf = NULL;
+ }
+ m->pid = INVALID_PID;
+ }
+ }
+ if ((tracks < this->audio_tracks_count) && this->audio_fifo) {
+ /* at least 1 audio track removed, tell audio decoder loop */
+ reset_track_map(this->audio_fifo);
+#ifdef LOG_DYNAMIC_PMT
+ printf ("demux_ts: new audio track map\n");
+#endif
+ }
+#ifdef LOG_DYNAMIC_PMT
+ printf ("demux_ts: using %d pids, %d audio %d subtitle channels\n", count, tracks, spus);
+#endif
+ /* adjust table sizes */
+ this->media_num = count;
+ this->audio_tracks_count = tracks;
+ /* should really have no effect */
+ this->spu_langs_count = spus;
+}
+
+static void demux_ts_dynamic_pmt_clear (demux_ts_t *this) {
+ unsigned int i;
+ for (i = 0; i < this->media_num; i++) {
+ if (this->media[i].buf) {
+ this->media[i].buf->free_buffer (this->media[i].buf);
+ this->media[i].buf = NULL;
+ }
+ }
+ this->media_num = 0;
+
+ this->videoPid = INVALID_PID;
+ this->audio_tracks_count = 0;
+ this->spu_pid = INVALID_PID;
+ this->spu_langs_count = 0;
+ this->spu_media = 0;
+
+ this->pcr_pid = INVALID_PID;
+
+ this->last_pmt_crc = 0;
+}
+
+
static void demux_ts_tbre_reset (demux_ts_t *this) {
if (this->tbre_time <= TBRE_TIME) {
this->tbre_pid = INVALID_PID;
@@ -576,6 +743,9 @@ static void demux_ts_update_spu_channel(demux_ts_t *th
this->spu_pid = lang->pid;
this->spu_media = lang->media_index;
+ /* multiple spu langs can share same media descriptor */
+ this->media[lang->media_index].type =
+ (this->media[lang->media_index].type & ~0xff) | this->current_spu_channel;
#ifdef TS_LOG
printf("demux_ts: DVBSUB: selecting lang: %s page %ld %ld\n",
lang->desc.lang, lang->desc.comp_page_id, lang->desc.aux_page_id);
@@ -630,6 +800,7 @@ static void demux_ts_flush(demux_ts_t *this)
unsigned int i;
for (i = 0; i < this->media_num; ++i) {
demux_ts_flush_media(&this->media[i]);
+ this->media[i].corrupted_pes = 1;
}
}
@@ -645,11 +816,13 @@ static void demux_ts_flush(demux_ts_t *this)
*/
static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
unsigned char *pkt, unsigned int pusi) {
+#ifdef TS_PAT_LOG
uint32_t table_id;
+ uint32_t version_number;
+#endif
uint32_t section_syntax_indicator;
int32_t section_length;
uint32_t transport_stream_id;
- uint32_t version_number;
uint32_t current_next_indicator;
uint32_t section_number;
uint32_t last_section_number;
@@ -680,11 +853,15 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsig
"demux_ts: demux error! PAT with invalid pointer\n");
return;
}
+#ifdef TS_PAT_LOG
table_id = (unsigned int)pkt[5] ;
+#endif
section_syntax_indicator = (((unsigned int)pkt[6] >> 7) & 1) ;
section_length = (((unsigned int)pkt[6] & 0x03) << 8) | pkt[7];
transport_stream_id = ((uint32_t)pkt[8] << 8) | pkt[9];
+#ifdef TS_PAT_LOG
version_number = ((uint32_t)pkt[10] >> 1) & 0x1f;
+#endif
current_next_indicator = ((uint32_t)pkt[10] & 0x01);
section_number = (uint32_t)pkt[11];
last_section_number = (uint32_t)pkt[12];
@@ -779,11 +956,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsig
/* force PMT reparsing when pmt_pid changes */
if (this->pmt_pid[program_count] != pmt_pid) {
this->pmt_pid[program_count] = pmt_pid;
- this->audio_tracks_count = 0;
- this->last_pmt_crc = 0;
- this->videoPid = INVALID_PID;
- this->spu_pid = INVALID_PID;
- this->pcr_pid = INVALID_PID;
+ demux_ts_dynamic_pmt_clear (this);
if (this->pmt[program_count] != NULL) {
free(this->pmt[program_count]);
@@ -834,14 +1007,13 @@ static int demux_ts_parse_pes_header (xine_t *xine, de
return 0 ;
}
- /* packet_len = p[4] << 8 | p[5]; */
stream_id = p[3];
- header_len = p[8];
+ header_len = p[8] + 9;
/* sometimes corruption on header_len causes segfault in memcpy below */
- if (header_len + 9 > packet_len) {
+ if (header_len > packet_len) {
xprintf (xine, XINE_VERBOSITY_DEBUG,
- "demux_ts: illegal value for PES_header_data_length (0x%x)\n", header_len);
+ "demux_ts: illegal value for PES_header_data_length (0x%x)\n", header_len - 9);
return 0;
}
@@ -852,7 +1024,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, de
if (p[7] & 0x80) { /* pts avail */
- if (header_len < 5) {
+ if (header_len < 14) {
return 0;
}
@@ -880,22 +1052,21 @@ static int demux_ts_parse_pes_header (xine_t *xine, de
m->pts = pts;
- p += header_len + 9;
- packet_len -= header_len + 9;
+ m->pes_bytes_left = (int)(p[4] << 8 | p[5]) - header_len + 6;
+ lprintf("PES packet payload left: %d bytes\n", m->pes_bytes_left);
+ p += header_len;
+ packet_len -= header_len;
+
if (m->descriptor_tag == STREAM_VIDEO_VC1) {
- m->size = packet_len;
m->type = BUF_VIDEO_VC1;
- return 1;
+ return header_len;
}
if (m->descriptor_tag == HDMV_SPU_BITMAP) {
- long payload_len = ((buf[4] << 8) | buf[5]) - header_len - 3;
-
- m->size = packet_len;
m->type |= BUF_SPU_HDMV;
- m->buf->decoder_info[2] = payload_len;
- return 1;
+ m->buf->decoder_info[2] = m->pes_bytes_left;
+ return header_len;
} else
@@ -912,27 +1083,25 @@ static int demux_ts_parse_pes_header (xine_t *xine, de
* these "raw" streams may begin with a byte that looks like a stream type.
* For audio streams, m->type already contains the stream no.
*/
- if(m->descriptor_tag == HDMV_AUDIO_84_EAC3) {
- m->size = packet_len;
+ if(m->descriptor_tag == HDMV_AUDIO_84_EAC3 ||
+ m->descriptor_tag == STREAM_AUDIO_EAC3) {
m->type |= BUF_AUDIO_EAC3;
- return 1;
+ return header_len;
} else if(m->descriptor_tag == STREAM_AUDIO_AC3) { /* ac3 - raw */
- m->size = packet_len;
m->type |= BUF_AUDIO_A52;
- return 1;
+ return header_len;
} else if (m->descriptor_tag == HDMV_AUDIO_83_TRUEHD) {
/* TODO: separate AC3 and TrueHD streams ... */
- m->size = packet_len;
m->type |= BUF_AUDIO_A52;
- return 1;
+ return header_len;
- } else if (m->descriptor_tag == HDMV_AUDIO_82_DTS ||
+ } else if (m->descriptor_tag == STREAM_AUDIO_DTS ||
+ m->descriptor_tag == HDMV_AUDIO_82_DTS ||
m->descriptor_tag == HDMV_AUDIO_86_DTS_HD_MA ) {
- m->size = packet_len;
m->type |= BUF_AUDIO_DTS;
- return 1;
+ return header_len;
} else if (packet_len < 2) {
return 0;
@@ -943,45 +1112,42 @@ static int demux_ts_parse_pes_header (xine_t *xine, de
return 0;
}
- m->size = packet_len - 4;
m->type |= BUF_AUDIO_LPCM_BE;
m->buf->decoder_flags |= BUF_FLAG_SPECIAL;
m->buf->decoder_info[1] = BUF_SPECIAL_LPCM_CONFIG;
m->buf->decoder_info[2] = (p[3]<<24) | (p[2]<<16) | (p[1]<<8) | p[0];
- return 1;
+ m->pes_bytes_left -= 4;
+ return header_len + 4;
} else if (m->descriptor_tag == ISO_13818_PES_PRIVATE
&& p[0] == 0x20 && p[1] == 0x00) {
/* DVBSUB */
- long payload_len = ((buf[4] << 8) | buf[5]) - header_len - 3;
-
- m->size = packet_len;
m->type |= BUF_SPU_DVB;
- m->buf->decoder_info[2] = payload_len;
- return 1;
+ m->buf->decoder_info[2] = m->pes_bytes_left;
+ return header_len;
} else if (p[0] == 0x0B && p[1] == 0x77) { /* ac3 - syncword */
- m->size = packet_len;
m->type |= BUF_AUDIO_A52;
- return 1;
+ return header_len;
} else if ((p[0] & 0xE0) == 0x20) {
spu_id = (p[0] & 0x1f);
- m->size = packet_len-1;
m->type = BUF_SPU_DVD + spu_id;
- return 1;
+ m->pes_bytes_left -= 1;
+ return header_len + 1;
+
} else if ((p[0] & 0xF0) == 0x80) {
if (packet_len < 4) {
return 0;
}
- m->size = packet_len - 4;
m->type |= BUF_AUDIO_A52;
- return 1;
+ m->pes_bytes_left -= 4;
+ return header_len + 4;
#if 0
/* commented out: does not set PCM type. Decoder can't handle raw PCM stream without configuration. */
@@ -1000,15 +1166,14 @@ static int demux_ts_parse_pes_header (xine_t *xine, de
return 0;
}
- m->size = packet_len-pcm_offset;
m->type |= BUF_AUDIO_LPCM_BE;
- return 1;
+ m->pes_bytes_left -= pcm_offset;
+ return header_len + pcm_offset;
#endif
}
} else if ((stream_id & 0xf0) == 0xe0) {
- m->size = packet_len;
switch (m->descriptor_tag) {
case ISO_11172_VIDEO:
case ISO_13818_VIDEO:
@@ -1029,11 +1194,10 @@ static int demux_ts_parse_pes_header (xine_t *xine, de
m->type = BUF_VIDEO_MPEG;
break;
}
- return 1;
+ return header_len;
} else if ((stream_id & 0xe0) == 0xc0) {
- m->size = packet_len;
switch (m->descriptor_tag) {
case ISO_11172_AUDIO:
case ISO_13818_AUDIO:
@@ -1053,7 +1217,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, de
m->type |= BUF_AUDIO_MPEG;
break;
}
- return 1;
+ return header_len;
} else {
#ifdef TS_LOG
@@ -1114,7 +1278,9 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsig
/* allocate the buffer here, as pes_header needs a valid buf for dvbsubs */
m->buf = m->fifo->buffer_pool_alloc(m->fifo);
- if (!demux_ts_parse_pes_header(this->stream->xine, m, ts, len)) {
+ int pes_header_len = demux_ts_parse_pes_header(this->stream->xine, m, ts, len);
+
+ if (pes_header_len <= 0) {
m->buf->free_buffer(m->buf);
m->buf = NULL;
@@ -1124,9 +1290,11 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsig
} else {
m->corrupted_pes = 0;
- memcpy(m->buf->mem, ts+len-m->size, m->size);
- m->buf->size = m->size;
+ /* skip PES header */
+ ts += pes_header_len;
+ len -= pes_header_len;
+
update_extra_info(this, m);
/* rate estimation */
@@ -1135,41 +1303,29 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsig
if (m->pid == this->tbre_pid)
demux_ts_tbre_update (this, TBRE_MODE_AUDIO_PTS, m->pts);
}
+ }
- } else if (!m->corrupted_pes) { /* no pus -- PES packet continuation */
+ if (!m->corrupted_pes) {
- if ((m->buf->size + len) > MAX_PES_BUF_SIZE) {
+ if ((m->buf->size + len) > m->buf->max_size) {
+ m->pes_bytes_left -= m->buf->size;
demux_ts_send_buffer(m, 0);
m->buf = m->fifo->buffer_pool_alloc(m->fifo);
}
+
memcpy(m->buf->mem + m->buf->size, ts, len);
m->buf->size += len;
+
+ if (m->pes_bytes_left > 0 && m->buf->size >= m->pes_bytes_left) {
+ /* PES payload complete */
+ m->pes_bytes_left -= m->buf->size;
+ demux_ts_flush_media(m);
+ /* skip rest data - there shouldn't be any */
+ m->corrupted_pes = 1;
+ }
}
}
-/*
- * Create a buffer for a PES stream.
- */
-static void demux_ts_pes_new(demux_ts_t*this,
- unsigned int mediaIndex,
- unsigned int pid,
- fifo_buffer_t *fifo,
- uint16_t descriptor) {
-
- demux_ts_media *m = &this->media[mediaIndex];
-
- /* new PID seen - initialise stuff */
- m->pid = pid;
- m->fifo = fifo;
-
- if (m->buf != NULL) m->buf->free_buffer(m->buf);
- m->buf = NULL;
- m->counter = INVALID_CC;
- m->descriptor_tag = descriptor;
- m->corrupted_pes = 1;
-}
-
-
/* Find the first ISO 639 language descriptor (tag 10) and
* store the 3-char code in dest, nullterminated. If no
* code is found, zero out dest.
@@ -1260,11 +1416,13 @@ static void demux_ts_parse_pmt (demux_ts_t *this,
unsigned int pusi,
uint32_t program_count) {
+#ifdef TS_PMT_LOG
uint32_t table_id;
+ uint32_t version_number;
+#endif
uint32_t section_syntax_indicator;
uint32_t section_length = 0; /* to calm down gcc */
uint32_t program_number;
- uint32_t version_number;
uint32_t current_next_indicator;
uint32_t section_number;
uint32_t last_section_number;
@@ -1279,6 +1437,7 @@ static void demux_ts_parse_pmt (demux_ts_t *this,
char *ptr = NULL;
unsigned char len;
unsigned int offset=0;
+ int mi;
/*
* A new section should start with the payload unit start
@@ -1293,11 +1452,15 @@ static void demux_ts_parse_pmt (demux_ts_t *this,
this->pmt[program_count] = (uint8_t *) calloc(4096, sizeof(unsigned char));
this->pmt_write_ptr[program_count] = this->pmt[program_count];
+#ifdef TS_PMT_LOG
table_id = pkt[5] ;
+#endif
section_syntax_indicator = (pkt[6] >> 7) & 0x01;
section_length = (((uint32_t) pkt[6] << 8) | pkt[7]) & 0x03ff;
program_number = ((uint32_t) pkt[8] << 8) | pkt[9];
+#ifdef TS_PMT_LOG
version_number = (pkt[10] >> 1) & 0x1f;
+#endif
current_next_indicator = pkt[10] & 0x01;
section_number = pkt[11];
last_section_number = pkt[12];
@@ -1425,10 +1588,12 @@ printf("Program Number is %i, looking for %i\n",progra
* PMT has changed (e.g. an IPTV streamer that's just changed its source),
* we'll get new PIDs that we should follow.
*/
- this->audio_tracks_count = 0;
this->videoPid = INVALID_PID;
this->spu_pid = INVALID_PID;
+ this->spu_langs_count = 0;
+ reset_track_map(this->video_fifo);
+
/*
* ES definitions start here...we are going to learn upto one video
* PID and one audio PID.
@@ -1454,7 +1619,6 @@ printf("Program Number is %i, looking for %i\n",progra
/*
* Extract the elementary streams.
*/
- this->spu_langs_count = 0;
while (section_length > 0) {
unsigned int stream_info_length;
@@ -1481,9 +1645,12 @@ printf("Program Number is %i, looking for %i\n",progra
#ifdef TS_PMT_LOG
printf ("demux_ts: PMT video pid 0x%.4x type %2.2x\n", pid, stream[0]);
#endif
- demux_ts_pes_new(this, this->media_num, pid, this->video_fifo,stream[0]);
- this->videoMedia = this->media_num;
- this->videoPid = pid;
+
+ mi = demux_ts_dynamic_pmt_find (this, pid, BUF_VIDEO_BASE, stream[0]);
+ if (mi >= 0) {
+ this->videoMedia = mi;
+ this->videoPid = pid;
+ }
}
break;
@@ -1492,18 +1659,17 @@ printf("Program Number is %i, looking for %i\n",progra
case ISO_13818_PART7_AUDIO:
case ISO_14496_PART3_AUDIO:
if (this->audio_tracks_count < MAX_AUDIO_TRACKS) {
- if (apid_check(this, pid) < 0) {
+
+ mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, stream[0]);
+ if (mi >= 0) {
#ifdef TS_PMT_LOG
- printf ("demux_ts: PMT audio pid 0x%.4x type %2.2x\n", pid, stream[0]);
+ printf ("demux_ts: PMT audio pid 0x%.4x type %2.2x\n", pid, stream[0]);
#endif
- demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo,stream[0]);
- this->audio_tracks[this->audio_tracks_count].pid = pid;
- this->audio_tracks[this->audio_tracks_count].media_index = this->media_num;
- this->media[this->media_num].type = this->audio_tracks_count;
- demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang,
- stream + 5, stream_info_length);
- this->audio_tracks_count++;
+ demux_ts_get_lang_desc (this,
+ this->audio_tracks[this->media[mi].type & 0xff].lang,
+ stream + 5, stream_info_length);
}
+
}
break;
case ISO_13818_PRIVATE:
@@ -1522,28 +1688,23 @@ printf("Program Number is %i, looking for %i\n",progra
break;
case ISO_13818_PES_PRIVATE:
for (i = 5; i < coded_length; i += stream[i+1] + 2) {
- if (((stream[i] == DESCRIPTOR_AC3) || (stream[i] == DESCRIPTOR_EAC3)) &&
- (this->audio_tracks_count < MAX_AUDIO_TRACKS)) {
- if (apid_check(this, pid) < 0) {
+
+ if ((stream[i] == DESCRIPTOR_AC3) || (stream[i] == DESCRIPTOR_EAC3) || (stream[i] == DESCRIPTOR_DTS)) {
+ mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE,
+ stream[i] == DESCRIPTOR_AC3 ? STREAM_AUDIO_AC3 :
+ stream[i] == DESCRIPTOR_DTS ? STREAM_AUDIO_DTS :
+ STREAM_AUDIO_EAC3);
+ if (mi >= 0) {
#ifdef TS_PMT_LOG
printf ("demux_ts: PMT AC3 audio pid 0x%.4x type %2.2x\n", pid, stream[0]);
#endif
- if (stream[i] == DESCRIPTOR_AC3)
- demux_ts_pes_new(this, this->media_num, pid,
- this->audio_fifo, STREAM_AUDIO_AC3);
- else
- demux_ts_pes_new(this, this->media_num, pid,
- this->audio_fifo, HDMV_AUDIO_84_EAC3);
-
- this->audio_tracks[this->audio_tracks_count].pid = pid;
- this->audio_tracks[this->audio_tracks_count].media_index = this->media_num;
- this->media[this->media_num].type = this->audio_tracks_count;
- demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang,
- stream + 5, stream_info_length);
- this->audio_tracks_count++;
+ demux_ts_get_lang_desc (this,
+ this->audio_tracks[this->media[mi].type & 0xff].lang,
+ stream + 5, stream_info_length);
break;
}
}
+
/* Teletext */
else if (stream[i] == DESCRIPTOR_TELETEXT)
{
@@ -1561,6 +1722,10 @@ printf("Program Number is %i, looking for %i\n",progra
else if (stream[i] == DESCRIPTOR_DVBSUB)
{
int pos;
+
+ mi = demux_ts_dynamic_pmt_find (this, pid, BUF_SPU_BASE, stream[0]);
+ if (mi < 0) break;
+
for (pos = i + 2;
pos + 8 <= i + 2 + stream[i + 1]
&& this->spu_langs_count < MAX_SPU_LANGS;
@@ -1578,9 +1743,7 @@ printf("Program Number is %i, looking for %i\n",progra
lang->desc.aux_page_id =
(stream[pos + 6] << 8) | stream[pos + 7];
lang->pid = pid;
- lang->media_index = this->media_num;
- this->media[this->media_num].type = no;
- demux_ts_pes_new(this, this->media_num, pid, this->video_fifo, stream[0]);
+ lang->media_index = mi;
demux_send_special_spu_buf( this, BUF_SPU_DVB, no );
#ifdef TS_LOG
printf("demux_ts: DVBSUB: pid 0x%.4x: %s page %ld %ld type %2.2x\n",
@@ -1615,15 +1778,17 @@ printf("Program Number is %i, looking for %i\n",progra
break;
}
+ mi = demux_ts_dynamic_pmt_find (this, pid, BUF_SPU_BASE, stream[0]);
+ if (mi < 0) break;
+
+
demux_ts_spu_lang *lang = &this->spu_langs[this->spu_langs_count];
memset(lang->desc.lang, 0, sizeof(lang->desc.lang));
/*memcpy(lang->desc.lang, &stream[pos], 3);*/
/*lang->desc.lang[3] = 0;*/
lang->pid = pid;
- lang->media_index = this->media_num;
- this->media[this->media_num].type = this->spu_langs_count;
- demux_ts_pes_new(this, this->media_num, pid, this->video_fifo, stream[0]);
+ lang->media_index = mi;
demux_send_special_spu_buf( this, BUF_SPU_HDMV, this->spu_langs_count );
this->spu_langs_count++;
#ifdef TS_PMT_LOG
@@ -1642,43 +1807,43 @@ printf("Program Number is %i, looking for %i\n",progra
* if is does, we tag this as an audio stream.
* FIXME: This will need expanding if we ever see a DTS or other media format here.
*/
- if ((this->audio_tracks_count < MAX_AUDIO_TRACKS) && (stream[0] >= 0x80) ) {
- if (apid_check(this,pid) < 0) {
- uint32_t format_identifier=0;
- demux_ts_get_reg_desc(this, &format_identifier,
- stream + 5, stream_info_length);
- /* If no format identifier, assume A52 */
- if (( format_identifier == 0x41432d33) ||
- ( format_identifier == 0) ||
- ((format_identifier == 0x48444d56 || this->hdmv>0) && stream[0] == HDMV_AUDIO_80_PCM) /* BluRay PCM */) {
+ if ((this->audio_tracks_count < MAX_AUDIO_TRACKS) && (stream[0] >= 0x80) ) {
- demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo, stream[0]);
- this->audio_tracks[this->audio_tracks_count].pid = pid;
- this->audio_tracks[this->audio_tracks_count].media_index = this->media_num;
- this->media[this->media_num].type = this->audio_tracks_count;
- demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang,
- stream + 5, stream_info_length);
- this->audio_tracks_count++;
- break;
- }
+ uint32_t format_identifier=0;
+ demux_ts_get_reg_desc(this, &format_identifier, stream + 5, stream_info_length);
+ /* If no format identifier, assume A52 */
+ if (( format_identifier == 0x41432d33) ||
+ ( format_identifier == 0) ||
+ ((format_identifier == 0x48444d56 || this->hdmv>0) && stream[0] == HDMV_AUDIO_80_PCM) /* BluRay PCM */) {
+
+ mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, stream[0]);
+ if (mi >= 0) {
+ demux_ts_get_lang_desc (this,
+ this->audio_tracks[this->media[mi].type & 0xff].lang,
+ stream + 5, stream_info_length);
+#ifdef TS_PMT_LOG
+ printf ("demux_ts: PMT audio pid 0x%.4x type %2.2x\n", pid, stream[0]);
+#endif
+ break;
+ }
}
- } else {
+ }
#ifdef TS_PMT_LOG
- printf ("demux_ts: PMT unknown stream_type: 0x%.2x pid: 0x%.4x\n",
- stream[0], pid);
+ printf ("demux_ts: PMT unknown stream_type: 0x%.2x pid: 0x%.4x\n",
+ stream[0], pid);
- for (i = 5; i < coded_length; i++)
- printf ("%.2x ", stream[i]);
- printf ("\n");
+ for (i = 5; i < coded_length; i++)
+ printf ("%.2x ", stream[i]);
+ printf ("\n");
#endif
- }
break;
}
- this->media_num++;
stream += coded_length;
section_length -= coded_length;
}
+ demux_ts_dynamic_pmt_clean (this);
+
/*
* Get the current PCR PID.
*/
@@ -1812,8 +1977,19 @@ static unsigned char * demux_synchronise(demux_ts_t* t
this->frame_pos = this->input->get_current_pos (this->input);
read_length = this->input->read(this->input, this->buf,
- this->pkt_size * NPKT_PER_READ);
- if (read_length < 0 || read_length % this->pkt_size) {
+ this->pkt_size * NPKT_PER_READ);
+
+ if (read_length < 0) {
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "demux_ts: read returned %d\n", read_length);
+ if (this->read_retries > 2)
+ this->status = DEMUX_FINISHED;
+ this->read_retries++;
+ return NULL;
+ }
+ this->read_retries = 0;
+
+ if (read_length % this->pkt_size) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
"demux_ts: read returned %d bytes (not a multiple of %d!)\n",
read_length, this->pkt_size);
@@ -1832,6 +2008,7 @@ static unsigned char * demux_synchronise(demux_ts_t* t
*/
if (this->npkt_read == 0) {
+ demux_ts_flush(this);
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: read 0 packets\n");
this->status = DEMUX_FINISHED;
return NULL;
@@ -1964,7 +2141,9 @@ static void demux_ts_parse_packet (demux_ts_t*this) {
unsigned int sync_byte;
unsigned int transport_error_indicator;
unsigned int payload_unit_start_indicator;
+#ifdef TS_HEADER_LOG
unsigned int transport_priority;
+#endif
unsigned int pid;
unsigned int transport_scrambling_control;
unsigned int adaptation_field_control;
@@ -1982,7 +2161,9 @@ static void demux_ts_parse_packet (demux_ts_t*this) {
sync_byte = originalPkt[0];
transport_error_indicator = (originalPkt[1] >> 7) & 0x01;
payload_unit_start_indicator = (originalPkt[1] >> 6) & 0x01;
+#ifdef TS_HEADER_LOG
transport_priority = (originalPkt[1] >> 5) & 0x01;
+#endif
pid = ((originalPkt[1] << 8) |
originalPkt[2]) & 0x1fff;
transport_scrambling_control = (originalPkt[3] >> 6) & 0x03;
@@ -2154,15 +2335,8 @@ static void demux_ts_event_handler (demux_ts_t *this)
case XINE_EVENT_PIDS_CHANGE:
- this->videoPid = INVALID_PID;
- this->pcr_pid = INVALID_PID;
- this->audio_tracks_count = 0;
- this->media_num = 0;
+ demux_ts_dynamic_pmt_clear(this);
this->send_newpts = 1;
- this->spu_pid = INVALID_PID;
- this->spu_media = 0;
- this->spu_langs_count= 0;
- this->last_pmt_crc = 0;
_x_demux_control_start (this->stream);
break;
@@ -2297,6 +2471,7 @@ static int demux_ts_seek (demux_plugin_t *this_gen,
m->buf = NULL;
m->counter = INVALID_CC;
m->corrupted_pes = 1;
+ m->pts = 0;
}
if( !playing ) {

View File

@ -1,34 +0,0 @@
$OpenBSD: patch-src_input_Makefile_am,v 1.1 2012/04/08 07:37:25 ajacoutot Exp $
--- src/input/Makefile.am.orig Sat Apr 7 13:15:19 2012
+++ src/input/Makefile.am Sat Apr 7 13:16:28 2012
@@ -56,6 +56,10 @@ if DVB
in_dvb = xineplug_inp_dvb.la
endif
+if HAVE_LIBBLURAY
+in_bluray = xineplug_inp_bluray.la
+endif
+
AM_CFLAGS = -D_LARGEFILE64_SOURCE $(GNOME_VFS_CFLAGS) $(ALSA_CFLAGS) $(DVD_CFLAGS)
xineplug_LTLIBRARIES = \
@@ -75,6 +79,7 @@ xineplug_LTLIBRARIES = \
xineplug_inp_net.la \
$(in_pvr) \
$(in_dvb) \
+ $(in_bluray) \
xineplug_inp_cdda.la
@@ -162,6 +167,11 @@ xineplug_inp_pvr_la_SOURCES = input_pvr.c
xineplug_inp_pvr_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL)
xineplug_inp_pvr_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS)
xineplug_inp_pvr_la_LDFLAGS = $(xineplug_ldflags)
+
+xineplug_inp_bluray_la_SOURCES = input_bluray.c media_helper.c
+xineplug_inp_bluray_la_LIBADD = $(XINE_LIB) $(LIBBLURAY_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL)
+xineplug_inp_bluray_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) $(LIBBLURAY_CFLAGS)
+xineplug_inp_bluray_la_LDFLAGS = $(xineplug_ldflags)
xineinclude_HEADERS = input_plugin.h
noinst_HEADERS = net_buf_ctrl.h mms.h mmsh.h pnm.h media_helper.h http_helper.h

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-src_input_input_vcd_c,v 1.7 2012/04/08 19:33:31 ajacoutot Exp $
--- src/input/input_vcd.c.orig Sun Oct 16 14:59:32 2011
+++ src/input/input_vcd.c Sun Apr 8 14:39:38 2012
@@ -53,6 +53,8 @@
#if defined(__sun)
#define CDROM "/vol/dev/aliases/cdrom0"
+#elif defined(__OpenBSD__)
+#define CDROM "/dev/rcd0c"
#else
/* for FreeBSD make a link to the right devnode, like /dev/acd0c */
#define CDROM "/dev/cdrom"

View File

@ -1,155 +0,0 @@
$OpenBSD: patch-src_libspudvb_xine_spudvb_decoder_c,v 1.1 2012/04/07 05:48:49 ajacoutot Exp $
- Fix region size check (HD can have 1920x1080 regions).
- Skip display descriptor segments.
- Use PTS timestamps with DVB subtitles.
- Make sure we don't use old PTS.
- Added config option to ignore DVB SPU PTS timestamps.
- Fix #include.
--- src/libspudvb/xine_spudvb_decoder.c.orig Fri Feb 17 23:20:13 2012
+++ src/libspudvb/xine_spudvb_decoder.c Fri Feb 17 23:20:22 2012
@@ -25,8 +25,9 @@
* - Implement support for teletext based subtitles
*/
-#include "pthread.h"
+#include <pthread.h>
#include <errno.h>
+
#include "xine_internal.h"
#include "bswap.h"
#include "osd.h"
@@ -79,6 +80,8 @@ typedef struct {
typedef struct dvb_spu_class_s {
spu_decoder_class_t class;
xine_t *xine;
+
+ int ignore_pts;
} dvb_spu_class_t;
typedef struct dvb_spu_decoder_s {
@@ -97,9 +100,8 @@ typedef struct dvb_spu_decoder_s {
char *pes_pkt_wrptr;
unsigned int pes_pkt_size;
- uint64_t pts;
- uint64_t vpts;
- uint64_t end_vpts;
+ int64_t vpts;
+ int64_t end_vpts;
pthread_t dvbsub_timer_thread;
struct timespec dvbsub_hide_timeout;
@@ -695,7 +697,7 @@ static void draw_subtitles (dvb_spu_decoder_t * this)
pthread_mutex_lock(&this->dvbsub_osd_mutex);
#ifdef LOG
- printf("SPUDVB: this->vpts=%llu\n",this->vpts);
+ printf("SPUDVB: this->vpts=%"PRId64"\n", this->vpts);
#endif
for ( r=0; r<MAX_REGIONS; r++ ) {
#ifdef LOG
@@ -752,27 +754,29 @@ static void spudec_decode_data (spu_decoder_t * this_g
}
return;
}
- else {
- if (buf->decoder_info[2]) {
- memset (this->pes_pkt, 0xff, 64*1024);
- this->pes_pkt_wrptr = this->pes_pkt;
- this->pes_pkt_size = buf->decoder_info[2];
- this->pts = buf->pts;
- xine_fast_memcpy (this->pes_pkt, buf->content, buf->size);
+ /* accumulate data */
+ if (buf->decoder_info[2]) {
+ memset (this->pes_pkt, 0xff, 64*1024);
+ this->pes_pkt_wrptr = this->pes_pkt;
+ this->pes_pkt_size = buf->decoder_info[2];
+
+ xine_fast_memcpy (this->pes_pkt, buf->content, buf->size);
+ this->pes_pkt_wrptr += buf->size;
+
+ this->vpts = 0;
+ }
+ else {
+ if (this->pes_pkt && (this->pes_pkt_wrptr != this->pes_pkt)) {
+ xine_fast_memcpy (this->pes_pkt_wrptr, buf->content, buf->size);
this->pes_pkt_wrptr += buf->size;
}
- else {
- if (this->pes_pkt && (this->pes_pkt_wrptr != this->pes_pkt)) {
- xine_fast_memcpy (this->pes_pkt_wrptr, buf->content, buf->size);
- this->pes_pkt_wrptr += buf->size;
- }
- }
}
+
/* don't ask metronom for a vpts but rather do the calculation
* because buf->pts could be too far in future and metronom won't accept
* further backwards pts (see metronom_got_spu_packet) */
- if (buf->pts) {
+ if (!this->class->ignore_pts && buf->pts > 0) {
metronom_t *const metronom = this->stream->metronom;
const int64_t vpts_offset = metronom->get_option( metronom, METRONOM_VPTS_OFFSET );
const int64_t spu_offset = metronom->get_option( metronom, METRONOM_SPU_OFFSET );
@@ -781,7 +785,7 @@ static void spudec_decode_data (spu_decoder_t * this_g
const int64_t curvpts = clock->get_current_time( clock );
/* if buf->pts is unreliable, show page asap (better than nothing) */
#ifdef LOG
- printf("SPUDVB: spu_vpts=%lld - current_vpts=%lld\n", vpts, curvpts);
+ printf("SPUDVB: spu_vpts=%"PRId64" - current_vpts=%"PRId64"\n", vpts, curvpts);
#endif
if ( vpts<=curvpts || (vpts-curvpts)>(5*90000) )
this->vpts = 0;
@@ -790,7 +794,7 @@ static void spudec_decode_data (spu_decoder_t * this_g
}
/* completely ignore pts since it makes a lot of problems with various providers */
- this->vpts = 0;
+ /* this->vpts = 0; */
/* process the pes section */
@@ -925,8 +929,12 @@ static spu_decoder_t *dvb_spu_class_open_plugin (spu_d
return (spu_decoder_t *) this;
}
-static void dvb_spu_class_dispose (spu_decoder_class_t * this)
+static void dvb_spu_class_dispose (spu_decoder_class_t * this_gen)
{
+ dvb_spu_class_t *this = (dvb_spu_class_t *) this_gen;
+
+ this->xine->config->unregister_callback(this->xine->config, "subtitles.dvb.ignore_pts");
+
free (this);
}
@@ -940,6 +948,13 @@ static char *dvb_spu_class_get_description (spu_decode
return "DVB subtitle decoder plugin";
}
+static void spu_dvb_ignore_pts_change(void *this_gen, xine_cfg_entry_t *value)
+{
+ dvb_spu_class_t *this = (dvb_spu_class_t *) this_gen;
+
+ this->ignore_pts = value->num_value;
+}
+
static void *init_spu_decoder_plugin (xine_t * xine, void *data)
{
dvb_spu_class_t *this = calloc(1, sizeof (dvb_spu_class_t));
@@ -950,6 +965,12 @@ static void *init_spu_decoder_plugin (xine_t * xine, v
this->class.dispose = dvb_spu_class_dispose;
this->xine = xine;
+
+ this->ignore_pts = xine->config->register_bool(xine->config,
+ "subtitles.dvb.ignore_pts", 0,
+ _("Ignore DVB subtitle timing"),
+ _("Do not use PTS timestamps for DVB subtitle timing"),
+ 1, spu_dvb_ignore_pts_change, this);
return &this->class;
}

View File

@ -1,27 +0,0 @@
$OpenBSD: patch-src_video_out_video_out_opengl_c,v 1.1 2012/04/07 05:48:49 ajacoutot Exp $
Quick-fix to enable OSD when using fragment shader for YUV conversion.
--- src/video_out/video_out_opengl.c.orig Fri Feb 17 23:24:07 2012
+++ src/video_out/video_out_opengl.c Fri Feb 17 23:25:19 2012
@@ -1480,6 +1480,20 @@ static void opengl_overlay_blend (vo_driver_t *this_ge
XUnlockDisplay (this->display);
}
} else {
+
+ if (!frame->rgb_dst) {
+ if (frame->format == XINE_IMGFMT_YV12) {
+ _x_blend_yuv(frame->vo_frame.base, overlay,
+ frame->width, frame->height, frame->vo_frame.pitches,
+ &this->alphablend_extra_data);
+ } else {
+ _x_blend_yuy2(frame->vo_frame.base[0], overlay,
+ frame->width, frame->height, frame->vo_frame.pitches[0],
+ &this->alphablend_extra_data);
+ }
+ return;
+ }
+
if (!overlay->rgb_clut || !overlay->hili_rgb_clut)
opengl_overlay_clut_yuv2rgb (this, overlay, frame);

View File

@ -1,21 +0,0 @@
$OpenBSD: patch-src_xine-engine_audio_decoder_c,v 1.13 2012/05/09 06:29:43 ajacoutot Exp $
--- src/xine-engine/audio_decoder.c.orig Tue May 8 23:20:07 2012
+++ src/xine-engine/audio_decoder.c Tue May 8 23:20:47 2012
@@ -466,7 +466,7 @@ static void *audio_decoder_loop (void *stream_gen) {
int _x_audio_decoder_init (xine_stream_t *stream) {
pthread_attr_t pth_attrs;
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0)
struct sched_param pth_params;
#endif
int err;
@@ -506,7 +506,7 @@ int _x_audio_decoder_init (xine_stream_t *stream) {
*/
pthread_attr_init(&pth_attrs);
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0)
pthread_attr_getschedparam(&pth_attrs, &pth_params);
pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
pthread_attr_setschedparam(&pth_attrs, &pth_params);

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-src_xine-engine_audio_out_c,v 1.14 2012/05/09 06:29:43 ajacoutot Exp $
--- src/xine-engine/audio_out.c.orig Tue May 8 23:21:09 2012
+++ src/xine-engine/audio_out.c Tue May 8 23:21:30 2012
@@ -2284,7 +2284,7 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_dr
this->audio_loop_running = 1;
pthread_attr_init(&pth_attrs);
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0)
pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
#endif

View File

@ -1,57 +0,0 @@
$OpenBSD: patch-src_xine-engine_metronom_c,v 1.1 2012/04/07 05:48:49 ajacoutot Exp $
Fix race in metronom_get_option(): reading int64 is not atomic in 32-bit systems
--- src/xine-engine/metronom.c.orig Fri Apr 6 19:53:44 2012
+++ src/xine-engine/metronom.c Fri Apr 6 19:56:49 2012
@@ -745,23 +745,41 @@ static void metronom_clock_set_option (metronom_clock_
static int64_t metronom_get_option (metronom_t *this, int option) {
- if (this->master)
- return this->master->get_option(this->master, option);
+ int64_t result;
+ pthread_mutex_lock (&this->lock);
+
+ if (this->master) {
+ result = this->master->get_option(this->master, option);
+ pthread_mutex_unlock (&this->lock);
+ return result;
+ }
+
switch (option) {
case METRONOM_AV_OFFSET:
- return this->av_offset;
+ result = this->av_offset;
+ break;
case METRONOM_SPU_OFFSET:
- return this->spu_offset;
+ result = this->spu_offset;
+ break;
case METRONOM_FRAME_DURATION:
- return this->img_duration;
+ result = this->img_duration;
+ break;
case METRONOM_VPTS_OFFSET:
- return this->vpts_offset;
+ result = this->vpts_offset;
+ break;
case METRONOM_PREBUFFER:
- return this->prebuffer;
+ result = this->prebuffer;
+ break;
+ default:
+ result = 0;
+ xprintf(this->xine, XINE_VERBOSITY_NONE, "unknown option in get_option: %d\n", option);
+ break;
}
- xprintf(this->xine, XINE_VERBOSITY_NONE, "unknown option in get_option: %d\n", option);
- return 0;
+
+ pthread_mutex_unlock (&this->lock);
+
+ return result;
}
static int64_t metronom_clock_get_option (metronom_clock_t *this, int option) {

View File

@ -1,21 +0,0 @@
$OpenBSD: patch-src_xine-engine_video_decoder_c,v 1.12 2012/05/09 06:29:43 ajacoutot Exp $
--- src/xine-engine/video_decoder.c.orig Tue May 8 23:17:58 2012
+++ src/xine-engine/video_decoder.c Tue May 8 23:18:56 2012
@@ -518,7 +518,7 @@ int _x_video_decoder_init (xine_stream_t *stream) {
} else {
pthread_attr_t pth_attrs;
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0)
struct sched_param pth_params;
#endif
int err, num_buffers;
@@ -549,7 +549,7 @@ int _x_video_decoder_init (xine_stream_t *stream) {
stream->spu_track_map_entries = 0;
pthread_attr_init(&pth_attrs);
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0)
pthread_attr_getschedparam(&pth_attrs, &pth_params);
pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
pthread_attr_setschedparam(&pth_attrs, &pth_params);

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-src_xine-engine_video_out_c,v 1.13 2012/05/09 06:29:43 ajacoutot Exp $
--- src/xine-engine/video_out.c.orig Tue May 8 23:19:12 2012
+++ src/xine-engine/video_out.c Tue May 8 23:19:41 2012
@@ -1948,7 +1948,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_dr
this->grab_only = 0;
pthread_attr_init(&pth_attrs);
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0)
pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
#endif

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-src_xine-engine_xine_c,v 1.15 2012/06/10 07:35:30 ajacoutot Exp $
Fix using uninitialized value (return random size).
--- src/xine-engine/xine.c.orig Sat Jun 9 21:32:06 2012
+++ src/xine-engine/xine.c Sat Jun 9 21:32:19 2012
@@ -1985,7 +1985,7 @@ static int _x_get_current_frame_data (xine_stream_t *s
int flags, int img_size_unknown) {
vo_frame_t *frame;
- size_t required_size;
+ size_t required_size = 0;
stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0);
frame = stream->video_out->get_last_frame (stream->video_out);

View File

@ -1,94 +1,24 @@
$OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
$OpenBSD: patch-src_xine-utils_color_c,v 1.3 2012/06/10 07:35:30 ajacoutot Exp $
- Use proper chroma upsampling for YV12 to YUY2 conversion.
- Improve RGB->YUV conversion (use MPEG range instead of full range).
- Use the same macros for both odd and even lines.
- MMX version of yv12_to_yuy2().
- Remove incorrect .align directives from asm code.
- Add yv12_to_yuy2_sse2().
--- src/xine-utils/color.c.orig Sat Dec 31 11:25:26 2011
+++ src/xine-utils/color.c Thu Apr 26 16:04:17 2012
@@ -66,52 +66,47 @@
/*
* In search of the perfect colorspace conversion formulae...
- * These are the conversion equations that xine currently uses:
+ * These are the conversion equations that xine currently uses
+ * (before normalisation):
*
* Y = 0.29900 * R + 0.58700 * G + 0.11400 * B
* U = -0.16874 * R - 0.33126 * G + 0.50000 * B + 128
* V = 0.50000 * R - 0.41869 * G - 0.08131 * B + 128
- *
- * Feel free to experiment with different coefficients by altering the
- * next 9 defines.
--- src/xine-utils/color.c.orig Tue Feb 14 19:38:31 2012
+++ src/xine-utils/color.c Sat Jun 9 21:04:03 2012
@@ -62,6 +62,10 @@
* instructions.
*/
-#if 1
+/*
+#define Y_R (SCALEFACTOR * 0.29900 * 219.0 / 255.0)
+#define Y_G (SCALEFACTOR * 0.58700 * 219.0 / 255.0)
+#define Y_B (SCALEFACTOR * 0.11400 * 219.0 / 255.0)
-#define Y_R (SCALEFACTOR * 0.29900)
-#define Y_G (SCALEFACTOR * 0.58700)
-#define Y_B (SCALEFACTOR * 0.11400)
+#define U_R (SCALEFACTOR * -0.16874 * 224.0 / 255.0)
+#define U_G (SCALEFACTOR * -0.33126 * 224.0 / 255.0)
+#define U_B (SCALEFACTOR * 0.50000 * 224.0 / 255.0)
-#define U_R (SCALEFACTOR * -0.16874)
-#define U_G (SCALEFACTOR * -0.33126)
-#define U_B (SCALEFACTOR * 0.50000)
+#define V_R (SCALEFACTOR * 0.50000 * 224.0 / 255.0)
+#define V_G (SCALEFACTOR * -0.41869 * 224.0 / 255.0)
+#define V_B (SCALEFACTOR * -0.08131 * 224.0 / 255.0)
+*/
-#define V_R (SCALEFACTOR * 0.50000)
-#define V_G (SCALEFACTOR * -0.41869)
-#define V_B (SCALEFACTOR * -0.08131)
+#define Y_R (SCALEFACTOR * 0.299 * 219.0 / 255.0)
+#define Y_G (SCALEFACTOR * 0.587 * 219.0 / 255.0)
+#define Y_B (SCALEFACTOR * 0.114 * 219.0 / 255.0)
-#else
+#define U_R (SCALEFACTOR * -0.299 / 1.772 * 224.0 / 255.0)
+#define U_G (SCALEFACTOR * -0.587 / 1.772 * 224.0 / 255.0)
+#define U_B (SCALEFACTOR * 0.886 / 1.772 * 224.0 / 255.0)
+#define V_R (SCALEFACTOR * 0.701 / 1.402 * 224.0 / 255.0)
+#define V_G (SCALEFACTOR * -0.587 / 1.402 * 224.0 / 255.0)
+#define V_B (SCALEFACTOR * -0.114 / 1.402 * 224.0 / 255.0)
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
/*
- * Here is another promising set of coefficients. If you use these, you
- * must also add 16 to the Y calculation in the COMPUTE_Y macro found
- * in xineutils.h.
+ * With the normalisation factors above, Y needs 16 added.
+ * This is done during setup, not in the macros in xineutils.h, because
+ * doing it there would be an API change.
*/
+#define Y_MOD (16 * SCALEFACTOR)
#include "xine_internal.h"
-#define Y_R (SCALEFACTOR * 0.257)
-#define Y_G (SCALEFACTOR * 0.504)
-#define Y_B (SCALEFACTOR * 0.098)
-
-#define U_R (SCALEFACTOR * -0.148)
-#define U_G (SCALEFACTOR * -0.291)
-#define U_B (SCALEFACTOR * 0.439)
-
-#define V_R (SCALEFACTOR * 0.439)
-#define V_G (SCALEFACTOR * -0.368)
-#define V_B (SCALEFACTOR * -0.071)
-
-#endif
-
/*
* Precalculate all of the YUV tables since it requires fewer than
* 10 kilobytes to store them.
@@ -658,26 +653,20 @@ static void yuv411_to_yv12_c
@@ -653,26 +657,20 @@ static void yuv411_to_yv12_c
}
@ -123,7 +53,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
/*****************************************************************************
* I420_YUY2: planar YUV 4:2:0 to packed YUYV 4:2:2
* original conversion routine from Videolan project
@@ -728,7 +717,7 @@ static void yv12_to_yuy2_c
@@ -723,7 +721,7 @@ static void yv12_to_yuy2_c
for( i_x = width / 2 ; i_x-- ; )
{
@ -132,7 +62,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
}
p_y2 += i_source_margin;
@@ -759,7 +748,7 @@ static void yv12_to_yuy2_c
@@ -754,7 +752,7 @@ static void yv12_to_yuy2_c
for( i_x = width / 2 ; i_x-- ; )
{
@ -141,7 +71,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
}
p_y2 += i_source_margin + y_src_pitch;
@@ -793,9 +782,10 @@ static void yv12_to_yuy2_c
@@ -788,9 +786,10 @@ static void yv12_to_yuy2_c
p_vb = p_v;
}
@ -153,7 +83,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
}
p_y2 += i_source_margin + y_src_pitch;
@@ -811,10 +801,11 @@ static void yv12_to_yuy2_c
@@ -806,10 +805,11 @@ static void yv12_to_yuy2_c
#if defined(ARCH_X86) || defined(ARCH_X86_64)
@ -167,7 +97,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
"movq (%0), %%mm0 \n\t" /* Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 */ \
"movd (%1), %%mm1 \n\t" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ \
"movd (%2), %%mm2 \n\t" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ \
@@ -856,24 +847,69 @@ do {
@@ -851,24 +851,68 @@ do {
: \
: "r" (p_ut), "r" (p_vt), "r" (p_ub), "r" (p_vb) ); \
__asm__ __volatile__( \
@ -236,14 +166,13 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
+ p_ub += 4; p_vb += 4; p_ut += 4; p_vt += 4; \
+} while(0)
+
+
+#define MMX_YUV420_YUYV_INTERLACED(p_y1,p_y2,p_u,p_ut,p_ub,p_v,p_vt,p_vb,p_line1,p_line2) \
+do { \
+ __asm__ __volatile__( \
"movd (%0), %%mm1 \n\t" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ \
"movd (%1), %%mm2 \n\t" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ \
"pxor %%mm7, %%mm7 \n\t" /* 00 00 00 00 00 00 00 00 */ \
@@ -906,9 +942,9 @@ do {
@@ -901,9 +945,9 @@ do {
"por %%mm5, %%mm6 \n\t" /* Cr1 Cb1 interl v3 u3 v2 u2 v1 u1 v0 u0 */ \
"movq %%mm0, %%mm3 \n\t" /* y7 y6 y5 y4 y3 y2 y1 y0 */ \
"punpcklbw %%mm6, %%mm3 \n\t" /* v1 y3 u1 y2 v0 y1 u0 y0 */ \
@ -255,7 +184,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
: \
: "r" (p_y1), "r" (p_ut), "r" (p_vt), "r" (p_line1) ); \
__asm__ __volatile__( \
@@ -932,82 +968,60 @@ do {
@@ -927,82 +971,60 @@ do {
"por %%mm1, %%mm2 \n\t" /* Cr2 Cb2 interl v3 u3 v2 u2 v1 u1 v0 u0 */ \
"movq %%mm0, %%mm1 \n\t" /* Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ \
"punpcklbw %%mm2, %%mm1 \n\t" /* v1 Y3 u1 Y2 v0 Y1 u0 Y0 */ \
@ -376,7 +305,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
p_line1 += 16; p_line2 += 16; p_y1 += 8; p_y2 += 8; p_u += 4; p_v += 4; \
p_ub += 4; p_vb += 4; p_ut += 4; p_vt += 4; \
} while(0)
@@ -1037,6 +1051,11 @@ static void yv12_to_yuy2_mmxext
@@ -1032,6 +1054,11 @@ static void yv12_to_yuy2_mmxext
const int i_source_v_margin = v_src_pitch - width/2;
const int i_dest_margin = yuy2_pitch - width*2;
@ -388,7 +317,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
if( progressive ) {
for( i_y = height / 2; i_y-- ; )
@@ -1057,11 +1076,11 @@ static void yv12_to_yuy2_mmxext
@@ -1052,11 +1079,11 @@ static void yv12_to_yuy2_mmxext
for( i_x = width / 8 ; i_x-- ; )
{
@ -402,7 +331,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
}
p_y2 += i_source_margin;
@@ -1089,16 +1108,139 @@ static void yv12_to_yuy2_mmxext
@@ -1084,16 +1111,139 @@ static void yv12_to_yuy2_mmxext
p_ub = p_u;
p_vb = p_v;
}
@ -544,7 +473,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
p_y2 += i_source_margin + y_src_pitch;
p_u += i_source_u_margin + u_src_pitch;
p_v += i_source_v_margin + v_src_pitch;
@@ -1130,13 +1272,14 @@ static void yv12_to_yuy2_mmxext
@@ -1125,13 +1275,14 @@ static void yv12_to_yuy2_mmxext
p_vb = p_v;
}
@ -561,7 +490,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
}
p_y2 += i_source_margin + y_src_pitch;
@@ -1210,7 +1353,7 @@ static void yuy2_to_yv12_c
@@ -1205,7 +1356,7 @@ static void yuy2_to_yv12_c
/* yuy2->yv12 with subsampling (some ideas from mplayer's yuy2toyv12) */
#define MMXEXT_YUYV_YUV420( ) \
do { \
@ -570,7 +499,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
"movq (%0), %%mm0 \n\t" /* Load v1 y3 u1 y2 v0 y1 u0 y0 */ \
"movq 8(%0), %%mm1 \n\t" /* Load v3 y7 u3 y6 v2 y5 u2 y4 */ \
"movq %%mm0, %%mm2 \n\t" /* v1 y3 u1 y2 v0 y1 u0 y0 */ \
@@ -1224,7 +1367,7 @@ do {
@@ -1219,7 +1370,7 @@ do {
"movntq %%mm2, (%1) \n\t" /* Store YYYYYYYY line1 */ \
: \
: "r" (p_line1), "r" (p_y1) ); \
@ -579,16 +508,7 @@ $OpenBSD: patch-src_xine-utils_color_c,v 1.2 2012/04/28 09:14:33 ajacoutot Exp $
"movq (%0), %%mm1 \n\t" /* Load v1 y3 u1 y2 v0 y1 u0 y0 */ \
"movq 8(%0), %%mm2 \n\t" /* Load v3 y7 u3 y6 v2 y5 u2 y4 */ \
"movq %%mm1, %%mm3 \n\t" /* v1 y3 u1 y2 v0 y1 u0 y0 */ \
@@ -1317,7 +1460,7 @@ void init_yuv_conversion(void) {
/* initialize the RGB -> YUV tables */
for (i = 0; i < 256; i++) {
- y_r_table[i] = Y_R * i;
+ y_r_table[i] = Y_R * i + Y_MOD;
y_g_table[i] = Y_G * i;
y_b_table[i] = Y_B * i;
@@ -1339,6 +1482,8 @@ void init_yuv_conversion(void) {
@@ -1334,6 +1485,8 @@ void init_yuv_conversion(void) {
/* determine best YV12 -> YUY2 converter to use */
if (xine_mm_accel() & MM_ACCEL_X86_MMXEXT)
yv12_to_yuy2 = yv12_to_yuy2_mmxext;

View File

@ -1,39 +0,0 @@
$OpenBSD: patch-src_xine-utils_memcpy_c,v 1.1 2012/04/07 05:48:49 ajacoutot Exp $
Use POSIX timers where available for determining which memcpy method to use.
--- src/xine-utils/memcpy.c.orig Fri Feb 17 23:29:00 2012
+++ src/xine-utils/memcpy.c Fri Feb 17 23:29:07 2012
@@ -408,7 +408,18 @@ static struct {
{ NULL, NULL, 0, 0 }
};
-#if (defined(ARCH_X86) || defined(ARCH_X86_64)) && defined(HAVE_SYS_TIMES_H)
+#ifdef HAVE_POSIX_TIMERS
+/* Prefer clock_gettime() where available. */
+static int64_t _x_gettime(void)
+{
+ struct timespec tm;
+ return (clock_gettime (CLOCK_THREAD_CPUTIME_ID, &tm) == -1)
+ ? times (NULL)
+ : (int64_t)tm.tv_sec * 1e9 + tm.tv_nsec;
+}
+# define rdtsc(x) _x_gettime()
+
+#elif (defined(ARCH_X86) || defined(ARCH_X86_64)) && defined(HAVE_SYS_TIMES_H)
static int64_t rdtsc(int config_flags)
{
int64_t x;
@@ -510,6 +521,12 @@ void xine_probe_fast_memcpy(xine_t *xine)
/* make sure buffers are present on physical memory */
memset(buf1,0,BUFSIZE);
memset(buf2,0,BUFSIZE);
+
+ /* some initial activity to ensure that we're not running slowly :-) */
+ for(j=0;j<50;j++) {
+ memcpy_method[1].function(buf2,buf1,BUFSIZE);
+ memcpy_method[1].function(buf1,buf2,BUFSIZE);
+ }
for(i=1; memcpy_method[i].name; i++)
{

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.16 2012/04/08 07:37:25 ajacoutot Exp $
@comment $OpenBSD: PLIST,v 1.17 2012/06/10 07:35:30 ajacoutot Exp $
@conflict xine-lib-arts-*
@conflict xine-lib-esd-*
@conflict xine-lib-jack-*
@ -64,6 +64,7 @@ lib/xine/plugins/${XINEAPI_REV}/post/xineplug_post_planar.so
lib/xine/plugins/${XINEAPI_REV}/post/xineplug_post_switch.so
lib/xine/plugins/${XINEAPI_REV}/post/xineplug_post_tvtime.so
lib/xine/plugins/${XINEAPI_REV}/post/xineplug_post_visualizations.so
@comment lib/xine/plugins/${XINEAPI_REV}/vidix/
lib/xine/plugins/${XINEAPI_REV}/xineplug_ao_out_file.so
lib/xine/plugins/${XINEAPI_REV}/xineplug_ao_out_none.so
lib/xine/plugins/${XINEAPI_REV}/xineplug_ao_out_sndio.so