- Add some fixes for the FFmpeg decoder

- Enable the libvpx decoder as a means of working around a bug
  with Xine's VP9 decoder via FFmpeg
- Add Opus support

ok sthen@
This commit is contained in:
brad 2014-05-21 23:41:03 +00:00
parent c168c9a31d
commit 7bbb4f54f6
8 changed files with 148 additions and 21 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.110 2014/05/14 08:07:24 brad Exp $
# $OpenBSD: Makefile,v 1.111 2014/05/21 23:41:03 brad Exp $
SHARED_ONLY= Yes
@ -9,7 +9,7 @@ CATEGORIES= multimedia
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=xine/}
EXTRACT_SUFX= .tar.xz
REVISION= 0
REVISION= 1
SHARED_LIBS= xine 31.0
@ -25,7 +25,8 @@ WANTLIB= FLAC GL GLU ICE SDL SM X11 Xext Xinerama Xv XvMCW a52 avcodec \
avformat avutil bluray c cdio dca dvdnav dvdread expat faad \
fontconfig freetype iso9660 jpeg m mad modplug mpcdec mng ogg \
postproc pthread pthread-stubs sndio speex theora usbhid vcdinfo \
vorbis wavpack xcb-shape xcb-shm xcb-xv xcb xdg-basedir xml2 z
vorbis vpx>=5 wavpack xcb-shape xcb-shm xcb-xv xcb xdg-basedir \
xml2 z
XINEAPI_REV= 2.4
SUBST_VARS+= XINEAPI_REV
@ -51,6 +52,7 @@ LIB_DEPENDS= audio/faad \
multimedia/libbluray \
multimedia/libdvdnav \
multimedia/libtheora \
multimedia/libvpx>=1.3.0 \
x11/libxdg-basedir
# Add back fast math flag since we override CFLAGS
@ -70,7 +72,6 @@ CONFIGURE_ARGS+=--disable-aalib \
--disable-optimizations \
--disable-real-codecs \
--disable-samba \
--disable-vpx \
--disable-w32dll \
--with-external-dvdnav \
--with-fontconfig \

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-include_xine_buffer_h,v 1.1 2014/05/21 23:41:03 brad Exp $
Add buffer type for Opus.
--- include/xine/buffer.h.orig Wed May 21 09:33:56 2014
+++ include/xine/buffer.h Wed May 21 09:34:30 2014
@@ -272,6 +272,7 @@ extern "C" {
#define BUF_AUDIO_EAC3 0x03410000
#define BUF_AUDIO_AAC_LATM 0x03420000
#define BUF_AUDIO_ADPCM_G726 0x03430000
+#define BUF_AUDIO_OPUS 0x03440000
/*@}*/
/**

View File

@ -1,10 +1,20 @@
$OpenBSD: patch-src_combined_ffmpeg_ff_video_decoder_c,v 1.16 2014/05/14 08:07:24 brad Exp $
$OpenBSD: patch-src_combined_ffmpeg_ff_video_decoder_c,v 1.17 2014/05/21 23:41:03 brad Exp $
Attempt to fix FFmpeg VP9 segfault.
- Simplify FFmpeg video edge handling.
- Add DR1 reenable message.
- Fix multithreading.
--- src/combined/ffmpeg/ff_video_decoder.c.orig Thu Mar 13 00:06:09 2014
+++ src/combined/ffmpeg/ff_video_decoder.c Tue May 13 21:11:15 2014
@@ -406,9 +406,11 @@ static int get_buffer (AVCodecContext *context, AVFram
+++ src/combined/ffmpeg/ff_video_decoder.c Tue May 20 14:04:56 2014
@@ -278,6 +278,7 @@ static int get_buffer (AVCodecContext *context, AVFram
/* The visible size, may be smaller. */
int width = context->width;
int height = context->height;
+ int top_edge;
int guarded_render = 0;
/* A bit of unmotivated paranoia... */
@@ -406,9 +407,14 @@ static int get_buffer (AVCodecContext *context, AVFram
#endif /* ENABLE_VAAPI */
/* The alignment rhapsody */
@ -15,11 +25,26 @@ Attempt to fix FFmpeg VP9 segfault.
+ buf_width += 2 * this->edge + 31;
+ buf_width &= ~31;
+ /* 2 extra lines for the edge wrap below plus XINE requirement */
+ buf_height += 2 * this->edge + 2 + 15;
+ top_edge = this->edge;
+ if (top_edge)
+ top_edge += 2;
+ buf_height += top_edge + this->edge + 15;
buf_height &= ~15;
if ((this->full2mpeg || (this->context->pix_fmt != PIX_FMT_YUV420P &&
@@ -503,12 +505,15 @@ static int get_buffer (AVCodecContext *context, AVFram
@@ -449,7 +455,10 @@ static int get_buffer (AVCodecContext *context, AVFram
}
}
- this->is_direct_rendering_disabled = 0;
+ if (this->is_direct_rendering_disabled) {
+ xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: direct rendering enabled\n"));
+ this->is_direct_rendering_disabled = 0;
+ }
img = this->stream->video_out->get_frame (this->stream->video_out,
buf_width,
@@ -503,13 +512,15 @@ static int get_buffer (AVCodecContext *context, AVFram
av_frame->linesize[2] = img->pitches[2];
if (this->output_format == XINE_IMGFMT_YV12) {
@ -27,16 +52,35 @@ Attempt to fix FFmpeg VP9 segfault.
- av_frame->data[1] += (img->pitches[1] + 1) * this->edge / 2;
- av_frame->data[2] += (img->pitches[2] + 1) * this->edge / 2;
- img->crop_left = this->edge;
+ /* nasty hack: wrap right edge to the left side when needed to get proper
+ SSE2 alignment on all planes. */
+ int left_edge = (this->edge + 31) & ~31;
+ av_frame->data[0] += img->pitches[0] * this->edge + left_edge;
+ av_frame->data[1] += (img->pitches[1] * this->edge + left_edge) / 2;
+ av_frame->data[2] += (img->pitches[2] * this->edge + left_edge) / 2;
+ img->crop_left = left_edge;
img->crop_top = this->edge;
- img->crop_top = this->edge;
- img->crop_right = buf_width - width - this->edge;
+ img->crop_right = buf_width - width - left_edge;
img->crop_bottom = buf_height - height - this->edge;
- img->crop_bottom = buf_height - height - this->edge;
+ /* nasty hack: wrap left edge to the right side to get proper
+ SSE2 alignment on all planes. */
+ av_frame->data[0] += img->pitches[0] * top_edge;
+ av_frame->data[1] += img->pitches[1] * top_edge / 2;
+ av_frame->data[2] += img->pitches[2] * top_edge / 2;
+ img->crop_left = 0;
+ img->crop_top = top_edge;
+ img->crop_right = buf_width - width;
+ img->crop_bottom = buf_height - height - top_edge;
}
/* We should really keep track of the ages of xine frames (see
@@ -2280,6 +2291,7 @@ static void ff_free_dr1_frames (ff_video_decoder_t *th
They will only be replaced when new ones arrive, and freed on codec close.
They also have no AVCodec.flush () callback for manual freeing (that is,
avcodec_flush_buffers () does nothing).
+ Even worse: multithreading seems to always do it like that...
So lets tolerate this behaviour on plain stream seek. */
if (!all) {
it = NULL;
@@ -2288,7 +2300,7 @@ static void ff_free_dr1_frames (ff_video_decoder_t *th
frames++;
if (!frames)
return;
- if (frames < 5) {
+ if (frames < 12) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
"ffmpeg_video_dec: tolerating %d held DR1 frames.\n", frames);
return;

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-src_combined_ffmpeg_xine_audio_list,v 1.1 2014/05/21 23:41:03 brad Exp $
Enable Opus decoder.
--- src/combined/ffmpeg/xine_audio.list.orig Wed May 21 09:37:06 2014
+++ src/combined/ffmpeg/xine_audio.list Wed May 21 09:37:32 2014
@@ -46,6 +46,7 @@ AAC AAC MPEG4
AAC_LATM AAC_LATM AAC LATM
ADPCM_G726 ADPCM_G726 ADPCM G726
QCLP QCELP QualComm Purevoice
+OPUS OPUS Opus Audio
# disabled codecs (ref. configure.ac)
! AC3

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-src_demuxers_demux_matroska_c,v 1.13 2014/05/21 23:41:03 brad Exp $
Demux Opus.
--- src/demuxers/demux_matroska.c.orig Wed May 21 09:35:32 2014
+++ src/demuxers/demux_matroska.c Wed May 21 09:36:08 2014
@@ -1425,6 +1425,11 @@ static int parse_track_entry(demux_matroska_t *this, m
track->buf_type = BUF_AUDIO_VORBIS;
init_codec = init_codec_xiph;
+ } else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_OPUS)) {
+ lprintf("MATROSKA_CODEC_ID_A_OPUS\n");
+ track->buf_type = BUF_AUDIO_OPUS;
+ init_codec = init_codec_audio;
+
} else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_ACM)) {
xine_waveformatex *wfh;
lprintf("MATROSKA_CODEC_ID_A_ACM\n");

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-src_demuxers_matroska_h,v 1.8 2014/05/21 23:41:03 brad Exp $
Demux Opus.
--- src/demuxers/matroska.h.orig Wed May 21 09:36:13 2014
+++ src/demuxers/matroska.h Wed May 21 09:36:39 2014
@@ -337,6 +337,7 @@ struct matroska_track_s {
#define MATROSKA_CODEC_ID_A_REAL_RALF "A_REAL/RALF"
#define MATROSKA_CODEC_ID_A_REAL_ATRC "A_REAL/ATRC"
#define MATROSKA_CODEC_ID_A_FLAC "A_FLAC"
+#define MATROSKA_CODEC_ID_A_OPUS "A_OPUS"
#define MATROSKA_CODEC_ID_S_TEXT_UTF8 "S_TEXT/UTF8"
#define MATROSKA_CODEC_ID_S_TEXT_SSA "S_TEXT/SSA"

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-src_xine-engine_buffer_types_c,v 1.5 2014/05/21 23:41:03 brad Exp $
Add buffer type for Opus.
--- src/xine-engine/buffer_types.c.orig Wed May 21 09:34:46 2014
+++ src/xine-engine/buffer_types.c Wed May 21 09:35:11 2014
@@ -1231,6 +1231,14 @@ static const audio_db_t audio_db[] = {
BUF_AUDIO_ADPCM_G726,
"ADPCM G.726"
},
+{
+ {
+ ME_FOURCC('O', 'p', 'u', 's'),
+ 0
+ },
+ BUF_AUDIO_OPUS,
+ "Opus Audio"
+},
{ { 0 }, 0, "last entry" }
};

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.19 2013/06/15 22:58:24 brad Exp $
@comment $OpenBSD: PLIST,v 1.20 2014/05/21 23:41:03 brad Exp $
@conflict xine-lib-arts-*
@conflict xine-lib-esd-*
@conflict xine-lib-jack-*
@ -78,6 +78,7 @@ lib/xine/plugins/${XINEAPI_REV}/xineplug_decode_faad.so
lib/xine/plugins/${XINEAPI_REV}/xineplug_decode_ff.so
lib/xine/plugins/${XINEAPI_REV}/xineplug_decode_gsm610.so
lib/xine/plugins/${XINEAPI_REV}/xineplug_decode_libjpeg.so
lib/xine/plugins/${XINEAPI_REV}/xineplug_decode_libvpx.so
lib/xine/plugins/${XINEAPI_REV}/xineplug_decode_lpcm.so
lib/xine/plugins/${XINEAPI_REV}/xineplug_decode_mad.so
lib/xine/plugins/${XINEAPI_REV}/xineplug_decode_mpc.so