summaryrefslogtreecommitdiff
path: root/extra/xine-lib
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2013-05-31 01:57:14 -0700
committerroot <root@rshg054.dnsready.net>2013-05-31 01:57:14 -0700
commit94a3b302f520438e919ef8706ce9cf42ad7c2e11 (patch)
tree7fa5b120c4fb8ccd67c09d5096bd7e1dc7d35b1c /extra/xine-lib
parent76ee9007095484a113d1856786b81e2d2fae8202 (diff)
Fri May 31 01:56:04 PDT 2013
Diffstat (limited to 'extra/xine-lib')
-rw-r--r--extra/xine-lib/PKGBUILD26
-rw-r--r--extra/xine-lib/accel_vaapi.h135
-rw-r--r--extra/xine-lib/xine-lib-1.2.2-ffmpeg_audio_decoder-support-new-av_decode_audio4.patch277
3 files changed, 147 insertions, 291 deletions
diff --git a/extra/xine-lib/PKGBUILD b/extra/xine-lib/PKGBUILD
index e6666456e..db3b37892 100644
--- a/extra/xine-lib/PKGBUILD
+++ b/extra/xine-lib/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 180316 2013-03-20 02:35:37Z eric $
+# $Id: PKGBUILD 186598 2013-05-30 03:34:04Z eric $
# Maintainer: Eric BĂ©langer <eric@archlinux.org>
pkgname=xine-lib
-pkgver=1.2.2
-pkgrel=8
+pkgver=1.2.3
+pkgrel=1
pkgdesc="A multimedia playback engine"
arch=('i686' 'x86_64')
url="http://www.xine-project.org"
@@ -30,23 +30,21 @@ optdepends=('imagemagick: for using the imagemagick plugin' \
'gnome-vfs: for using the gnome-vfs plugin' \
'libvdpau: for using the VDPAU plugin')
options=('!libtool')
-source=(http://downloads.sourceforge.net/sourceforge/xine/${pkgname}-${pkgver}.tar.xz
- xine-lib-1.2.2-ffmpeg_audio_decoder-support-new-av_decode_audio4.patch)
-sha1sums=('a349cbb0b72256bb262377796a022dcf63829b4c'
- '45500eca2aa40c133e1a6e8b23dbadc4b921b11f')
+source=(http://downloads.sourceforge.net/sourceforge/xine/${pkgname}-${pkgver}.tar.xz accel_vaapi.h)
+sha1sums=('6f9ef4ba75688659052d21448d46527db2b77e57'
+ '08ed9947ef919c71c87151baa8fc0ce7d8f72050')
-build() {
- cd "${srcdir}/${pkgname}-${pkgver}"
-
- # Fix audio decoding with newest FFmpeg
- # https://bugs.archlinux.org/task/33818
- patch -Np1 -i "$srcdir/xine-lib-1.2.2-ffmpeg_audio_decoder-support-new-av_decode_audio4.patch"
+prepare() {
+ cp accel_vaapi.h ${pkgname}-${pkgver}/src/xine-engine/
+}
+build() {
+ cd ${pkgname}-${pkgver}
./configure --prefix=/usr --with-wavpack --enable-vdpau --disable-optimizations
make
}
package() {
- cd "${srcdir}/${pkgname}-${pkgver}"
+ cd ${pkgname}-${pkgver}
make DESTDIR="${pkgdir}" install
}
diff --git a/extra/xine-lib/accel_vaapi.h b/extra/xine-lib/accel_vaapi.h
new file mode 100644
index 000000000..666b23fd6
--- /dev/null
+++ b/extra/xine-lib/accel_vaapi.h
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2008 the xine project
+ *
+ * This file is part of xine, a free video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ * Common acceleration definitions for vdpau
+ *
+ *
+ */
+
+#ifndef HAVE_XINE_ACCEL_VAAPI_H
+#define HAVE_XINE_ACCEL_VAAPI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <va/va_x11.h>
+#include <pthread.h>
+#ifdef HAVE_FFMPEG_AVUTIL_H
+# include <avcodec.h>
+#else
+# include <libavcodec/avcodec.h>
+#endif
+
+#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
+
+#define NUM_OUTPUT_SURFACES 22
+
+#define SURFACE_FREE 0
+#define SURFACE_ALOC 1
+#define SURFACE_RELEASE 2
+#define SURFACE_RENDER 3
+#define SURFACE_RENDER_RELEASE 5
+
+struct vaapi_equalizer {
+ VADisplayAttribute brightness;
+ VADisplayAttribute contrast;
+ VADisplayAttribute hue;
+ VADisplayAttribute saturation;
+};
+
+typedef struct ff_vaapi_context_s ff_vaapi_context_t;
+
+struct ff_vaapi_context_s {
+ VADisplay va_display;
+ VAContextID va_context_id;
+ VAConfigID va_config_id;
+ int width;
+ int height;
+ int sw_width;
+ int sw_height;
+ int va_profile;
+ unsigned int va_colorspace;
+ VAImage va_subpic_image;
+ VASubpictureID va_subpic_id;
+ int va_subpic_width;
+ int va_subpic_height;
+ int is_bound;
+ void *gl_surface;
+ unsigned int soft_head;
+ unsigned int valid_context;
+ unsigned int va_head;
+ unsigned int va_soft_head;
+ vo_driver_t *driver;
+ unsigned int last_sub_image_fmt;
+ VASurfaceID last_sub_surface_id;
+ struct vaapi_equalizer va_equalizer;
+ VAImageFormat *va_image_formats;
+ int va_num_image_formats;
+ VAImageFormat *va_subpic_formats;
+ int va_num_subpic_formats;
+};
+
+typedef struct ff_vaapi_surface_s ff_vaapi_surface_t;
+typedef struct vaapi_accel_s vaapi_accel_t;
+
+struct ff_vaapi_surface_s {
+ unsigned int index;
+ vaapi_accel_t *accel;
+ VASurfaceID va_surface_id;
+ unsigned int status;
+};
+
+struct vaapi_accel_s {
+ unsigned int index;
+ vo_frame_t *vo_frame;
+
+#if AVVIDEO > 1
+ int (*avcodec_decode_video2)(vo_frame_t *frame_gen, AVCodecContext *avctx, AVFrame *picture,
+ int *got_picture_ptr, AVPacket *avpkt);
+#else
+ int (*avcodec_decode_video)(vo_frame_t *frame_gen, AVCodecContext *avctx, AVFrame *picture,
+ int *got_picture_ptr, uint8_t *buf, int buf_size);
+#endif
+ VAStatus (*vaapi_init)(vo_frame_t *frame_gen, int va_profile, int width, int height, int softrender);
+ int (*profile_from_imgfmt)(vo_frame_t *frame_gen, enum PixelFormat pix_fmt, int codec_id, int vaapi_mpeg_sofdec);
+ ff_vaapi_context_t *(*get_context)(vo_frame_t *frame_gen);
+ int (*guarded_render)(vo_frame_t *frame_gen);
+ ff_vaapi_surface_t *(*get_vaapi_surface)(vo_frame_t *frame_gen);
+ void (*render_vaapi_surface)(vo_frame_t *frame_gen, ff_vaapi_surface_t *va_surface);
+ void (*release_vaapi_surface)(vo_frame_t *frame_gen, ff_vaapi_surface_t *va_surface);
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/extra/xine-lib/xine-lib-1.2.2-ffmpeg_audio_decoder-support-new-av_decode_audio4.patch b/extra/xine-lib/xine-lib-1.2.2-ffmpeg_audio_decoder-support-new-av_decode_audio4.patch
deleted file mode 100644
index 255f56d0d..000000000
--- a/extra/xine-lib/xine-lib-1.2.2-ffmpeg_audio_decoder-support-new-av_decode_audio4.patch
+++ /dev/null
@@ -1,277 +0,0 @@
-From 679582503c8ba2f91a82e44c4a2938550306fd07 Mon Sep 17 00:00:00 2001
-From: Torsten Jager <t.jager@gmx.de>
-Date: Thu, 21 Feb 2013 22:35:00 +0200
-Subject: [PATCH 3/5] ffmpeg_audio_decoder: support new av_decode_audio4 ()
-
----
- src/combined/ffmpeg/ff_audio_decoder.c | 153 +++++++++++++++++++++++++++------
- src/combined/ffmpeg/ffmpeg_compat.h | 4 +-
- 2 files changed, 131 insertions(+), 26 deletions(-)
-
-diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c
-index 4e64378..34a7a9e 100644
---- a/src/combined/ffmpeg/ff_audio_decoder.c
-+++ b/src/combined/ffmpeg/ff_audio_decoder.c
-@@ -71,7 +71,9 @@ typedef struct ff_audio_decoder_s {
- int decoder_ok;
-
- AVCodecParserContext *parser_context;
--
-+#if AVAUDIO > 3
-+ AVFrame *av_frame;
-+#endif
- } ff_audio_decoder_t;
-
-
-@@ -150,6 +152,9 @@ static void ff_audio_init_codec(ff_audio_decoder_t *this, unsigned int codec_typ
- return;
- }
-
-+ /* Try to make the following true */
-+ this->context->request_sample_fmt = AV_SAMPLE_FMT_S16;
-+
- /* Current ffmpeg audio decoders usually use 16 bits/sample
- * buf->decoder_info[2] can't be used as it doesn't refer to the output
- * bits/sample for some codecs (e.g. MS ADPCM) */
-@@ -358,25 +363,19 @@ static void ff_audio_output_close(ff_audio_decoder_t *this)
- this->audio_channels = 0;
- }
-
--static int ff_audio_decode(xine_t *xine,
-- AVCodecContext *ctx,
-- AVCodecParserContext *parser_ctx,
-- int16_t *decode_buffer, int *decode_buffer_size,
-- uint8_t *buf, int size)
--{
-+static int ff_audio_decode (ff_audio_decoder_t *this,
-+ int16_t *decode_buffer, int *decode_buffer_size, uint8_t *buf, int size) {
- int consumed;
- int parser_consumed = 0;
-
- #if AVPARSE > 1
-- if (parser_ctx) {
-+ if (this->parser_context) {
- uint8_t *outbuf;
- int outsize;
-
- do {
-- int ret = av_parser_parse2(parser_ctx, ctx,
-- &outbuf, &outsize,
-- buf, size,
-- 0, 0, 0);
-+ int ret = av_parser_parse2 (this->parser_context, this->context,
-+ &outbuf, &outsize, buf, size, 0, 0, 0);
- parser_consumed += ret;
- buf += ret;
- size -= ret;
-@@ -385,7 +384,7 @@ static int ff_audio_decode(xine_t *xine,
- /* nothing to decode ? */
- if (outsize <= 0) {
- *decode_buffer_size = 0;
-- xprintf (xine, XINE_VERBOSITY_DEBUG,
-+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "ffmpeg_audio_dec: not enough data to decode\n");
- return parser_consumed;
- }
-@@ -402,21 +401,115 @@ static int ff_audio_decode(xine_t *xine,
- avpkt.data = buf;
- avpkt.size = size;
- avpkt.flags = AV_PKT_FLAG_KEY;
-- consumed = avcodec_decode_audio3 (ctx,
-- decode_buffer, decode_buffer_size,
-- &avpkt);
-+# if AVAUDIO > 3
-+ int got_frame;
-+ if (!this->av_frame)
-+ this->av_frame = avcodec_alloc_frame ();
-+
-+ consumed = avcodec_decode_audio4 (this->context, this->av_frame, &got_frame, &avpkt);
-+ if ((consumed >= 0) && got_frame) {
-+ int16_t *q = decode_buffer;
-+ int samples = this->av_frame->nb_samples;
-+ int channels = this->context->channels;
-+ int bytes, i, j;
-+ /* limit buffer */
-+ if (channels > 12)
-+ channels = 12;
-+ if (*decode_buffer_size < samples * channels * 2)
-+ samples = *decode_buffer_size / (channels * 2);
-+ bytes = samples * channels * 2;
-+ *decode_buffer_size = bytes;
-+ /* convert to packed int16_t. I guess there is something
-+ in libavfilter but also another dependency... */
-+ switch (this->context->sample_fmt) {
-+ case AV_SAMPLE_FMT_U8P:
-+ if (channels > 1) {
-+ uint8_t *p[12];
-+ for (i = 0; i < channels; i++)
-+ p[i] = (uint8_t *)this->av_frame->extended_data[i];
-+ for (i = samples; i; i--) {
-+ for (j = 0; j < channels; j++)
-+ *q++ = ((uint16_t)(*p[j]++) << 8) ^ 0x8000;
-+ }
-+ break;
-+ }
-+ case AV_SAMPLE_FMT_U8:
-+ {
-+ uint8_t *p = (uint8_t *)this->av_frame->extended_data[0];
-+ for (i = samples * channels; i; i--)
-+ *q++ = ((uint16_t)(*p++) << 8) ^ 0x8000;
-+ }
-+ break;
-+ case AV_SAMPLE_FMT_S16P:
-+ if (channels > 1) {
-+ int16_t *p[12];
-+ for (i = 0; i < channels; i++)
-+ p[i] = (int16_t *)this->av_frame->extended_data[i];
-+ for (i = samples; i; i--) {
-+ for (j = 0; j < channels; j++)
-+ *q++ = *p[j]++;
-+ }
-+ break;
-+ }
-+ case AV_SAMPLE_FMT_S16:
-+ xine_fast_memcpy (q, this->av_frame->extended_data[0], bytes);
-+ break;
-+ case AV_SAMPLE_FMT_S32P:
-+ if (channels > 1) {
-+ int32_t *p[12];
-+ for (i = 0; i < channels; i++)
-+ p[i] = (int32_t *)this->av_frame->extended_data[i];
-+ for (i = samples; i; i--) {
-+ for (j = 0; j < channels; j++)
-+ *q++ = *p[j]++ >> 16;
-+ }
-+ break;
-+ }
-+ case AV_SAMPLE_FMT_S32:
-+ {
-+ int32_t *p = (int32_t *)this->av_frame->extended_data[0];
-+ for (i = samples * channels; i; i--)
-+ *q++ = *p++ >> 16;
-+ }
-+ break;
-+ case AV_SAMPLE_FMT_FLTP: /* the most popular one */
-+ if (channels > 1) {
-+ float *p[12];
-+ for (i = 0; i < channels; i++)
-+ p[i] = (float *)this->av_frame->extended_data[i];
-+ for (i = samples; i; i--) {
-+ for (j = 0; j < channels; j++) {
-+ int v = *p[j]++ * (float)0x7fff;
-+ *q++ = (v + 0x8000) & ~0xffff ? (v >> 31) ^ 0x7fff : v;
-+ }
-+ }
-+ break;
-+ }
-+ case AV_SAMPLE_FMT_FLT:
-+ {
-+ float *p = (float *)this->av_frame->extended_data[0];
-+ for (i = samples * channels; i; i--) {
-+ int v = *p++ * (float)0x7fff;
-+ *q++ = (v + 0x8000) & ~0xffff ? (v >> 31) ^ 0x7fff : v;
-+ }
-+ }
-+ break;
-+ default: ;
-+ }
-+ } else *decode_buffer_size = 0;
-+# else
-+ consumed = avcodec_decode_audio3 (this->context, decode_buffer, decode_buffer_size, &avpkt);
-+# endif
- #else
-- consumed = avcodec_decode_audio2 (ctx,
-- decode_buffer, decode_buffer_size,
-- buf, size);
-+ consumed = avcodec_decode_audio2 (this->context, decode_buffer, decode_buffer_size, buf, size);
- #endif
-
- if (consumed < 0) {
-- xprintf (xine, XINE_VERBOSITY_DEBUG,
-+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "ffmpeg_audio_dec: error decompressing audio frame (%d)\n", consumed);
- } else if (parser_consumed && consumed != size) {
-
-- xprintf (xine, XINE_VERBOSITY_DEBUG,
-+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "ffmpeg_audio_dec: decoder didn't consume all data\n");
- }
-
-@@ -469,8 +562,7 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
- decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
-
- bytes_consumed =
-- ff_audio_decode(this->stream->xine, this->context,
-- this->parser_context,
-+ ff_audio_decode(this,
- (int16_t *)this->decode_buffer, &decode_buffer_size,
- &this->buf[offset], this->size);
-
-@@ -539,6 +631,7 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
- }
-
- /* fill up this buffer */
-+#if AVAUDIO < 4
- if (codec_type == BUF_AUDIO_WMAPRO) {
- /* the above codecs output float samples, not 16-bit integers */
- int bytes_per_sample = sizeof(float);
-@@ -558,7 +651,9 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
- bytes_to_send = bytes_to_send * 2 / bytes_per_sample;
- xine_fast_memcpy(audio_buffer->mem, int_buffer, bytes_to_send);
- free(int_buffer);
-- } else {
-+ } else
-+#endif
-+ {
- if ((decode_buffer_size - out) > audio_buffer->mem_size)
- bytes_to_send = audio_buffer->mem_size;
- else
-@@ -595,6 +690,9 @@ static void ff_audio_reset (audio_decoder_t *this_gen) {
-
- /* try to reset the wma decoder */
- if( this->decoder_ok ) {
-+#if AVAUDIO > 3
-+ avcodec_free_frame (&this->av_frame);
-+#endif
- pthread_mutex_lock (&ffmpeg_lock);
- avcodec_close (this->context);
- if (avcodec_open (this->context, this->codec) < 0)
-@@ -626,6 +724,9 @@ static void ff_audio_dispose (audio_decoder_t *this_gen) {
- }
-
- if( this->context && this->decoder_ok ) {
-+#if AVAUDIO > 3
-+ avcodec_free_frame (&this->av_frame);
-+#endif
- pthread_mutex_lock (&ffmpeg_lock);
- avcodec_close (this->context);
- pthread_mutex_unlock (&ffmpeg_lock);
-@@ -668,7 +769,9 @@ static audio_decoder_t *ff_audio_open_plugin (audio_decoder_class_t *class_gen,
-
- this->context = avcodec_alloc_context();
- this->decode_buffer = malloc16 (AVCODEC_MAX_AUDIO_FRAME_SIZE);
--
-+#if AVAUDIO > 3
-+ this->av_frame = NULL;
-+#endif
- return &this->audio_decoder;
- }
-
-diff --git a/src/combined/ffmpeg/ffmpeg_compat.h b/src/combined/ffmpeg/ffmpeg_compat.h
-index 0acead8..b567dc1 100644
---- a/src/combined/ffmpeg/ffmpeg_compat.h
-+++ b/src/combined/ffmpeg/ffmpeg_compat.h
-@@ -94,7 +94,9 @@
- #endif
-
- /* avcodec_decode_audio() */
--#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32)
-+#if LIBAVCODEC_VERSION_MAJOR >= 54
-+# define AVAUDIO 4
-+#elif LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32)
- # define AVAUDIO 3
- #else
- # define AVAUDIO 2
---
-1.8.1.5
-