mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 05:36:47 +00:00
ffmpeg: move to packages/multimedia/, complete rework to match xbmc's internal setup, add patches from xbmc, add xvba support
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
8d881d1373
commit
34975f1b00
231
packages/multimedia/ffmpeg/build
Executable file
231
packages/multimedia/ffmpeg/build
Executable file
@ -0,0 +1,231 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# This Program 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, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program 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 OpenELEC.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
. config/options $1
|
||||
|
||||
if [ "$DEBUG" = yes ]; then
|
||||
FFMPEG_DEBUG="--enable-debug --disable-stripping"
|
||||
else
|
||||
FFMPEG_DEBUG="--disable-debug --enable-stripping"
|
||||
fi
|
||||
|
||||
if [ "$OPTIMIZATIONS" = size ]; then
|
||||
FFMPEG_OPTIM="--enable-small"
|
||||
else
|
||||
FFMPEG_OPTIM="--disable-small"
|
||||
fi
|
||||
|
||||
if [ "$CRYSTALHD" = yes ]; then
|
||||
# disabled, we use XBMC's internal solution
|
||||
FFMPEG_CRYSTALHD="--disable-crystalhd"
|
||||
else
|
||||
FFMPEG_CRYSTALHD="--disable-crystalhd"
|
||||
fi
|
||||
|
||||
if [ "$VAAPI" = yes ]; then
|
||||
FFMPEG_VAAPI="--enable-vaapi"
|
||||
else
|
||||
FFMPEG_VAAPI="--disable-vaapi"
|
||||
fi
|
||||
|
||||
if [ "$VDPAU" = yes ]; then
|
||||
FFMPEG_VDPAU="--enable-vdpau"
|
||||
else
|
||||
FFMPEG_VDPAU="--disable-vdpau"
|
||||
fi
|
||||
|
||||
if [ "$XVBA" = yes ]; then
|
||||
FFMPEG_XVBA="--enable-xvba"
|
||||
else
|
||||
FFMPEG_XVBA="--disable-xvba"
|
||||
fi
|
||||
|
||||
if [ "$TARGET_ARCH" = "arm" ]; then
|
||||
FFMPEG_SUPPORT_ARM="--enable-armv5te --disable-armv6t2 --enable-armv6"
|
||||
else
|
||||
FFMPEG_SUPPORT_ARM="--disable-armv5te --disable-armv6t2 --disable-armv6"
|
||||
fi
|
||||
|
||||
case "$TARGET_ARCH" in
|
||||
arm)
|
||||
FFMPEG_CPU="--enable-armv5te --disable-armv6t2 --enable-armv6"
|
||||
FFMPEG_TABLES="--disable-hardcoded-tables"
|
||||
FFMPEG_PIC="--enable-pic"
|
||||
;;
|
||||
i?86)
|
||||
FFMPEG_CPU="--disable-armv5te --disable-armv6t2 --disable-armv6"
|
||||
FFMPEG_TABLES="--disable-hardcoded-tables"
|
||||
FFMPEG_PIC="--disable-pic"
|
||||
;;
|
||||
x86_64)
|
||||
FFMPEG_CPU="--disable-armv5te --disable-armv6t2 --disable-armv6"
|
||||
FFMPEG_TABLES="--disable-hardcoded-tables"
|
||||
FFMPEG_PIC="--enable-pic"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$TARGET_FPU" in
|
||||
neon*)
|
||||
FFMPEG_FPU="--enable-neon --disable-armvfp"
|
||||
;;
|
||||
vfp*)
|
||||
FFMPEG_FPU="--enable-armvfp --disable-neon"
|
||||
;;
|
||||
*)
|
||||
FFMPEG_FPU="--disable-neon --disable-armvfp"
|
||||
;;
|
||||
esac
|
||||
|
||||
export pkg_config="$ROOT/$TOOLCHAIN/bin/pkg-config"
|
||||
|
||||
# libav fails building with LTO support
|
||||
strip_lto
|
||||
|
||||
#LDFLAGS="$(echo "$LDFLAGS" | sed "s/-Wl,-Bsymbolic-functions//g")"
|
||||
|
||||
cd $PKG_BUILD/
|
||||
./configure --prefix=/usr \
|
||||
--cpu=$TARGET_CPU \
|
||||
--arch=$TARGET_ARCH \
|
||||
--enable-cross-compile \
|
||||
--cross-prefix=$TARGET_PREFIX \
|
||||
--sysroot=$SYSROOT_PREFIX \
|
||||
--sysinclude="$SYSROOT_PREFIX/usr/include" \
|
||||
--target-os="linux" \
|
||||
--nm="$NM" \
|
||||
--ar="$AR" \
|
||||
--as="$CC" \
|
||||
--cc="$CC" \
|
||||
--ld="$CC" \
|
||||
--host-cc="$HOST_CC" \
|
||||
--host-cflags="$HOST_CFLAGS" \
|
||||
--host-ldflags="$HOST_LDFLAGS" \
|
||||
--host-libs="" \
|
||||
--extra-cflags="$CFLAGS" \
|
||||
--extra-ldflags="$LDFLAGS" \
|
||||
--extra-libs="" \
|
||||
--extra-version="" \
|
||||
--build-suffix="" \
|
||||
--disable-static \
|
||||
--enable-shared \
|
||||
--enable-gpl \
|
||||
--disable-version3 \
|
||||
--disable-nonfree \
|
||||
--enable-logging \
|
||||
--disable-doc \
|
||||
$FFMPEG_DEBUG \
|
||||
$FFMPEG_PIC \
|
||||
--enable-optimizations \
|
||||
--disable-extra-warnings \
|
||||
--disable-ffprobe \
|
||||
--disable-ffplay \
|
||||
--disable-ffserver \
|
||||
--enable-ffmpeg \
|
||||
--enable-avdevice \
|
||||
--enable-avcodec \
|
||||
--enable-avformat \
|
||||
--enable-swscale \
|
||||
--enable-postproc \
|
||||
--enable-avfilter \
|
||||
--disable-devices \
|
||||
--enable-pthreads \
|
||||
--disable-w32threads \
|
||||
--disable-x11grab \
|
||||
--enable-network \
|
||||
--disable-gray \
|
||||
--enable-swscale-alpha \
|
||||
--enable-fastdiv \
|
||||
$FFMPEG_OPTIM \
|
||||
--enable-aandct \
|
||||
--enable-dct \
|
||||
--enable-fft \
|
||||
--enable-golomb \
|
||||
--enable-huffman \
|
||||
--enable-lpc \
|
||||
--enable-mdct \
|
||||
--enable-rdft \
|
||||
$FFMPEG_CRYSTALHD \
|
||||
$FFMPEG_VAAPI \
|
||||
$FFMPEG_VDPAU \
|
||||
$FFMPEG_XVBA \
|
||||
--disable-dxva2 \
|
||||
--enable-runtime-cpudetect \
|
||||
$FFMPEG_TABLES \
|
||||
--disable-memalign-hack \
|
||||
--disable-encoders \
|
||||
--enable-encoder=ac3 \
|
||||
--enable-encoder=aac \
|
||||
--disable-decoder=mpeg_xvmc \
|
||||
--enable-hwaccels \
|
||||
--disable-muxers \
|
||||
--enable-muxer=spdif \
|
||||
--enable-muxer=adts \
|
||||
--enable-demuxers \
|
||||
--enable-parsers \
|
||||
--enable-bsfs \
|
||||
--enable-protocol=http \
|
||||
--disable-indevs \
|
||||
--disable-outdevs \
|
||||
--enable-filters \
|
||||
--disable-avisynth \
|
||||
--enable-bzlib \
|
||||
--disable-frei0r \
|
||||
--disable-libopencore-amrnb \
|
||||
--disable-libopencore-amrwb \
|
||||
--disable-libopencv \
|
||||
--disable-libdc1394 \
|
||||
--disable-libdirac \
|
||||
--disable-libfaac \
|
||||
--disable-libfreetype \
|
||||
--disable-libgsm \
|
||||
--disable-libmp3lame \
|
||||
--disable-libnut \
|
||||
--disable-libopenjpeg \
|
||||
--disable-librtmp \
|
||||
--disable-libschroedinger \
|
||||
--disable-libspeex \
|
||||
--disable-libtheora \
|
||||
--disable-libvo-aacenc \
|
||||
--disable-libvo-amrwbenc \
|
||||
--enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis \
|
||||
--disable-libvpx \
|
||||
--disable-libx264 \
|
||||
--disable-libxavs \
|
||||
--disable-libxvid \
|
||||
--disable-mlib \
|
||||
--enable-zlib \
|
||||
--enable-asm \
|
||||
--disable-altivec \
|
||||
$FFMPEG_SUPPORT_ARM \
|
||||
$FFMPEG_FPU \
|
||||
--disable-iwmmxt \
|
||||
--disable-mmi \
|
||||
--disable-vis \
|
||||
--enable-yasm \
|
||||
--disable-sram \
|
||||
--disable-symver \
|
||||
|
||||
#sed -i -e "s#define HAVE_SYMVER 1#define HAVE_SYMVER 0#" config.h &&
|
||||
#sed -i -e "s#define HAVE_SYMVER_GNU_ASM 1#define HAVE_SYMVER_GNU_ASM 0#" config.h
|
||||
|
||||
make
|
||||
$MAKEINSTALL
|
33
packages/multimedia/ffmpeg/install
Executable file
33
packages/multimedia/ffmpeg/install
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# This Program 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, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program 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 OpenELEC.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
. config/options $1
|
||||
|
||||
mkdir -p $INSTALL/usr/bin
|
||||
cp $PKG_BUILD/ffmpeg $INSTALL/usr/bin
|
||||
|
||||
mkdir -p $INSTALL/usr/lib
|
||||
cp -P $PKG_BUILD/*/*.so* $INSTALL/usr/lib
|
||||
|
||||
mkdir -p $INSTALL/usr/share/ffmpeg
|
||||
cp $PKG_BUILD/presets/*.ffpreset $INSTALL/usr/share/ffmpeg
|
||||
cp $PKG_BUILD/doc/ffprobe.xsd $INSTALL/usr/share/ffmpeg
|
36
packages/multimedia/ffmpeg/meta
Normal file
36
packages/multimedia/ffmpeg/meta
Normal file
@ -0,0 +1,36 @@
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# This Program 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, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program 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 OpenELEC.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
PKG_NAME="ffmpeg"
|
||||
PKG_VERSION="0.10.3"
|
||||
PKG_REV="1"
|
||||
PKG_ARCH="any"
|
||||
PKG_LICENSE="LGPL"
|
||||
PKG_SITE="http://ffmpeg.org"
|
||||
PKG_URL="http://ffmpeg.org/releases/$PKG_NAME-$PKG_VERSION.tar.bz2"
|
||||
PKG_DEPENDS="zlib bzip2 libvorbis"
|
||||
PKG_BUILD_DEPENDS="toolchain zlib bzip2 libvorbis"
|
||||
PKG_PRIORITY="optional"
|
||||
PKG_SECTION="multimedia"
|
||||
PKG_SHORTDESC="FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video."
|
||||
PKG_LONGDESC="FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video."
|
||||
|
||||
PKG_IS_ADDON="no"
|
||||
PKG_AUTORECONF="no"
|
@ -0,0 +1,56 @@
|
||||
From 5d361593f1149c2c0874d76a27c5cc68a219088c Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Sun, 11 Sep 2011 19:04:51 +0200
|
||||
Subject: [PATCH 01/24] Support raw dvdsub palette as stored on normal dvd's
|
||||
|
||||
This is how the palette is stored on dvd's. Currently
|
||||
only xbmc passes the palette information to libavcodec
|
||||
this way.
|
||||
---
|
||||
libavcodec/dvdsubdec.c | 23 +++++++++++++++++++++++
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
|
||||
index f4b5439..d0d13ee 100644
|
||||
--- a/libavcodec/dvdsubdec.c
|
||||
+++ b/libavcodec/dvdsubdec.c
|
||||
@@ -50,6 +50,24 @@ static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t *
|
||||
}
|
||||
}
|
||||
|
||||
+static void ayvu_to_argb(const uint8_t *ayvu, uint32_t *argb, int num_values)
|
||||
+{
|
||||
+ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
|
||||
+ uint8_t r, g, b;
|
||||
+ int i, y, cb, cr, a;
|
||||
+ int r_add, g_add, b_add;
|
||||
+
|
||||
+ for (i = num_values; i > 0; i--) {
|
||||
+ a = *ayvu++;
|
||||
+ y = *ayvu++;
|
||||
+ cr = *ayvu++;
|
||||
+ cb = *ayvu++;
|
||||
+ YUV_TO_RGB1_CCIR(cb, cr);
|
||||
+ YUV_TO_RGB2_CCIR(r, g, b, y);
|
||||
+ *argb++ = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int decode_run_2bit(GetBitContext *gb, int *color)
|
||||
{
|
||||
unsigned int v, t;
|
||||
@@ -547,6 +565,11 @@ static int dvdsub_init(AVCodecContext *avctx)
|
||||
data += strspn(data, "\n\r");
|
||||
}
|
||||
|
||||
+ if (!ctx->has_palette && avctx->extradata_size == 64) {
|
||||
+ ayvu_to_argb((uint8_t*)avctx->extradata, ctx->palette, 16);
|
||||
+ ctx->has_palette = 1;
|
||||
+ }
|
||||
+
|
||||
if (ctx->has_palette) {
|
||||
int i;
|
||||
av_log(avctx, AV_LOG_DEBUG, "palette:");
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,145 @@
|
||||
From 8b480b7321130ad691cf46314164787301691161 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Mon, 12 Sep 2011 23:53:29 +0200
|
||||
Subject: [PATCH 02/24] Change fallthrough logic for read_seek to be based on
|
||||
return value
|
||||
|
||||
This changes the logic for read_seek to only use generic seek
|
||||
rutines if the return value is AVERROR(ENOSYS) to avoid retrying
|
||||
seeks if the demuxer already realized it wasn't possible.
|
||||
---
|
||||
libavformat/asfdec.c | 2 +-
|
||||
libavformat/gxf.c | 4 ++--
|
||||
libavformat/jvdec.c | 2 +-
|
||||
libavformat/matroskadec.c | 2 +-
|
||||
libavformat/oggdec.c | 4 +++-
|
||||
libavformat/pmpdec.c | 2 +-
|
||||
libavformat/r3d.c | 2 +-
|
||||
libavformat/utils.c | 4 +++-
|
||||
8 files changed, 13 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
|
||||
index 0deafc6..a62bab3 100644
|
||||
--- a/libavformat/asfdec.c
|
||||
+++ b/libavformat/asfdec.c
|
||||
@@ -1278,7 +1278,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
|
||||
AVStream *st = s->streams[stream_index];
|
||||
|
||||
if (s->packet_size <= 0)
|
||||
- return -1;
|
||||
+ return AVERROR(ENOSYS);
|
||||
|
||||
/* Try using the protocol's read_seek if available */
|
||||
if(s->pb) {
|
||||
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
|
||||
index e773ba7..a3298a7 100644
|
||||
--- a/libavformat/gxf.c
|
||||
+++ b/libavformat/gxf.c
|
||||
@@ -542,7 +542,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int
|
||||
idx = av_index_search_timestamp(st, timestamp - start_time,
|
||||
AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD);
|
||||
if (idx < 0)
|
||||
- return -1;
|
||||
+ return AVERROR(ENOSYS);
|
||||
pos = st->index_entries[idx].pos;
|
||||
if (idx < st->nb_index_entries - 2)
|
||||
maxlen = st->index_entries[idx + 2].pos - pos;
|
||||
@@ -552,7 +552,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int
|
||||
return res;
|
||||
found = gxf_resync_media(s, maxlen, -1, timestamp);
|
||||
if (FFABS(found - timestamp) > 4)
|
||||
- return -1;
|
||||
+ return AVERROR(ENOSYS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
|
||||
index 212cd8a..d52060b 100644
|
||||
--- a/libavformat/jvdec.c
|
||||
+++ b/libavformat/jvdec.c
|
||||
@@ -207,7 +207,7 @@ static int read_seek(AVFormatContext *s, int stream_index,
|
||||
}
|
||||
|
||||
if (i < 0 || i >= ast->nb_index_entries)
|
||||
- return 0;
|
||||
+ return -1;
|
||||
if (avio_seek(s->pb, ast->index_entries[i].pos, SEEK_SET) < 0)
|
||||
return -1;
|
||||
|
||||
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
|
||||
index 2787a17..135fddd 100644
|
||||
--- a/libavformat/matroskadec.c
|
||||
+++ b/libavformat/matroskadec.c
|
||||
@@ -2048,7 +2048,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
||||
}
|
||||
|
||||
if (!st->nb_index_entries)
|
||||
- return 0;
|
||||
+ return -1;
|
||||
timestamp = FFMAX(timestamp, st->index_entries[0].timestamp);
|
||||
|
||||
if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
|
||||
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
|
||||
index ceb4091..80669a5 100644
|
||||
--- a/libavformat/oggdec.c
|
||||
+++ b/libavformat/oggdec.c
|
||||
@@ -663,8 +663,10 @@ static int ogg_read_seek(AVFormatContext *s, int stream_index,
|
||||
|
||||
ret = ff_seek_frame_binary(s, stream_index, timestamp, flags);
|
||||
os = ogg->streams + stream_index;
|
||||
- if (ret < 0)
|
||||
+ if (ret < 0) {
|
||||
os->keyframe_seek = 0;
|
||||
+ ret = AVERROR(ENOSYS);
|
||||
+ }
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff --git a/libavformat/pmpdec.c b/libavformat/pmpdec.c
|
||||
index a57b660..9db4e26 100644
|
||||
--- a/libavformat/pmpdec.c
|
||||
+++ b/libavformat/pmpdec.c
|
||||
@@ -157,7 +157,7 @@ static int pmp_seek(AVFormatContext *s, int stream_index, int64_t ts, int flags)
|
||||
PMPContext *pmp = s->priv_data;
|
||||
pmp->cur_stream = 0;
|
||||
// fallback to default seek now
|
||||
- return -1;
|
||||
+ return AVERROR(ENOSYS);
|
||||
}
|
||||
|
||||
static int pmp_close(AVFormatContext *s)
|
||||
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
|
||||
index 874c361..0adad72 100644
|
||||
--- a/libavformat/r3d.c
|
||||
+++ b/libavformat/r3d.c
|
||||
@@ -358,7 +358,7 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i
|
||||
int frame_num;
|
||||
|
||||
if (!st->codec->time_base.num || !st->time_base.den)
|
||||
- return -1;
|
||||
+ return AVERROR(ENOSYS);
|
||||
|
||||
frame_num = sample_time*st->codec->time_base.den/
|
||||
((int64_t)st->codec->time_base.num*st->time_base.den);
|
||||
diff --git a/libavformat/utils.c b/libavformat/utils.c
|
||||
index 9164cd0..242d616 100644
|
||||
--- a/libavformat/utils.c
|
||||
+++ b/libavformat/utils.c
|
||||
@@ -1910,11 +1910,13 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f
|
||||
ff_read_frame_flush(s);
|
||||
ret = s->iformat->read_seek(s, stream_index, timestamp, flags);
|
||||
} else
|
||||
- ret = -1;
|
||||
+ ret = AVERROR(ENOSYS);
|
||||
)
|
||||
if (ret >= 0) {
|
||||
return 0;
|
||||
}
|
||||
+ if (ret != AVERROR(ENOSYS))
|
||||
+ return ret;
|
||||
|
||||
if (s->iformat->read_timestamp && !(s->iformat->flags & AVFMT_NOBINSEARCH)) {
|
||||
ff_read_frame_flush(s);
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,64 @@
|
||||
From a8a72d52860df38f3a126ca544663f9ea379a929 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Sat, 22 Oct 2011 18:33:45 +0200
|
||||
Subject: [PATCH 03/24] [matroska] Check return value of avio_seek and avoid
|
||||
modifying state if it fails
|
||||
|
||||
The code still modifies state if the timestamp is not found. Not
|
||||
sure exactly how to avoid that.
|
||||
---
|
||||
libavformat/matroskadec.c | 19 ++++++++++++-------
|
||||
1 file changed, 12 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
|
||||
index 135fddd..a9a0d1f 100644
|
||||
--- a/libavformat/matroskadec.c
|
||||
+++ b/libavformat/matroskadec.c
|
||||
@@ -2052,7 +2052,8 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
||||
timestamp = FFMAX(timestamp, st->index_entries[0].timestamp);
|
||||
|
||||
if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
|
||||
- avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
|
||||
+ if (avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET) < 0)
|
||||
+ return -1;
|
||||
matroska->current_id = 0;
|
||||
while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
|
||||
matroska_clear_queue(matroska);
|
||||
@@ -2061,16 +2062,11 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
||||
}
|
||||
}
|
||||
|
||||
- matroska_clear_queue(matroska);
|
||||
if (index < 0)
|
||||
return 0;
|
||||
|
||||
index_min = index;
|
||||
for (i=0; i < matroska->tracks.nb_elem; i++) {
|
||||
- tracks[i].audio.pkt_cnt = 0;
|
||||
- tracks[i].audio.sub_packet_cnt = 0;
|
||||
- tracks[i].audio.buf_timecode = AV_NOPTS_VALUE;
|
||||
- tracks[i].end_timecode = 0;
|
||||
if (tracks[i].type == MATROSKA_TRACK_TYPE_SUBTITLE
|
||||
&& !tracks[i].stream->discard != AVDISCARD_ALL) {
|
||||
index_sub = av_index_search_timestamp(tracks[i].stream, st->index_entries[index].timestamp, AVSEEK_FLAG_BACKWARD);
|
||||
@@ -2081,7 +2077,16 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
||||
}
|
||||
}
|
||||
|
||||
- avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET);
|
||||
+ if (avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ matroska_clear_queue(matroska);
|
||||
+ for (i=0; i < matroska->tracks.nb_elem; i++) {
|
||||
+ tracks[i].audio.pkt_cnt = 0;
|
||||
+ tracks[i].audio.sub_packet_cnt = 0;
|
||||
+ tracks[i].audio.buf_timecode = AV_NOPTS_VALUE;
|
||||
+ tracks[i].end_timecode = 0;
|
||||
+ }
|
||||
matroska->current_id = 0;
|
||||
matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);
|
||||
matroska->skip_to_timecode = st->index_entries[index].timestamp;
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,37 @@
|
||||
From 16ed0150800958b4ca544fd380bda92f21393555 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Mon, 12 Sep 2011 21:37:17 +0200
|
||||
Subject: [PATCH 04/24] asf hacks
|
||||
|
||||
---
|
||||
libavformat/asfdec.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
|
||||
index a62bab3..7db3bd8 100644
|
||||
--- a/libavformat/asfdec.c
|
||||
+++ b/libavformat/asfdec.c
|
||||
@@ -1277,9 +1277,20 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
|
||||
ASFContext *asf = s->priv_data;
|
||||
AVStream *st = s->streams[stream_index];
|
||||
|
||||
+ if (pts == 0) {
|
||||
+ // this is a hack since av_gen_search searches the entire file in this case
|
||||
+ av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", s->data_offset);
|
||||
+ if (avio_seek(s->pb, s->data_offset, SEEK_SET) < 0)
|
||||
+ return -1;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (s->packet_size <= 0)
|
||||
return AVERROR(ENOSYS);
|
||||
|
||||
+ if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO)
|
||||
+ return -1;
|
||||
+
|
||||
/* Try using the protocol's read_seek if available */
|
||||
if(s->pb) {
|
||||
int ret = avio_seek_time(s->pb, stream_index, pts, flags);
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,27 @@
|
||||
From 55467e617c4772441e128cfcc3939beafdd8bf8a Mon Sep 17 00:00:00 2001
|
||||
From: Cory Fields <theuni-nospam-@xbmc.org>
|
||||
Date: Mon, 28 Jun 2010 01:55:31 -0400
|
||||
Subject: [PATCH 05/24] if av_read_packet returns AVERROR_IO, we are done.
|
||||
ffmpeg's codecs might or might not handle returning
|
||||
any completed demuxed packets correctly
|
||||
|
||||
---
|
||||
libavformat/utils.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libavformat/utils.c b/libavformat/utils.c
|
||||
index 242d616..ebb8493 100644
|
||||
--- a/libavformat/utils.c
|
||||
+++ b/libavformat/utils.c
|
||||
@@ -1248,6 +1248,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
|
||||
if (ret < 0) {
|
||||
if (ret == AVERROR(EAGAIN))
|
||||
return ret;
|
||||
+ if (ret == AVERROR(EIO))
|
||||
+ return ret;
|
||||
/* return the last frames, if any */
|
||||
for(i = 0; i < s->nb_streams; i++) {
|
||||
st = s->streams[i];
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,42 @@
|
||||
From 406e25be924a32d5df14a977e8b9694a767f6378 Mon Sep 17 00:00:00 2001
|
||||
From: Cory Fields <theuni-nospam-@xbmc.org>
|
||||
Date: Mon, 28 Jun 2010 02:10:50 -0400
|
||||
Subject: [PATCH 06/24] added: Ticket #7187, TV Teletext support for DVB EBU
|
||||
Teletext streams
|
||||
|
||||
---
|
||||
libavcodec/avcodec.h | 4 ++++
|
||||
libavformat/mpegts.c | 2 ++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
|
||||
index 81849c1..0b756d0 100644
|
||||
--- a/libavcodec/avcodec.h
|
||||
+++ b/libavcodec/avcodec.h
|
||||
@@ -425,6 +425,10 @@ enum CodecID {
|
||||
CODEC_ID_SRT,
|
||||
CODEC_ID_MICRODVD = MKBETAG('m','D','V','D'),
|
||||
|
||||
+ /* data codecs */
|
||||
+ CODEC_ID_VBI_DATA= 0x17500,
|
||||
+ CODEC_ID_VBI_TELETEXT,
|
||||
+
|
||||
/* other specific kind of codecs (generally used for attachments) */
|
||||
CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
|
||||
CODEC_ID_TTF = 0x18000,
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index 9998248..e7e061e 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -581,6 +581,8 @@ static const StreamType DESC_types[] = {
|
||||
{ 0x7b, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS },
|
||||
{ 0x56, AVMEDIA_TYPE_SUBTITLE, CODEC_ID_DVB_TELETEXT },
|
||||
{ 0x59, AVMEDIA_TYPE_SUBTITLE, CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */
|
||||
+ { 0x45, AVMEDIA_TYPE_DATA, CODEC_ID_VBI_DATA }, /* VBI Data descriptor */
|
||||
+ { 0x46, AVMEDIA_TYPE_DATA, CODEC_ID_VBI_TELETEXT }, /* VBI Teletext descriptor */
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,41 @@
|
||||
From 3bf21b1049abf8991beac79235adfcca9d705eda Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Sun, 18 Sep 2011 19:16:34 +0200
|
||||
Subject: [PATCH 07/24] Don't accept mpegts PMT that isn't current
|
||||
|
||||
---
|
||||
libavformat/mpegts.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index e7e061e..817fbed 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -437,6 +437,7 @@ typedef struct SectionHeader {
|
||||
uint8_t tid;
|
||||
uint16_t id;
|
||||
uint8_t version;
|
||||
+ uint8_t current;
|
||||
uint8_t sec_num;
|
||||
uint8_t last_sec_num;
|
||||
} SectionHeader;
|
||||
@@ -508,6 +509,7 @@ static int parse_section_header(SectionHeader *h,
|
||||
val = get8(pp, p_end);
|
||||
if (val < 0)
|
||||
return -1;
|
||||
+ h->current = val & 0x1;
|
||||
h->version = (val >> 1) & 0x1f;
|
||||
val = get8(pp, p_end);
|
||||
if (val < 0)
|
||||
@@ -1556,6 +1558,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
||||
return;
|
||||
if (h->tid != PAT_TID)
|
||||
return;
|
||||
+ if (!h->current)
|
||||
+ return;
|
||||
|
||||
ts->stream->ts_id = h->id;
|
||||
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,43 @@
|
||||
From 5fecd135de1486be63e0cef53134c44f8b4becd6 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Sun, 18 Sep 2011 19:17:23 +0200
|
||||
Subject: [PATCH 08/24] Don't reparse PMT unless it's version has changed
|
||||
|
||||
---
|
||||
libavformat/mpegts.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index 817fbed..8bdafc5 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -78,6 +78,7 @@ struct MpegTSFilter {
|
||||
int pid;
|
||||
int es_id;
|
||||
int last_cc; /* last cc code (-1 if first packet) */
|
||||
+ int last_version; /* last version of data on this pid */
|
||||
enum MpegTSFilterType type;
|
||||
union {
|
||||
MpegTSPESFilter pes_filter;
|
||||
@@ -334,6 +335,7 @@ static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts, unsigned int
|
||||
filter->pid = pid;
|
||||
filter->es_id = -1;
|
||||
filter->last_cc = -1;
|
||||
+ filter->last_version = -1;
|
||||
sec = &filter->u.section_filter;
|
||||
sec->section_cb = section_cb;
|
||||
sec->opaque = opaque;
|
||||
@@ -1560,6 +1562,10 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
||||
return;
|
||||
if (!h->current)
|
||||
return;
|
||||
+ if (h->version == filter->last_version)
|
||||
+ return;
|
||||
+ filter->last_version = h->version;
|
||||
+ av_dlog(ts->stream, "version=%d\n", filter->last_version);
|
||||
|
||||
ts->stream->ts_id = h->id;
|
||||
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,63 @@
|
||||
From 13fa8f2299e51192354cfb468dc05452ab9c9e4e Mon Sep 17 00:00:00 2001
|
||||
From: Cory Fields <theuni-nospam-@xbmc.org>
|
||||
Date: Mon, 28 Jun 2010 03:04:26 -0400
|
||||
Subject: [PATCH 09/24] fixed: compile with VDPAU header versions without
|
||||
MPEG4 support.
|
||||
|
||||
See http://repo.or.cz/w/FFMpeg-mirror/mplayer-patches.git/commitdiff/136c16af11076153717d3de31c9d84360644e006
|
||||
---
|
||||
configure | 2 ++
|
||||
libavcodec/vdpau.c | 2 ++
|
||||
libavcodec/vdpau.h | 2 ++
|
||||
3 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 07d473e..6255f57 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -3058,6 +3058,8 @@ check_header sys/select.h
|
||||
check_header termios.h
|
||||
check_header vdpau/vdpau.h
|
||||
check_header vdpau/vdpau_x11.h
|
||||
+check_cpp_condition vdpau/vdpau.h "defined(VDP_DECODER_PROFILE_MPEG4_PART2_SP)" && enable vdpau_mpeg4_support
|
||||
+
|
||||
check_header X11/extensions/XvMClib.h
|
||||
check_header asm/types.h
|
||||
|
||||
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
|
||||
index ce5103a..21b4fc9 100644
|
||||
--- a/libavcodec/vdpau.c
|
||||
+++ b/libavcodec/vdpau.c
|
||||
@@ -316,6 +316,7 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
||||
render->bitstream_buffers_used = 0;
|
||||
}
|
||||
|
||||
+#ifdef VDP_DECODER_PROFILE_MPEG4_PART2_SP
|
||||
void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
||||
int buf_size)
|
||||
{
|
||||
@@ -369,6 +370,7 @@ void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
||||
ff_draw_horiz_band(s, 0, s->avctx->height);
|
||||
render->bitstream_buffers_used = 0;
|
||||
}
|
||||
+#endif
|
||||
|
||||
// Only dummy functions for now
|
||||
static int vdpau_mpeg2_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
|
||||
diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h
|
||||
index f3a5471..3748675 100644
|
||||
--- a/libavcodec/vdpau.h
|
||||
+++ b/libavcodec/vdpau.h
|
||||
@@ -79,7 +79,9 @@ struct vdpau_render_state {
|
||||
VdpPictureInfoH264 h264;
|
||||
VdpPictureInfoMPEG1Or2 mpeg;
|
||||
VdpPictureInfoVC1 vc1;
|
||||
+#ifdef VDP_DECODER_PROFILE_MPEG4_PART2_SP
|
||||
VdpPictureInfoMPEG4Part2 mpeg4;
|
||||
+#endif
|
||||
} info;
|
||||
};
|
||||
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,100 @@
|
||||
From 17c6bca0f47b1a0c3deac3ad948cdd674c135321 Mon Sep 17 00:00:00 2001
|
||||
From: Cory Fields <theuni-nospam-@xbmc.org>
|
||||
Date: Fri, 9 Jul 2010 16:43:31 -0400
|
||||
Subject: [PATCH 10/24] Read PID timestamps as well as PCR timestamps to find
|
||||
location in mpegts stream
|
||||
|
||||
---
|
||||
libavformat/mpegts.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 46 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index 8bdafc5..ba2f163 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -1928,6 +1928,44 @@ static int parse_pcr(int64_t *ppcr_high, int *ppcr_low,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int parse_timestamp(int64_t *ts, const uint8_t *buf)
|
||||
+{
|
||||
+ int afc, flags;
|
||||
+ const uint8_t *p;
|
||||
+
|
||||
+ if(!(buf[1] & 0x40)) /* must be a start packet */
|
||||
+ return -1;
|
||||
+
|
||||
+ afc = (buf[3] >> 4) & 3;
|
||||
+ p = buf + 4;
|
||||
+ if (afc == 0 || afc == 2) /* invalid or only adaption field */
|
||||
+ return -1;
|
||||
+ if (afc == 3)
|
||||
+ p += p[0] + 1;
|
||||
+ if (p >= buf + TS_PACKET_SIZE)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (p[0] != 0x00 || p[1] != 0x00 || p[2] != 0x01) /* packet_start_code_prefix */
|
||||
+ return -1;
|
||||
+
|
||||
+ flags = p[3] | 0x100; /* stream type */
|
||||
+ if (!((flags >= 0x1c0 && flags <= 0x1df) ||
|
||||
+ (flags >= 0x1e0 && flags <= 0x1ef) ||
|
||||
+ (flags == 0x1bd) || (flags == 0x1fd)))
|
||||
+ return -1;
|
||||
+
|
||||
+ flags = p[7];
|
||||
+ if ((flags & 0xc0) == 0x80) {
|
||||
+ *ts = ff_parse_pes_pts(p+9);
|
||||
+ return 0;
|
||||
+ } else if ((flags & 0xc0) == 0xc0) {
|
||||
+ *ts = ff_parse_pes_pts(p+9+5);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int mpegts_read_header(AVFormatContext *s,
|
||||
AVFormatParameters *ap)
|
||||
{
|
||||
@@ -2118,6 +2156,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
|
||||
int64_t pos, timestamp;
|
||||
uint8_t buf[TS_PACKET_SIZE];
|
||||
int pcr_l, pcr_pid = ((PESContext*)s->streams[stream_index]->priv_data)->pcr_pid;
|
||||
+ int pid = ((PESContext*)s->streams[stream_index]->priv_data)->pid;
|
||||
pos = ((*ppos + ts->raw_packet_size - 1 - ts->pos47) / ts->raw_packet_size) * ts->raw_packet_size + ts->pos47;
|
||||
while(pos < pos_limit) {
|
||||
if (avio_seek(s->pb, pos, SEEK_SET) < 0)
|
||||
@@ -2135,6 +2174,11 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
|
||||
*ppos = pos;
|
||||
return timestamp;
|
||||
}
|
||||
+ if ((pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pid) &&
|
||||
+ parse_timestamp(×tamp, buf) == 0) {
|
||||
+ *ppos = pos;
|
||||
+ return timestamp;
|
||||
+ }
|
||||
pos += ts->raw_packet_size;
|
||||
}
|
||||
|
||||
@@ -2322,7 +2366,7 @@ AVInputFormat ff_mpegts_demuxer = {
|
||||
.read_header = mpegts_read_header,
|
||||
.read_packet = mpegts_read_packet,
|
||||
.read_close = mpegts_read_close,
|
||||
- .read_timestamp = mpegts_get_dts,
|
||||
+ .read_timestamp = mpegts_get_pcr,
|
||||
.flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT,
|
||||
#ifdef USE_SYNCPOINT_SEARCH
|
||||
.read_seek2 = read_seek2,
|
||||
@@ -2336,7 +2380,7 @@ AVInputFormat ff_mpegtsraw_demuxer = {
|
||||
.read_header = mpegts_read_header,
|
||||
.read_packet = mpegts_raw_read_packet,
|
||||
.read_close = mpegts_read_close,
|
||||
- .read_timestamp = mpegts_get_dts,
|
||||
+ .read_timestamp = mpegts_get_pcr,
|
||||
.flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT,
|
||||
#ifdef USE_SYNCPOINT_SEARCH
|
||||
.read_seek2 = read_seek2,
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,69 @@
|
||||
From 95926a84fe1369f796c916f72c50dd5b7d50b15a Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Sat, 22 Oct 2011 19:01:38 +0200
|
||||
Subject: [PATCH 11/24] Get stream durations using read_timestamp
|
||||
|
||||
---
|
||||
libavformat/utils.c | 39 +++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 39 insertions(+)
|
||||
|
||||
diff --git a/libavformat/utils.c b/libavformat/utils.c
|
||||
index ebb8493..25fe38e 100644
|
||||
--- a/libavformat/utils.c
|
||||
+++ b/libavformat/utils.c
|
||||
@@ -2082,6 +2082,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
|
||||
#define DURATION_MAX_READ_SIZE 250000
|
||||
#define DURATION_MAX_RETRY 3
|
||||
|
||||
+static void av_estimate_timings_from_pts2(AVFormatContext *ic, int64_t old_offset)
|
||||
+{
|
||||
+ AVStream *st;
|
||||
+ int i, step= 1024;
|
||||
+ int64_t ts, pos;
|
||||
+
|
||||
+ for(i=0;i<ic->nb_streams;i++) {
|
||||
+ st = ic->streams[i];
|
||||
+
|
||||
+ pos = 0;
|
||||
+ ts = ic->iformat->read_timestamp(ic, i, &pos, DURATION_MAX_READ_SIZE);
|
||||
+ if (ts == AV_NOPTS_VALUE)
|
||||
+ continue;
|
||||
+ if (st->start_time > ts || st->start_time == AV_NOPTS_VALUE)
|
||||
+ st->start_time = ts;
|
||||
+
|
||||
+ pos = url_fsize(ic->pb) - 1;
|
||||
+ do {
|
||||
+ pos -= step;
|
||||
+ ts = ic->iformat->read_timestamp(ic, i, &pos, pos + step);
|
||||
+ step += step;
|
||||
+ } while (ts == AV_NOPTS_VALUE && pos >= step && step < DURATION_MAX_READ_SIZE);
|
||||
+
|
||||
+ if (ts == AV_NOPTS_VALUE)
|
||||
+ continue;
|
||||
+
|
||||
+ if (st->duration < ts - st->start_time || st->duration == AV_NOPTS_VALUE)
|
||||
+ st->duration = ts - st->start_time;
|
||||
+ }
|
||||
+
|
||||
+ fill_all_stream_timings(ic);
|
||||
+
|
||||
+ avio_seek(ic->pb, old_offset, SEEK_SET);
|
||||
+}
|
||||
+
|
||||
/* only usable for MPEG-PS streams */
|
||||
static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
|
||||
{
|
||||
@@ -2184,6 +2219,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
|
||||
/* at least one component has timings - we use them for all
|
||||
the components */
|
||||
fill_all_stream_timings(ic);
|
||||
+ } else if (ic->iformat->read_timestamp &&
|
||||
+ file_size && ic->pb->seekable) {
|
||||
+ /* get accurate estimate from the PTSes */
|
||||
+ av_estimate_timings_from_pts2(ic, old_offset);
|
||||
} else {
|
||||
av_log(ic, AV_LOG_WARNING, "Estimating duration from bitrate, this may be inaccurate\n");
|
||||
/* less precise: use bitrate info */
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,24 @@
|
||||
From eaa6256c161f1f6d48b222b171f68869dace8f3f Mon Sep 17 00:00:00 2001
|
||||
From: Cory Fields <theuni-nospam-@xbmc.org>
|
||||
Date: Fri, 9 Jul 2010 16:49:01 -0400
|
||||
Subject: [PATCH 12/24] include stdint.h
|
||||
|
||||
---
|
||||
libavutil/common.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libavutil/common.h b/libavutil/common.h
|
||||
index 84290c6..5b73579 100644
|
||||
--- a/libavutil/common.h
|
||||
+++ b/libavutil/common.h
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
+#include <stdint.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,35 @@
|
||||
From 8728e8bdef30313f1961d2687cfb0ffccf540797 Mon Sep 17 00:00:00 2001
|
||||
From: Anssi Hannula <anssi.hannula@iki.fi>
|
||||
Date: Fri, 21 Jan 2011 20:44:02 +0200
|
||||
Subject: [PATCH 13/24] aacenc: add recognized profiles array
|
||||
|
||||
Submitted upstream.
|
||||
---
|
||||
libavcodec/aacenc.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
|
||||
index 2ff6f9c..4ffaa3d 100644
|
||||
--- a/libavcodec/aacenc.c
|
||||
+++ b/libavcodec/aacenc.c
|
||||
@@ -777,6 +777,11 @@ static const AVClass aacenc_class = {
|
||||
LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
+static const AVProfile profiles[] = {
|
||||
+ { FF_PROFILE_AAC_LOW, "Low" },
|
||||
+ { FF_PROFILE_UNKNOWN },
|
||||
+};
|
||||
+
|
||||
AVCodec ff_aac_encoder = {
|
||||
.name = "aac",
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
@@ -789,4 +794,5 @@ AVCodec ff_aac_encoder = {
|
||||
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
|
||||
.priv_class = &aacenc_class,
|
||||
+ .profiles = profiles,
|
||||
};
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,28 @@
|
||||
From 5cc735503bfe1242606f19638bffeb686dd4d1b5 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Wed, 8 Dec 2010 14:03:43 +0000
|
||||
Subject: [PATCH 14/24] changed: allow 8 second skew between streams in mov
|
||||
before attempting to seek
|
||||
|
||||
---
|
||||
libavformat/mov.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libavformat/mov.c b/libavformat/mov.c
|
||||
index 9da8eab..0f9836c 100644
|
||||
--- a/libavformat/mov.c
|
||||
+++ b/libavformat/mov.c
|
||||
@@ -2763,8 +2763,8 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st)
|
||||
if (!sample || (!s->pb->seekable && current_sample->pos < sample->pos) ||
|
||||
(s->pb->seekable &&
|
||||
((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb &&
|
||||
- ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) ||
|
||||
- (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) {
|
||||
+ ((FFABS(best_dts - dts) <= 8*AV_TIME_BASE && current_sample->pos < sample->pos) ||
|
||||
+ (FFABS(best_dts - dts) > 8*AV_TIME_BASE && dts < best_dts)))))) {
|
||||
sample = current_sample;
|
||||
best_dts = dts;
|
||||
*st = avst;
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,38 @@
|
||||
From b83c9a2505338cdf021dd499c26686e82bcbc066 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Fri, 26 Nov 2010 20:56:48 +0000
|
||||
Subject: [PATCH 15/24] fixed: memleak in mpegts demuxer on some malformed
|
||||
(??) mpegts files with too large pes packets
|
||||
|
||||
at-visions sample file brokenStream.mpg
|
||||
---
|
||||
libavformat/mpegts.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index ba2f163..c374cb9 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -664,6 +664,10 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
|
||||
|
||||
static void new_pes_packet(PESContext *pes, AVPacket *pkt)
|
||||
{
|
||||
+ if(pkt->data) {
|
||||
+ av_log(pes->stream, AV_LOG_ERROR, "ignoring previously allocated packet on stream %d\n", pkt->stream_index);
|
||||
+ av_free_packet(pkt);
|
||||
+ }
|
||||
av_init_packet(pkt);
|
||||
|
||||
pkt->destruct = av_destruct_packet;
|
||||
@@ -2117,6 +2121,8 @@ static int mpegts_read_packet(AVFormatContext *s,
|
||||
int ret, i;
|
||||
|
||||
ts->pkt = pkt;
|
||||
+ ts->pkt->data = NULL;
|
||||
+
|
||||
ret = handle_packets(ts, 0);
|
||||
if (ret < 0) {
|
||||
/* flush pes data left */
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,37 @@
|
||||
From c240357f903f20ba51001fb90aa2de415d5be825 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Mon, 28 Jun 2010 21:26:54 +0000
|
||||
Subject: [PATCH 16/24] Speed up mpegts av_find_stream_info
|
||||
|
||||
---
|
||||
libavformat/mpegts.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index c374cb9..6da6db5 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -825,7 +825,7 @@ static int mpegts_push_data(MpegTSFilter *filter,
|
||||
goto skip;
|
||||
|
||||
/* stream not present in PMT */
|
||||
- if (!pes->st) {
|
||||
+ if (ts->auto_guess && !pes->st) {
|
||||
pes->st = avformat_new_stream(ts->stream, NULL);
|
||||
if (!pes->st)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -2013,7 +2013,10 @@ static int mpegts_read_header(AVFormatContext *s,
|
||||
|
||||
av_dlog(ts->stream, "tuning done\n");
|
||||
|
||||
- s->ctx_flags |= AVFMTCTX_NOHEADER;
|
||||
+ /* only flag NOHEADER if we are in file mode,
|
||||
+ in streaming mode scanning may take too long for users */
|
||||
+ if (!url_is_streamed(pb))
|
||||
+ s->ctx_flags |= AVFMTCTX_NOHEADER;
|
||||
} else {
|
||||
AVStream *st;
|
||||
int pcr_pid, pid, nb_packets, nb_pcrs, ret, pcr_l;
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,43 @@
|
||||
From 954d92f3fc2c5bd45fc1b4d347f2d9295d269574 Mon Sep 17 00:00:00 2001
|
||||
From: Anssi Hannula <anssi.hannula@iki.fi>
|
||||
Date: Wed, 23 Feb 2011 19:24:07 +0200
|
||||
Subject: [PATCH 17/24] allow customizing shared library soname (name with
|
||||
major)
|
||||
|
||||
This is a hack.
|
||||
---
|
||||
configure | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 6255f57..5e11b2d 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -238,6 +238,7 @@ Advanced options (experts only):
|
||||
--arch=ARCH select architecture [$arch]
|
||||
--cpu=CPU select the minimum required CPU (affects
|
||||
instruction selection, may crash on older CPUs)
|
||||
+ --custom-libname-with-major=NAME custom library name with major [$SLIBNAME_WITH_MAJOR]
|
||||
--disable-asm disable all assembler optimizations
|
||||
--disable-altivec disable AltiVec optimizations
|
||||
--disable-amd3dnow disable 3DNow! optimizations
|
||||
@@ -1298,6 +1299,7 @@ CMDLINE_SET="
|
||||
cpu
|
||||
cross_prefix
|
||||
cxx
|
||||
+ custom_libname_with_major
|
||||
dep_cc
|
||||
extra_version
|
||||
host_cc
|
||||
@@ -2778,6 +2780,8 @@ EOF
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
+test -n "$custom_libname_with_major" && SLIBNAME_WITH_MAJOR="$custom_libname_with_major"
|
||||
+
|
||||
die_license_disabled() {
|
||||
enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
|
||||
}
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,75 @@
|
||||
From 40f4c15370f7027dc5422edcb10e8a3b7e58e83d Mon Sep 17 00:00:00 2001
|
||||
From: CrystalP <CrystalP@xbmc.org>
|
||||
Date: Wed, 5 Oct 2011 12:38:30 -0400
|
||||
Subject: [PATCH 18/24] dxva-mpeg2 Allocate slices array dynamically - fixes
|
||||
videos with > 175 slices. They used to result in
|
||||
images with a black bottom.
|
||||
|
||||
sample on team ftp samples/PR471/too_many_slices.ts
|
||||
|
||||
Inspired by the vaapi code to reallocate the slices array for each new slice.
|
||||
Could be more efficient if the array could be preserved for all frames and
|
||||
freed only at the end of the video, but there doesn't seem to be anywhere
|
||||
appropriate to free the memory at the end.
|
||||
|
||||
Alternative is to allocate the proper size straight away for a new frame,
|
||||
instead of realloc'ing for each slice.
|
||||
---
|
||||
libavcodec/dxva2_mpeg2.c | 14 +++++++++++---
|
||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
|
||||
index 951305d..8ba83b6 100644
|
||||
--- a/libavcodec/dxva2_mpeg2.c
|
||||
+++ b/libavcodec/dxva2_mpeg2.c
|
||||
@@ -22,12 +22,12 @@
|
||||
|
||||
#include "dxva2_internal.h"
|
||||
|
||||
-#define MAX_SLICES (SLICE_MAX_START_CODE - SLICE_MIN_START_CODE + 1)
|
||||
struct dxva2_picture_context {
|
||||
DXVA_PictureParameters pp;
|
||||
DXVA_QmatrixData qm;
|
||||
unsigned slice_count;
|
||||
- DXVA_SliceInfo slice[MAX_SLICES];
|
||||
+ DXVA_SliceInfo *slice;
|
||||
+ unsigned int slice_alloc;
|
||||
|
||||
const uint8_t *bitstream;
|
||||
unsigned bitstream_size;
|
||||
@@ -220,6 +220,8 @@ static int start_frame(AVCodecContext *avctx,
|
||||
fill_quantization_matrices(avctx, ctx, s, &ctx_pic->qm);
|
||||
|
||||
ctx_pic->slice_count = 0;
|
||||
+ ctx_pic->slice = NULL;
|
||||
+ ctx_pic->slice_alloc = 0;
|
||||
ctx_pic->bitstream_size = 0;
|
||||
ctx_pic->bitstream = NULL;
|
||||
return 0;
|
||||
@@ -232,9 +234,14 @@ static int decode_slice(AVCodecContext *avctx,
|
||||
struct dxva2_picture_context *ctx_pic =
|
||||
s->current_picture_ptr->f.hwaccel_picture_private;
|
||||
unsigned position;
|
||||
+ DXVA_SliceInfo* slice;
|
||||
|
||||
- if (ctx_pic->slice_count >= MAX_SLICES)
|
||||
+ slice = av_fast_realloc(ctx_pic->slice,
|
||||
+ &ctx_pic->slice_alloc,
|
||||
+ (ctx_pic->slice_count + 1) * sizeof(DXVA_SliceInfo));
|
||||
+ if (!slice)
|
||||
return -1;
|
||||
+ ctx_pic->slice = slice;
|
||||
|
||||
if (!ctx_pic->bitstream)
|
||||
ctx_pic->bitstream = buffer;
|
||||
@@ -258,6 +265,7 @@ static int end_frame(AVCodecContext *avctx)
|
||||
&ctx_pic->pp, sizeof(ctx_pic->pp),
|
||||
&ctx_pic->qm, sizeof(ctx_pic->qm),
|
||||
commit_bitstream_and_slice_buffer);
|
||||
+ av_freep(ctx_pic->slice);
|
||||
}
|
||||
|
||||
AVHWAccel ff_mpeg2_dxva2_hwaccel = {
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,74 @@
|
||||
From 681f74b224e16a4df7f8c4e31a9be56975d57e10 Mon Sep 17 00:00:00 2001
|
||||
From: CrystalP <CrystalP@xbmc.org>
|
||||
Date: Mon, 10 Oct 2011 19:42:50 -0400
|
||||
Subject: [PATCH 19/24] dxva-mpeg2 speed up slice allocation
|
||||
|
||||
The number of slices is not very likely to change from frame to frame, so
|
||||
at the beginning of a new frame, allocate memory for the amount of slices of
|
||||
the previous frame. Saves a lot of reallocation, for some TV capture samples
|
||||
there are over 200 slices.
|
||||
|
||||
There wasn't anywhere really appropriate to store last_slice_count (needs to
|
||||
live from first frame to last frame), so this is likely to cause discussion to
|
||||
merge upstream.
|
||||
Adding members to dxva_context breaks ABI, which we don't care too much about
|
||||
since on Windows we don't support external ffmpeg.
|
||||
dxva mpeg2 code also has access to MpegEncContext, but adding there would
|
||||
likely break ABI as well.
|
||||
---
|
||||
libavcodec/dxva2.h | 1 +
|
||||
libavcodec/dxva2_mpeg2.c | 12 ++++++++++++
|
||||
2 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/dxva2.h b/libavcodec/dxva2.h
|
||||
index fc99560..16a6994 100644
|
||||
--- a/libavcodec/dxva2.h
|
||||
+++ b/libavcodec/dxva2.h
|
||||
@@ -66,6 +66,7 @@ struct dxva_context {
|
||||
* Private to the FFmpeg AVHWAccel implementation
|
||||
*/
|
||||
unsigned report_id;
|
||||
+ unsigned last_slice_count;
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_DXVA_H */
|
||||
diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
|
||||
index 8ba83b6..90507f9 100644
|
||||
--- a/libavcodec/dxva2_mpeg2.c
|
||||
+++ b/libavcodec/dxva2_mpeg2.c
|
||||
@@ -224,6 +224,16 @@ static int start_frame(AVCodecContext *avctx,
|
||||
ctx_pic->slice_alloc = 0;
|
||||
ctx_pic->bitstream_size = 0;
|
||||
ctx_pic->bitstream = NULL;
|
||||
+
|
||||
+ if (ctx->last_slice_count > 0)
|
||||
+ {
|
||||
+ ctx_pic->slice = av_fast_realloc(NULL,
|
||||
+ &ctx_pic->slice_alloc,
|
||||
+ ctx->last_slice_count * sizeof(DXVA_SliceInfo));
|
||||
+ if (!ctx_pic->slice)
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -258,6 +268,7 @@ static int end_frame(AVCodecContext *avctx)
|
||||
struct MpegEncContext *s = avctx->priv_data;
|
||||
struct dxva2_picture_context *ctx_pic =
|
||||
s->current_picture_ptr->f.hwaccel_picture_private;
|
||||
+ struct dxva_context *ctx = avctx->hwaccel_context;
|
||||
|
||||
if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
|
||||
return -1;
|
||||
@@ -266,6 +277,7 @@ static int end_frame(AVCodecContext *avctx)
|
||||
&ctx_pic->qm, sizeof(ctx_pic->qm),
|
||||
commit_bitstream_and_slice_buffer);
|
||||
av_freep(ctx_pic->slice);
|
||||
+ ctx->last_slice_count = ctx_pic->slice_count;
|
||||
}
|
||||
|
||||
AVHWAccel ff_mpeg2_dxva2_hwaccel = {
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,49 @@
|
||||
From 1c0fcc2cfe27197368e0490afe34dd51a831995f Mon Sep 17 00:00:00 2001
|
||||
From: CrystalP <CrystalP@xbmc.org>
|
||||
Date: Wed, 5 Oct 2011 12:53:38 -0400
|
||||
Subject: [PATCH 20/24] dxva-vc1 Take BI into account for forward and backward
|
||||
pictures
|
||||
|
||||
See ticket #11643, sample on team ftp, samples/11643/vc-1 test.wmv
|
||||
---
|
||||
libavcodec/dxva2_vc1.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
|
||||
index 0ae9685..23507d3 100644
|
||||
--- a/libavcodec/dxva2_vc1.c
|
||||
+++ b/libavcodec/dxva2_vc1.c
|
||||
@@ -38,15 +38,17 @@ static void fill_picture_parameters(AVCodecContext *avctx,
|
||||
{
|
||||
const MpegEncContext *s = &v->s;
|
||||
const Picture *current_picture = s->current_picture_ptr;
|
||||
+ BYTE bPicIntra = s->pict_type == AV_PICTURE_TYPE_I || v->bi_type == 1;
|
||||
+ BYTE bPicBackwardPrediction = s->pict_type == AV_PICTURE_TYPE_B && v->bi_type == 0;
|
||||
|
||||
memset(pp, 0, sizeof(*pp));
|
||||
pp->wDecodedPictureIndex =
|
||||
pp->wDeblockedPictureIndex = ff_dxva2_get_surface_index(ctx, current_picture);
|
||||
- if (s->pict_type != AV_PICTURE_TYPE_I)
|
||||
+ if (!bPicIntra)
|
||||
pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->last_picture);
|
||||
else
|
||||
pp->wForwardRefPictureIndex = 0xffff;
|
||||
- if (s->pict_type == AV_PICTURE_TYPE_B)
|
||||
+ if (bPicBackwardPrediction)
|
||||
pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->next_picture);
|
||||
else
|
||||
pp->wBackwardRefPictureIndex = 0xffff;
|
||||
@@ -69,8 +71,8 @@ static void fill_picture_parameters(AVCodecContext *avctx,
|
||||
if (s->picture_structure & PICT_BOTTOM_FIELD)
|
||||
pp->bPicStructure |= 0x02;
|
||||
pp->bSecondField = v->interlace && v->fcm != ILACE_FIELD && !s->first_field;
|
||||
- pp->bPicIntra = s->pict_type == AV_PICTURE_TYPE_I;
|
||||
- pp->bPicBackwardPrediction = s->pict_type == AV_PICTURE_TYPE_B;
|
||||
+ pp->bPicIntra = bPicIntra;
|
||||
+ pp->bPicBackwardPrediction = bPicBackwardPrediction;
|
||||
pp->bBidirectionalAveragingMode = (1 << 7) |
|
||||
((ctx->cfg->ConfigIntraResidUnsigned != 0) << 6) |
|
||||
((ctx->cfg->ConfigResidDiffAccelerator != 0) << 5) |
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,29 @@
|
||||
From 6ba7fd3e2acf39e8c276e7db901c54dba0fd8307 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Sat, 22 Oct 2011 21:59:22 +0200
|
||||
Subject: [PATCH 21/24] dxva-vc1 Pass overlapping transforms hint
|
||||
|
||||
see ticket #11643
|
||||
---
|
||||
libavcodec/dxva2_vc1.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
|
||||
index 23507d3..9d550dd 100644
|
||||
--- a/libavcodec/dxva2_vc1.c
|
||||
+++ b/libavcodec/dxva2_vc1.c
|
||||
@@ -103,7 +103,10 @@ static void fill_picture_parameters(AVCodecContext *avctx,
|
||||
(v->rangered << 3) |
|
||||
(s->max_b_frames );
|
||||
pp->bPicExtrapolation = (!v->interlace || v->fcm == PROGRESSIVE) ? 1 : 2;
|
||||
- pp->bPicDeblocked = ((v->profile != PROFILE_ADVANCED && v->rangeredfrm) << 5) |
|
||||
+ pp->bPicDeblocked = ((v->overlap == 1 &&
|
||||
+ pp->bPicBackwardPrediction == 0 &&
|
||||
+ ctx->cfg->ConfigResidDiffHost == 0) << 6) |
|
||||
+ ((v->profile != PROFILE_ADVANCED && v->rangeredfrm) << 5) |
|
||||
(s->loop_filter << 1);
|
||||
pp->bPicDeblockConfined = (v->postprocflag << 7) |
|
||||
(v->broadcast << 6) |
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,75 @@
|
||||
From 3b6417ff1e86c2aa72fc5360f67be2db8b83b80d Mon Sep 17 00:00:00 2001
|
||||
From: CrystalP <CrystalP@xbmc.org>
|
||||
Date: Wed, 5 Oct 2011 13:13:25 -0400
|
||||
Subject: [PATCH 22/24] dxva-h264 Fix dxva playback of streams that don't
|
||||
start with an I-Frame.
|
||||
|
||||
GPUs with ATI UVDa and UVD+ have trouble when decoding doesn't start on an
|
||||
I-Frame, and they don't recover on later I-Frames.
|
||||
|
||||
The variable to track the first I-Frame is in H264Context so that it can be
|
||||
reset by code in h264 when initializing the context or flushing.
|
||||
|
||||
credits isidrogar, see ticket #11772.
|
||||
sample on team ftp, samples/11772/CSI_ New York - TV3 - 2008-09-16_1.ts
|
||||
---
|
||||
libavcodec/dxva2_h264.c | 8 ++++++++
|
||||
libavcodec/h264.c | 2 ++
|
||||
libavcodec/h264.h | 2 ++
|
||||
3 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
|
||||
index af91e02..b7e0251 100644
|
||||
--- a/libavcodec/dxva2_h264.c
|
||||
+++ b/libavcodec/dxva2_h264.c
|
||||
@@ -432,6 +432,14 @@ static int end_frame(AVCodecContext *avctx)
|
||||
|
||||
if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
|
||||
return -1;
|
||||
+
|
||||
+ // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs
|
||||
+ if (!h->got_first_iframe) {
|
||||
+ if (!(ctx_pic->pp.wBitFields & (1 << 15)))
|
||||
+ return -1;
|
||||
+ h->got_first_iframe = 1;
|
||||
+ }
|
||||
+
|
||||
return ff_dxva2_common_end_frame(avctx, s,
|
||||
&ctx_pic->pp, sizeof(ctx_pic->pp),
|
||||
&ctx_pic->qm, sizeof(ctx_pic->qm),
|
||||
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
|
||||
index d010b55..98c7a5d 100644
|
||||
--- a/libavcodec/h264.c
|
||||
+++ b/libavcodec/h264.c
|
||||
@@ -2372,6 +2372,7 @@ static void flush_dpb(AVCodecContext *avctx){
|
||||
h->delayed_pic[i]->f.reference = 0;
|
||||
h->delayed_pic[i]= NULL;
|
||||
}
|
||||
+ h->got_first_iframe = 0;
|
||||
h->outputed_poc=h->next_outputed_poc= INT_MIN;
|
||||
h->prev_interlaced_frame = 1;
|
||||
idr(h);
|
||||
@@ -2819,6 +2820,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
}
|
||||
s->first_field = 0;
|
||||
h->prev_interlaced_frame = 1;
|
||||
+ h->got_first_iframe = 0;
|
||||
|
||||
init_scan_tables(h);
|
||||
if (ff_h264_alloc_tables(h) < 0) {
|
||||
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
|
||||
index d0dfca3..f4df997 100644
|
||||
--- a/libavcodec/h264.h
|
||||
+++ b/libavcodec/h264.h
|
||||
@@ -584,6 +584,8 @@ typedef struct H264Context{
|
||||
int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag
|
||||
int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag
|
||||
|
||||
+ int got_first_iframe;
|
||||
+
|
||||
// Timestamp stuff
|
||||
int sei_buffering_period_present; ///< Buffering period SEI flag
|
||||
int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,26 @@
|
||||
From 0b24d2cd7338ddba22926a7725dc751cc801ac78 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Sat, 22 Oct 2011 22:01:31 +0200
|
||||
Subject: [PATCH 23/24] Changed format string - %td not supported by our MingW
|
||||
environment.
|
||||
|
||||
---
|
||||
libavcodec/h264.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
|
||||
index 98c7a5d..c4785db 100644
|
||||
--- a/libavcodec/h264.c
|
||||
+++ b/libavcodec/h264.c
|
||||
@@ -3629,7 +3629,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
|
||||
return 0;
|
||||
}
|
||||
if( ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 2) {
|
||||
- av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d, bytestream (%td)\n", s->mb_x, s->mb_y, h->cabac.bytestream_end - h->cabac.bytestream);
|
||||
+ av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d, bytestream (%d)\n", s->mb_x, s->mb_y, h->cabac.bytestream_end - h->cabac.bytestream);
|
||||
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR&part_mask);
|
||||
return -1;
|
||||
}
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,48 @@
|
||||
From 399301fd74ed748d24d7ee2806f50e8ad57aeea8 Mon Sep 17 00:00:00 2001
|
||||
From: elupus <elupus@xbmc.org>
|
||||
Date: Tue, 1 Nov 2011 20:18:35 +0100
|
||||
Subject: [PATCH 24/24] add public version of ff_read_frame_flush
|
||||
|
||||
We need this since we sometimes seek on the
|
||||
input stream behind ffmpeg's back. After this
|
||||
all data need to be flushed completely.
|
||||
---
|
||||
libavformat/avformat.h | 5 +++++
|
||||
libavformat/utils.c | 5 +++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
|
||||
index 1e8a629..c76ac71 100644
|
||||
--- a/libavformat/avformat.h
|
||||
+++ b/libavformat/avformat.h
|
||||
@@ -1631,6 +1631,11 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt);
|
||||
int av_read_frame(AVFormatContext *s, AVPacket *pkt);
|
||||
|
||||
/**
|
||||
+ * Clear out any buffered data in context
|
||||
+ */
|
||||
+void av_read_frame_flush(AVFormatContext *s);
|
||||
+
|
||||
+/**
|
||||
* Seek to the keyframe at timestamp.
|
||||
* 'timestamp' in 'stream_index'.
|
||||
* @param stream_index If stream_index is (-1), a default
|
||||
diff --git a/libavformat/utils.c b/libavformat/utils.c
|
||||
index 25fe38e..4729a40 100644
|
||||
--- a/libavformat/utils.c
|
||||
+++ b/libavformat/utils.c
|
||||
@@ -1463,6 +1463,11 @@ void ff_read_frame_flush(AVFormatContext *s)
|
||||
}
|
||||
}
|
||||
|
||||
+void av_read_frame_flush(AVFormatContext *s)
|
||||
+{
|
||||
+ ff_read_frame_flush(s);
|
||||
+}
|
||||
+
|
||||
#if FF_API_SEEK_PUBLIC
|
||||
void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
|
||||
{
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,65 @@
|
||||
From 6261cbcd71e5cd192623434fa698e9f1e701f365 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Kendall <paul@kcbbs.gen.nz>
|
||||
Date: Sun, 29 Jan 2012 14:50:19 +0100
|
||||
Subject: [PATCH 1/1] Fix dvb subtitle decoding when display segment is
|
||||
missing.
|
||||
|
||||
closes ticket #8504
|
||||
---
|
||||
libavcodec/dvbsubdec.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
|
||||
index e2a804a..503223f 100644
|
||||
--- a/libavcodec/dvbsubdec.c
|
||||
+++ b/libavcodec/dvbsubdec.c
|
||||
@@ -1451,6 +1451,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
|
||||
int segment_type;
|
||||
int page_id;
|
||||
int segment_length;
|
||||
+ int got_segment = 0;
|
||||
int i;
|
||||
|
||||
av_dlog(avctx, "DVB sub packet:\n");
|
||||
@@ -1490,21 +1491,26 @@ static int dvbsub_decode(AVCodecContext *avctx,
|
||||
switch (segment_type) {
|
||||
case DVBSUB_PAGE_SEGMENT:
|
||||
dvbsub_parse_page_segment(avctx, p, segment_length);
|
||||
+ got_segment |= 1;
|
||||
break;
|
||||
case DVBSUB_REGION_SEGMENT:
|
||||
dvbsub_parse_region_segment(avctx, p, segment_length);
|
||||
+ got_segment |= 2;
|
||||
break;
|
||||
case DVBSUB_CLUT_SEGMENT:
|
||||
dvbsub_parse_clut_segment(avctx, p, segment_length);
|
||||
+ got_segment |= 4;
|
||||
break;
|
||||
case DVBSUB_OBJECT_SEGMENT:
|
||||
dvbsub_parse_object_segment(avctx, p, segment_length);
|
||||
+ got_segment |= 8;
|
||||
break;
|
||||
case DVBSUB_DISPLAYDEFINITION_SEGMENT:
|
||||
dvbsub_parse_display_definition_segment(avctx, p, segment_length);
|
||||
break;
|
||||
case DVBSUB_DISPLAY_SEGMENT:
|
||||
*data_size = dvbsub_display_end_segment(avctx, p, segment_length, sub);
|
||||
+ got_segment |= 16;
|
||||
break;
|
||||
default:
|
||||
av_dlog(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n",
|
||||
@@ -1516,6 +1522,11 @@ static int dvbsub_decode(AVCodecContext *avctx,
|
||||
p += segment_length;
|
||||
}
|
||||
|
||||
+ // Some streams do not send a display segment but if we have all the other
|
||||
+ // segments then we need no further data.
|
||||
+ if (got_segment == 15 && sub)
|
||||
+ *data_size = dvbsub_display_end_segment(avctx, p, 0, sub);
|
||||
+
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,51 @@
|
||||
From d659958d58dfec08f4666a8add325c8154a662de Mon Sep 17 00:00:00 2001
|
||||
From: CrystalP <CrystalP@xbmc.org>
|
||||
Date: Fri, 11 Nov 2011 19:10:54 -0500
|
||||
Subject: [PATCH 1/1] Handle return value of BeginFrame better.
|
||||
|
||||
The nVidia cards sometimes return E_PENDING and need time before they can start
|
||||
decoding a new frame.
|
||||
|
||||
Helps nVidia cards with blocky pictures/pixellation artifacts after skip or
|
||||
when CPU is busy.
|
||||
---
|
||||
libavcodec/dxva2.c | 14 ++++++++++++--
|
||||
1 file changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
|
||||
index b6f8aea..3a10f69 100644
|
||||
--- a/libavcodec/dxva2.c
|
||||
+++ b/libavcodec/dxva2.c
|
||||
@@ -21,6 +21,9 @@
|
||||
*/
|
||||
|
||||
#include "dxva2_internal.h"
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#define MAX_RETRY_ON_PENDING 50
|
||||
|
||||
void *ff_dxva2_get_surface(const Picture *picture)
|
||||
{
|
||||
@@ -88,10 +91,17 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s,
|
||||
DXVA2_DecodeBufferDesc buffer[4];
|
||||
DXVA2_DecodeExecuteParams exec;
|
||||
int result;
|
||||
+ HRESULT hr;
|
||||
+ int tries = 0;
|
||||
|
||||
- if (FAILED(IDirectXVideoDecoder_BeginFrame(ctx->decoder,
|
||||
+ while ((hr=IDirectXVideoDecoder_BeginFrame(ctx->decoder,
|
||||
ff_dxva2_get_surface(s->current_picture_ptr),
|
||||
- NULL))) {
|
||||
+ NULL)) == E_PENDING
|
||||
+ && tries < MAX_RETRY_ON_PENDING) {
|
||||
+ usleep(1000);
|
||||
+ tries++;
|
||||
+ }
|
||||
+ if (FAILED(hr)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to begin frame\n");
|
||||
return -1;
|
||||
}
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,34 @@
|
||||
From 05f8b5549c5e20cf9a417069838edd6841d7bd40 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Niedermayer <michaelni@gmx.at>
|
||||
Date: Sat, 11 Feb 2012 20:14:33 +0100
|
||||
Subject: [PATCH 1/1] threads: Perform the generic progress cleanup more
|
||||
carefully.
|
||||
|
||||
The cleanup is only done now when
|
||||
a picture is returned (assuming that it has to be done when its returned)
|
||||
a error is returned (assuming that there will be no further progress on the frame)
|
||||
the codec is not h264 (this is still needed due to some deadlocks in realvideo)
|
||||
|
||||
This fixes a decoding regression with 00017.MTS
|
||||
|
||||
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
|
||||
---
|
||||
libavcodec/pthread.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
|
||||
index 6ae763d..c58222b 100644
|
||||
--- a/libavcodec/pthread.c
|
||||
+++ b/libavcodec/pthread.c
|
||||
@@ -390,7 +390,7 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
|
||||
|
||||
pthread_mutex_lock(&p->progress_mutex);
|
||||
for (i = 0; i < MAX_BUFFERS; i++)
|
||||
- if (p->progress_used[i]) {
|
||||
+ if (p->progress_used[i] && (p->got_frame || p->result<0 || avctx->codec_id != CODEC_ID_H264)) {
|
||||
p->progress[i][0] = INT_MAX;
|
||||
p->progress[i][1] = INT_MAX;
|
||||
}
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,35 @@
|
||||
From 90a3ab0d766e3a026a37f7290f59abda30c4de32 Mon Sep 17 00:00:00 2001
|
||||
From: elupus <elupus@xbmc.org>
|
||||
Date: Tue, 17 Apr 2012 01:13:15 +0200
|
||||
Subject: [PATCH] fixed: dvd still frames ended up in internal lavf buffer
|
||||
|
||||
This is very hackish, but it's the old solution we had for dvd
|
||||
still frames. The problem is that the demuxer asks for probing
|
||||
of the codec in the mpeg stream. This causes lavf to read the
|
||||
whole menu structure into internal buffers. After which, it
|
||||
won't read from input stream anymore and no events triggers.
|
||||
|
||||
The only proper fix to avoid this is to allow this situation
|
||||
in our navigator. This needs further work so that we can
|
||||
process HOP/ACTIVATION events in libdvdnav without advancing
|
||||
stream.
|
||||
---
|
||||
libavformat/utils.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavformat/utils.c b/libavformat/utils.c
|
||||
index 1bf81a5..051dcc0 100644
|
||||
--- a/libavformat/utils.c
|
||||
+++ b/libavformat/utils.c
|
||||
@@ -833,7 +833,7 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
|
||||
if(end || av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)){
|
||||
int score= set_codec_from_probe_data(s, st, pd);
|
||||
- if( (st->codec->codec_id != CODEC_ID_NONE && score > AVPROBE_SCORE_MAX/4)
|
||||
+ if( (st->codec->codec_id != CODEC_ID_NONE && score > AVPROBE_SCORE_MAX/4-1)
|
||||
|| end){
|
||||
pd->buf_size=0;
|
||||
av_freep(&pd->buf);
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -0,0 +1,14 @@
|
||||
diff --git a/configure b/configure
|
||||
index 5e11b2d..c06005b 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -2635,7 +2635,7 @@ case $target_os in
|
||||
;;
|
||||
darwin)
|
||||
enable malloc_aligned
|
||||
- gas="gas-preprocessor.pl $cc"
|
||||
+ #gas="gas-preprocessor.pl $cc"
|
||||
enabled ppc && add_asflags -force_cpusubtype_ALL
|
||||
SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
|
||||
enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
|
||||
|
@ -0,0 +1,813 @@
|
||||
diff -Naur a/configure b/configure
|
||||
--- a/configure 2012-05-12 21:45:47.005596234 +0200
|
||||
+++ b/configure 2012-05-12 21:46:03.902936436 +0200
|
||||
@@ -113,6 +113,7 @@
|
||||
--enable-vdpau enable VDPAU code [autodetect]
|
||||
--disable-dxva2 disable DXVA2 code
|
||||
--disable-vda disable VDA code
|
||||
+ --disable-xvba disable XVBA code
|
||||
--enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
|
||||
--enable-hardcoded-tables use hardcoded tables instead of runtime generation
|
||||
--disable-safe-bitstream-reader
|
||||
@@ -1084,6 +1085,7 @@
|
||||
vaapi
|
||||
vda
|
||||
vdpau
|
||||
+ xvba
|
||||
version3
|
||||
x11grab
|
||||
zlib
|
||||
@@ -1423,6 +1425,7 @@
|
||||
h264_vaapi_hwaccel_select="vaapi h264_decoder"
|
||||
h264_vda_hwaccel_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
|
||||
h264_vda_hwaccel_select="vda h264_decoder"
|
||||
+h264_xvba_hwaccel_select="xvba"
|
||||
h264_vdpau_decoder_select="vdpau h264_decoder"
|
||||
imc_decoder_select="fft mdct sinewin"
|
||||
jpegls_decoder_select="golomb"
|
||||
@@ -1459,6 +1462,7 @@
|
||||
mpeg4_decoder_select="h263_decoder mpeg4video_parser"
|
||||
mpeg4_encoder_select="h263_encoder"
|
||||
mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
|
||||
+mpeg2_xvba_hwaccel_select="xvba mpeg2video_decoder"
|
||||
mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
|
||||
msmpeg4_crystalhd_decoder_select="crystalhd"
|
||||
msmpeg4v1_decoder_select="h263_decoder"
|
||||
@@ -1501,6 +1505,7 @@
|
||||
vc1_dxva2_hwaccel_deps="dxva2api_h"
|
||||
vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
|
||||
vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
|
||||
+vc1_xvba_hwaccel_select="xvba vc1_decoder"
|
||||
vc1_vdpau_decoder_select="vdpau vc1_decoder"
|
||||
vc1image_decoder_select="vc1_decoder"
|
||||
vorbis_decoder_select="mdct"
|
||||
@@ -1525,6 +1530,7 @@
|
||||
wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
|
||||
wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
|
||||
wmv3image_decoder_select="wmv3_decoder"
|
||||
+wmv3_xvba_hwaccel_select="vc1_xvba_hwaccel"
|
||||
zlib_decoder_select="zlib"
|
||||
zlib_encoder_select="zlib"
|
||||
zmbv_decoder_select="zlib"
|
||||
@@ -1533,6 +1539,7 @@
|
||||
crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
|
||||
vaapi_deps="va_va_h"
|
||||
vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
|
||||
+xvba_deps="amd_amdxvba_h"
|
||||
vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
|
||||
|
||||
# parsers
|
||||
@@ -3062,6 +3069,7 @@
|
||||
check_header termios.h
|
||||
check_header vdpau/vdpau.h
|
||||
check_header vdpau/vdpau_x11.h
|
||||
+check_header amd/amdxvba.h
|
||||
check_cpp_condition vdpau/vdpau.h "defined(VDP_DECODER_PROFILE_MPEG4_PART2_SP)" && enable vdpau_mpeg4_support
|
||||
|
||||
check_header X11/extensions/XvMClib.h
|
||||
diff -Naur a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
|
||||
--- a/libavcodec/allcodecs.c 2012-05-12 21:45:47.257601308 +0200
|
||||
+++ b/libavcodec/allcodecs.c 2012-05-12 21:46:03.905936496 +0200
|
||||
@@ -59,14 +59,18 @@
|
||||
REGISTER_HWACCEL (H264_VAAPI, h264_vaapi);
|
||||
REGISTER_HWACCEL (H264_VDA, h264_vda);
|
||||
REGISTER_HWACCEL (MPEG1_VDPAU, mpeg1_vdpau);
|
||||
+ REGISTER_HWACCEL (H264_XVBA, h264_xvba);
|
||||
REGISTER_HWACCEL (MPEG2_DXVA2, mpeg2_dxva2);
|
||||
REGISTER_HWACCEL (MPEG2_VAAPI, mpeg2_vaapi);
|
||||
REGISTER_HWACCEL (MPEG2_VDPAU, mpeg2_vdpau);
|
||||
REGISTER_HWACCEL (MPEG4_VAAPI, mpeg4_vaapi);
|
||||
+ REGISTER_HWACCEL (MPEG2_XVBA, mpeg2_xvba);
|
||||
REGISTER_HWACCEL (VC1_DXVA2, vc1_dxva2);
|
||||
REGISTER_HWACCEL (VC1_VAAPI, vc1_vaapi);
|
||||
+ REGISTER_HWACCEL (VC1_XVBA, vc1_xvba);
|
||||
REGISTER_HWACCEL (WMV3_DXVA2, wmv3_dxva2);
|
||||
REGISTER_HWACCEL (WMV3_VAAPI, wmv3_vaapi);
|
||||
+ REGISTER_HWACCEL (WMV3_XVBA, wmv3_xvba);
|
||||
|
||||
/* video codecs */
|
||||
REGISTER_ENCODER (A64MULTI, a64multi);
|
||||
diff -Naur a/libavcodec/h264.c b/libavcodec/h264.c
|
||||
--- a/libavcodec/h264.c 2012-05-12 21:45:47.757611376 +0200
|
||||
+++ b/libavcodec/h264.c 2012-05-12 21:46:03.908936558 +0200
|
||||
@@ -60,6 +60,7 @@
|
||||
PIX_FMT_DXVA2_VLD,
|
||||
PIX_FMT_VAAPI_VLD,
|
||||
PIX_FMT_VDA_VLD,
|
||||
+ PIX_FMT_XVBA_VLD,
|
||||
PIX_FMT_YUVJ420P,
|
||||
PIX_FMT_NONE
|
||||
};
|
||||
diff -Naur a/libavcodec/Makefile b/libavcodec/Makefile
|
||||
--- a/libavcodec/Makefile 2012-05-12 21:45:47.927614798 +0200
|
||||
+++ b/libavcodec/Makefile 2012-05-12 21:46:03.904936476 +0200
|
||||
@@ -3,7 +3,7 @@
|
||||
NAME = avcodec
|
||||
FFLIBS = avutil
|
||||
|
||||
-HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vda.h vdpau.h version.h xvmc.h
|
||||
+HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vda.h vdpau.h version.h xvmc.h xvba.h
|
||||
|
||||
OBJS = allcodecs.o \
|
||||
audioconvert.o \
|
||||
@@ -51,6 +51,7 @@
|
||||
OBJS-$(CONFIG_VAAPI) += vaapi.o
|
||||
OBJS-$(CONFIG_VDA) += vda.o
|
||||
OBJS-$(CONFIG_VDPAU) += vdpau.o
|
||||
+OBJS-$(CONFIG_XVBA) += xvba.o
|
||||
|
||||
# decoders/encoders/hardware accelerators
|
||||
OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o
|
||||
@@ -201,6 +202,7 @@
|
||||
OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o
|
||||
OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o
|
||||
OBJS-$(CONFIG_H264_VDA_HWACCEL) += vda_h264.o
|
||||
+OBJS-$(CONFIG_H264_XVBA_HWACCEL) += xvba_h264.o
|
||||
OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o
|
||||
OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o
|
||||
OBJS-$(CONFIG_IDCIN_DECODER) += idcinvideo.o
|
||||
@@ -284,6 +286,7 @@
|
||||
mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o
|
||||
+OBJS-$(CONFIG_MPEG2_XVBA_HWACCEL) += xvba_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12.o mpeg12data.o \
|
||||
mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \
|
||||
@@ -431,6 +434,7 @@
|
||||
intrax8.o intrax8dsp.o
|
||||
OBJS-$(CONFIG_VC1_DXVA2_HWACCEL) += dxva2_vc1.o
|
||||
OBJS-$(CONFIG_VC1_VAAPI_HWACCEL) += vaapi_vc1.o
|
||||
+OBJS-$(CONFIG_VC1_XVBA_HWACCEL) += xvba_vc1.o
|
||||
OBJS-$(CONFIG_VCR1_DECODER) += vcr1.o
|
||||
OBJS-$(CONFIG_VCR1_ENCODER) += vcr1.o
|
||||
OBJS-$(CONFIG_VMDAUDIO_DECODER) += vmdav.o
|
||||
@@ -732,6 +736,7 @@
|
||||
SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
|
||||
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h
|
||||
SKIPHEADERS-$(CONFIG_VDA) += vda_internal.h
|
||||
+SKIPHEADERS-$(CONFIG_XVBA) += xvba_internal.h
|
||||
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h
|
||||
SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
|
||||
SKIPHEADERS-$(HAVE_W32THREADS) += w32pthreads.h
|
||||
diff -Naur a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
|
||||
--- a/libavcodec/mpegvideo.c 2012-05-12 21:45:48.027616812 +0200
|
||||
+++ b/libavcodec/mpegvideo.c 2012-05-12 21:46:03.910936598 +0200
|
||||
@@ -136,6 +136,7 @@
|
||||
PIX_FMT_DXVA2_VLD,
|
||||
PIX_FMT_VAAPI_VLD,
|
||||
PIX_FMT_VDA_VLD,
|
||||
+ PIX_FMT_XVBA_VLD,
|
||||
PIX_FMT_YUV420P,
|
||||
PIX_FMT_NONE
|
||||
};
|
||||
diff -Naur a/libavcodec/xvba.c b/libavcodec/xvba.c
|
||||
--- a/libavcodec/xvba.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/libavcodec/xvba.c 2012-05-12 21:46:03.918936758 +0200
|
||||
@@ -0,0 +1,66 @@
|
||||
+/*
|
||||
+ * HW decode acceleration for MPEG-2, H.264 and VC-1
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
+ *
|
||||
+ * This file is part of FFmpeg.
|
||||
+ *
|
||||
+ * FFmpeg is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * FFmpeg 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
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with FFmpeg; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * \addtogroup XVBA_Decoding
|
||||
+ *
|
||||
+ * @{
|
||||
+ */
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+#include "xvba.h"
|
||||
+#include "xvba_internal.h"
|
||||
+#include "avcodec.h"
|
||||
+
|
||||
+int ff_xvba_translate_profile(int profile) {
|
||||
+
|
||||
+ if (profile == 66)
|
||||
+ return 1;
|
||||
+ else if (profile == 77)
|
||||
+ return 2;
|
||||
+ else if (profile == 100)
|
||||
+ return 3;
|
||||
+ else if (profile == 0)
|
||||
+ return 4;
|
||||
+ else if (profile == 1)
|
||||
+ return 5;
|
||||
+ else if (profile == 3)
|
||||
+ return 6;
|
||||
+ else
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+void ff_xvba_add_slice_data(struct xvba_render_state *render, const uint8_t *buffer, uint32_t size) {
|
||||
+
|
||||
+ render->buffers = av_fast_realloc(
|
||||
+ render->buffers,
|
||||
+ &render->buffers_alllocated,
|
||||
+ sizeof(struct xvba_bitstream_buffers)*(render->num_slices + 1)
|
||||
+ );
|
||||
+
|
||||
+ render->buffers[render->num_slices].buffer = buffer;
|
||||
+ render->buffers[render->num_slices].size = size;
|
||||
+
|
||||
+ render->num_slices++;
|
||||
+}
|
||||
+
|
||||
diff -Naur a/libavcodec/xvba.h b/libavcodec/xvba.h
|
||||
--- a/libavcodec/xvba.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/libavcodec/xvba.h 2012-05-12 21:46:03.918936758 +0200
|
||||
@@ -0,0 +1,71 @@
|
||||
+/*
|
||||
+ * HW decode acceleration for MPEG-2, H.264 and VC-1
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
+ *
|
||||
+ * This file is part of FFmpeg.
|
||||
+ *
|
||||
+ * FFmpeg is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * FFmpeg 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
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with FFmpeg; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#ifndef AVCODEC_XVBA_H
|
||||
+#define AVCODEC_XVBA_H
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+#include <X11/Xlib.h>
|
||||
+#include <amd/amdxvba.h>
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * \defgroup XVBA_Decoding VA API Decoding
|
||||
+ * \ingroup Decoder
|
||||
+ * @{
|
||||
+ */
|
||||
+
|
||||
+/** \brief The videoSurface is used for rendering. */
|
||||
+#define FF_XVBA_STATE_USED_FOR_RENDER 1
|
||||
+
|
||||
+/**
|
||||
+ * \brief The videoSurface is needed for reference/prediction.
|
||||
+ * The codec manipulates this.
|
||||
+ */
|
||||
+#define FF_XVBA_STATE_USED_FOR_REFERENCE 2
|
||||
+
|
||||
+/**
|
||||
+ * \brief The videoSurface holds a decoded frame.
|
||||
+ * The codec manipulates this.
|
||||
+ */
|
||||
+#define FF_XVBA_STATE_DECODED 4
|
||||
+
|
||||
+/* @} */
|
||||
+
|
||||
+struct xvba_bitstream_buffers
|
||||
+{
|
||||
+ const void *buffer;
|
||||
+ unsigned int size;
|
||||
+};
|
||||
+
|
||||
+struct xvba_render_state {
|
||||
+
|
||||
+ int state; ///< Holds FF_XVBA_STATE_* values.
|
||||
+ void *surface;
|
||||
+ XVBAPictureDescriptor *picture_descriptor;
|
||||
+ XVBAQuantMatrixAvc *iq_matrix;
|
||||
+ int num_slices;
|
||||
+ struct xvba_bitstream_buffers *buffers;
|
||||
+ uint32_t buffers_alllocated;
|
||||
+};
|
||||
+
|
||||
+#endif /* AVCODEC_XVBA_H */
|
||||
diff -Naur a/libavcodec/xvba_h264.c b/libavcodec/xvba_h264.c
|
||||
--- a/libavcodec/xvba_h264.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/libavcodec/xvba_h264.c 2012-05-12 21:46:03.919936778 +0200
|
||||
@@ -0,0 +1,180 @@
|
||||
+/*
|
||||
+ * H.264 HW decode acceleration through XVBA
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
+ *
|
||||
+ * This file is part of FFmpeg.
|
||||
+ *
|
||||
+ * FFmpeg is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * FFmpeg 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
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with FFmpeg; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#include "xvba.h"
|
||||
+#include "xvba_internal.h"
|
||||
+#include "h264.h"
|
||||
+#include <assert.h>
|
||||
+
|
||||
+/** @file
|
||||
+ * This file implements the glue code between FFmpeg's and XvBA API's
|
||||
+ * structures for H.264 decoding.
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+/** Initialize and start decoding a frame with XVBA. */
|
||||
+static int start_frame(AVCodecContext *avctx,
|
||||
+ av_unused const uint8_t *buffer,
|
||||
+ av_unused uint32_t size)
|
||||
+{
|
||||
+ H264Context * const h = avctx->priv_data;
|
||||
+ MpegEncContext * const s = &h->s;
|
||||
+ struct xvba_render_state *render;
|
||||
+ XVBAPictureDescriptor *pic_descriptor;
|
||||
+ int i;
|
||||
+
|
||||
+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0];
|
||||
+ assert(render);
|
||||
+
|
||||
+ if (render->picture_descriptor == 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ pic_descriptor = render->picture_descriptor;
|
||||
+
|
||||
+ for (i = 0; i < 2; ++i) {
|
||||
+ int foc = s->current_picture_ptr->field_poc[i];
|
||||
+ if (foc == INT_MAX)
|
||||
+ foc = 0;
|
||||
+ pic_descriptor->avc_curr_field_order_cnt_list[i] = foc;
|
||||
+ }
|
||||
+
|
||||
+ pic_descriptor->avc_frame_num = h->frame_num;
|
||||
+
|
||||
+ render->num_slices = 0;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/** End a hardware decoding based frame. */
|
||||
+static int end_frame(AVCodecContext *avctx)
|
||||
+{
|
||||
+ H264Context * const h = avctx->priv_data;
|
||||
+ MpegEncContext * const s = &h->s;
|
||||
+ struct xvba_render_state *render;
|
||||
+ XVBAPictureDescriptor *pic_descriptor;
|
||||
+ XVBAQuantMatrixAvc *iq_matrix;
|
||||
+
|
||||
+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0];
|
||||
+ assert(render);
|
||||
+
|
||||
+ if (render->picture_descriptor == 0 || render->iq_matrix == 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ pic_descriptor = render->picture_descriptor;
|
||||
+ iq_matrix = render->iq_matrix;
|
||||
+
|
||||
+ av_dlog(avctx, "end_frame()\n");
|
||||
+
|
||||
+ /* Fill in Picture Parameters*/
|
||||
+ pic_descriptor->profile = ff_xvba_translate_profile(avctx->profile);
|
||||
+ pic_descriptor->level = avctx->level;
|
||||
+ pic_descriptor->width_in_mb = s->mb_width;
|
||||
+ pic_descriptor->height_in_mb = s->mb_height;
|
||||
+ pic_descriptor->picture_structure = s->picture_structure;
|
||||
+ pic_descriptor->chroma_format = s->chroma_format ? s->chroma_format : 1;
|
||||
+ pic_descriptor->avc_intra_flag = (h->slice_type == FF_I_TYPE) ? 1 : 0;
|
||||
+ pic_descriptor->avc_reference = (s->current_picture_ptr->f.reference & 3) ? 1 : 0;
|
||||
+
|
||||
+ pic_descriptor->avc_bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8;
|
||||
+ pic_descriptor->avc_bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8;
|
||||
+ pic_descriptor->avc_log2_max_frame_num_minus4 = h->sps.log2_max_frame_num -4;
|
||||
+ pic_descriptor->avc_pic_order_cnt_type = h->sps.poc_type;
|
||||
+ pic_descriptor->avc_log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4;
|
||||
+ pic_descriptor->avc_num_ref_frames = h->sps.ref_frame_count;
|
||||
+ pic_descriptor->avc_reserved_8bit = 0;
|
||||
+
|
||||
+ pic_descriptor->avc_num_slice_groups_minus1 = h->pps.slice_group_count - 1;
|
||||
+ pic_descriptor->avc_num_ref_idx_l0_active_minus1 = h->pps.ref_count[0] - 1;
|
||||
+ pic_descriptor->avc_num_ref_idx_l1_active_minus1 = h->pps.ref_count[1] - 1;
|
||||
+
|
||||
+ pic_descriptor->avc_pic_init_qp_minus26 = h->pps.init_qp - 26;
|
||||
+ pic_descriptor->avc_pic_init_qs_minus26 = h->pps.init_qs - 26;
|
||||
+ pic_descriptor->avc_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0];
|
||||
+ pic_descriptor->avc_second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1];
|
||||
+ pic_descriptor->avc_slice_group_change_rate_minus1 = 0; // not implemented in ffmpeg
|
||||
+ pic_descriptor->avc_reserved_16bit = 0; // must be 0
|
||||
+ memset(pic_descriptor->avc_field_order_cnt_list,0,sizeof(pic_descriptor->avc_field_order_cnt_list)); // must be 0
|
||||
+ memset(pic_descriptor->avc_slice_group_map,0,sizeof(pic_descriptor->avc_slice_group_map)); // must be 0
|
||||
+
|
||||
+ // sps
|
||||
+ pic_descriptor->sps_info.avc.delta_pic_always_zero_flag = h->sps.delta_pic_order_always_zero_flag;
|
||||
+ pic_descriptor->sps_info.avc.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag;
|
||||
+ pic_descriptor->sps_info.avc.frame_mbs_only_flag = h->sps.frame_mbs_only_flag;
|
||||
+ pic_descriptor->sps_info.avc.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag;
|
||||
+ pic_descriptor->sps_info.avc.mb_adaptive_frame_field_flag = h->sps.mb_aff;
|
||||
+ pic_descriptor->sps_info.avc.residual_colour_transform_flag = h->sps.residual_color_transform_flag;
|
||||
+ pic_descriptor->sps_info.avc.xvba_avc_sps_reserved = 0;
|
||||
+
|
||||
+ // pps
|
||||
+ pic_descriptor->pps_info.avc.entropy_coding_mode_flag = h->pps.cabac;
|
||||
+ pic_descriptor->pps_info.avc.pic_order_present_flag = h->pps.pic_order_present;
|
||||
+ pic_descriptor->pps_info.avc.weighted_pred_flag = h->pps.weighted_pred;
|
||||
+ pic_descriptor->pps_info.avc.weighted_bipred_idc = h->pps.weighted_bipred_idc;
|
||||
+ pic_descriptor->pps_info.avc.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present;
|
||||
+ pic_descriptor->pps_info.avc.constrained_intra_pred_flag = h->pps.constrained_intra_pred;
|
||||
+ pic_descriptor->pps_info.avc.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present;
|
||||
+ pic_descriptor->pps_info.avc.transform_8x8_mode_flag = h->pps.transform_8x8_mode;
|
||||
+ pic_descriptor->pps_info.avc.xvba_avc_pps_reserved = 0; // must be 0
|
||||
+
|
||||
+ memcpy(iq_matrix->bScalingLists4x4, h->pps.scaling_matrix4, sizeof(iq_matrix->bScalingLists4x4));
|
||||
+ memcpy(iq_matrix->bScalingLists8x8, h->pps.scaling_matrix8, sizeof(iq_matrix->bScalingLists8x8));
|
||||
+
|
||||
+ // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs
|
||||
+ if (!h->got_first_iframe) {
|
||||
+ if (h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE)
|
||||
+ return -1;
|
||||
+ h->got_first_iframe = 1;
|
||||
+ }
|
||||
+
|
||||
+ ff_draw_horiz_band(s, 0, s->avctx->height);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/** Decode the given H.264 slice with XVBA. */
|
||||
+static int decode_slice(AVCodecContext *avctx,
|
||||
+ const uint8_t *buffer,
|
||||
+ uint32_t size)
|
||||
+{
|
||||
+ H264Context * const h = avctx->priv_data;
|
||||
+ MpegEncContext * const s = &h->s;
|
||||
+ struct xvba_render_state *render;
|
||||
+
|
||||
+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0];
|
||||
+ assert(render);
|
||||
+
|
||||
+ ff_xvba_add_slice_data(render, buffer, size);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+AVHWAccel ff_h264_xvba_hwaccel = {
|
||||
+ .name = "h264_xvba",
|
||||
+ .type = AVMEDIA_TYPE_VIDEO,
|
||||
+ .id = CODEC_ID_H264,
|
||||
+ .pix_fmt = PIX_FMT_XVBA_VLD,
|
||||
+ .capabilities = 0,
|
||||
+ .start_frame = start_frame,
|
||||
+ .end_frame = end_frame,
|
||||
+ .decode_slice = decode_slice,
|
||||
+ .priv_data_size = 0,
|
||||
+};
|
||||
diff -Naur a/libavcodec/xvba_internal.h b/libavcodec/xvba_internal.h
|
||||
--- a/libavcodec/xvba_internal.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/libavcodec/xvba_internal.h 2012-05-12 21:46:03.920936798 +0200
|
||||
@@ -0,0 +1,24 @@
|
||||
+/*
|
||||
+ * HW decode acceleration for MPEG-2, H.264 and VC-1
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
+ *
|
||||
+ * This file is part of FFmpeg.
|
||||
+ *
|
||||
+ * FFmpeg is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * FFmpeg 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
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with FFmpeg; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+int ff_xvba_translate_profile(int profile);
|
||||
+void ff_xvba_add_slice_data(struct xvba_render_state *render, const uint8_t *buffer, uint32_t size);
|
||||
diff -Naur a/libavcodec/xvba_mpeg2.c b/libavcodec/xvba_mpeg2.c
|
||||
--- a/libavcodec/xvba_mpeg2.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/libavcodec/xvba_mpeg2.c 2012-05-12 21:46:03.920936798 +0200
|
||||
@@ -0,0 +1,52 @@
|
||||
+/*
|
||||
+ * MPEG-2 HW decode acceleration through XVBA
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
+ *
|
||||
+ * This file is part of FFmpeg.
|
||||
+ *
|
||||
+ * FFmpeg is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * FFmpeg 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
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with FFmpeg; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#include "dsputil.h"
|
||||
+
|
||||
+static int start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
|
||||
+{
|
||||
+ struct MpegEncContext * const s = avctx->priv_data;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int end_frame(AVCodecContext *avctx)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
|
||||
+{
|
||||
+ struct MpegEncContext * const s = avctx->priv_data;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+AVHWAccel ff_mpeg2_xvba_hwaccel = {
|
||||
+ .name = "mpeg2_xvba",
|
||||
+ .type = AVMEDIA_TYPE_VIDEO,
|
||||
+ .id = CODEC_ID_MPEG2VIDEO,
|
||||
+ .pix_fmt = PIX_FMT_XVBA_VLD,
|
||||
+ .capabilities = 0,
|
||||
+ .start_frame = start_frame,
|
||||
+ .end_frame = end_frame,
|
||||
+ .decode_slice = decode_slice,
|
||||
+ .priv_data_size = 0,
|
||||
+};
|
||||
diff -Naur a/libavcodec/xvba_vc1.c b/libavcodec/xvba_vc1.c
|
||||
--- a/libavcodec/xvba_vc1.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/libavcodec/xvba_vc1.c 2012-05-12 21:46:03.921936819 +0200
|
||||
@@ -0,0 +1,194 @@
|
||||
+/*
|
||||
+ * VC-1 HW decode acceleration through XVBA
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
+ *
|
||||
+ * This file is part of FFmpeg.
|
||||
+ *
|
||||
+ * FFmpeg is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * FFmpeg 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
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with FFmpeg; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#include "xvba.h"
|
||||
+#include "xvba_internal.h"
|
||||
+#include "vc1.h"
|
||||
+#include "vc1data.h"
|
||||
+#include <assert.h>
|
||||
+
|
||||
+
|
||||
+/** @file
|
||||
+ * Implement structures of ffmpeg <-> XvBA
|
||||
+ */
|
||||
+
|
||||
+/* Initialize and start decoding a frame with XvBA */
|
||||
+static int start_frame(AVCodecContext *avctx,
|
||||
+ av_unused const uint8_t *buffer,
|
||||
+ av_unused uint32_t size)
|
||||
+{
|
||||
+ VC1Context * const v = avctx->priv_data;
|
||||
+ MpegEncContext * const s = &v->s;
|
||||
+ struct xvba_render_state *render;
|
||||
+
|
||||
+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0];
|
||||
+ assert(render);
|
||||
+
|
||||
+ render->num_slices = 0;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/* End a hardware decoding based frame */
|
||||
+static int end_frame(AVCodecContext *avctx)
|
||||
+{
|
||||
+ VC1Context* const v = avctx->priv_data;
|
||||
+ MpegEncContext* const s = &v->s;
|
||||
+ struct xvba_render_state *render, *last, *next;
|
||||
+ XVBAPictureDescriptor *pic_descriptor;
|
||||
+
|
||||
+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0];
|
||||
+ assert(render);
|
||||
+
|
||||
+ if (render->picture_descriptor == 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ pic_descriptor = render->picture_descriptor;
|
||||
+
|
||||
+ av_dlog(avctx, "xvba_vc1_end_frame()\n");
|
||||
+
|
||||
+ memset(pic_descriptor, 0, sizeof(*pic_descriptor));
|
||||
+
|
||||
+ /* Fill in Parameters - for reference see AMD sdk documentation */
|
||||
+ pic_descriptor->profile = ff_xvba_translate_profile(v->profile);
|
||||
+ pic_descriptor->level = v->level;
|
||||
+ //done like in va-driver and vaapi
|
||||
+ if (v->profile == PROFILE_ADVANCED) {
|
||||
+ pic_descriptor->width_in_mb = s->avctx->coded_width;
|
||||
+ pic_descriptor->height_in_mb = s->avctx->coded_height;
|
||||
+ } else {
|
||||
+ pic_descriptor->width_in_mb = s->mb_width;
|
||||
+ pic_descriptor->height_in_mb = s->mb_height;
|
||||
+ }
|
||||
+ pic_descriptor->picture_structure = s->picture_structure;
|
||||
+ // xvba-video set this to 1 only 4:2:0 supported
|
||||
+ // doc says: if not set, choose 1 - we try this
|
||||
+ pic_descriptor->chroma_format = 1;
|
||||
+ pic_descriptor->avc_intra_flag = s->pict_type == FF_I_TYPE || v->bi_type == 1;
|
||||
+ pic_descriptor->avc_reference = (s->current_picture_ptr->f.reference & 3) ? 1 : 0;
|
||||
+
|
||||
+ // VC-1 explicit parameters see page 30 of sdk
|
||||
+ // sps_info
|
||||
+ pic_descriptor->sps_info.vc1.postprocflag = v->postprocflag;
|
||||
+
|
||||
+ // done as in vaapi
|
||||
+ pic_descriptor->sps_info.vc1.pulldown = v->broadcast;
|
||||
+ pic_descriptor->sps_info.vc1.interlace = v->interlace;
|
||||
+ pic_descriptor->sps_info.vc1.tfcntrflag = v->tfcntrflag;
|
||||
+ pic_descriptor->sps_info.vc1.finterpflag = v->finterpflag;
|
||||
+ pic_descriptor->sps_info.vc1.reserved = 1;
|
||||
+ // eventually check if this makes sense together with interlace
|
||||
+ pic_descriptor->sps_info.vc1.psf = v->psf;
|
||||
+ // what about if it is a frame (page 31)
|
||||
+ // looked at xvba-driver
|
||||
+ pic_descriptor->sps_info.vc1.second_field = !s->first_field;
|
||||
+ pic_descriptor->sps_info.vc1.xvba_vc1_sps_reserved = 0;
|
||||
+
|
||||
+ // VC-1 explicit parameters see page 30 of sdk
|
||||
+ // pps_info
|
||||
+ pic_descriptor->pps_info.vc1.panscan_flag = v->panscanflag;
|
||||
+ pic_descriptor->pps_info.vc1.refdist_flag = v->refdist_flag;
|
||||
+ pic_descriptor->pps_info.vc1.loopfilter = s->loop_filter;
|
||||
+ pic_descriptor->pps_info.vc1.fastuvmc = v->fastuvmc;
|
||||
+ pic_descriptor->pps_info.vc1.extended_mv = v->extended_mv;
|
||||
+ pic_descriptor->pps_info.vc1.dquant = v->dquant;
|
||||
+ pic_descriptor->pps_info.vc1.vstransform = v->vstransform;
|
||||
+ pic_descriptor->pps_info.vc1.overlap = v->overlap;
|
||||
+ pic_descriptor->pps_info.vc1.quantizer = v->quantizer_mode;
|
||||
+ pic_descriptor->pps_info.vc1.extended_dmv = v->extended_dmv;
|
||||
+ pic_descriptor->pps_info.vc1.maxbframes = s->avctx->max_b_frames;
|
||||
+ pic_descriptor->pps_info.vc1.rangered = (pic_descriptor->profile == PROFILE_SIMPLE) ? 0 : v->rangered;
|
||||
+ pic_descriptor->pps_info.vc1.syncmarker = (pic_descriptor->profile == PROFILE_SIMPLE) ? 0 : s->resync_marker;
|
||||
+ pic_descriptor->pps_info.vc1.multires = v->multires;
|
||||
+ pic_descriptor->pps_info.vc1.reserved = 1;
|
||||
+ pic_descriptor->pps_info.vc1.range_mapy_flag = v->range_mapy_flag;
|
||||
+ pic_descriptor->pps_info.vc1.range_mapy = v->range_mapy;
|
||||
+ pic_descriptor->pps_info.vc1.range_mapuv_flag = v->range_mapuv_flag;
|
||||
+ pic_descriptor->pps_info.vc1.range_mapuv = v->range_mapuv;
|
||||
+ pic_descriptor->pps_info.vc1.xvba_vc1_pps_reserved = 0;
|
||||
+
|
||||
+ pic_descriptor->past_surface = 0;
|
||||
+ pic_descriptor->future_surface = 0;
|
||||
+ switch (s->pict_type) {
|
||||
+ case FF_B_TYPE:
|
||||
+ next = (struct xvba_render_state *)s->next_picture.f.data[0];
|
||||
+ assert(next);
|
||||
+ if (next)
|
||||
+ pic_descriptor->past_surface = next->surface;
|
||||
+ // fall-through
|
||||
+ case FF_P_TYPE:
|
||||
+ last = (struct xvba_render_state *)s->last_picture.f.data[0];
|
||||
+ assert(last);
|
||||
+ if (last)
|
||||
+ pic_descriptor->future_surface = last->surface;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ ff_draw_horiz_band(s, 0, s->avctx->height);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
|
||||
+{
|
||||
+ VC1Context* const v = avctx->priv_data;
|
||||
+ MpegEncContext* const s = &v->s;
|
||||
+ struct xvba_render_state *render;
|
||||
+
|
||||
+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0];
|
||||
+ assert(render);
|
||||
+
|
||||
+ if (avctx->codec_id == CODEC_ID_VC1 &&
|
||||
+ size >= 4 && IS_MARKER(AV_RB32(buffer))) {
|
||||
+ buffer += 4;
|
||||
+ size -= 4;
|
||||
+ }
|
||||
+
|
||||
+ ff_xvba_add_slice_data(render, buffer, size);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#if CONFIG_WMV3_XVBA_HWACCEL
|
||||
+AVHWAccel ff_wmv3_xvba_hwaccel = {
|
||||
+ .name = "wmv3_xvba",
|
||||
+ .type = AVMEDIA_TYPE_VIDEO,
|
||||
+ .id = CODEC_ID_WMV3,
|
||||
+ .pix_fmt = PIX_FMT_XVBA_VLD,
|
||||
+ .capabilities = 0,
|
||||
+ .start_frame = start_frame,
|
||||
+ .end_frame = end_frame,
|
||||
+ .decode_slice = decode_slice,
|
||||
+ .priv_data_size = 0,
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
+AVHWAccel ff_vc1_xvba_hwaccel = {
|
||||
+ .name = "vc1_xvba",
|
||||
+ .type = AVMEDIA_TYPE_VIDEO,
|
||||
+ .id = CODEC_ID_VC1,
|
||||
+ .pix_fmt = PIX_FMT_XVBA_VLD,
|
||||
+ .capabilities = 0,
|
||||
+ .start_frame = start_frame,
|
||||
+ .end_frame = end_frame,
|
||||
+ .decode_slice = decode_slice,
|
||||
+ .priv_data_size = 0,
|
||||
+};
|
||||
diff -Naur a/libavcodec/xvmc_internal.h b/libavcodec/xvmc_internal.h
|
||||
--- a/libavcodec/xvmc_internal.h 2012-05-12 21:45:48.572627784 +0200
|
||||
+++ b/libavcodec/xvmc_internal.h 2012-05-12 21:46:03.922936840 +0200
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
- * XVideo Motion Compensation internal functions
|
||||
+ * HW decode acceleration for MPEG-2, H.264 and VC-1
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
diff -Naur a/libavutil/pixdesc.c b/libavutil/pixdesc.c
|
||||
--- a/libavutil/pixdesc.c 2012-05-12 21:45:49.442645301 +0200
|
||||
+++ b/libavutil/pixdesc.c 2012-05-12 21:46:03.923936860 +0200
|
||||
@@ -874,6 +874,12 @@
|
||||
.log2_chroma_h = 1,
|
||||
.flags = PIX_FMT_HWACCEL,
|
||||
},
|
||||
+ [PIX_FMT_XVBA_VLD] = {
|
||||
+ .name = "xvba_vld",
|
||||
+ .log2_chroma_w = 1,
|
||||
+ .log2_chroma_h = 1,
|
||||
+ .flags = PIX_FMT_HWACCEL,
|
||||
+ },
|
||||
[PIX_FMT_YUV420P9LE] = {
|
||||
.name = "yuv420p9le",
|
||||
.nb_components = 3,
|
||||
diff -Naur a/libavutil/pixfmt.h b/libavutil/pixfmt.h
|
||||
--- a/libavutil/pixfmt.h 2012-05-12 21:45:49.445645361 +0200
|
||||
+++ b/libavutil/pixfmt.h 2012-05-12 21:46:03.924936880 +0200
|
||||
@@ -129,6 +129,7 @@
|
||||
PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
|
||||
PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
|
||||
+ PIX_FMT_XVBA_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
|
||||
PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
|
||||
PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
|
@ -0,0 +1,50 @@
|
||||
From 1f4d4832065673eaa989bd8d45f55703d8a135ab Mon Sep 17 00:00:00 2001
|
||||
From: xbmc <xbmc@AD02.(none)>
|
||||
Date: Mon, 30 Apr 2012 13:58:29 +0200
|
||||
Subject: [PATCH] ffmpeg: xvba, adapt to new ffmpeg, fix artifacts for h.264
|
||||
|
||||
---
|
||||
libavcodec/xvba_h264.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/xvba_h264.c b/libavcodec/xvba_h264.c
|
||||
index 1f737b0..9be6ffb 100644
|
||||
--- a/libavcodec/xvba_h264.c
|
||||
+++ b/libavcodec/xvba_h264.c
|
||||
@@ -91,7 +91,7 @@ static int end_frame(AVCodecContext *avctx)
|
||||
pic_descriptor->height_in_mb = s->mb_height;
|
||||
pic_descriptor->picture_structure = s->picture_structure;
|
||||
pic_descriptor->chroma_format = s->chroma_format ? s->chroma_format : 1;
|
||||
- pic_descriptor->avc_intra_flag = (h->slice_type == FF_I_TYPE) ? 1 : 0;
|
||||
+ pic_descriptor->avc_intra_flag = (h->slice_type == AV_PICTURE_TYPE_I) ? 1 : 0;
|
||||
pic_descriptor->avc_reference = (s->current_picture_ptr->f.reference & 3) ? 1 : 0;
|
||||
|
||||
pic_descriptor->avc_bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8;
|
||||
@@ -136,11 +136,12 @@ static int end_frame(AVCodecContext *avctx)
|
||||
pic_descriptor->pps_info.avc.xvba_avc_pps_reserved = 0; // must be 0
|
||||
|
||||
memcpy(iq_matrix->bScalingLists4x4, h->pps.scaling_matrix4, sizeof(iq_matrix->bScalingLists4x4));
|
||||
- memcpy(iq_matrix->bScalingLists8x8, h->pps.scaling_matrix8, sizeof(iq_matrix->bScalingLists8x8));
|
||||
+ memcpy(iq_matrix->bScalingLists8x8[0], h->pps.scaling_matrix8[0], sizeof(iq_matrix->bScalingLists8x8[0]));
|
||||
+ memcpy(iq_matrix->bScalingLists8x8[1], h->pps.scaling_matrix8[3], sizeof(iq_matrix->bScalingLists8x8[0]));
|
||||
|
||||
// Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs
|
||||
if (!h->got_first_iframe) {
|
||||
- if (h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE)
|
||||
+ if (h->slice_type != AV_PICTURE_TYPE_I && h->slice_type != AV_PICTURE_TYPE_SI)
|
||||
return -1;
|
||||
h->got_first_iframe = 1;
|
||||
}
|
||||
@@ -172,9 +173,7 @@ static int decode_slice(AVCodecContext *avctx,
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = CODEC_ID_H264,
|
||||
.pix_fmt = PIX_FMT_XVBA_VLD,
|
||||
- .capabilities = 0,
|
||||
.start_frame = start_frame,
|
||||
.end_frame = end_frame,
|
||||
.decode_slice = decode_slice,
|
||||
- .priv_data_size = 0,
|
||||
};
|
||||
--
|
||||
1.7.10
|
||||
|
@ -0,0 +1,64 @@
|
||||
From 81d1514a1daf379d58c61080244bb01c7ee7e662 Mon Sep 17 00:00:00 2001
|
||||
From: fritsch <peter.fruehberger@gmail.com>
|
||||
Date: Mon, 30 Apr 2012 21:33:18 +0200
|
||||
Subject: [PATCH] xvba: (VC-1) rename FF_P_TYPE, FF_B_TYPE and FF_I_TYPE to
|
||||
new ffmpeg conventions
|
||||
|
||||
---
|
||||
libavcodec/xvba_vc1.c | 10 +++-------
|
||||
1 file changed, 3 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/xvba_vc1.c b/libavcodec/xvba_vc1.c
|
||||
index c202b9c..7315b62 100644
|
||||
--- a/libavcodec/xvba_vc1.c
|
||||
+++ b/libavcodec/xvba_vc1.c
|
||||
@@ -82,7 +82,7 @@ static int end_frame(AVCodecContext *avctx)
|
||||
// xvba-video set this to 1 only 4:2:0 supported
|
||||
// doc says: if not set, choose 1 - we try this
|
||||
pic_descriptor->chroma_format = 1;
|
||||
- pic_descriptor->avc_intra_flag = s->pict_type == FF_I_TYPE || v->bi_type == 1;
|
||||
+ pic_descriptor->avc_intra_flag = s->pict_type == AV_PICTURE_TYPE_I || v->bi_type == 1;
|
||||
pic_descriptor->avc_reference = (s->current_picture_ptr->f.reference & 3) ? 1 : 0;
|
||||
|
||||
// VC-1 explicit parameters see page 30 of sdk
|
||||
@@ -128,13 +128,13 @@ static int end_frame(AVCodecContext *avctx)
|
||||
pic_descriptor->past_surface = 0;
|
||||
pic_descriptor->future_surface = 0;
|
||||
switch (s->pict_type) {
|
||||
- case FF_B_TYPE:
|
||||
+ case AV_PICTURE_TYPE_B:
|
||||
next = (struct xvba_render_state *)s->next_picture.f.data[0];
|
||||
assert(next);
|
||||
if (next)
|
||||
pic_descriptor->past_surface = next->surface;
|
||||
// fall-through
|
||||
- case FF_P_TYPE:
|
||||
+ case AV_PICTURE_TYPE_P:
|
||||
last = (struct xvba_render_state *)s->last_picture.f.data[0];
|
||||
assert(last);
|
||||
if (last)
|
||||
@@ -173,11 +173,9 @@ static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t s
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = CODEC_ID_WMV3,
|
||||
.pix_fmt = PIX_FMT_XVBA_VLD,
|
||||
- .capabilities = 0,
|
||||
.start_frame = start_frame,
|
||||
.end_frame = end_frame,
|
||||
.decode_slice = decode_slice,
|
||||
- .priv_data_size = 0,
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -186,9 +184,7 @@ static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t s
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = CODEC_ID_VC1,
|
||||
.pix_fmt = PIX_FMT_XVBA_VLD,
|
||||
- .capabilities = 0,
|
||||
.start_frame = start_frame,
|
||||
.end_frame = end_frame,
|
||||
.decode_slice = decode_slice,
|
||||
- .priv_data_size = 0,
|
||||
};
|
||||
--
|
||||
1.7.10
|
||||
|
Loading…
x
Reference in New Issue
Block a user