update to xine-lib-1.2.12, from Brad (maintainer)

This commit is contained in:
sthen 2022-03-13 13:55:09 +00:00
parent 4633b9a2ba
commit 2016d5b56b
12 changed files with 19 additions and 965 deletions

View File

@ -1,12 +1,11 @@
COMMENT= multimedia decoding library
DISTNAME= xine-lib-1.2.11
REVISION= 2
DISTNAME= xine-lib-1.2.12
CATEGORIES= multimedia
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=xine/}
EXTRACT_SUFX= .tar.xz
SHARED_LIBS= xine 36.0
SHARED_LIBS= xine 37.0
HOMEPAGE= https://www.xine-project.org/
@ -16,18 +15,17 @@ MAINTAINER= Brad Smith <brad@comstyle.com>
PERMIT_PACKAGE= Yes
WANTLIB += ${COMPILER_LIBCXX} EGL FLAC GL GLU ICE SDL SM X11 X11-xcb
WANTLIB += Xau Xdamage Xdmcp Xext Xfixes Xinerama Xv XvMCW Xxf86vm aom
WANTLIB += avcodec avformat avutil bluray bz2 c cdio crypto dav1d drm
WANTLIB += dvdnav dvdread execinfo expat fontconfig freetype gbm
WANTLIB += glapi gsm iconv intl iso9660 jpeg lcms lzma m mng modplug
WANTLIB += mp3lame mpcdec nfs ogg opus png postproc sndio speex
WANTLIB += ssl swresample theora theoradec theoraenc usbhid v4l2
WANTLIB += v4lconvert vcdinfo vorbis vorbisenc vpx x264 x265 xcb
WANTLIB += xcb-dri2 xcb-dri3 xcb-glx xcb-present xcb-shape xcb-shm
WANTLIB += xcb-sync xcb-xfixes xcb-xv xdg-basedir xml2 xshmfence
WANTLIB += xvidcore z
WANTLIB += Xau Xdmcp Xext Xfixes Xinerama Xv XvMCW Xxf86vm aom avcodec
WANTLIB += avformat avutil bluray bz2 c cdio crypto dav1d drm dvdnav
WANTLIB += dvdread execinfo expat fontconfig freetype gbm gcrypt glapi
WANTLIB += gpg-error gsm iconv intl iso9660 jpeg lcms lzma m mng modplug
WANTLIB += mp3lame mpcdec nfs ogg opus png postproc sndio speex ssl
WANTLIB += swresample theora theoradec theoraenc udfread usbhid v4l2
WANTLIB += v4lconvert vcdinfo vorbis vorbisenc vpx x264 x265 xcb xcb-dri2
WANTLIB += xcb-dri3 xcb-glx xcb-present xcb-shape xcb-shm xcb-sync
WANTLIB += xcb-xfixes xcb-xv xdg-basedir xml2 xshmfence xvidcore z
XINEAPI_REV= 2.9
XINEAPI_REV= 2.10
SUBST_VARS+= XINEAPI_REV
COMPILER= base-clang ports-gcc
@ -54,6 +52,7 @@ LIB_DEPENDS= audio/flac \
multimedia/libdvdnav \
multimedia/libtheora \
multimedia/libv4l \
security/libgcrypt \
x11/libxdg-basedir
# Add back fast math flag since we override CFLAGS
@ -85,6 +84,7 @@ CONFIGURE_ARGS+=--disable-a52dec \
--without-caca \
--without-dav1d \
--without-esound \
--without-gnutls \
--without-imagemagick \
--without-libaom
CONFIGURE_ENV= CPPFLAGS="-I${X11BASE}/include -I${LOCALBASE}/include" \

View File

@ -1,2 +1,2 @@
SHA256 (xine-lib-1.2.11.tar.xz) = 71GyHRDdoQRfp9cRvZFxz9rwpaKHQjO88W/98o7AcAU=
SIZE (xine-lib-1.2.11.tar.xz) = 5282204
SHA256 (xine-lib-1.2.12.tar.xz) = 1gYnBGjhVAwqicDX9f3xHhfswMJpjMC8sQZf8mq+4Jg=
SIZE (xine-lib-1.2.12.tar.xz) = 5341212

View File

@ -1,12 +0,0 @@
Index: m4/decoders.m4
--- m4/decoders.m4.orig
+++ m4/decoders.m4
@@ -461,7 +461,7 @@ a52_init ();
[AC_CHECK_HEADERS([mpc/mpcdec.h], [have_external_libmpcdec=yes], [have_external_libmpcdec=no])],
[AC_CHECK_LIB([mpcdec], [mpc_decoder_decode],
[AC_CHECK_HEADERS([mpcdec/mpcdec.h], [have_external_libmpcdec=yes], [have_external_libmpcdec=no])],
- [have_external_libmpcdec=no])])
+ [have_external_libmpcdec=no], [-lm])], [-lm])
if test x"$have_external_libmpcdec" != x"yes"; then
AC_MSG_RESULT([*** no usable version of libmpcdec found, using internal copy ***])
else

View File

@ -1,15 +0,0 @@
Don't pick up GnuTLS over OpenSSL.
Index: m4/input.m4
--- m4/input.m4.orig
+++ m4/input.m4
@@ -257,8 +257,7 @@ AC_DEFUN([XINE_INPUT_PLUGINS], [
dnl TLS support (ftps, https)
XINE_ARG_ENABLE([tls], [Enable TLS support using gnutls (enables secure http (https) and ftp (ftps)])
if test "x$enable_tls" != "xno"; then
- PKG_CHECK_MODULES([GNUTLS], [gnutls >= 2.8.6], [have_gnutls=yes], [have_gnutls=no])
- PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.2], [have_openssl=yes], [have_openssl=no])
+ PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.0], [have_openssl=yes], [have_openssl=no])
if test x"$have_gnutls" = x"yes" || test x"$have_openssl" = x"yes"; then
have_tls=yes
elif test x"$hard_enable_tls" = x"yes"; then

View File

@ -1,113 +0,0 @@
- ffmpeg 4 compatibility attempt.
4e5ad7ebed6111ba9e1ea2eab4a6b94477b066a8
- Fix avformat.
6087f17933a15a0fee6a1ba58dc3a65841cf6232
Index: src/combined/ffmpeg/demux_avformat.c
--- src/combined/ffmpeg/demux_avformat.c.orig
+++ src/combined/ffmpeg/demux_avformat.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
+#include <errno.h>
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
@@ -543,28 +544,28 @@ static int send_avpacket(avformat_demux_plugin_t *this
{
int64_t stream_pos = avio_tell(this->fmt_ctx->pb);
int64_t stream_length = avio_size(this->fmt_ctx->pb);
- AVPacket pkt;
+ XFF_PACKET_DECL (pkt);
uint32_t buffer_type = 0;
fifo_buffer_t *fifo = NULL;
- av_init_packet(&pkt);
- pkt.data = NULL;
- pkt.size = 0;
+ XFF_PACKET_NEW (pkt);
+ pkt->data = NULL;
+ pkt->size = 0;
/* read frame from the file */
- if (av_read_frame(this->fmt_ctx, &pkt) < 0) {
+ if (av_read_frame(this->fmt_ctx, pkt) < 0) {
xprintf (this->stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE": av_read_frame() failed\n");
return -1;
}
/* map to xine fifo / buffer type */
- if (pkt.stream_index >= 0 && (unsigned)pkt.stream_index < this->num_streams) {
- buffer_type = this->xine_buf_type[pkt.stream_index];
+ if (pkt->stream_index >= 0 && (unsigned)pkt->stream_index < this->num_streams) {
+ buffer_type = this->xine_buf_type [pkt->stream_index];
} else {
// TODO: new streams found
}
- if (this->video_stream_idx >= 0 && pkt.stream_index == this->video_stream_idx) {
+ if (this->video_stream_idx >= 0 && pkt->stream_index == this->video_stream_idx) {
fifo = this->stream->video_fifo;
} else {
fifo = this->stream->audio_fifo;
@@ -577,17 +578,17 @@ static int send_avpacket(avformat_demux_plugin_t *this
int total_time = (int)((int64_t)this->fmt_ctx->duration * 1000 / AV_TIME_BASE);
int input_time = input_normpos * total_time / 65535;
- if (pkt.pts != AV_NOPTS_VALUE) {
- AVStream *stream = this->fmt_ctx->streams[pkt.stream_index];
- pts = (int64_t)(pkt.pts * stream->time_base.num * 90000 / stream->time_base.den);
+ if (pkt->pts != AV_NOPTS_VALUE) {
+ AVStream *stream = this->fmt_ctx->streams [pkt->stream_index];
+ pts = (int64_t)(pkt->pts * stream->time_base.num * 90000 / stream->time_base.den);
check_newpts(this, pts);
}
- _x_demux_send_data(fifo, pkt.data, pkt.size, pts, buffer_type, 0/*decoder_flags*/,
+ _x_demux_send_data (fifo, pkt->data, pkt->size, pts, buffer_type, 0/*decoder_flags*/,
input_normpos, input_time, total_time, 0/*frame_number*/);
}
- XFF_PACKET_UNREF(&pkt);
+ XFF_PACKET_UNREF (pkt);
return 1;
}
@@ -749,11 +750,23 @@ static void demux_avformat_dispose (demux_plugin_t *th
static int pb_input_read_packet(void *opaque, uint8_t *buf, int buf_size) {
input_plugin_t *input = (input_plugin_t *)opaque;
- return input->read(input, buf, buf_size);
+ int r = input->read (input, buf, buf_size);
+ /* avoid eternal misunderstanding :-O */
+ if (r > 0)
+ return r;
+ if (r == 0) {
+#ifdef AVERROR_EOF
+ return AVERROR_EOF;
+#else
+ return 0;
+#endif
+ }
+ return AVERROR (errno);
}
static int64_t pb_input_seek(void *opaque, int64_t offset, int whence) {
input_plugin_t *input = (input_plugin_t *)opaque;
+ int64_t r;
if (whence == AVSEEK_SIZE) {
off_t len = input->get_length(input);
@@ -762,7 +775,10 @@ static int64_t pb_input_seek(void *opaque, int64_t off
return -1;
}
- return input->seek(input, offset, whence);
+ r = input->seek (input, offset, whence);
+ if (r >= 0)
+ return r;
+ return AVERROR (errno);
}
static AVIOContext *get_io_context(xine_stream_t *stream, input_plugin_t *input)

View File

@ -1,97 +0,0 @@
- ffmpeg 4 compatibility attempt.
4e5ad7ebed6111ba9e1ea2eab4a6b94477b066a8
- ff_audio_decoder: enable parser for AC3.
0562ea919530d540857f63268d3ccc12d6becf63
Index: src/combined/ffmpeg/ff_audio_decoder.c
--- src/combined/ffmpeg/ff_audio_decoder.c.orig
+++ src/combined/ffmpeg/ff_audio_decoder.c
@@ -74,7 +74,7 @@ typedef struct ff_audio_decoder_s {
int size;
AVCodecContext *context;
- AVCodec *codec;
+ const AVCodec *codec;
char *decode_buffer;
int decoder_ok;
@@ -83,6 +83,9 @@ typedef struct ff_audio_decoder_s {
#if XFF_AUDIO > 3
AVFrame *av_frame;
#endif
+#if XFF_AUDIO > 2
+ XFF_PACKET_DECL (avpkt);
+#endif
/* AAC ADTS */
uint32_t buftype;
@@ -298,6 +301,7 @@ static void ff_audio_init_codec(ff_audio_decoder_t *th
#if XFF_PARSE > 1
if (codec_type == BUF_AUDIO_AAC_LATM ||
codec_type == BUF_AUDIO_EAC3 ||
+ codec_type == BUF_AUDIO_A52 ||
codec_type == BUF_AUDIO_MPEG) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
@@ -690,11 +694,9 @@ static int ff_audio_decode (ff_audio_decoder_t *this,
else parsed = 0;
#if XFF_AUDIO > 2
- AVPacket avpkt;
- av_init_packet (&avpkt);
- avpkt.data = buf;
- avpkt.size = size;
- avpkt.flags = AV_PKT_FLAG_KEY;
+ this->avpkt->data = buf;
+ this->avpkt->size = size;
+ this->avpkt->flags = AV_PKT_FLAG_KEY;
# if XFF_AUDIO > 3
int got_frame;
float gain = this->class->gain;
@@ -702,7 +704,7 @@ static int ff_audio_decode (ff_audio_decoder_t *this,
this->av_frame = XFF_ALLOC_FRAME ();
# if XFF_AUDIO == 5
{
- int err = avcodec_send_packet (this->context, &avpkt);
+ int err = avcodec_send_packet (this->context, this->avpkt);
/* xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ff_audio_dec: send (%d) = %d.\n", (int)size, err); */
/* multiple frames per packet */
consumed = (err >= 0) ? size : ((err == AVERROR (EAGAIN)) ? 0 : err);
@@ -712,7 +714,7 @@ static int ff_audio_decode (ff_audio_decoder_t *this,
got_frame = (err == 0);
}
# else
- consumed = avcodec_decode_audio4 (this->context, this->av_frame, &got_frame, &avpkt);
+ consumed = avcodec_decode_audio4 (this->context, this->av_frame, &got_frame, this->avpkt);
# endif
if ((consumed >= 0) && got_frame) {
/* setup may have altered while decoding */
@@ -970,7 +972,7 @@ static int ff_audio_decode (ff_audio_decoder_t *this,
}
} else *decode_buffer_size = 0;
# else
- consumed = avcodec_decode_audio3 (this->context, decode_buffer, decode_buffer_size, &avpkt);
+ consumed = avcodec_decode_audio3 (this->context, decode_buffer, decode_buffer_size, this->avpkt);
ff_map_channels (this);
# endif
#else
@@ -1286,6 +1288,8 @@ static void ff_audio_dispose (audio_decoder_t *this_ge
this->context->extradata_size = 0;
XFF_FREE_CONTEXT (this->context);
+ XFF_PACKET_UNREF (this->avpkt);
+
free (this_gen);
}
@@ -1311,6 +1315,10 @@ static audio_decoder_t *ff_audio_open_plugin (audio_de
# if XFF_AUDIO > 3
this->av_frame = NULL;
# endif
+#endif
+
+# if XFF_AUDIO > 2
+ XFF_PACKET_NEW (this->avpkt);
#endif
this->class = (ff_audio_class_t *)class_gen;

View File

@ -1,394 +0,0 @@
- ffmpeg 4 compatibility attempt.
4e5ad7ebed6111ba9e1ea2eab4a6b94477b066a8
- Fix video failure after temporary video out jam.
c87919f2efbb51cbeda963e4cb5db9a8cd08163
Index: src/combined/ffmpeg/ff_video_decoder.c
--- src/combined/ffmpeg/ff_video_decoder.c.orig
+++ src/combined/ffmpeg/ff_video_decoder.c
@@ -51,23 +51,33 @@
#include "ffmpeg_decoder.h"
#include "ff_mpeg_parser.h"
+#include "ffmpeg_compat.h"
+
+#if LIBAVCODEC_VERSION_INT >= XFF_INT_VERSION(59,0,100)
+# undef HAVE_POSTPROC
+#endif
+
#ifdef HAVE_POSTPROC
-#ifdef HAVE_FFMPEG_AVUTIL_H
-# include <postprocess.h>
-#else
-# include <libpostproc/postprocess.h>
-# include <libavutil/mem.h>
+# ifdef HAVE_FFMPEG_AVUTIL_H
+# include <postprocess.h>
+# else
+# include <libpostproc/postprocess.h>
+# include <libavutil/mem.h>
+# endif
#endif
-#endif
#ifdef HAVE_VA_VA_X11_H
-# include <libavcodec/vaapi.h>
+# if XFF_VAAPI == 1
+# include <libavcodec/vaapi.h>
+# elif XFF_VAAPI == 2
+# warning rumms
+# include <libavutil/hwcontext.h>
+# include <libavutil/hwcontext_vaapi.h>
+# endif
# include "accel_vaapi.h"
# define ENABLE_VAAPI 1
#endif
-#include "ffmpeg_compat.h"
-
#if defined(ARCH_X86) && defined(HAVE_MMX)
# include "xine_mmx.h"
# define ENABLE_EMMS
@@ -140,7 +150,7 @@ struct ff_video_decoder_s {
AVFrame *av_frame;
AVFrame *av_frame2;
AVCodecContext *context;
- AVCodec *codec;
+ const AVCodec *codec;
#ifdef HAVE_POSTPROC
int pp_quality;
@@ -187,7 +197,15 @@ struct ff_video_decoder_s {
#ifdef ENABLE_VAAPI
int vaapi_width, vaapi_height;
int vaapi_profile;
+# if XFF_VAAPI == 1
struct vaapi_context vaapi_context;
+# elif XFF_VAAPI == 2
+ /* these are _here_ for debugging mostly. */
+ AVBufferRef *vaapi_av_ctx_ref;
+ AVHWDeviceContext *vaapi_av_ctx;
+ AVVAAPIDeviceContext *vaapi_hw_ctx;
+ AVVAAPIHWConfig *vaapi_hw_cfg;
+# endif
const struct vaapi_accel_funcs_s *accel;
vo_frame_t *accel_img;
#endif
@@ -210,13 +228,80 @@ struct ff_video_decoder_s {
/* see get_buffer () */
int use_emms;
#endif
+
+#if XFF_VIDEO > 1
+ XFF_PACKET_DECL (avpkt);
+#endif
};
/* import color matrix names */
#define CM_HAVE_YCGCO_SUPPORT 1
#include "../../video_out/color_matrix.c"
+#ifdef ENABLE_VAAPI
+# if XFF_VAAPI == 2
+static void ff_vaapi_stop (ff_video_decoder_t *this) {
+ if (this->vaapi_av_ctx) {
+ av_buffer_unref (&this->vaapi_av_ctx_ref);
+ this->vaapi_av_ctx = NULL;
+ this->vaapi_av_ctx_ref = NULL;
+ }
+}
+
+static void ff_vaapi_free_ctx (AVHWDeviceContext *ctx) {
+ ff_video_decoder_t *this;
+
+ if (!ctx)
+ return;
+ this = (ff_video_decoder_t *)ctx->user_opaque;
+ if (!this)
+ return;
+
+ av_free (this->vaapi_hw_cfg);
+ this->vaapi_hw_cfg = NULL;
+}
+
+static int ff_vaapi_start (ff_video_decoder_t *this, VADisplay display, VAConfigID config_id) {
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "ffmpeg_video_dec: ff_vaapi_start (display = %p, config_id = %d).\n",
+ (void *)display, (int)config_id);
+
+ this->vaapi_av_ctx_ref = av_hwdevice_ctx_alloc (AV_HWDEVICE_TYPE_VAAPI);
+ if (!this->vaapi_av_ctx_ref)
+ return 0;
+ this->vaapi_av_ctx = (AVHWDeviceContext *)this->vaapi_av_ctx_ref->data;
+ if (!this->vaapi_av_ctx) {
+ ff_vaapi_stop (this);
+ return 0;
+ }
+
+ this->vaapi_hw_ctx = (AVVAAPIDeviceContext *)this->vaapi_av_ctx->hwctx;
+ if (!this->vaapi_hw_ctx) {
+ ff_vaapi_stop (this);
+ return 0;
+ }
+ this->vaapi_av_ctx->user_opaque = this;
+ this->vaapi_av_ctx->free = ff_vaapi_free_ctx;
+ this->vaapi_hw_ctx->display = display;
+
+ this->vaapi_hw_cfg = (AVVAAPIHWConfig *)av_hwdevice_hwconfig_alloc (this->vaapi_av_ctx_ref);
+ if (!this->vaapi_hw_cfg) {
+ ff_vaapi_stop (this);
+ return 0;
+ }
+ this->vaapi_hw_cfg->config_id = config_id;
+
+ if (av_hwdevice_ctx_init (this->vaapi_av_ctx_ref)) {
+ ff_vaapi_stop (this);
+ return 0;
+ }
+ return 1;
+}
+
+# endif
+#endif
+
static void ff_check_colorspace (ff_video_decoder_t *this) {
int i, cm, caps;
@@ -481,9 +566,20 @@ static int get_buffer_vaapi_vld (AVCodecContext *conte
ff_vaapi_context_t *va_context = this->accel->get_context (this->accel_img);
if (va_context) {
+# if XFF_VAAPI == 2
+ /* avcodec.h saye custom frame allocators shall use AVCodecContext.hw_frames_ctx instead.
+ * however, avcodec_default_get_buffer2 () seems the only 1 using it as such. */
+ if (ff_vaapi_start (this, va_context->va_display, va_context->va_config_id)) {
+ AVBufferRef *old_vaapi_av_ctx_ref = context->hw_device_ctx;
+
+ context->hw_device_ctx = this->vaapi_av_ctx_ref;
+ av_buffer_unref (&old_vaapi_av_ctx_ref);
+ }
+# else
this->vaapi_context.config_id = va_context->va_config_id;
this->vaapi_context.context_id = va_context->va_context_id;
this->vaapi_context.display = va_context->va_display;
+# endif
}
}
}
@@ -867,11 +963,22 @@ static enum PixelFormat get_format(struct AVCodecConte
context->draw_horiz_band = NULL;
context->slice_flags = SLICE_FLAG_CODED_ORDER | SLICE_FLAG_ALLOW_FIELD;
+# if XFF_VAAPI == 2
+ /* avcodec.h saye custom frame allocators shall use AVCodecContext.hw_frames_ctx instead.
+ * however, avcodec_default_get_buffer2 () seems the only 1 using it as such. */
+ if (ff_vaapi_start (this, va_context->va_display, va_context->va_config_id)) {
+ AVBufferRef *old_vaapi_av_ctx_ref = context->hw_device_ctx;
+
+ context->hw_device_ctx = this->vaapi_av_ctx_ref;
+ av_buffer_unref (&old_vaapi_av_ctx_ref);
+ }
+# else
this->vaapi_context.config_id = va_context->va_config_id;
this->vaapi_context.context_id = va_context->va_context_id;
this->vaapi_context.display = va_context->va_display;
context->hwaccel_context = &this->vaapi_context;
+# endif
this->pts = 0;
return fmt[i];
@@ -955,7 +1062,12 @@ static void init_video_codec (ff_video_decoder_t *this
if( this->codec->capabilities & AV_CODEC_CAP_DR1 && this->class->enable_dri ) {
# ifdef XFF_AV_BUFFER
this->context->get_buffer2 = get_buffer;
+# if XFF_THREAD_SAFE_CB == 2
+# warning h.264 still needs this set, or falls back to indirect rendering. please ignore the next warning.
+# endif
+# if XFF_THREAD_SAFE_CB != 0
this->context->thread_safe_callbacks = 1;
+# endif
# if XFF_VIDEO != 3
this->context->refcounted_frames = 1;
# endif
@@ -1162,9 +1274,9 @@ static void pp_change_quality (ff_video_decoder_t *thi
static void init_postprocess (ff_video_decoder_t *this) {
#ifdef HAVE_POSTPROC
-#if defined(ARCH_X86)
+# if defined(ARCH_X86)
uint32_t cpu_caps;
-#endif
+# endif
/* Allow post processing on mpeg-4 (based) codecs */
switch(this->codec->id) {
@@ -1183,7 +1295,7 @@ static void init_postprocess (ff_video_decoder_t *this
this->pp_flags = PP_FORMAT_420;
-#if defined(ARCH_X86)
+# if defined(ARCH_X86)
/* Detect what cpu accel we have */
cpu_caps = xine_mm_accel();
@@ -1195,10 +1307,12 @@ static void init_postprocess (ff_video_decoder_t *this
if(cpu_caps & MM_ACCEL_X86_3DNOW)
this->pp_flags |= PP_CPU_CAPS_3DNOW;
-#endif
+# endif
/* Set level */
pp_change_quality(this);
+#else
+ (void)this;
#endif /* HAVE_POSTPROC */
}
@@ -1848,15 +1962,13 @@ static int decode_video_wrapper (ff_video_decoder_t *t
#endif /* ENABLE_VAAPI */
#if XFF_VIDEO > 1
- AVPacket avpkt;
- av_init_packet(&avpkt);
- avpkt.data = buf;
- avpkt.size = buf_size;
- avpkt.flags = AV_PKT_FLAG_KEY;
+ this->avpkt->data = buf;
+ this->avpkt->size = buf_size;
+ this->avpkt->flags = AV_PKT_FLAG_KEY;
# if XFF_PALETTE == 2 || XFF_PALETTE == 3
if (buf && this->palette_changed) {
- uint8_t *sd = av_packet_new_side_data (&avpkt, AV_PKT_DATA_PALETTE, 256 * 4);
+ uint8_t *sd = av_packet_new_side_data (this->avpkt, AV_PKT_DATA_PALETTE, 256 * 4);
if (sd)
memcpy (sd, this->palette, 256 * 4);
}
@@ -1868,7 +1980,7 @@ static int decode_video_wrapper (ff_video_decoder_t *t
{
int e = AVERROR (EAGAIN);
if (buf || !this->flush_packet_sent) {
- e = avcodec_send_packet (this->context, &avpkt);
+ e = avcodec_send_packet (this->context, this->avpkt);
this->flush_packet_sent = (buf == NULL);
}
len = (e == AVERROR (EAGAIN)) ? 0 : buf_size;
@@ -1878,7 +1990,7 @@ static int decode_video_wrapper (ff_video_decoder_t *t
# else
{
int got_picture = 0;
- len = avcodec_decode_video2 (this->context, av_frame, &got_picture, &avpkt);
+ len = avcodec_decode_video2 (this->context, av_frame, &got_picture, this->avpkt);
if ((len < 0) || (len > (int)buf_size)) {
*err = got_picture ? 0 : len;
len = buf_size;
@@ -1891,16 +2003,16 @@ static int decode_video_wrapper (ff_video_decoder_t *t
# if XFF_PALETTE == 2 || XFF_PALETTE == 3
if (buf && this->palette_changed) {
/* Prevent freeing our data buffer */
- avpkt.data = NULL;
- avpkt.size = 0;
+ this->avpkt->data = NULL;
+ this->avpkt->size = 0;
# if XFF_PALETTE == 2
/* TJ. Oh dear and sigh.
AVPacket side data handling is broken even in ffmpeg 1.1.1 - see avcodec/avpacket.c
The suggested av_free_packet () would leave a memory leak here, and
ff_packet_free_side_data () is private. */
- av_destruct_packet (&avpkt);
+ av_destruct_packet (this->avpkt);
# else /* XFF_PALETTE == 3 */
- XFF_PACKET_UNREF (&avpkt);
+ /* XFF_PACKET_UNREF (this->avpkt); */ ;
# endif
this->palette_changed = 0;
}
@@ -1929,6 +2041,8 @@ static int decode_video_wrapper (ff_video_decoder_t *t
return len;
}
+static void ff_reset (video_decoder_t *this_gen);
+
static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *buf) {
vo_frame_t *img;
@@ -2012,8 +2126,20 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_
flush = next_flush;
if ((err < 0) && (err != AVERROR (EAGAIN))) {
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "ffmpeg_video_dec: error decompressing frame (%d).\n", err);
+#ifdef AVERROR_EOF
+ if (err == AVERROR_EOF) {
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "ffmpeg_video_dec: lost track, reinitializing.\n");
+ ff_reset (&this->video_decoder);
+ } else
+#endif
+ {
+ char b[20];
+
+ _x_tag32_me2str (b, -err);
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "ffmpeg_video_dec: error decompressing frame [%s] (%d).\n", b, err);
+ }
}
size -= len;
offset += len;
@@ -2266,8 +2392,20 @@ static void ff_handle_buffer (ff_video_decoder_t *this
this->size -= len;
continue;
}
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "ffmpeg_video_dec: error decompressing frame (%d).\n", err);
+#ifdef AVERROR_EOF
+ if (err == AVERROR_EOF) {
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "ffmpeg_video_dec: lost track, reinitializing.\n");
+ ff_reset (&this->video_decoder);
+ } else
+#endif
+ {
+ char b[20];
+
+ _x_tag32_me2str (b, -err);
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "ffmpeg_video_dec: error decompressing frame [%s] (%d).\n", b, err);
+ }
this->size = 0;
} else {
@@ -2763,6 +2901,10 @@ static void ff_dispose (video_decoder_t *this_gen) {
XFF_FREE_CONTEXT (this->context);
}
+#if XFF_VIDEO > 1
+ XFF_PACKET_UNREF (this->avpkt);
+#endif
+
if( this->av_frame )
XFF_FREE_FRAME( this->av_frame );
if (this->av_frame2)
@@ -2805,7 +2947,7 @@ static void ff_dispose (video_decoder_t *this_gen) {
static video_decoder_t *ff_video_open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) {
ff_video_decoder_t *this ;
- AVCodec *codec = NULL;
+ const AVCodec *codec = NULL;
uint32_t video_type;
size_t i;
@@ -2913,6 +3055,10 @@ static video_decoder_t *ff_video_open_plugin (video_de
this->pix_fmt = -1;
#ifdef LOG
this->debug_fmt = -1;
+#endif
+
+#if XFF_VIDEO > 1
+ XFF_PACKET_NEW (this->avpkt);
#endif
#ifdef ENABLE_VAAPI

View File

@ -1,88 +0,0 @@
ffmpeg 4 compatibility attempt.
4e5ad7ebed6111ba9e1ea2eab4a6b94477b066a8
Index: src/combined/ffmpeg/ffmpeg_compat.h
--- src/combined/ffmpeg/ffmpeg_compat.h.orig
+++ src/combined/ffmpeg/ffmpeg_compat.h
@@ -130,6 +130,14 @@
# define XFF_PALETTE 3
#endif
+#if LIBAVCODEC_VERSION_INT < XFF_INT_VERSION(59,0,100) /** << revise this */
+# define XFF_VAAPI 1 /** << libavcodec/vaapi.h */
+#else
+# define XFF_VAAPI 2 /** << libavutil/hwcontext.h, libavutil/hwcontext_vaapi.h */
+#endif
+
+
+
#if LIBAVUTIL_VERSION_INT >= XFF_INT_VERSION(52,0,0)
# define PIX_FMT_NONE AV_PIX_FMT_NONE
# define PIX_FMT_YUV420P AV_PIX_FMT_YUV420P
@@ -138,7 +146,6 @@
# define PIX_FMT_YUVJ444P AV_PIX_FMT_YUVJ444P
# define PIX_FMT_YUV410P AV_PIX_FMT_YUV410P
# define PIX_FMT_YUV411P AV_PIX_FMT_YUV411P
-# define PIX_FMT_VAAPI_VLD AV_PIX_FMT_VAAPI_VLD
# define PIX_FMT_ARGB AV_PIX_FMT_ARGB
# define PIX_FMT_BGRA AV_PIX_FMT_BGRA
# define PIX_FMT_RGB24 AV_PIX_FMT_RGB24
@@ -150,8 +157,17 @@
# define PIX_FMT_PAL8 AV_PIX_FMT_PAL8
# define PixelFormat AVPixelFormat
/* video_out/video_out_vaapi */
-# define PIX_FMT_VAAPI_IDCT AV_PIX_FMT_VAAPI_IDCT
-# define PIX_FMT_VAAPI_MOCO AV_PIX_FMT_VAAPI_MOCO
+# if LIBAVCODEC_VERSION_INT < XFF_INT_VERSION(59,0,100) /** << revise this */
+# define PIX_FMT_VAAPI_VLD AV_PIX_FMT_VAAPI_VLD
+# define PIX_FMT_VAAPI_IDCT AV_PIX_FMT_VAAPI_IDCT
+# define PIX_FMT_VAAPI_MOCO AV_PIX_FMT_VAAPI_MOCO
+# else
+# define PIX_FMT_VAAPI_VLD AV_PIX_FMT_VAAPI
+# define PIX_FMT_VAAPI_IDCT AV_PIX_FMT_VAAPI
+# define PIX_FMT_VAAPI_MOCO AV_PIX_FMT_VAAPI
+# endif
+
+# define CODEC_FLAG_BITEXACT AV_CODEC_FLAG_BITEXACT
#endif
#if LIBAVCODEC_VERSION_INT >= XFF_INT_VERSION(54,25,0)
@@ -188,6 +204,18 @@
# define XFF_AV_BUFFER 1
#endif
+/* 0 (no), 1 (yes), 2 (deprecated but still needed to make direct rendering work) */
+#if LIBAVCODEC_VERSION_INT < XFF_INT_VERSION(55,0,100)
+# define XFF_THREAD_SAFE_CB 0
+#elif LIBAVCODEC_VERSION_INT < XFF_INT_VERSION(59,0,100)
+# define XFF_THREAD_SAFE_CB 1
+#elif LIBAVCODEC_VERSION_INT < XFF_INT_VERSION(60,0,0)
+# define XFF_THREAD_SAFE_CB 2
+#else
+/* now callbacks shall always be thread safe. */
+# define XFF_THREAD_SAFE_CB 0
+#endif
+
/* function aliases */
#if LIBAVCODEC_VERSION_INT < XFF_INT_VERSION(52,66,0)
@@ -235,9 +263,17 @@
#endif
#if LIBAVCODEC_VERSION_INT < XFF_INT_VERSION(57,12,100)
-#define XFF_PACKET_UNREF av_free_packet
+# define XFF_PACKET_DECL(_p) AVPacket _p##_stat, *_p
+# define XFF_PACKET_NEW(_p) _p = &_p##_stat, av_init_packet (_p)
+# define XFF_PACKET_UNREF(_p) av_free_packet (_p)
+#elif LIBAVCODEC_VERSION_INT < XFF_INT_VERSION(59,0,100) /** << revise this */
+# define XFF_PACKET_DECL(_p) AVPacket _p##_stat, *_p
+# define XFF_PACKET_NEW(_p) _p = &_p##_stat, av_init_packet (_p)
+# define XFF_PACKET_UNREF(_p) av_packet_unref (_p)
#else
-#define XFF_PACKET_UNREF av_packet_unref
+# define XFF_PACKET_DECL(_p) AVPacket *_p
+# define XFF_PACKET_NEW(_p) _p = av_packet_alloc ()
+# define XFF_PACKET_UNREF(_p) av_packet_free (&(_p))
#endif
#ifndef AV_INPUT_BUFFER_PADDING_SIZE

View File

@ -1,184 +0,0 @@
- demux_ac3: fix framing
e8696b746454e1e089e93b1f2267eba5db3e6daf
- Split function
580c6c6cfb73cd99f342b341ddf0546e8e17be57
- demux_ac3: Fix frame size
5ca0195617b1e584c795caad4cd1fb277835bb63
- demux_ac3: More accurate pts
778e9d14087f4d5efbba6bd9fb6cca23322ec9d0
- demux_ac3: resync after seek/garbage
f85f6e1ec6f57c5dc321ecbf97f648587ff1c943
Index: src/demuxers/demux_ac3.c
--- src/demuxers/demux_ac3.c.orig
+++ src/demuxers/demux_ac3.c
@@ -69,11 +69,41 @@ typedef struct {
int sample_rate;
int frame_size;
int running_time;
+ unsigned frame_number;
uint32_t buf_type;
+ unsigned start_offset;
} demux_ac3_t;
+static int _frame_size(const uint8_t *buf)
+{
+ static const uint8_t byterates[19] = {
+ 4, 5, 6, 7, 8, 10, 12, 14,
+ 16, 20, 24, 28, 32, 40, 48, 56,
+ 64, 72, 80
+ };
+ uint32_t idx, rate;
+ idx = buf[4];
+ if ((idx & 0x3f) > 37)
+ return -1;
+ rate = (uint32_t)byterates[(idx >> 1) & 0x1f];
+ if (idx & 0x80) {
+ if (idx & 0x40) {
+ return -1;
+ } else {
+ return rate * 24 * 2;
+ }
+ } else {
+ if (idx & 0x40) {
+ return ((rate * 16 * 48000 / 44100) + (idx & 0x01)) * 2;
+ } else {
+ return rate * 16 * 2;
+ }
+ }
+ return -1;
+}
+
/* returns 1 if the AC3 file was opened successfully, 0 otherwise */
static int open_ac3_file(demux_ac3_t *this) {
buf_element_t *buf = NULL;
@@ -182,6 +212,8 @@ static int open_ac3_file(demux_ac3_t *this) {
if (offset >= bsize - 2)
break;
+ this->start_offset = offset;
+
if (spdif_mode) {
this->sample_rate = 44100;
this->frame_size = 256 * 6 * 4;
@@ -190,35 +222,14 @@ static int open_ac3_file(demux_ac3_t *this) {
break;
}
+ this->frame_size = _frame_size(b + offset);
+ if (this->frame_size < 0)
+ break;
{
- static const uint8_t byterates[19] = {
- 4, 5, 6, 7, 8, 10, 12, 14,
- 16, 20, 24, 28, 32, 40, 48, 56,
- 64, 72, 80
- };
- uint32_t idx, rate;
- if (offset >= bsize - 4)
+ const uint16_t srate[4] = { 48000, 44100, 32000, 0 };
+ this->sample_rate = srate[b[offset + 4] >> 6];
+ if (this->sample_rate == 0)
break;
- idx = b[offset + 4];
- if ((idx & 0x3f) > 37)
- break;
- rate = (uint32_t)byterates[(idx >> 1) & 0x1f];
- if (idx & 0x80) {
- if (idx & 0x40) {
- break;
- } else {
- this->frame_size = rate * 24 * 2;
- this->sample_rate = 32000;
- }
- } else {
- if (idx & 0x40) {
- this->frame_size = ((rate * 16 * 48000 / 44100) + (idx & 0x01)) * 2;
- this->sample_rate = 44100;
- } else {
- this->frame_size = rate * 16 * 2;
- this->sample_rate = 48000;
- }
- }
}
/* Look for a second sync word */
@@ -254,11 +265,12 @@ static int demux_ac3_send_chunk (demux_plugin_t *this_
buf_element_t *buf = NULL;
off_t current_stream_pos;
int64_t audio_pts;
- int frame_number;
uint32_t blocksize;
current_stream_pos = this->input->get_current_pos(this->input);
- frame_number = current_stream_pos / this->frame_size;
+ if (this->seek_flag) {
+ this->frame_number = current_stream_pos / this->frame_size;
+ }
/*
* Each frame represents 256*6 new audio samples according to the a52 spec.
@@ -268,10 +280,11 @@ static int demux_ac3_send_chunk (demux_plugin_t *this_
* ------------- * ----------- * ---------
* 1 frame sample rate 1 sec
*/
- audio_pts = frame_number;
+ audio_pts = this->frame_number;
audio_pts *= 90000;
audio_pts *= 256 * 6;
audio_pts /= this->sample_rate;
+ this->frame_number++;
if (this->seek_flag) {
_x_demux_control_newpts(this->stream, audio_pts, BUF_FLAG_SEEK);
@@ -288,8 +301,35 @@ static int demux_ac3_send_chunk (demux_plugin_t *this_
}
} else {
buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->size = this->input->read(this->input, buf->content,
- this->frame_size);
+ _x_assert(buf->max_size >= this->frame_size);
+
+ if (this->buf_type != BUF_AUDIO_A52) {
+ buf->size = this->input->read(this->input, buf->content, this->frame_size);
+ } else {
+
+ buf->size = this->input->read(this->input, buf->content, 8);
+ if (buf->size == 8) {
+
+ /* re-sync (rare case, usually after seek) */
+ while (buf->content[0] != 0x0b || buf->content[1] != 0x77) {
+ memmove(buf->content, buf->content + 1, buf->size);
+ if (this->input->read(this->input, buf->content + buf->size - 1, 1) != 1) {
+ buf->size -= 1;
+ break;
+ }
+ }
+
+ /* check frame size and read the rest */
+ if (buf->content[0] == 0x0b && buf->content[1] == 0x77) {
+ int got, frame_size = _frame_size(buf->content);
+ if (frame_size > 0)
+ this->frame_size = frame_size;
+ got = this->input->read(this->input, buf->content + buf->size, this->frame_size - buf->size);
+ if (got > 0)
+ buf->size += got;
+ }
+ }
+ }
}
if (buf->size <= 0) {
@@ -360,6 +400,10 @@ static int demux_ac3_seek (demux_plugin_t *this_gen,
* multiply by the frame alignment to determine the new starting block */
start_pos /= this->frame_size;
start_pos *= this->frame_size;
+
+ /* skip possible file header */
+ start_pos += this->start_offset;
+
this->input->seek(this->input, start_pos, SEEK_SET);
return this->status;

View File

@ -1,19 +0,0 @@
Make use of HW_NCPUONLINE.
Index: src/xine-utils/cpu_accel.c
--- src/xine-utils/cpu_accel.c.orig
+++ src/xine-utils/cpu_accel.c
@@ -453,6 +453,13 @@ static int _cpu_count()
if (!sched_getaffinity(0, sizeof(cpuset), &cpuset))
cpu_count = CPU_COUNT(&cpuset);
+#elif defined(HAVE_SYSCTL) && defined(HW_NCPUONLINE)
+
+ int mib[2] = { CTL_HW, HW_NCPUONLINE };
+ size_t len = sizeof(cpu_count);
+ if (sysctl(mib, 2, &cpu_count, &len, NULL, 0) == -1)
+ cpu_count = 1;
+
#elif defined(HAVE_SYSCTL) && defined(HW_NCPU)
int mib[2] = { CTL_HW, HW_NCPU };

View File

@ -1,20 +0,0 @@
Index: src/xine-utils/ppcasm_string.S
--- src/xine-utils/ppcasm_string.S.orig
+++ src/xine-utils/ppcasm_string.S
@@ -32,7 +32,6 @@
#define __stringify(x) __stringify_1(x)
#define _GLOBFN(n)\
- .stabs __stringify(n:F-1),N_FUN,0,0,n;\
.type n,@function; \
.globl n;\
.hidden n;\
@@ -43,8 +42,6 @@ n:
.text
- .stabs "src/xine-utils",N_SO,0,0,.
- .stabs "ppcasm_string.S",N_SO,0,0,.
#warning FIXME: Get cache line sizes from /proc
#define L1_CACHE_LINE_SIZE 32

View File

@ -1,10 +1,3 @@
@conflict xine-lib-arts-*
@conflict xine-lib-esd-*
@conflict xine-lib-jack-*
@pkgpath ${BASE_PKGPATH},-arts
@pkgpath ${BASE_PKGPATH},-esd
@pkgpath ${BASE_PKGPATH},-jack
@pkgpath ${BASE_PKGPATH},-main
bin/xine-config
@bin bin/xine-list-1.2
include/xine/
@ -24,6 +17,7 @@ include/xine/input_plugin.h
include/xine/io_helper.h
include/xine/list.h
include/xine/metronom.h
include/xine/mfrag.h
include/xine/os_types.h
include/xine/osd.h
include/xine/plugin_catalog.h
@ -36,6 +30,7 @@ include/xine/scratch.h
include/xine/sorted_array.h
include/xine/spu.h
include/xine/spu_decoder.h
include/xine/stree.h
include/xine/tickets.h
include/xine/vdr.h
include/xine/version.h
@ -98,6 +93,7 @@ lib/xine/plugins/${XINEAPI_REV}/post/
@so lib/xine/plugins/${XINEAPI_REV}/xineplug_flac.so
@so lib/xine/plugins/${XINEAPI_REV}/xineplug_inp_bluray.so
@so lib/xine/plugins/${XINEAPI_REV}/xineplug_inp_cdda.so
@so lib/xine/plugins/${XINEAPI_REV}/xineplug_inp_crypto.so
@so lib/xine/plugins/${XINEAPI_REV}/xineplug_inp_dvd.so
@so lib/xine/plugins/${XINEAPI_REV}/xineplug_inp_mms.so
@so lib/xine/plugins/${XINEAPI_REV}/xineplug_inp_network.so