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:
Stephan Raue
2012-06-05 07:50:30 +02:00
parent 8d881d1373
commit 34975f1b00
35 changed files with 2694 additions and 0 deletions

231
packages/multimedia/ffmpeg/build Executable file
View 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

View 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

View 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"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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(&timestamp, 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More