summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorTaylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>2015-03-04 16:29:08 +0100
committerTaylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>2015-03-22 21:59:37 +0100
commit38829eac4ba820daeaa8911187b841276e6990a9 (patch)
tree5d30654f958d97fae052f3565a083eca8969d810 /gnu
parent9d297fae5f42300909d0a9b8031c14f4c332ed9e (diff)
gnu: Add mplayer2.
* gnu/packages/video.scm (mplayer2): New variable. * gnu/packages/patches/mplayer2-theora-fix.patch: New file. * gnu-system.am (dist_patch_DATA): Add it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/patches/mplayer2-theora-fix.patch286
-rw-r--r--gnu/packages/video.scm124
2 files changed, 410 insertions, 0 deletions
diff --git a/gnu/packages/patches/mplayer2-theora-fix.patch b/gnu/packages/patches/mplayer2-theora-fix.patch
new file mode 100644
index 0000000000..982db5f57c
--- /dev/null
+++ b/gnu/packages/patches/mplayer2-theora-fix.patch
@@ -0,0 +1,286 @@
+Fix libtheora linking issue with modern theora versions.
+
+Adapted from:
+http://git.buildroot.net/buildroot/commit/?id=46b71cb0be27c0e6b7c93afb49fc80779bf310e3
+
+--- a/libmpcodecs/vd_theora.c
++++ b/libmpcodecs/vd_theora.c
+@@ -39,22 +39,23 @@
+
+ LIBVD_EXTERN(theora)
+
+-#include <theora/theora.h>
++#include <theora/theoradec.h>
+
+ #define THEORA_NUM_HEADER_PACKETS 3
+
+ typedef struct theora_struct_st {
+- theora_state st;
+- theora_comment cc;
+- theora_info inf;
++ th_setup_info *tsi;
++ th_dec_ctx *tctx;
++ th_comment tc;
++ th_info ti;
+ } theora_struct_t;
+
+ /** Convert Theora pixelformat to the corresponding IMGFMT_ */
+-static uint32_t theora_pixelformat2imgfmt(theora_pixelformat fmt){
++static uint32_t theora_pixelformat2imgfmt(th_pixel_fmt fmt){
+ switch(fmt) {
+- case OC_PF_420: return IMGFMT_YV12;
+- case OC_PF_422: return IMGFMT_422P;
+- case OC_PF_444: return IMGFMT_444P;
++ case TH_PF_420: return IMGFMT_YV12;
++ case TH_PF_422: return IMGFMT_422P;
++ case TH_PF_444: return IMGFMT_444P;
+ }
+ return 0;
+ }
+@@ -64,7 +65,7 @@
+ theora_struct_t *context = sh->context;
+ switch(cmd) {
+ case VDCTRL_QUERY_FORMAT:
+- if (*(int*)arg == theora_pixelformat2imgfmt(context->inf.pixelformat))
++ if (*(int*)arg == theora_pixelformat2imgfmt(context->ti.pixel_fmt))
+ return CONTROL_TRUE;
+ return CONTROL_FALSE;
+ }
+@@ -88,8 +89,9 @@
+ if (!context)
+ goto err_out;
+
+- theora_info_init(&context->inf);
+- theora_comment_init(&context->cc);
++ th_info_init(&context->ti);
++ th_comment_init(&context->tc);
++ context->tsi = NULL;
+
+ /* Read all header packets, pass them to theora_decode_header. */
+ for (i = 0; i < THEORA_NUM_HEADER_PACKETS; i++)
+@@ -109,7 +111,7 @@
+ op.b_o_s = 1;
+ }
+
+- if ( (errorCode = theora_decode_header (&context->inf, &context->cc, &op)) )
++ if ( (errorCode = th_decode_headerin (&context->ti, &context->tc, &context->tsi, &op)) < 0)
+ {
+ mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Broken Theora header; errorCode=%i!\n", errorCode);
+ goto err_out;
+@@ -117,23 +119,25 @@
+ }
+
+ /* now init codec */
+- errorCode = theora_decode_init (&context->st, &context->inf);
+- if (errorCode)
++ context->tctx = th_decode_alloc (&context->ti, context->tsi);
++ if (!context->tctx)
+ {
+- mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode init failed: %i \n", errorCode);
++ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode init failed\n");
+ goto err_out;
+ }
++ /* free memory used for decoder setup information */
++ th_setup_free(context->tsi);
+
+- if(sh->aspect==0.0 && context->inf.aspect_denominator!=0)
++ if(sh->aspect==0.0 && context->ti.aspect_denominator!=0)
+ {
+- sh->aspect = ((double)context->inf.aspect_numerator * context->inf.width)/
+- ((double)context->inf.aspect_denominator * context->inf.height);
++ sh->aspect = ((double)context->ti.aspect_numerator * context->ti.frame_width)/
++ ((double)context->ti.aspect_denominator * context->ti.frame_height);
+ }
+
+ mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Theora video init ok!\n");
+- mp_msg(MSGT_DECVIDEO,MSGL_INFO,"Frame: %dx%d, Picture %dx%d, Offset [%d,%d]\n", context->inf.width, context->inf.height, context->inf.frame_width, context->inf.frame_height, context->inf.offset_x, context->inf.offset_y);
++ mp_msg(MSGT_DECVIDEO,MSGL_INFO,"Frame: %dx%d, Picture %dx%d, Offset [%d,%d]\n", context->ti.frame_width, context->ti.frame_height, context->ti.pic_width, context->ti.pic_height, context->ti.pic_x, context->ti.pic_y);
+
+- return mpcodecs_config_vo (sh,context->inf.width,context->inf.height,theora_pixelformat2imgfmt(context->inf.pixelformat));
++ return mpcodecs_config_vo (sh,context->ti.frame_width,context->ti.frame_height,theora_pixelformat2imgfmt(context->ti.pixel_fmt));
+
+ err_out:
+ free(context);
+@@ -150,9 +154,9 @@
+
+ if (context)
+ {
+- theora_info_clear(&context->inf);
+- theora_comment_clear(&context->cc);
+- theora_clear (&context->st);
++ th_info_clear(&context->ti);
++ th_comment_clear(&context->tc);
++ th_decode_free (context->tctx);
+ free (context);
+ }
+ }
+@@ -165,7 +169,7 @@
+ theora_struct_t *context = sh->context;
+ int errorCode = 0;
+ ogg_packet op;
+- yuv_buffer yuv;
++ th_ycbcr_buffer ycbcrbuf;
+ mp_image_t* mpi;
+
+ // no delayed frames
+@@ -177,31 +181,31 @@
+ op.packet = data;
+ op.granulepos = -1;
+
+- errorCode = theora_decode_packetin (&context->st, &op);
+- if (errorCode)
++ errorCode = th_decode_packetin (context->tctx, &op, NULL);
++ if (errorCode < 0)
+ {
+ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode packetin failed: %i \n",
+ errorCode);
+ return NULL;
+ }
+
+- errorCode = theora_decode_YUVout (&context->st, &yuv);
+- if (errorCode)
++ errorCode = th_decode_ycbcr_out (context->tctx, ycbcrbuf);
++ if (errorCode < 0)
+ {
+ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode YUVout failed: %i \n",
+ errorCode);
+ return NULL;
+ }
+
+- mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, yuv.y_width, yuv.y_height);
++ mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, ycbcrbuf[0].width, ycbcrbuf[0].height);
+ if(!mpi) return NULL;
+
+- mpi->planes[0]=yuv.y;
+- mpi->stride[0]=yuv.y_stride;
+- mpi->planes[1]=yuv.u;
+- mpi->stride[1]=yuv.uv_stride;
+- mpi->planes[2]=yuv.v;
+- mpi->stride[2]=yuv.uv_stride;
++ mpi->planes[0]=ycbcrbuf[0].data;
++ mpi->stride[0]=ycbcrbuf[0].stride;
++ mpi->planes[1]=ycbcrbuf[1].data;
++ mpi->stride[1]=ycbcrbuf[1].stride;
++ mpi->planes[2]=ycbcrbuf[2].data;
++ mpi->stride[2]=ycbcrbuf[2].stride;
+
+ return mpi;
+ }
+--- a/libmpdemux/demux_ogg.c
++++ b/libmpdemux/demux_ogg.c
+@@ -49,21 +49,21 @@
+ #endif
+
+ #ifdef CONFIG_OGGTHEORA
+-#include <theora/theora.h>
+-int _ilog (unsigned int); /* defined in many places in theora/lib/ */
++#include <theora/theoradec.h>
+ #endif
+
+ #define BLOCK_SIZE 4096
+
+ /* Theora decoder context : we won't be able to interpret granule positions
+- * without using theora_granule_time with the theora_state of the stream.
++ * without using th_granule_time with the th_dec_ctx of the stream.
+ * This is duplicated in `vd_theora.c'; put this in a common header?
+ */
+ #ifdef CONFIG_OGGTHEORA
+ typedef struct theora_struct_st {
+- theora_state st;
+- theora_comment cc;
+- theora_info inf;
++ th_setup_info *tsi;
++ th_dec_ctx *tctx;
++ th_comment tc;
++ th_info ti;
+ } theora_struct_t;
+ #endif
+
+@@ -116,7 +116,7 @@
+ float samplerate; /// granulpos 2 time
+ int64_t lastpos;
+ int32_t lastsize;
+- int keyframe_frequency_force;
++ int keyframe_granule_shift;
+
+ // Logical stream state
+ ogg_stream_state stream;
+@@ -299,11 +299,10 @@
+ have theora_state st, until all header packets were passed to the
+ decoder. */
+ if (!pack->bytes || !(*data&0x80)) {
+- int keyframe_granule_shift = _ilog(os->keyframe_frequency_force - 1);
+- int64_t iframemask = (1 << keyframe_granule_shift) - 1;
++ int64_t iframemask = (1 << os->keyframe_granule_shift) - 1;
+
+ if (pack->granulepos >= 0) {
+- os->lastpos = pack->granulepos >> keyframe_granule_shift;
++ os->lastpos = pack->granulepos >> os->keyframe_granule_shift;
+ os->lastpos += pack->granulepos & iframemask;
+ *flags = (pack->granulepos & iframemask) == 0;
+ } else {
+@@ -892,14 +891,15 @@
+ #ifdef CONFIG_OGGTHEORA
+ } else if (pack.bytes >= 7 && !strncmp (&pack.packet[1], "theora", 6)) {
+ int errorCode = 0;
+- theora_info inf;
+- theora_comment cc;
++ th_info ti;
++ th_comment tc;
++ th_setup_info *tsi = NULL;
+
+- theora_info_init (&inf);
+- theora_comment_init (&cc);
++ th_info_init (&ti);
++ th_comment_init (&tc);
+
+- errorCode = theora_decode_header (&inf, &cc, &pack);
+- if (errorCode) {
++ errorCode = th_decode_headerin(&ti, &tc, &tsi, &pack);
++ if (errorCode < 0) {
+ mp_msg(MSGT_DEMUX, MSGL_ERR,
+ "Theora header parsing failed: %i \n", errorCode);
+ } else {
+@@ -908,30 +908,32 @@
+ sh_v->bih = calloc(1, sizeof(*sh_v->bih));
+ sh_v->bih->biSize = sizeof(*sh_v->bih);
+ sh_v->bih->biCompression = sh_v->format = FOURCC_THEORA;
+- sh_v->fps = ((double)inf.fps_numerator) / (double)inf.fps_denominator;
+- sh_v->frametime = ((double)inf.fps_denominator) / (double)inf.fps_numerator;
+- sh_v->disp_w = sh_v->bih->biWidth = inf.frame_width;
+- sh_v->disp_h = sh_v->bih->biHeight = inf.frame_height;
++ sh_v->fps = ((double)ti.fps_numerator) / (double)ti.fps_denominator;
++ sh_v->frametime = ((double)ti.fps_denominator) / (double)ti.fps_numerator;
++ sh_v->i_bps = ti.target_bitrate / 8;
++ sh_v->disp_w = sh_v->bih->biWidth = ti.frame_width;
++ sh_v->disp_h = sh_v->bih->biHeight = ti.frame_height;
+ sh_v->bih->biBitCount = 24;
+ sh_v->bih->biPlanes = 3;
+ sh_v->bih->biSizeImage = ((sh_v->bih->biBitCount / 8) * sh_v->bih->biWidth * sh_v->bih->biHeight);
+ ogg_d->subs[ogg_d->num_sub].samplerate = sh_v->fps;
+ ogg_d->subs[ogg_d->num_sub].theora = 1;
+- ogg_d->subs[ogg_d->num_sub].keyframe_frequency_force = inf.keyframe_frequency_force;
++ ogg_d->subs[ogg_d->num_sub].keyframe_granule_shift = ti.keyframe_granule_shift;
+ ogg_d->subs[ogg_d->num_sub].id = n_video;
+ n_video++;
+ mp_msg(MSGT_DEMUX, MSGL_INFO,
+ "[Ogg] stream %d: video (Theora v%d.%d.%d), -vid %d\n",
+ ogg_d->num_sub,
+- (int)inf.version_major,
+- (int)inf.version_minor,
+- (int)inf.version_subminor,
++ (int)ti.version_major,
++ (int)ti.version_minor,
++ (int)ti.version_subminor,
+ n_video - 1);
+ if (mp_msg_test(MSGT_HEADER, MSGL_V))
+ print_video_header(sh_v->bih, MSGL_V);
+ }
+- theora_comment_clear(&cc);
+- theora_info_clear(&inf);
++ th_comment_clear(&tc);
++ th_info_clear(&ti);
++ th_setup_free(tsi);
+ #endif /* CONFIG_OGGTHEORA */
+ } else if (pack.bytes >= 4 && !strncmp (&pack.packet[0], "fLaC", 4)) {
+ sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio, NULL);
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index ce26812aec..a7f39b8249 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -26,6 +26,7 @@
fsf-free isc))
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix git-download)
#:use-module (guix build-system cmake)
#:use-module (guix build-system gnu)
#:use-module (guix build-system python)
@@ -34,6 +35,7 @@
#:use-module (gnu packages audio)
#:use-module (gnu packages autotools)
#:use-module (gnu packages avahi)
+ #:use-module (gnu packages base)
#:use-module (gnu packages cdrom)
#:use-module (gnu packages compression)
#:use-module (gnu packages databases)
@@ -42,6 +44,7 @@
#:use-module (gnu packages fontutils)
#:use-module (gnu packages fribidi)
#:use-module (gnu packages gettext)
+ #:use-module (gnu packages ghostscript)
#:use-module (gnu packages gl)
#:use-module (gnu packages glib)
#:use-module (gnu packages guile)
@@ -59,6 +62,7 @@
#:use-module (gnu packages pulseaudio)
#:use-module (gnu packages python)
#:use-module (gnu packages qt)
+ #:use-module (gnu packages samba)
#:use-module (gnu packages sdl)
#:use-module (gnu packages ssh)
#:use-module (gnu packages texlive)
@@ -512,6 +516,126 @@ NuppelVideo, FLI, YUV4MPEG, FILM, RoQ, PVA files. One can watch VideoCD,
SVCD, DVD, 3ivx, DivX 3/4/5, WMV and H.264 movies.")
(license gpl2)))
+;;; This is not version 2; it's a fork literally named "mplayer2".
+(define-public mplayer2
+ (package
+ (name "mplayer2")
+ ;; There are no tarballs. The 2.0 git tag, which is actually the first
+ ;; release is from 2011. The latest commit is from 2013 October, so we
+ ;; use that commit.
+ (version "201310")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ ;; XXX Change this if mplayer2.org goes up again.
+ (url "http://repo.or.cz/mplayer2.git")
+ (commit "2c378c71a4d9b1df382db9aa787b646628b4e3f9")))
+ (sha256
+ (base32
+ "0s8554sanj6cvnf0h148nsmjgy5v0568nmcza7grpv6fnmddpfam"))
+ (file-name (string-append name "-" version "-checkout"))
+ ;; Warning: after using this patch, one must pass the -ltheora
+ ;; linker flag manually to configure; see below.
+ (patches (list (search-patch "mplayer2-theora-fix.patch")))))
+ (build-system gnu-build-system)
+ (native-inputs
+ `(("pkg-config" ,pkg-config)
+ ("perl" ,perl)
+ ("python" ,python)
+ ("python-2" ,python-2)
+ ("python-docutils" ,python-docutils)
+ ;; ./configure uses which(1) to find rst2man.py.
+ ("which" ,which)))
+ ;; Missing features: DirectFB, Xss screensaver extensions, VDPAU, MNG,
+ ;; libnut, DirectShow TV interface, Radio interfaces of all kinds, vstream
+ ;; client, XMSS inputplugin support, joystick, lirc/lircc, and openal.
+ ;; OpenAL support is experimental and causes compilation to fail with
+ ;; linker errors.
+ (inputs
+ `(("alsa-lib" ,alsa-lib)
+ ("faad2" ,faad2)
+ ("ffmpeg" ,ffmpeg)
+ ("gettext" ,gnu-gettext)
+ ("jack" ,jack-2)
+ ("ladspa" ,ladspa)
+ ("lcms" ,lcms)
+ ("liba52" ,liba52)
+ ("libass" ,libass)
+ ("libbluray" ,libbluray)
+ ("libbs2b" ,libbs2b)
+ ("libcaca" ,libcaca)
+ ("libcdio-paranoia" ,libcdio-paranoia)
+ ("libdca" ,libdca)
+ ("libdv" ,libdv)
+ ("libdvdread" ,libdvdread)
+ ("libdvdnav" ,libdvdnav-4)
+ ("libjpeg" ,libjpeg)
+ ("libmad" ,libmad)
+ ("libpng" ,libpng)
+ ("libquvi" ,libquvi)
+ ("libtheora" ,libtheora)
+ ("libungif" ,libungif)
+ ("libvorbis" ,libvorbis)
+ ("libx11" ,libx11)
+ ("libxinerama" ,libxinerama)
+ ("libxv" ,libxv)
+ ("mesa" ,mesa)
+ ("mpg123" ,mpg123)
+ ("ncurses" ,ncurses)
+ ("portaudio" ,portaudio)
+ ("pulseaudio" ,pulseaudio)
+ ("rsound" ,rsound)
+ ("samba" ,samba)
+ ("sdl" ,sdl)
+ ("speex" ,speex)
+ ("xvid" ,xvid)))
+ (arguments
+ '(#:phases
+ (alist-replace
+ 'configure
+ ;; ./configure does not work followed by "SHELL=..." and
+ ;; "CONFIG_SHELL=..."; set environment variables instead.
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (setenv "SHELL" (which "bash"))
+ (setenv "CONFIG_SHELL" (which "bash"))
+ (substitute* "configure"
+ (("/usr/X11") (assoc-ref inputs "libx11")))
+ (zero?
+ (system* "./configure"
+ (string-append "--prefix=" (assoc-ref outputs "out"))
+ "--enable-translation"
+ "--enable-runtime-cpudetection"
+ ;; This is needed in accordance with the theora patch.
+ "--extra-libs=-ltheoradec")))
+ (alist-cons-before
+ 'build 'fix-TOOLS-shebangs
+ (lambda _
+ (substitute* (find-files "TOOLS" "\\.(sh|pl|py)$")
+ (("/usr/bin/env") (which "env"))
+ (("/usr/bin/perl") (which "perl"))
+ (("/usr/bin/python3") (which "python3"))
+ (("/usr/bin/python") (which "python"))))
+ (alist-cons-before
+ 'build 'fix-input-buffer-padding-size
+ (lambda _
+ (substitute* "libmpdemux/demuxer.h"
+ ;; This has to match with FFmpeg's FF_INPUT_BUFFER_PADDING_SIZE,
+ ;; which has changed at some point.
+ (("(#define MP_INPUT_BUFFER_PADDING_SIZE )[0-9]*" all)
+ (string-append all "32"))))
+ %standard-phases)))
+ ;; No 'check' target.
+ #:tests? #f))
+ ;; XXX Change this if mplayer2.org goes up again.
+ (home-page "http://repo.or.cz/w/mplayer2.git")
+ (synopsis "Audio and video player")
+ (description "mplayer2 is a general-purpose audio and video player. It's
+a fork of the original MPlayer project, and contains further development in
+several areas.")
+ ;; See file Copyright. Most files are gpl2+ or compatible, but talloc.c
+ ;; is under lgpl3+, thus the whole project becomes gpl3+.
+ (license gpl3+)))
+
(define-public libvpx
(package
(name "libvpx")