extra/xine-lib to 1.2.3-1

This commit is contained in:
Kevin Mihelich 2013-05-30 06:00:52 +00:00
parent 624e1b1d4a
commit 011dec038b
4 changed files with 148 additions and 343 deletions

View file

@ -1,20 +1,19 @@
# $Id: PKGBUILD 147743 2012-01-27 19:57:13Z eric $
# $Id$
# Maintainer: Eric Bélanger <eric@archlinux.org>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - disabled vdpau
# - patch to section off x86 code
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"
license=('LGPL' 'GPL')
depends=('libxvmc' 'ffmpeg' 'libxinerama')
makedepends=('wavpack' 'faad2' 'libmng' 'imagemagick' 'mesa' 'libmodplug'
'vcdimager' 'jack' 'aalib' 'libdca' 'a52dec' 'libmad'
'vcdimager' 'jack' 'aalib' 'libdca' 'a52dec' 'libmad'
'libmpcdec' 'libcaca' 'libbluray' 'gnome-vfs' 'glu')
optdepends=('imagemagick: for using the imagemagick plugin' \
'jack: for using the jack plugin' \
@ -33,27 +32,21 @@ optdepends=('imagemagick: for using the imagemagick plugin' \
'libbluray: for using the bluray plugin' \
'gnome-vfs: for using the gnome-vfs 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
alarm.patch)
sha1sums=('a349cbb0b72256bb262377796a022dcf63829b4c'
'45500eca2aa40c133e1a6e8b23dbadc4b921b11f'
'b0ffa9e139b63c178f4157ae4f442126b4e3664d')
source=(http://downloads.sourceforge.net/sourceforge/xine/${pkgname}-${pkgver}.tar.xz accel_vaapi.h)
sha1sums=('6f9ef4ba75688659052d21448d46527db2b77e57'
'08ed9947ef919c71c87151baa8fc0ce7d8f72050')
prepare() {
cp accel_vaapi.h ${pkgname}-${pkgver}/src/xine-engine/
}
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
patch -p1 -i "${srcdir}/alarm.patch"
# 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"
cd ${pkgname}-${pkgver}
./configure --prefix=/usr --with-wavpack --disable-vdpau --disable-optimizations
make
}
package() {
cd "${srcdir}/${pkgname}-${pkgver}"
cd ${pkgname}-${pkgver}
make DESTDIR="${pkgdir}" install
}

View file

@ -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

View file

@ -1,46 +0,0 @@
# HG changeset patch
# User Petri Hintukainen <phintuka@...>
# Date 1339310702 -10800
# Node ID b0df4b6003ad2b7454059c2d82ef7f8f29e48e9e
# Branch default
# Parent 52a99e60c2c9aa7e03be894b4396f229f881025c
Fix building on non-x86 systems
diff --git a/src/post/deinterlace/plugins/greedy2frame_template.c b/src/post/deinterlace/plugins/greedy2frame_template.c
--- a/src/post/deinterlace/plugins/greedy2frame_template.c
+++ b/src/post/deinterlace/plugins/greedy2frame_template.c
@@ -85,6 +85,7 @@
*/
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
#if !defined(MASKS_DEFINED)
#define MASKS_DEFINED
static const mmx_t Mask = { uq: 0x7f7f7f7f7f7f7f7fll };
@@ -92,6 +93,7 @@
static const mmx_t GreedyTwoFrameThreshold = { ub: {TP, TP, TP, TP} };
#undef TP
#endif
+#endif
#if defined(IS_MMXEXT)
static void DeinterlaceGreedy2Frame_MMXEXT(uint8_t *output, int outstride,
--git a/src/post/deinterlace/plugins/greedy2frame_template_sse2.c b/src/post/deinterlace/plugins/greedy2frame_template_sse2.c
--- a/src/post/deinterlace/plugins/greedy2frame_template_sse2.c
+++ b/src/post/deinterlace/plugins/greedy2frame_template_sse2.c
@@ -84,11 +84,12 @@
** B0 | | B1 | |
*/
-
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
static const sse_t Mask128 = { uq: { 0x7f7f7f7f7f7f7f7fll, 0x7f7f7f7f7f7f7f7fll} };
#define TP GREEDYTWOFRAMETHRESHOLD, GREEDYTWOFRAMETHRESHOLD2
static const sse_t GreedyTwoFrameThreshold128 = { ub: {TP, TP, TP, TP, TP, TP, TP, TP} };
#undef TP
+#endif
static void DeinterlaceGreedy2Frame_SSE2(uint8_t *output, int outstride,
deinterlace_frame_data_t *data,

View file

@ -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