Add mplayer with the vaapi patch.

atratsevskiy
Alexander Tratsevskiy 13 years ago
parent 3bd73a1e3e
commit 7ca038f216

@ -0,0 +1,26 @@
AUX vaapi-take2/01-mplayer-vaapi.patch 124283 RMD160 2eb017742707aba7dc4e7bb14221a044b3f2ebc3 SHA1 1333105c753235d02c9648e1c9c47086a4aac7e2 SHA256 6b82bf6a27685cd0cf082259a749bacb0c60752d4eaec70d46c4c52154f0a87c
AUX vaapi-take2/02-mplayer-vaapi-gma500-workaround.patch 3008 RMD160 3293051f87ec0f6663ef880ba79c71953d7f0174 SHA1 e27544b891fa5d19183e34ab56c255ae9ea5a3f7 SHA256 4ebde5f4e4e483346fc99fd813b9a94c0a3bbb0ad7517674737e9f23fe359abd
AUX vaapi-take2/03-mplayer-vaapi-0.29.patch 46329 RMD160 823bcafc8bc69a3d414c842d5944087495b2cfa8 SHA1 a1889c9996f8ec8d317b3ce033e3300472c6f840 SHA256 59afee2a470fb79cbc9844ff68b846b665aebff36612103fb3bc468f198f9cd4
AUX vaapi-take2/04-mplayer-vdpau.patch 45086 RMD160 c3ea2f31039ac3bb951836bd9462879a76c752f1 SHA1 798e287550f965d1f540843a0729a14d90d2d928 SHA256 e648f6c97cdbcd6bdc86d61f4d385b1756ff5f2a764c168ff3e3fe98120d194b
AUX vaapi-take3/01-mplayer-vaapi.patch 128727 RMD160 7478cfef6680c88cabb31f832bb53fde988b6625 SHA1 663d239651c35a879f091e20b317c10ece6ae828 SHA256 be09d12958cb0750e4c3af74ae3a3d69182cae542134bff82b3ac349a8c84d37
AUX vaapi-take3/02-mplayer-vaapi-gma500-workaround.patch 3021 RMD160 89ac058ace2d9d16e849400013719463f28db2dd SHA1 9a383ad908482f6e907ab21eca8064752408fe75 SHA256 ee7d47d2d1ad6208f446f104c6bf53450363088671d2b1b7859447beee46cc63
AUX vaapi-take3/03-mplayer-vaapi-0.29.patch 47012 RMD160 3dd75a2b460baed845490825d9277bcf70ec4356 SHA1 93c0cdb35b0f39dd465e7dfec5d3efdf0dcea7a9 SHA256 63537514f137ed08c274a3000416c17c1d4db5dbb995a6d015cc07573d864a95
AUX vaapi-take3/04-mplayer-vdpau.patch 44989 RMD160 ee0ba678398a48c24b8a234bef7f2b9782e7a941 SHA1 3e3d4f9555ba482c351563ccbb5c5689e624c3ec SHA256 9f4367b1023e9806001ca4d0d116e919b30c78e1550689d3e2926e1000f038e8
AUX vaapi/01-mplayer-vaapi.patch 125634 RMD160 add288326843d97fc33d0d1eba9e3818a5a778bd SHA1 6821081a03627715223d7a55044ce04e02c07350 SHA256 0373141e6d662ba65a3a37f8d7808b073f7e740746a897a81cb40ea36450f670
AUX vaapi/02-mplayer-vaapi-gma500-workaround.patch 2994 RMD160 cc3911d951c42ec1468eae4b8976697f47df050a SHA1 408c6783aae243fdb60fa7ea851cb5ec6184d4f4 SHA256 c145b2f8523bc99340d097f17c57538197b9c49175fce0b38d6eced3e06828a5
AUX vaapi/03-mplayer-vaapi-0.29.patch 46210 RMD160 1d90e15164aac446d29450265890048c2e2bbca8 SHA1 f0553b65bf90178d4aac8f14f977b74e282b67d2 SHA256 f87d5c7e1a4fa084c5b07e19a92496ad1ffa0dd866196669af5cb4469600efdd
AUX vaapi/04-mplayer-vdpau.patch 44724 RMD160 9c5a3162bbe5b5a3ec137f1c48d82a63f2c15bec SHA1 34e471df2348f849dc3835896c81166871a698ea SHA256 61be856ec47cdd3dc91481776d38b1fdb858b5c32a347f270856672c072a028c
DIST Blue-1.7.tar.bz2 222567 RMD160 1f8c539ccadc54eea5e6678839bcc8ae1e16e6eb SHA1 45e5ee7a5541a5f1cfd2678a6c9b5911ca473cb9 SHA256 8bcd39a5755c44df778ebca3119c922347abfdadb101dcef011ce2566c1fb1d8
DIST font-arial-cp1250.tar.bz2 249705 RMD160 a2fc7ae07b0d80936ea58e168e1047efccb9eb91 SHA1 ccf11dce5d0fb72fd3af97f788b7471cd0cd0b68 SHA256 423a07e780bb130cd8e4730715545c5d919c248dda595aab7a0a01de3c83fd12
DIST font-arial-iso-8859-1.tar.bz2 234242 RMD160 666697cd5efd9387057a898c714175e7c2aacbcd SHA1 152c40bf20de34aa8802d7f80d34d673b0b67212 SHA256 9730f481764f367c9089d0166fb6ccf9148808ffbbfeca635cf0e6db75765d29
DIST font-arial-iso-8859-2.tar.bz2 222208 RMD160 562d4d92c4f5f3d537340fde3ad8d1495ac41acb SHA1 7b99bbe0e9ba89a57eccbea8f93c453c4f268181 SHA256 71debfc960007c2f6242dfc91e8b1c005b30a99e129aeb00ab8c03f4371b41c1
DIST mplayer-1.0_rc4_p20100612.tbz2 8968316 RMD160 4179808dc9b99404affa2c95189fba3bb6fe5ad8 SHA1 a8d758dca9473006f66a947fb9019c35c66baa6b SHA256 098e16793baea2a9c4cf24ebcc8bc41c639c9806347b08724168e17e367b5d74
DIST mplayer-1.0_rc4_p20101114.tar.xz 8515160 RMD160 73aec83d64abaadf9c6b6110f5d42e6bfae1ca87 SHA1 b6cfd5e05ef5a48a9d3d2f272f6f629461de8474 SHA256 02d6a259e063304cbf2ebb89fcb89d5133383d514264df9a423872684eb36c2d
DIST mplayer-1.0_rc4_p20101219.tar.xz 8639552 RMD160 f8f1c05185aba8efa5a78d7d0666eb7712a1120b SHA1 d0909a96cdb228b23795553827bcce8f82609e0a SHA256 8f5c56c7fdc811a38d8b4cd8dfbfb620a5160ae2f67605941e32c33c771233be
DIST mplayer-1.0_rc4_p20110322.tar.xz 8323532 RMD160 7082c95fa20cb7e3d491546ae08a4dfafdc17d09 SHA1 3f60cf0ce8c910e3628e425167cb6a46bb4a29a3 SHA256 addaae78cfd7f8cb950370b3b43d82c2f8170830ccc1046b98726d34f3958bf5
DIST svgalib_helper-1.9.17-mplayer.tar.gz 7583 RMD160 927ff34f187e4fa9528e2e48208173d98b3d1d1b SHA1 bf789706d1d79c695f781644c7ea6d57c3eed4c3 SHA256 a6f803f3df4cd4544751d3a3ee936a8bf0e20e32a452639b3f7c7d9e73e65938
EBUILD mplayer-1.0_rc4_p20100612-r50.ebuild 20354 RMD160 5e0a18409cfb24e6dbaeb1c3a51d8fb98f18b953 SHA1 053978376a1ec7c3836197539296a4fb23ee3f38 SHA256 a05791c258d16c6dba09f1dc2a782afa0f1d03cb316bd3b6871621b6712ecd17
EBUILD mplayer-1.0_rc4_p20101114-r50.ebuild 20280 RMD160 a85a39739d94dad854f1cb6b718979242e6312f1 SHA1 9a28c2c5925fe903be518e6c3be891caa225ac78 SHA256 4cb97389439a616f936d5f67ef83f96cd0048706c2e92c2446e9b01df1f192e4
EBUILD mplayer-1.0_rc4_p20101219-r50.ebuild 20280 RMD160 5eb3cd60a2886251f521d4e435eb9a067e6b4286 SHA1 0d6e3d8650bf6f0afb4b23ddfc43648fc727dfb0 SHA256 398951968d4d191d8527c88bceeb7b9cbf6bc662f35947db16cfc48a05ff91c6
EBUILD mplayer-1.0_rc4_p20110322-r50.ebuild 20452 RMD160 3a44cfb138af89a49a549992de6ff20a88dba727 SHA1 e66408ba16a996ba692c7d2b4d6ab53b93ebc0b7 SHA256 d7cf0f7081948159ec56ce831b110aef4d062dcdac46c605173db8dfcbffa911
MISC metadata.xml 3591 RMD160 883e9161526d98f546d5b790a76da78ae6b03b94 SHA1 bf3ab6509cfa4a72a088ba005c9a92e44bac6df1 SHA256 956383713923533a4caa6e39fbe8067b2afa7c7aecc3e52c9dd0715435226ef8

File diff suppressed because it is too large Load Diff

@ -0,0 +1,97 @@
commit 7d70d28f190e37cfa3a9a827877ddd6bb81408d3
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Mon Dec 28 08:52:56 2009 +0000
Add GMA500 workaround for H.264 DPB. This is disabled by default. Enable with GMA500_WORKAROUND=yes environment variable.
diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
index 9f440c0..0139d64 100644
--- a/ffmpeg/libavcodec/vaapi_h264.c
+++ b/ffmpeg/libavcodec/vaapi_h264.c
@@ -28,6 +28,60 @@
* structures for H.264 decoding.
*/
+/** Parses ENV environment variable expecting "yes" | "no" values. */
+static int getenv_yesno(const char *env, int *pval)
+{
+ int val;
+ const char *env_str;
+
+ env_str = getenv(env);
+ if (!env_str)
+ return -1;
+
+ if (strcmp(env_str, "1") == 0 || strcmp(env_str, "yes") == 0)
+ val = 1;
+ else if (strcmp(env_str, "0") == 0 || strcmp(env_str, "no") == 0)
+ val = 0;
+ else
+ return -1;
+
+ if (pval)
+ *pval = val;
+ return 0;
+}
+
+/**
+ * Use old GMA500 workaround for DPB. It requires other pictures than
+ * those marked as "used for reference".
+ */
+static int get_use_gma500_workaround(struct vaapi_context *vactx)
+{
+ int gma500_workaround_env;
+ const char *vendor_string;
+
+ if (getenv_yesno("GMA500_WORKAROUND", &gma500_workaround_env) < 0)
+ return 0;
+ if (!gma500_workaround_env)
+ return 0;
+
+ vendor_string = vaQueryVendorString(vactx->display);
+ if (vendor_string && strstr(vendor_string, "Intel")) {
+ if (strstr(vendor_string, "GMA500"))
+ return 1;
+ if (strstr(vendor_string, "Embedded Graphics Driver"))
+ return 1;
+ }
+ return 0;
+}
+
+static inline int use_gma500_workaround(struct vaapi_context *vactx)
+{
+ static int gma500_workaround = -1;
+ if (gma500_workaround < 0)
+ gma500_workaround = get_use_gma500_workaround(vactx);
+ return gma500_workaround;
+}
+
/**
* Initializes an empty VA API picture.
*
@@ -123,6 +177,7 @@ static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param,
{
DPB dpb;
int i;
+ unsigned int list;
dpb.size = 0;
dpb.max_size = FF_ARRAY_ELEMS(pic_param->ReferenceFrames);
@@ -130,6 +185,17 @@ static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param,
for (i = 0; i < dpb.max_size; i++)
init_vaapi_pic(&dpb.va_pics[i]);
+ if (use_gma500_workaround(h->s.avctx->hwaccel_context)) {
+ /* XXX: this is really wrong */
+ for (list = 0; list < h->list_count; list++)
+ for (i = 0; i < (int)h->ref_count[list]; i++) {
+ Picture * const pic = &h->ref_list[list][i];
+ if (pic->reference && dpb_add(&dpb, pic) < 0)
+ return -1;
+ }
+ return 0;
+ }
+
for (i = 0; i < h->short_ref_count; i++) {
Picture * const pic = h->short_ref[i];
if (pic && pic->reference && dpb_add(&dpb, pic) < 0)

@ -0,0 +1,675 @@
commit 5fbfa3b77f6b3f55cc61df16533324ebcf8e0b70
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Fri Feb 12 11:03:00 2010 +0000
Add compatibility with original VA-API 0.29.
diff --git a/configure b/configure
index 8011680..f7ce215 100755
--- a/configure
+++ b/configure
@@ -6167,20 +6167,35 @@ fi #if os2
echocheck "VA-API"
if test "$_vaapi" = yes -o "$_vaapi" = auto; then
_vaapi=no
+ _vaapi_old=no
cat > $TMPC <<EOF
#include <va/va_x11.h>
int main(void) { (void) vaGetDisplay(0); return 0; }
EOF
- cc_check -lva-x11 && _vaapi=yes
+ cc_check -lva-x11 && _vaapi=yes || {
+ cat > $TMPC <<EOF
+#include <va_x11.h>
+int main(void) { (void) vaGetDisplay(0); return 0; }
+EOF
+ cc_check -lva && _vaapi=yes _vaapi_old=yes
+ }
fi
if test "$_vaapi" = yes ; then
def_vaapi='#define CONFIG_VAAPI 1'
- libs_mencoder="$libs_mencoder -lva"
- libs_mplayer="$libs_mplayer -lva-x11 -lva"
+ if test "$_vaapi_old" = no ; then
+ def_vaapi_old='#define CONFIG_VAAPI_OLD 0'
+ libs_mencoder="$libs_mencoder -lva"
+ libs_mplayer="$libs_mplayer -lva-x11 -lva"
+ else
+ def_vaapi_old='#define CONFIG_VAAPI_OLD 1'
+ _mencoder="no"
+ libs_mplayer="$libs_mplayer -lva"
+ fi
vomodules="vaapi $vomodules"
else
def_vaapi='#define CONFIG_VAAPI 0'
+ def_vaapi_old='#define CONFIG_VAAPI_OLD 0'
novomodules="vaapi $novomodules"
_libavhwaccels=`echo $_libavhwaccels | sed -e "s/\(MPEG[124]\|H26[34]\|WMV3\|VC1\)_VAAPI_HWACCEL//g"`
fi
@@ -8862,6 +8877,7 @@ CONFIG_MLIB = $_mlib
CONFIG_MUXERS = $_mencoder
CONFIG_POSTPROC = yes
CONFIG_VAAPI = $_vaapi
+CONFIG_VAAPI_OLD= $_vaapi_old
CONFIG_VDPAU = $_vdpau
CONFIG_XVMC = $_xvmc
CONFIG_ZLIB = $_zlib
@@ -9241,6 +9257,7 @@ $def_tdfxvid
$def_tga
$def_v4l2
$def_vaapi
+$def_vaapi_old
$def_vaapi_glx
$def_vdpau
$def_vesa
diff --git a/libavcodec/vaapi_compat.h b/libavcodec/vaapi_compat.h
new file mode 100644
index 0000000..f463118
--- /dev/null
+++ b/ffmpeg/libavcodec/vaapi_compat.h
@@ -0,0 +1,92 @@
+/*
+ * Video Acceleration API (video decoding)
+ * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
+ *
+ * Copyright (C) 2008-2009 Splitted-Desktop Systems
+ *
+ * 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_VAAPI_COMPAT_H
+#define AVCODEC_VAAPI_COMPAT_H
+
+/* Compatibility glue with original VA-API 0.29 */
+#if CONFIG_VAAPI_OLD
+typedef struct _VASliceParameterBufferBase {
+ unsigned int slice_data_size;
+ unsigned int slice_data_offset;
+ unsigned int slice_data_flag;
+} VASliceParameterBufferBase;
+#endif
+
+#ifndef VA_CHECK_VERSION
+#define VA_MAJOR_VERSION 0
+#define VA_MINOR_VERSION 29
+#define VA_CHECK_VERSION(major,minor,micro) \
+ (VA_MAJOR_VERSION > (major) || \
+ (VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION > (minor)) || \
+ (VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION == (minor) && VA_MICRO_VERSION >= (micro)))
+#endif
+
+#ifndef VA_FOURCC
+#define VA_FOURCC(ch0, ch1, ch2, ch3) \
+ ((uint32_t)(uint8_t)(ch0) | \
+ ((uint32_t)(uint8_t)(ch1) << 8) | \
+ ((uint32_t)(uint8_t)(ch2) << 16) | \
+ ((uint32_t)(uint8_t)(ch3) << 24 ))
+#endif
+
+#ifndef VA_INVALID_ID
+#define VA_INVALID_ID 0xffffffff
+#endif
+#ifndef VA_INVALID_SURFACE
+#define VA_INVALID_SURFACE VA_INVALID_ID
+#endif
+
+/* Compatibility glue with VA-API >= 0.31 */
+#if VA_CHECK_VERSION(0,31,0)
+#define vaSyncSurface(dpy, context, surface) (vaSyncSurface)((dpy), (surface))
+#define vaPutImage2 vaPutImage
+#define vaAssociateSubpicture2 vaAssociateSubpicture
+#endif
+
+/* Used in codec implementation to set up the right bit-fields */
+#if CONFIG_VAAPI_OLD
+# define BFV(a, b) a
+# define BFM(a, b, c) c
+# define BFMP(p, a, b, c) p##_##c
+# define NEW(x) /* nothing */
+#else
+# define BFV(a, b) a.b
+# define BFM(a, b, c) a.b.c
+# define BFMP(p, a, b, c) a.b.c
+# define NEW(x) x
+#endif
+
+#if CONFIG_VAAPI_OLD
+# define V_raw_coding raw_coding_flag
+# define M_raw_coding raw_coding
+# define V_bitplane_present bitplane_present_flag
+# define M_bitplane_present bitplane_present
+#else
+# define V_raw_coding raw_coding
+# define M_raw_coding raw_coding
+# define V_bitplane_present bitplane_present
+# define M_bitplane_present bitplane_present
+#endif
+
+#endif /* AVCODEC_VAAPI_COMPAT_H */
diff --git a/ffmpeg/libavcodec/vaapi_h264.c b/ffmpeg/libavcodec/vaapi_h264.c
index b61a9ca..cab6e41 100644
--- a/ffmpeg/libavcodec/vaapi_h264.c
+++ b/ffmpeg/libavcodec/vaapi_h264.c
@@ -123,8 +123,8 @@ static void fill_vaapi_pic(VAPictureH264 *va_pic,
if (pic_structure == 0)
pic_structure = pic->reference;
- va_pic->picture_id = ff_vaapi_get_surface_id(pic);
- va_pic->frame_idx = pic->long_ref ? pic->pic_id : pic->frame_num;
+ va_pic->picture_id = ff_vaapi_get_surface_id(pic);
+ NEW(va_pic->frame_idx = pic->long_ref ? pic->pic_id : pic->frame_num);
va_pic->flags = 0;
if (pic_structure != PICT_FRAME)
@@ -317,42 +317,42 @@ static int start_frame(AVCodecContext *avctx,
fill_vaapi_pic(&pic_param->CurrPic, s->current_picture_ptr, s->picture_structure);
if (fill_vaapi_ReferenceFrames(pic_param, h) < 0)
return -1;
- pic_param->picture_width_in_mbs_minus1 = s->mb_width - 1;
- pic_param->picture_height_in_mbs_minus1 = s->mb_height - 1;
- pic_param->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8;
- pic_param->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8;
- pic_param->num_ref_frames = h->sps.ref_frame_count;
- pic_param->seq_fields.value = 0; /* reset all bits */
- pic_param->seq_fields.bits.chroma_format_idc = h->sps.chroma_format_idc;
- pic_param->seq_fields.bits.residual_colour_transform_flag = h->sps.residual_color_transform_flag; /* XXX: only for 4:4:4 high profile? */
- pic_param->seq_fields.bits.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag;
- pic_param->seq_fields.bits.frame_mbs_only_flag = h->sps.frame_mbs_only_flag;
- pic_param->seq_fields.bits.mb_adaptive_frame_field_flag = h->sps.mb_aff;
- pic_param->seq_fields.bits.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag;
- pic_param->seq_fields.bits.MinLumaBiPredSize8x8 = h->sps.level_idc >= 31; /* A.3.3.2 */
- pic_param->seq_fields.bits.log2_max_frame_num_minus4 = h->sps.log2_max_frame_num - 4;
- pic_param->seq_fields.bits.pic_order_cnt_type = h->sps.poc_type;
- pic_param->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4;
- pic_param->seq_fields.bits.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag;
- pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1;
- pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type;
- pic_param->slice_group_change_rate_minus1 = 0; /* XXX: unimplemented in FFmpeg */
- pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26;
- pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26;
- pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0];
- pic_param->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1];
- pic_param->pic_fields.value = 0; /* reset all bits */
- pic_param->pic_fields.bits.entropy_coding_mode_flag = h->pps.cabac;
- pic_param->pic_fields.bits.weighted_pred_flag = h->pps.weighted_pred;
- pic_param->pic_fields.bits.weighted_bipred_idc = h->pps.weighted_bipred_idc;
- pic_param->pic_fields.bits.transform_8x8_mode_flag = h->pps.transform_8x8_mode;
- pic_param->pic_fields.bits.field_pic_flag = s->picture_structure != PICT_FRAME;
- pic_param->pic_fields.bits.constrained_intra_pred_flag = h->pps.constrained_intra_pred;
- pic_param->pic_fields.bits.pic_order_present_flag = h->pps.pic_order_present;
- pic_param->pic_fields.bits.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present;
- pic_param->pic_fields.bits.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present;
- pic_param->pic_fields.bits.reference_pic_flag = h->nal_ref_idc != 0;
- pic_param->frame_num = h->frame_num;
+ pic_param->picture_width_in_mbs_minus1 = s->mb_width - 1;
+ pic_param->picture_height_in_mbs_minus1 = s->mb_height - 1;
+ pic_param->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8;
+ pic_param->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8;
+ pic_param->num_ref_frames = h->sps.ref_frame_count;
+ pic_param->BFV(seq_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(seq_fields,bits,chroma_format_idc) = h->sps.chroma_format_idc;
+ pic_param->BFM(seq_fields,bits,residual_colour_transform_flag) = h->sps.residual_color_transform_flag; /* XXX: only for 4:4:4 high profile? */
+ NEW(pic_param->BFM(seq_fields,bits,gaps_in_frame_num_value_allowed_flag) = h->sps.gaps_in_frame_num_allowed_flag);
+ pic_param->BFM(seq_fields,bits,frame_mbs_only_flag) = h->sps.frame_mbs_only_flag;
+ pic_param->BFM(seq_fields,bits,mb_adaptive_frame_field_flag) = h->sps.mb_aff;
+ pic_param->BFM(seq_fields,bits,direct_8x8_inference_flag) = h->sps.direct_8x8_inference_flag;
+ pic_param->BFM(seq_fields,bits,MinLumaBiPredSize8x8) = h->sps.level_idc >= 31; /* A.3.3.2 */
+ NEW(pic_param->BFM(seq_fields,bits,log2_max_frame_num_minus4) = h->sps.log2_max_frame_num - 4);
+ NEW(pic_param->BFM(seq_fields,bits,pic_order_cnt_type) = h->sps.poc_type);
+ NEW(pic_param->BFM(seq_fields,bits,log2_max_pic_order_cnt_lsb_minus4) = h->sps.log2_max_poc_lsb - 4);
+ NEW(pic_param->BFM(seq_fields,bits,delta_pic_order_always_zero_flag) = h->sps.delta_pic_order_always_zero_flag);
+ pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1;
+ pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type;
+ NEW(pic_param->slice_group_change_rate_minus1 = 0); /* XXX: unimplemented in FFmpeg */
+ pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26;
+ NEW(pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26);
+ pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0];
+ pic_param->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1];
+ pic_param->BFV(pic_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(pic_fields,bits,entropy_coding_mode_flag) = h->pps.cabac;
+ pic_param->BFM(pic_fields,bits,weighted_pred_flag) = h->pps.weighted_pred;
+ pic_param->BFM(pic_fields,bits,weighted_bipred_idc) = h->pps.weighted_bipred_idc;
+ pic_param->BFM(pic_fields,bits,transform_8x8_mode_flag) = h->pps.transform_8x8_mode;
+ pic_param->BFM(pic_fields,bits,field_pic_flag) = s->picture_structure != PICT_FRAME;
+ pic_param->BFM(pic_fields,bits,constrained_intra_pred_flag) = h->pps.constrained_intra_pred;
+ NEW(pic_param->BFM(pic_fields,bits,pic_order_present_flag) = h->pps.pic_order_present);
+ NEW(pic_param->BFM(pic_fields,bits,deblocking_filter_control_present_flag) = h->pps.deblocking_filter_parameters_present);
+ NEW(pic_param->BFM(pic_fields,bits,redundant_pic_cnt_present_flag) = h->pps.redundant_pic_cnt_present);
+ NEW(pic_param->BFM(pic_fields,bits,reference_pic_flag) = h->nal_ref_idc != 0);
+ pic_param->frame_num = h->frame_num;
/* Fill in VAIQMatrixBufferH264. */
iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferH264));
diff --git a/ffmpeg/libavcodec/vaapi_internal.h b/ffmpeg/libavcodec/vaapi_internal.h
index 2c0fdf9..ff83b96 100644
--- a/ffmpeg/libavcodec/vaapi_internal.h
+++ b/ffmpeg/libavcodec/vaapi_internal.h
@@ -24,8 +24,14 @@
#ifndef AVCODEC_VAAPI_INTERNAL_H
#define AVCODEC_VAAPI_INTERNAL_H
+#include "config.h"
+#if CONFIG_VAAPI_OLD
+#include <va.h>
+#else
#include <va/va.h>
+#endif
#include "vaapi.h"
+#include "vaapi_compat.h"
#include "avcodec.h"
#include "mpegvideo.h"
diff --git a/ffmpeg/libavcodec/vaapi_mpeg2.c b/ffmpeg/libavcodec/vaapi_mpeg2.c
index 2e870dc..637546a 100644
--- a/ffmpeg/libavcodec/vaapi_mpeg2.c
+++ b/ffmpeg/libavcodec/vaapi_mpeg2.c
@@ -52,24 +52,24 @@ static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_
pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferMPEG2));
if (!pic_param)
return -1;
- pic_param->horizontal_size = s->width;
- pic_param->vertical_size = s->height;
- pic_param->forward_reference_picture = VA_INVALID_ID;
- pic_param->backward_reference_picture = VA_INVALID_ID;
- pic_param->picture_coding_type = s->pict_type;
- pic_param->f_code = mpeg2_get_f_code(s);
- pic_param->picture_coding_extension.value = 0; /* reset all bits */
- pic_param->picture_coding_extension.bits.intra_dc_precision = s->intra_dc_precision;
- pic_param->picture_coding_extension.bits.picture_structure = s->picture_structure;
- pic_param->picture_coding_extension.bits.top_field_first = s->top_field_first;
- pic_param->picture_coding_extension.bits.frame_pred_frame_dct = s->frame_pred_frame_dct;
- pic_param->picture_coding_extension.bits.concealment_motion_vectors = s->concealment_motion_vectors;
- pic_param->picture_coding_extension.bits.q_scale_type = s->q_scale_type;
- pic_param->picture_coding_extension.bits.intra_vlc_format = s->intra_vlc_format;
- pic_param->picture_coding_extension.bits.alternate_scan = s->alternate_scan;
- pic_param->picture_coding_extension.bits.repeat_first_field = s->repeat_first_field;
- pic_param->picture_coding_extension.bits.progressive_frame = s->progressive_frame;
- pic_param->picture_coding_extension.bits.is_first_field = mpeg2_get_is_frame_start(s);
+ pic_param->horizontal_size = s->width;
+ pic_param->vertical_size = s->height;
+ pic_param->forward_reference_picture = VA_INVALID_ID;
+ pic_param->backward_reference_picture = VA_INVALID_ID;
+ pic_param->picture_coding_type = s->pict_type;
+ pic_param->f_code = mpeg2_get_f_code(s);
+ pic_param->BFV(picture_coding_extension,value) = 0; /* reset all bits */
+ pic_param->BFM(picture_coding_extension,bits,intra_dc_precision) = s->intra_dc_precision;
+ pic_param->BFM(picture_coding_extension,bits,picture_structure) = s->picture_structure;
+ pic_param->BFM(picture_coding_extension,bits,top_field_first) = s->top_field_first;
+ pic_param->BFM(picture_coding_extension,bits,frame_pred_frame_dct) = s->frame_pred_frame_dct;
+ pic_param->BFM(picture_coding_extension,bits,concealment_motion_vectors) = s->concealment_motion_vectors;
+ pic_param->BFM(picture_coding_extension,bits,q_scale_type) = s->q_scale_type;
+ pic_param->BFM(picture_coding_extension,bits,intra_vlc_format) = s->intra_vlc_format;
+ pic_param->BFM(picture_coding_extension,bits,alternate_scan) = s->alternate_scan;
+ pic_param->BFM(picture_coding_extension,bits,repeat_first_field) = s->repeat_first_field;
+ pic_param->BFM(picture_coding_extension,bits,progressive_frame) = s->progressive_frame;
+ pic_param->BFM(picture_coding_extension,bits,is_first_field) = mpeg2_get_is_frame_start(s);
switch (s->pict_type) {
case FF_B_TYPE:
@@ -131,7 +131,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
if (!slice_param)
return -1;
slice_param->macroblock_offset = macroblock_offset;
- slice_param->slice_horizontal_position = s->mb_x;
+ NEW(slice_param->slice_horizontal_position = s->mb_x);
slice_param->slice_vertical_position = s->mb_y;
slice_param->quantiser_scale_code = quantiser_scale_code;
slice_param->intra_slice_flag = intra_slice_flag;
diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
index 466ce2f..ea306a4 100644
--- a/ffmpeg/libavcodec/vaapi_mpeg4.c
+++ b/ffmpeg/libavcodec/vaapi_mpeg4.c
@@ -54,42 +54,42 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferMPEG4));
if (!pic_param)
return -1;
- pic_param->vop_width = s->width;
- pic_param->vop_height = s->height;
- pic_param->forward_reference_picture = VA_INVALID_ID;
- pic_param->backward_reference_picture = VA_INVALID_ID;
- pic_param->vol_fields.value = 0; /* reset all bits */
- pic_param->vol_fields.bits.short_video_header = avctx->codec->id == CODEC_ID_H263;
- pic_param->vol_fields.bits.chroma_format = CHROMA_420;
- pic_param->vol_fields.bits.interlaced = !s->progressive_sequence;
- pic_param->vol_fields.bits.obmc_disable = 1;
- pic_param->vol_fields.bits.sprite_enable = s->vol_sprite_usage;
- pic_param->vol_fields.bits.sprite_warping_accuracy = s->sprite_warping_accuracy;
- pic_param->vol_fields.bits.quant_type = s->mpeg_quant;
- pic_param->vol_fields.bits.quarter_sample = s->quarter_sample;
- pic_param->vol_fields.bits.data_partitioned = s->data_partitioning;
- pic_param->vol_fields.bits.reversible_vlc = s->rvlc;
- pic_param->vol_fields.bits.resync_marker_disable = !s->resync_marker;
- pic_param->no_of_sprite_warping_points = s->num_sprite_warping_points;
+ pic_param->vop_width = s->width;
+ pic_param->vop_height = s->height;
+ pic_param->forward_reference_picture = VA_INVALID_ID;
+ pic_param->backward_reference_picture = VA_INVALID_ID;
+ pic_param->BFV(vol_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(vol_fields,bits,short_video_header) = avctx->codec->id == CODEC_ID_H263;
+ pic_param->BFM(vol_fields,bits,chroma_format) = CHROMA_420;
+ pic_param->BFM(vol_fields,bits,interlaced) = !s->progressive_sequence;
+ pic_param->BFM(vol_fields,bits,obmc_disable) = 1;
+ pic_param->BFM(vol_fields,bits,sprite_enable) = s->vol_sprite_usage;
+ pic_param->BFM(vol_fields,bits,sprite_warping_accuracy) = s->sprite_warping_accuracy;
+ pic_param->BFM(vol_fields,bits,quant_type) = s->mpeg_quant;
+ pic_param->BFM(vol_fields,bits,quarter_sample) = s->quarter_sample;
+ pic_param->BFM(vol_fields,bits,data_partitioned) = s->data_partitioning;
+ pic_param->BFM(vol_fields,bits,reversible_vlc) = s->rvlc;
+ NEW(pic_param->BFM(vol_fields,bits,resync_marker_disable) = !s->resync_marker);
+ pic_param->no_of_sprite_warping_points = s->num_sprite_warping_points;
for (i = 0; i < s->num_sprite_warping_points && i < 3; i++) {
- pic_param->sprite_trajectory_du[i] = s->sprite_traj[i][0];
- pic_param->sprite_trajectory_dv[i] = s->sprite_traj[i][1];
+ pic_param->sprite_trajectory_du[i] = s->sprite_traj[i][0];
+ pic_param->sprite_trajectory_dv[i] = s->sprite_traj[i][1];
}
- pic_param->quant_precision = s->quant_precision;
- pic_param->vop_fields.value = 0; /* reset all bits */
- pic_param->vop_fields.bits.vop_coding_type = s->pict_type - FF_I_TYPE;
- pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == FF_B_TYPE ? s->next_picture.pict_type - FF_I_TYPE : 0;
- pic_param->vop_fields.bits.vop_rounding_type = s->no_rounding;
- pic_param->vop_fields.bits.intra_dc_vlc_thr = mpeg4_get_intra_dc_vlc_thr(s);
- pic_param->vop_fields.bits.top_field_first = s->top_field_first;
- pic_param->vop_fields.bits.alternate_vertical_scan_flag = s->alternate_scan;
- pic_param->vop_fcode_forward = s->f_code;
- pic_param->vop_fcode_backward = s->b_code;
- pic_param->vop_time_increment_resolution = avctx->time_base.den;
- pic_param->num_macroblocks_in_gob = s->mb_width * ff_h263_get_gob_height(s);
- pic_param->num_gobs_in_vop = (s->mb_width * s->mb_height) / pic_param->num_macroblocks_in_gob;
- pic_param->TRB = s->pb_time;
- pic_param->TRD = s->pp_time;
+ pic_param->quant_precision = s->quant_precision;
+ pic_param->BFV(vop_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(vop_fields,bits,vop_coding_type) = s->pict_type - FF_I_TYPE;
+ pic_param->BFM(vop_fields,bits,backward_reference_vop_coding_type) = s->pict_type == FF_B_TYPE ? s->next_picture.pict_type - FF_I_TYPE : 0;
+ pic_param->BFM(vop_fields,bits,vop_rounding_type) = s->no_rounding;
+ pic_param->BFM(vop_fields,bits,intra_dc_vlc_thr) = mpeg4_get_intra_dc_vlc_thr(s);
+ pic_param->BFM(vop_fields,bits,top_field_first) = s->top_field_first;
+ pic_param->BFM(vop_fields,bits,alternate_vertical_scan_flag) = s->alternate_scan;
+ pic_param->vop_fcode_forward = s->f_code;
+ pic_param->vop_fcode_backward = s->b_code;
+ NEW(pic_param->vop_time_increment_resolution = avctx->time_base.den);
+ pic_param->num_macroblocks_in_gob = s->mb_width * ff_h263_get_gob_height(s);
+ pic_param->num_gobs_in_vop = (s->mb_width * s->mb_height) / pic_param->num_macroblocks_in_gob;
+ pic_param->TRB = s->pb_time;
+ pic_param->TRD = s->pp_time;
if (s->pict_type == FF_B_TYPE)
pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture);
@@ -98,7 +98,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
/* Fill in VAIQMatrixBufferMPEG4 */
/* Only the first inverse quantisation method uses the weighthing matrices */
- if (pic_param->vol_fields.bits.quant_type) {
+ if (pic_param->BFM(vol_fields,bits,quant_type)) {
iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferMPEG4));
if (!iq_matrix)
return -1;
diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
index 992e1da..8264dd9 100644
--- a/ffmpeg/libavcodec/vaapi_vc1.c
+++ b/ffmpeg/libavcodec/vaapi_vc1.c
@@ -146,100 +146,100 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferVC1));
if (!pic_param)
return -1;
- pic_param->forward_reference_picture = VA_INVALID_ID;
- pic_param->backward_reference_picture = VA_INVALID_ID;
- pic_param->inloop_decoded_picture = VA_INVALID_ID;
- pic_param->sequence_fields.value = 0; /* reset all bits */
- pic_param->sequence_fields.bits.pulldown = v->broadcast;
- pic_param->sequence_fields.bits.interlace = v->interlace;
- pic_param->sequence_fields.bits.tfcntrflag = v->tfcntrflag;
- pic_param->sequence_fields.bits.finterpflag = v->finterpflag;
- pic_param->sequence_fields.bits.psf = v->psf;
- pic_param->sequence_fields.bits.multires = v->multires;
- pic_param->sequence_fields.bits.overlap = v->overlap;
- pic_param->sequence_fields.bits.syncmarker = s->resync_marker;
- pic_param->sequence_fields.bits.rangered = v->rangered;
- pic_param->sequence_fields.bits.max_b_frames = s->avctx->max_b_frames;
- pic_param->coded_width = s->avctx->coded_width;
- pic_param->coded_height = s->avctx->coded_height;
- pic_param->entrypoint_fields.value = 0; /* reset all bits */
- pic_param->entrypoint_fields.bits.broken_link = v->broken_link;
- pic_param->entrypoint_fields.bits.closed_entry = v->closed_entry;
- pic_param->entrypoint_fields.bits.panscan_flag = v->panscanflag;
- pic_param->entrypoint_fields.bits.loopfilter = s->loop_filter;
- pic_param->conditional_overlap_flag = v->condover;
- pic_param->fast_uvmc_flag = v->fastuvmc;
- pic_param->range_mapping_fields.value = 0; /* reset all bits */
- pic_param->range_mapping_fields.bits.luma_flag = v->range_mapy_flag;
- pic_param->range_mapping_fields.bits.luma = v->range_mapy;
- pic_param->range_mapping_fields.bits.chroma_flag = v->range_mapuv_flag;
- pic_param->range_mapping_fields.bits.chroma = v->range_mapuv;
- pic_param->b_picture_fraction = v->bfraction_lut_index;
- pic_param->cbp_table = v->cbpcy_vlc ? v->cbpcy_vlc - ff_vc1_cbpcy_p_vlc : 0;
- pic_param->mb_mode_table = 0; /* XXX: interlaced frame */
- pic_param->range_reduction_frame = v->rangeredfrm;
- pic_param->rounding_control = v->rnd;
- pic_param->post_processing = v->postproc;
- pic_param->picture_resolution_index = v->respic;
- pic_param->luma_scale = v->lumscale;
- pic_param->luma_shift = v->lumshift;
- pic_param->picture_fields.value = 0; /* reset all bits */
- pic_param->picture_fields.bits.picture_type = vc1_get_PTYPE(v);
- pic_param->picture_fields.bits.frame_coding_mode = v->fcm;
- pic_param->picture_fields.bits.top_field_first = v->tff;
- pic_param->picture_fields.bits.is_first_field = v->fcm == 0; /* XXX: interlaced frame */
- pic_param->picture_fields.bits.intensity_compensation = v->mv_mode == MV_PMODE_INTENSITY_COMP;
- pic_param->raw_coding.value = 0; /* reset all bits */
- pic_param->raw_coding.flags.mv_type_mb = v->mv_type_is_raw;
- pic_param->raw_coding.flags.direct_mb = v->dmb_is_raw;
- pic_param->raw_coding.flags.skip_mb = v->skip_is_raw;
- pic_param->raw_coding.flags.field_tx = 0; /* XXX: interlaced frame */
- pic_param->raw_coding.flags.forward_mb = 0; /* XXX: interlaced frame */
- pic_param->raw_coding.flags.ac_pred = v->acpred_is_raw;
- pic_param->raw_coding.flags.overflags = v->overflg_is_raw;
- pic_param->bitplane_present.value = 0; /* reset all bits */
- pic_param->bitplane_present.flags.bp_mv_type_mb = vc1_has_MVTYPEMB_bitplane(v);
- pic_param->bitplane_present.flags.bp_direct_mb = vc1_has_DIRECTMB_bitplane(v);
- pic_param->bitplane_present.flags.bp_skip_mb = vc1_has_SKIPMB_bitplane(v);
- pic_param->bitplane_present.flags.bp_field_tx = 0; /* XXX: interlaced frame */
- pic_param->bitplane_present.flags.bp_forward_mb = 0; /* XXX: interlaced frame */
- pic_param->bitplane_present.flags.bp_ac_pred = vc1_has_ACPRED_bitplane(v);
- pic_param->bitplane_present.flags.bp_overflags = vc1_has_OVERFLAGS_bitplane(v);
- pic_param->reference_fields.value = 0; /* reset all bits */
- pic_param->reference_fields.bits.reference_distance_flag = v->refdist_flag;
- pic_param->reference_fields.bits.reference_distance = 0; /* XXX: interlaced frame */
- pic_param->reference_fields.bits.num_reference_pictures = 0; /* XXX: interlaced frame */
- pic_param->reference_fields.bits.reference_field_pic_indicator = 0; /* XXX: interlaced frame */
- pic_param->mv_fields.value = 0; /* reset all bits */
- pic_param->mv_fields.bits.mv_mode = vc1_get_MVMODE(v);
- pic_param->mv_fields.bits.mv_mode2 = vc1_get_MVMODE2(v);
- pic_param->mv_fields.bits.mv_table = s->mv_table_index;
- pic_param->mv_fields.bits.two_mv_block_pattern_table = 0; /* XXX: interlaced frame */
- pic_param->mv_fields.bits.four_mv_switch = 0; /* XXX: interlaced frame */
- pic_param->mv_fields.bits.four_mv_block_pattern_table = 0; /* XXX: interlaced frame */
- pic_param->mv_fields.bits.extended_mv_flag = v->extended_mv;
- pic_param->mv_fields.bits.extended_mv_range = v->mvrange;
- pic_param->mv_fields.bits.extended_dmv_flag = v->extended_dmv;
- pic_param->mv_fields.bits.extended_dmv_range = 0; /* XXX: interlaced frame */
- pic_param->pic_quantizer_fields.value = 0; /* reset all bits */
- pic_param->pic_quantizer_fields.bits.dquant = v->dquant;
- pic_param->pic_quantizer_fields.bits.quantizer = v->quantizer_mode;
- pic_param->pic_quantizer_fields.bits.half_qp = v->halfpq;
- pic_param->pic_quantizer_fields.bits.pic_quantizer_scale = v->pq;
- pic_param->pic_quantizer_fields.bits.pic_quantizer_type = v->pquantizer;
- pic_param->pic_quantizer_fields.bits.dq_frame = v->dquantfrm;
- pic_param->pic_quantizer_fields.bits.dq_profile = v->dqprofile;
- pic_param->pic_quantizer_fields.bits.dq_sb_edge = v->dqprofile == DQPROFILE_SINGLE_EDGE ? v->dqsbedge : 0;
- pic_param->pic_quantizer_fields.bits.dq_db_edge = v->dqprofile == DQPROFILE_DOUBLE_EDGES ? v->dqsbedge : 0;
- pic_param->pic_quantizer_fields.bits.dq_binary_level = v->dqbilevel;
- pic_param->pic_quantizer_fields.bits.alt_pic_quantizer = v->altpq;
- pic_param->transform_fields.value = 0; /* reset all bits */
- pic_param->transform_fields.bits.variable_sized_transform_flag = v->vstransform;
- pic_param->transform_fields.bits.mb_level_transform_type_flag = v->ttmbf;
- pic_param->transform_fields.bits.frame_level_transform_type = v->ttfrm;
- pic_param->transform_fields.bits.transform_ac_codingset_idx1 = v->c_ac_table_index;
- pic_param->transform_fields.bits.transform_ac_codingset_idx2 = v->y_ac_table_index;
- pic_param->transform_fields.bits.intra_transform_dc_table = v->s.dc_table_index;
+ pic_param->forward_reference_picture = VA_INVALID_ID;
+ pic_param->backward_reference_picture = VA_INVALID_ID;
+ pic_param->inloop_decoded_picture = VA_INVALID_ID;
+ pic_param->BFV(sequence_fields,value) = 0; /* reset all bits */
+ NEW(pic_param->BFM(sequence_fields,bits,pulldown) = v->broadcast);
+ pic_param->BFM(sequence_fields,bits,interlace) = v->interlace;
+ NEW(pic_param->BFM(sequence_fields,bits,tfcntrflag) = v->tfcntrflag);
+ NEW(pic_param->BFM(sequence_fields,bits,finterpflag) = v->finterpflag);
+ NEW(pic_param->BFM(sequence_fields,bits,psf) = v->psf);
+ NEW(pic_param->BFM(sequence_fields,bits,multires) = v->multires);
+ pic_param->BFM(sequence_fields,bits,overlap) = v->overlap;
+ pic_param->BFM(sequence_fields,bits,syncmarker) = s->resync_marker;
+ NEW(pic_param->BFM(sequence_fields,bits,rangered) = v->rangered);
+ NEW(pic_param->BFM(sequence_fields,bits,max_b_frames) = s->avctx->max_b_frames);
+ pic_param->coded_width = s->avctx->coded_width;
+ pic_param->coded_height = s->avctx->coded_height;
+ NEW(pic_param->BFV(entrypoint_fields,value) = 0); /* reset all bits */
+ pic_param->BFM(entrypoint_fields,bits,broken_link) = v->broken_link;
+ pic_param->BFM(entrypoint_fields,bits,closed_entry) = v->closed_entry;
+ NEW(pic_param->BFM(entrypoint_fields,bits,panscan_flag) = v->panscanflag);
+ pic_param->BFM(entrypoint_fields,bits,loopfilter) = s->loop_filter;
+ pic_param->conditional_overlap_flag = v->condover;
+ pic_param->fast_uvmc_flag = v->fastuvmc;
+ pic_param->BFV(range_mapping_fields,value) = 0; /* reset all bits */
+ pic_param->BFMP(range_mapping,range_mapping_fields,bits,luma_flag) = v->range_mapy_flag;
+ pic_param->BFMP(range_mapping,range_mapping_fields,bits,luma) = v->range_mapy;
+ pic_param->BFMP(range_mapping,range_mapping_fields,bits,chroma_flag) = v->range_mapuv_flag;
+ pic_param->BFMP(range_mapping,range_mapping_fields,bits,chroma) = v->range_mapuv;
+ pic_param->b_picture_fraction = v->bfraction_lut_index;
+ pic_param->cbp_table = v->cbpcy_vlc ? v->cbpcy_vlc - ff_vc1_cbpcy_p_vlc : 0;
+ pic_param->mb_mode_table = 0; /* XXX: interlaced frame */
+ pic_param->range_reduction_frame = v->rangeredfrm;
+ pic_param->rounding_control = v->rnd;
+ pic_param->post_processing = v->postproc;
+ pic_param->picture_resolution_index = v->respic;
+ pic_param->luma_scale = v->lumscale;
+ pic_param->luma_shift = v->lumshift;
+ pic_param->BFV(picture_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(picture_fields,bits,picture_type) = vc1_get_PTYPE(v);
+ pic_param->BFM(picture_fields,bits,frame_coding_mode) = v->fcm;
+ pic_param->BFM(picture_fields,bits,top_field_first) = v->tff;
+ pic_param->BFM(picture_fields,bits,is_first_field) = v->fcm == 0; /* XXX: interlaced frame */
+ pic_param->BFM(picture_fields,bits,intensity_compensation) = v->mv_mode == MV_PMODE_INTENSITY_COMP;
+ pic_param->BFV(V_raw_coding,value) = 0; /* reset all bits */
+ pic_param->BFM(M_raw_coding,flags,mv_type_mb) = v->mv_type_is_raw;
+ pic_param->BFM(M_raw_coding,flags,direct_mb) = v->dmb_is_raw;
+ pic_param->BFM(M_raw_coding,flags,skip_mb) = v->skip_is_raw;
+ pic_param->BFM(M_raw_coding,flags,field_tx) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(M_raw_coding,flags,forward_mb) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(M_raw_coding,flags,ac_pred) = v->acpred_is_raw;
+ pic_param->BFM(M_raw_coding,flags,overflags) = v->overflg_is_raw;
+ pic_param->BFV(V_bitplane_present,value) = 0; /* reset all bits */
+ pic_param->BFM(M_bitplane_present,flags,bp_mv_type_mb) = vc1_has_MVTYPEMB_bitplane(v);
+ pic_param->BFM(M_bitplane_present,flags,bp_direct_mb) = vc1_has_DIRECTMB_bitplane(v);
+ pic_param->BFM(M_bitplane_present,flags,bp_skip_mb) = vc1_has_SKIPMB_bitplane(v);
+ pic_param->BFM(M_bitplane_present,flags,bp_field_tx) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(M_bitplane_present,flags,bp_forward_mb) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(M_bitplane_present,flags,bp_ac_pred) = vc1_has_ACPRED_bitplane(v);
+ pic_param->BFM(M_bitplane_present,flags,bp_overflags) = vc1_has_OVERFLAGS_bitplane(v);
+ pic_param->BFV(reference_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(reference_fields,bits,reference_distance_flag) = v->refdist_flag;
+ pic_param->BFM(reference_fields,bits,reference_distance) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(reference_fields,bits,num_reference_pictures) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(reference_fields,bits,reference_field_pic_indicator) = 0; /* XXX: interlaced frame */
+ pic_param->BFV(mv_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(mv_fields,bits,mv_mode) = vc1_get_MVMODE(v);
+ pic_param->BFM(mv_fields,bits,mv_mode2) = vc1_get_MVMODE2(v);
+ pic_param->BFM(mv_fields,bits,mv_table) = s->mv_table_index;
+ pic_param->BFM(mv_fields,bits,two_mv_block_pattern_table) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(mv_fields,bits,four_mv_switch) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(mv_fields,bits,four_mv_block_pattern_table) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(mv_fields,bits,extended_mv_flag) = v->extended_mv;
+ pic_param->BFM(mv_fields,bits,extended_mv_range) = v->mvrange;
+ pic_param->BFM(mv_fields,bits,extended_dmv_flag) = v->extended_dmv;
+ pic_param->BFM(mv_fields,bits,extended_dmv_range) = 0; /* XXX: interlaced frame */
+ pic_param->BFV(pic_quantizer_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(pic_quantizer_fields,bits,dquant) = v->dquant;
+ pic_param->BFM(pic_quantizer_fields,bits,quantizer) = v->quantizer_mode;
+ pic_param->BFM(pic_quantizer_fields,bits,half_qp) = v->halfpq;
+ pic_param->BFM(pic_quantizer_fields,bits,pic_quantizer_scale) = v->pq;
+ pic_param->BFM(pic_quantizer_fields,bits,pic_quantizer_type) = v->pquantizer;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_frame) = v->dquantfrm;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_profile) = v->dqprofile;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_sb_edge) = v->dqprofile == DQPROFILE_SINGLE_EDGE ? v->dqsbedge : 0;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_db_edge) = v->dqprofile == DQPROFILE_DOUBLE_EDGES ? v->dqsbedge : 0;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_binary_level) = v->dqbilevel;
+ pic_param->BFM(pic_quantizer_fields,bits,alt_pic_quantizer) = v->altpq;
+ pic_param->BFV(transform_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(transform_fields,bits,variable_sized_transform_flag) = v->vstransform;
+ pic_param->BFM(transform_fields,bits,mb_level_transform_type_flag) = v->ttmbf;
+ pic_param->BFM(transform_fields,bits,frame_level_transform_type) = v->ttfrm;
+ pic_param->BFM(transform_fields,bits,transform_ac_codingset_idx1) = v->c_ac_table_index;
+ pic_param->BFM(transform_fields,bits,transform_ac_codingset_idx2) = v->y_ac_table_index;
+ pic_param->BFM(transform_fields,bits,intra_transform_dc_table) = v->s.dc_table_index;
switch (s->pict_type) {
case FF_B_TYPE:
@@ -250,29 +250,29 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
break;
}
- if (pic_param->bitplane_present.value) {
+ if (pic_param->BFV(V_bitplane_present,value)) {
uint8_t *bitplane;
const uint8_t *ff_bp[3];
int x, y, n;
switch (s->pict_type) {
case FF_P_TYPE:
- ff_bp[0] = pic_param->bitplane_present.flags.bp_direct_mb ? v->direct_mb_plane : NULL;
- ff_bp[1] = pic_param->bitplane_present.flags.bp_skip_mb ? s->mbskip_table : NULL;
- ff_bp[2] = pic_param->bitplane_present.flags.bp_mv_type_mb ? v->mv_type_mb_plane : NULL;
+ ff_bp[0] = pic_param->BFM(M_bitplane_present,flags,bp_direct_mb) ? v->direct_mb_plane : NULL;
+ ff_bp[1] = pic_param->BFM(M_bitplane_present,flags,bp_skip_mb) ? s->mbskip_table : NULL;
+ ff_bp[2] = pic_param->BFM(M_bitplane_present,flags,bp_mv_type_mb) ? v->mv_type_mb_plane : NULL;
break;
case FF_B_TYPE:
if (!v->bi_type) {
- ff_bp[0] = pic_param->bitplane_present.flags.bp_direct_mb ? v->direct_mb_plane : NULL;
- ff_bp[1] = pic_param->bitplane_present.flags.bp_skip_mb ? s->mbskip_table : NULL;
+ ff_bp[0] = pic_param->BFM(M_bitplane_present,flags,bp_direct_mb) ? v->direct_mb_plane : NULL;
+ ff_bp[1] = pic_param->BFM(M_bitplane_present,flags,bp_skip_mb) ? s->mbskip_table : NULL;
ff_bp[2] = NULL; /* XXX: interlaced frame (FORWARD plane) */
break;
}
/* fall-through (BI-type) */
case FF_I_TYPE:
ff_bp[0] = NULL; /* XXX: interlaced frame (FIELDTX plane) */
- ff_bp[1] = pic_param->bitplane_present.flags.bp_ac_pred ? v->acpred_plane : NULL;
- ff_bp[2] = pic_param->bitplane_present.flags.bp_overflags ? v->over_flags_plane : NULL;
+ ff_bp[1] = pic_param->BFM(M_bitplane_present,flags,bp_ac_pred) ? v->acpred_plane : NULL;
+ ff_bp[2] = pic_param->BFM(M_bitplane_present,flags,bp_overflags) ? v->over_flags_plane : NULL;
break;
default:
ff_bp[0] = NULL;
diff --git a/libvo/vo_vaapi.c b/libvo/vo_vaapi.c
index 5f75b09..bbc95ff 100644
--- a/libvo/vo_vaapi.c
+++ b/libvo/vo_vaapi.c
@@ -45,7 +45,11 @@
#include <assert.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#if CONFIG_VAAPI_OLD
+#include <va_x11.h>
+#else
#include <va/va_x11.h>
+#endif
#if CONFIG_VAAPI_GLX
#include <va/va_glx.h>
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,97 @@
commit b46788e0ed28de261a20b9cef3e41ed53909547b
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Mon Dec 28 08:52:56 2009 +0000
Add GMA500 workaround for H.264 DPB. This is disabled by default. Enable with GMA500_WORKAROUND=yes environment variable.
diff --git a/ffmpeg/libavcodec/vaapi_h264.c b/ffmpeg/libavcodec/vaapi_h264.c
index 29f3a81..739bce7 100644
--- a/ffmpeg/libavcodec/vaapi_h264.c
+++ b/ffmpeg/libavcodec/vaapi_h264.c
@@ -28,6 +28,60 @@
* structures for H.264 decoding.
*/
+/** Parses ENV environment variable expecting "yes" | "no" values. */
+static int getenv_yesno(const char *env, int *pval)
+{
+ int val;
+ const char *env_str;
+
+ env_str = getenv(env);
+ if (!env_str)
+ return -1;
+
+ if (strcmp(env_str, "1") == 0 || strcmp(env_str, "yes") == 0)
+ val = 1;
+ else if (strcmp(env_str, "0") == 0 || strcmp(env_str, "no") == 0)
+ val = 0;
+ else
+ return -1;
+
+ if (pval)
+ *pval = val;
+ return 0;
+}
+
+/**
+ * Use old GMA500 workaround for DPB. It requires other pictures than
+ * those marked as "used for reference".
+ */
+static int get_use_gma500_workaround(struct vaapi_context *vactx)
+{
+ int gma500_workaround_env;
+ const char *vendor_string;
+
+ if (getenv_yesno("GMA500_WORKAROUND", &gma500_workaround_env) < 0)
+ return 0;
+ if (!gma500_workaround_env)
+ return 0;
+
+ vendor_string = vaQueryVendorString(vactx->display);
+ if (vendor_string && strstr(vendor_string, "Intel")) {
+ if (strstr(vendor_string, "GMA500"))
+ return 1;
+ if (strstr(vendor_string, "Embedded Graphics Driver"))
+ return 1;
+ }
+ return 0;
+}
+
+static inline int use_gma500_workaround(struct vaapi_context *vactx)
+{
+ static int gma500_workaround = -1;
+ if (gma500_workaround < 0)
+ gma500_workaround = get_use_gma500_workaround(vactx);
+ return gma500_workaround;
+}
+
/**
* Initialize an empty VA API picture.
*
@@ -123,6 +177,7 @@ static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param,
{
DPB dpb;
int i;
+ unsigned int list;
dpb.size = 0;
dpb.max_size = FF_ARRAY_ELEMS(pic_param->ReferenceFrames);
@@ -130,6 +185,17 @@ static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param,
for (i = 0; i < dpb.max_size; i++)
init_vaapi_pic(&dpb.va_pics[i]);
+ if (use_gma500_workaround(h->s.avctx->hwaccel_context)) {
+ /* XXX: this is really wrong */
+ for (list = 0; list < h->list_count; list++)
+ for (i = 0; i < (int)h->ref_count[list]; i++) {
+ Picture * const pic = &h->ref_list[list][i];
+ if (pic->reference && dpb_add(&dpb, pic) < 0)
+ return -1;
+ }
+ return 0;
+ }
+
for (i = 0; i < h->short_ref_count; i++) {
Picture * const pic = h->short_ref[i];
if (pic && pic->reference && dpb_add(&dpb, pic) < 0)

@ -0,0 +1,689 @@
commit 9d15e003b4a981dbe21f197e7ee91f7d86f5b818
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Fri Feb 12 11:03:00 2010 +0000
Add compatibility with original VA-API 0.29.
diff --git a/configure b/configure
index 45e4574..b1ff778 100755
--- a/configure
+++ b/configure
@@ -5835,21 +5835,36 @@ if test -n "$_vaapiprefix"; then
fi
if test "$_vaapi" = yes -o "$_vaapi" = auto; then
_vaapi=no
+ _vaapi_old=no
cat > $TMPC <<EOF
#include <va/va_x11.h>
int main(void) { (void) vaGetDisplay(0); return 0; }
EOF
- cc_check $_vaapiinc $_vaapilib -lva-x11 && _vaapi=yes
+ cc_check $_vaapiinc $_vaapilib -lva-x11 && _vaapi=yes || {
+ cat > $TMPC <<EOF
+#include <va_x11.h>
+int main(void) { (void) vaGetDisplay(0); return 0; }
+EOF
+ cc_check $_vaapiinc $_vaapilib -lva && _vaapi=yes _vaapi_old=yes
+ }
fi
if test "$_vaapi" = yes ; then
def_vaapi='#define CONFIG_VAAPI 1'
extra_cflags="$extra_cflags $_vaapiinc"
- libs_mencoder="$libs_mencoder $_vaapilib -lva"
- libs_mplayer="$libs_mplayer $_vaapilib -lva -lva-x11"
+ if test "$_vaapi_old" = no ; then
+ def_vaapi_old='#define CONFIG_VAAPI_OLD 0'
+ libs_mencoder="$libs_mencoder $_vaapilib -lva"
+ libs_mplayer="$libs_mplayer $_vaapilib -lva -lva-x11"
+ else
+ def_vaapi_old='#define CONFIG_VAAPI_OLD 1'
+ _mencoder="no"
+ libs_mplayer="$libs_mplayer $_vaapilib -lva"
+ fi
vomodules="vaapi $vomodules"
else
def_vaapi='#define CONFIG_VAAPI 0'
+ def_vaapi_old='#define CONFIG_VAAPI_OLD 0'
novomodules="vaapi $novomodules"
libavhwaccels=`echo $libavhwaccels | sed -e "s/\(MPEG[124]\|H26[34]\|WMV3\|VC1\)_VAAPI_HWACCEL//g"`
fi
@@ -8298,6 +8313,7 @@ CONFIG_MUXERS = $_mencoder
CONFIG_POSTPROC = yes
CONFIG_RTPDEC = $networking
CONFIG_VAAPI = $_vaapi
+CONFIG_VAAPI_OLD= $_vaapi_old
CONFIG_VDPAU = $_vdpau
CONFIG_XRENDER = $_xrender
CONFIG_XVMC = $_xvmc
@@ -8675,6 +8691,7 @@ $def_tdfxvid
$def_tga
$def_v4l2
$def_vaapi
+$def_vaapi_old
$def_vaapi_glx
$def_vdpau
$def_vesa
diff --git a/ffmpeg/libavcodec/vaapi_compat.h b/ffmpeg/libavcodec/vaapi_compat.h
new file mode 100644
index 0000000..2f7ece8
--- /dev/null
+++ b/ffmpeg/libavcodec/vaapi_compat.h
@@ -0,0 +1,96 @@
+/*
+ * Video Acceleration API (video decoding)
+ * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
+ *
+ * Copyright (C) 2008-2009 Splitted-Desktop Systems
+ *
+ * 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_VAAPI_COMPAT_H
+#define AVCODEC_VAAPI_COMPAT_H
+
+/* Compatibility glue with original VA-API 0.29 */
+#if CONFIG_VAAPI_OLD
+typedef struct _VASliceParameterBufferBase {
+ unsigned int slice_data_size;
+ unsigned int slice_data_offset;
+ unsigned int slice_data_flag;
+} VASliceParameterBufferBase;
+#endif
+
+#ifndef VA_SDS_VERSION
+#define VA_SDS_VERSION 0
+#endif
+
+#ifndef VA_CHECK_VERSION
+#define VA_MAJOR_VERSION 0
+#define VA_MINOR_VERSION 29
+#define VA_CHECK_VERSION(major,minor,micro) \
+ (VA_MAJOR_VERSION > (major) || \
+ (VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION > (minor)) || \
+ (VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION == (minor) && VA_MICRO_VERSION >= (micro)))
+#endif
+
+#ifndef VA_FOURCC
+#define VA_FOURCC(ch0, ch1, ch2, ch3) \
+ ((uint32_t)(uint8_t)(ch0) | \
+ ((uint32_t)(uint8_t)(ch1) << 8) | \
+ ((uint32_t)(uint8_t)(ch2) << 16) | \
+ ((uint32_t)(uint8_t)(ch3) << 24 ))
+#endif
+
+#ifndef VA_INVALID_ID
+#define VA_INVALID_ID 0xffffffff
+#endif
+#ifndef VA_INVALID_SURFACE
+#define VA_INVALID_SURFACE VA_INVALID_ID
+#endif
+
+/* Compatibility glue with VA-API >= 0.31 */
+#if VA_CHECK_VERSION(0,31,0)
+#define vaSyncSurface(dpy, context, surface) (vaSyncSurface)((dpy), (surface))
+#define vaPutImage2 vaPutImage
+#define vaAssociateSubpicture2 vaAssociateSubpicture
+#endif
+
+/* Used in codec implementation to set up the right bit-fields */
+#if CONFIG_VAAPI_OLD
+# define BFV(a, b) a
+# define BFM(a, b, c) c
+# define BFMP(p, a, b, c) p##_##c
+# define NEW(x) /* nothing */
+#else
+# define BFV(a, b) a.b
+# define BFM(a, b, c) a.b.c
+# define BFMP(p, a, b, c) a.b.c
+# define NEW(x) x
+#endif
+
+#if CONFIG_VAAPI_OLD
+# define V_raw_coding raw_coding_flag
+# define M_raw_coding raw_coding
+# define V_bitplane_present bitplane_present_flag
+# define M_bitplane_present bitplane_present
+#else
+# define V_raw_coding raw_coding
+# define M_raw_coding raw_coding
+# define V_bitplane_present bitplane_present
+# define M_bitplane_present bitplane_present
+#endif
+
+#endif /* AVCODEC_VAAPI_COMPAT_H */
diff --git a/ffmpeg/libavcodec/vaapi_h264.c b/ffmpeg/libavcodec/vaapi_h264.c
index 739bce7..27a0ee4 100644
--- a/ffmpeg/libavcodec/vaapi_h264.c
+++ b/ffmpeg/libavcodec/vaapi_h264.c
@@ -110,8 +110,8 @@ static void fill_vaapi_pic(VAPictureH264 *va_pic,
if (pic_structure == 0)
pic_structure = pic->reference;
- va_pic->picture_id = ff_vaapi_get_surface_id(pic);
- va_pic->frame_idx = pic->long_ref ? pic->pic_id : pic->frame_num;
+ va_pic->picture_id = ff_vaapi_get_surface_id(pic);
+ NEW(va_pic->frame_idx = pic->long_ref ? pic->pic_id : pic->frame_num);
va_pic->flags = 0;
if (pic_structure != PICT_FRAME)
@@ -304,42 +304,42 @@ static int start_frame(AVCodecContext *avctx,
fill_vaapi_pic(&pic_param->CurrPic, s->current_picture_ptr, s->picture_structure);
if (fill_vaapi_ReferenceFrames(pic_param, h) < 0)
return -1;
- pic_param->picture_width_in_mbs_minus1 = s->mb_width - 1;
- pic_param->picture_height_in_mbs_minus1 = s->mb_height - 1;
- pic_param->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8;
- pic_param->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8;
- pic_param->num_ref_frames = h->sps.ref_frame_count;
- pic_param->seq_fields.value = 0; /* reset all bits */
- pic_param->seq_fields.bits.chroma_format_idc = h->sps.chroma_format_idc;
- pic_param->seq_fields.bits.residual_colour_transform_flag = h->sps.residual_color_transform_flag; /* XXX: only for 4:4:4 high profile? */
- pic_param->seq_fields.bits.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag;
- pic_param->seq_fields.bits.frame_mbs_only_flag = h->sps.frame_mbs_only_flag;
- pic_param->seq_fields.bits.mb_adaptive_frame_field_flag = h->sps.mb_aff;
- pic_param->seq_fields.bits.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag;
- pic_param->seq_fields.bits.MinLumaBiPredSize8x8 = h->sps.level_idc >= 31; /* A.3.3.2 */
- pic_param->seq_fields.bits.log2_max_frame_num_minus4 = h->sps.log2_max_frame_num - 4;
- pic_param->seq_fields.bits.pic_order_cnt_type = h->sps.poc_type;
- pic_param->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4;
- pic_param->seq_fields.bits.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag;
- pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1;
- pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type;
- pic_param->slice_group_change_rate_minus1 = 0; /* XXX: unimplemented in FFmpeg */
- pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26;
- pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26;
- pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0];
- pic_param->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1];
- pic_param->pic_fields.value = 0; /* reset all bits */
- pic_param->pic_fields.bits.entropy_coding_mode_flag = h->pps.cabac;
- pic_param->pic_fields.bits.weighted_pred_flag = h->pps.weighted_pred;
- pic_param->pic_fields.bits.weighted_bipred_idc = h->pps.weighted_bipred_idc;
- pic_param->pic_fields.bits.transform_8x8_mode_flag = h->pps.transform_8x8_mode;
- pic_param->pic_fields.bits.field_pic_flag = s->picture_structure != PICT_FRAME;
- pic_param->pic_fields.bits.constrained_intra_pred_flag = h->pps.constrained_intra_pred;
- pic_param->pic_fields.bits.pic_order_present_flag = h->pps.pic_order_present;
- pic_param->pic_fields.bits.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present;
- pic_param->pic_fields.bits.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present;
- pic_param->pic_fields.bits.reference_pic_flag = h->nal_ref_idc != 0;
- pic_param->frame_num = h->frame_num;
+ pic_param->picture_width_in_mbs_minus1 = s->mb_width - 1;
+ pic_param->picture_height_in_mbs_minus1 = s->mb_height - 1;
+ pic_param->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8;
+ pic_param->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8;
+ pic_param->num_ref_frames = h->sps.ref_frame_count;
+ pic_param->BFV(seq_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(seq_fields,bits,chroma_format_idc) = h->sps.chroma_format_idc;
+ pic_param->BFM(seq_fields,bits,residual_colour_transform_flag) = h->sps.residual_color_transform_flag; /* XXX: only for 4:4:4 high profile? */
+ NEW(pic_param->BFM(seq_fields,bits,gaps_in_frame_num_value_allowed_flag) = h->sps.gaps_in_frame_num_allowed_flag);
+ pic_param->BFM(seq_fields,bits,frame_mbs_only_flag) = h->sps.frame_mbs_only_flag;
+ pic_param->BFM(seq_fields,bits,mb_adaptive_frame_field_flag) = h->sps.mb_aff;
+ pic_param->BFM(seq_fields,bits,direct_8x8_inference_flag) = h->sps.direct_8x8_inference_flag;
+ pic_param->BFM(seq_fields,bits,MinLumaBiPredSize8x8) = h->sps.level_idc >= 31; /* A.3.3.2 */
+ NEW(pic_param->BFM(seq_fields,bits,log2_max_frame_num_minus4) = h->sps.log2_max_frame_num - 4);
+ NEW(pic_param->BFM(seq_fields,bits,pic_order_cnt_type) = h->sps.poc_type);
+ NEW(pic_param->BFM(seq_fields,bits,log2_max_pic_order_cnt_lsb_minus4) = h->sps.log2_max_poc_lsb - 4);
+ NEW(pic_param->BFM(seq_fields,bits,delta_pic_order_always_zero_flag) = h->sps.delta_pic_order_always_zero_flag);
+ pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1;
+ pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type;
+ NEW(pic_param->slice_group_change_rate_minus1 = 0); /* XXX: unimplemented in FFmpeg */
+ pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26;
+ NEW(pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26);
+ pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0];
+ pic_param->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1];
+ pic_param->BFV(pic_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(pic_fields,bits,entropy_coding_mode_flag) = h->pps.cabac;
+ pic_param->BFM(pic_fields,bits,weighted_pred_flag) = h->pps.weighted_pred;
+ pic_param->BFM(pic_fields,bits,weighted_bipred_idc) = h->pps.weighted_bipred_idc;
+ pic_param->BFM(pic_fields,bits,transform_8x8_mode_flag) = h->pps.transform_8x8_mode;
+ pic_param->BFM(pic_fields,bits,field_pic_flag) = s->picture_structure != PICT_FRAME;
+ pic_param->BFM(pic_fields,bits,constrained_intra_pred_flag) = h->pps.constrained_intra_pred;
+ NEW(pic_param->BFM(pic_fields,bits,pic_order_present_flag) = h->pps.pic_order_present);
+ NEW(pic_param->BFM(pic_fields,bits,deblocking_filter_control_present_flag) = h->pps.deblocking_filter_parameters_present);
+ NEW(pic_param->BFM(pic_fields,bits,redundant_pic_cnt_present_flag) = h->pps.redundant_pic_cnt_present);
+ NEW(pic_param->BFM(pic_fields,bits,reference_pic_flag) = h->nal_ref_idc != 0);
+ pic_param->frame_num = h->frame_num;
/* Fill in VAIQMatrixBufferH264. */
iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferH264));
diff --git a/ffmpeg/libavcodec/vaapi_internal.h b/ffmpeg/libavcodec/vaapi_internal.h
index 2c0fdf9..ff83b96 100644
--- a/ffmpeg/libavcodec/vaapi_internal.h
+++ b/ffmpeg/libavcodec/vaapi_internal.h
@@ -24,8 +24,14 @@
#ifndef AVCODEC_VAAPI_INTERNAL_H
#define AVCODEC_VAAPI_INTERNAL_H
+#include "config.h"
+#if CONFIG_VAAPI_OLD
+#include <va.h>
+#else
#include <va/va.h>
+#endif
#include "vaapi.h"
+#include "vaapi_compat.h"
#include "avcodec.h"
#include "mpegvideo.h"
diff --git a/ffmpeg/libavcodec/vaapi_mpeg2.c b/ffmpeg/libavcodec/vaapi_mpeg2.c
index 2e870dc..277c7a5 100644
--- a/ffmpeg/libavcodec/vaapi_mpeg2.c
+++ b/ffmpeg/libavcodec/vaapi_mpeg2.c
@@ -52,24 +52,24 @@ static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_
pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferMPEG2));
if (!pic_param)
return -1;
- pic_param->horizontal_size = s->width;
- pic_param->vertical_size = s->height;
- pic_param->forward_reference_picture = VA_INVALID_ID;
- pic_param->backward_reference_picture = VA_INVALID_ID;
- pic_param->picture_coding_type = s->pict_type;
- pic_param->f_code = mpeg2_get_f_code(s);
- pic_param->picture_coding_extension.value = 0; /* reset all bits */
- pic_param->picture_coding_extension.bits.intra_dc_precision = s->intra_dc_precision;
- pic_param->picture_coding_extension.bits.picture_structure = s->picture_structure;
- pic_param->picture_coding_extension.bits.top_field_first = s->top_field_first;
- pic_param->picture_coding_extension.bits.frame_pred_frame_dct = s->frame_pred_frame_dct;
- pic_param->picture_coding_extension.bits.concealment_motion_vectors = s->concealment_motion_vectors;
- pic_param->picture_coding_extension.bits.q_scale_type = s->q_scale_type;
- pic_param->picture_coding_extension.bits.intra_vlc_format = s->intra_vlc_format;
- pic_param->picture_coding_extension.bits.alternate_scan = s->alternate_scan;
- pic_param->picture_coding_extension.bits.repeat_first_field = s->repeat_first_field;
- pic_param->picture_coding_extension.bits.progressive_frame = s->progressive_frame;
- pic_param->picture_coding_extension.bits.is_first_field = mpeg2_get_is_frame_start(s);
+ pic_param->horizontal_size = s->width;
+ pic_param->vertical_size = s->height;
+ pic_param->forward_reference_picture = VA_INVALID_ID;
+ pic_param->backward_reference_picture = VA_INVALID_ID;
+ pic_param->picture_coding_type = s->pict_type;
+ pic_param->f_code = mpeg2_get_f_code(s);
+ pic_param->BFV(picture_coding_extension,value) = 0; /* reset all bits */
+ pic_param->BFM(picture_coding_extension,bits,intra_dc_precision) = s->intra_dc_precision;
+ pic_param->BFM(picture_coding_extension,bits,picture_structure) = s->picture_structure;
+ pic_param->BFM(picture_coding_extension,bits,top_field_first) = s->top_field_first;
+ pic_param->BFM(picture_coding_extension,bits,frame_pred_frame_dct) = s->frame_pred_frame_dct;
+ pic_param->BFM(picture_coding_extension,bits,concealment_motion_vectors) = s->concealment_motion_vectors;
+ pic_param->BFM(picture_coding_extension,bits,q_scale_type) = s->q_scale_type;
+ pic_param->BFM(picture_coding_extension,bits,intra_vlc_format) = s->intra_vlc_format;
+ pic_param->BFM(picture_coding_extension,bits,alternate_scan) = s->alternate_scan;
+ pic_param->BFM(picture_coding_extension,bits,repeat_first_field) = s->repeat_first_field;
+ pic_param->BFM(picture_coding_extension,bits,progressive_frame) = s->progressive_frame;
+ pic_param->BFM(picture_coding_extension,bits,is_first_field) = mpeg2_get_is_frame_start(s);
switch (s->pict_type) {
case FF_B_TYPE:
@@ -131,7 +131,9 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
if (!slice_param)
return -1;
slice_param->macroblock_offset = macroblock_offset;
+#if VA_CHECK_VERSION(0,31,1) || (VA_CHECK_VERSION(0,31,0) && VA_SDS_VERSION >= 3)
slice_param->slice_horizontal_position = s->mb_x;
+#endif
slice_param->slice_vertical_position = s->mb_y;
slice_param->quantiser_scale_code = quantiser_scale_code;
slice_param->intra_slice_flag = intra_slice_flag;
diff --git a/ffmpeg/libavcodec/vaapi_mpeg4.c b/ffmpeg/libavcodec/vaapi_mpeg4.c
index 8f02e91..557ae6c 100644
--- a/ffmpeg/libavcodec/vaapi_mpeg4.c
+++ b/ffmpeg/libavcodec/vaapi_mpeg4.c
@@ -55,42 +55,46 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferMPEG4));
if (!pic_param)
return -1;
- pic_param->vop_width = s->width;
- pic_param->vop_height = s->height;
- pic_param->forward_reference_picture = VA_INVALID_ID;
- pic_param->backward_reference_picture = VA_INVALID_ID;
- pic_param->vol_fields.value = 0; /* reset all bits */
- pic_param->vol_fields.bits.short_video_header = avctx->codec->id == CODEC_ID_H263;
- pic_param->vol_fields.bits.chroma_format = CHROMA_420;
- pic_param->vol_fields.bits.interlaced = !s->progressive_sequence;
- pic_param->vol_fields.bits.obmc_disable = 1;
- pic_param->vol_fields.bits.sprite_enable = s->vol_sprite_usage;
- pic_param->vol_fields.bits.sprite_warping_accuracy = s->sprite_warping_accuracy;
- pic_param->vol_fields.bits.quant_type = s->mpeg_quant;
- pic_param->vol_fields.bits.quarter_sample = s->quarter_sample;
- pic_param->vol_fields.bits.data_partitioned = s->data_partitioning;
- pic_param->vol_fields.bits.reversible_vlc = s->rvlc;
- pic_param->vol_fields.bits.resync_marker_disable = !s->resync_marker;
- pic_param->no_of_sprite_warping_points = s->num_sprite_warping_points;
+ pic_param->vop_width = s->width;
+ pic_param->vop_height = s->height;
+ pic_param->forward_reference_picture = VA_INVALID_ID;
+ pic_param->backward_reference_picture = VA_INVALID_ID;
+ pic_param->BFV(vol_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(vol_fields,bits,short_video_header) = avctx->codec->id == CODEC_ID_H263;
+ pic_param->BFM(vol_fields,bits,chroma_format) = CHROMA_420;
+ pic_param->BFM(vol_fields,bits,interlaced) = !s->progressive_sequence;
+ pic_param->BFM(vol_fields,bits,obmc_disable) = 1;
+ pic_param->BFM(vol_fields,bits,sprite_enable) = s->vol_sprite_usage;
+ pic_param->BFM(vol_fields,bits,sprite_warping_accuracy) = s->sprite_warping_accuracy;
+ pic_param->BFM(vol_fields,bits,quant_type) = s->mpeg_quant;
+ pic_param->BFM(vol_fields,bits,quarter_sample) = s->quarter_sample;
+ pic_param->BFM(vol_fields,bits,data_partitioned) = s->data_partitioning;
+ pic_param->BFM(vol_fields,bits,reversible_vlc) = s->rvlc;
+#if VA_CHECK_VERSION(0,31,1) || (VA_CHECK_VERSION(0,31,0) && VA_SDS_VERSION >= 4)
+ pic_param->BFM(vol_fields,bits,resync_marker_disable) = !s->resync_marker;
+#endif
+ pic_param->no_of_sprite_warping_points = s->num_sprite_warping_points;
for (i = 0; i < s->num_sprite_warping_points && i < 3; i++) {
- pic_param->sprite_trajectory_du[i] = s->sprite_traj[i][0];
- pic_param->sprite_trajectory_dv[i] = s->sprite_traj[i][1];
+ pic_param->sprite_trajectory_du[i] = s->sprite_traj[i][0];
+ pic_param->sprite_trajectory_dv[i] = s->sprite_traj[i][1];
}
- pic_param->quant_precision = s->quant_precision;
- pic_param->vop_fields.value = 0; /* reset all bits */
- pic_param->vop_fields.bits.vop_coding_type = s->pict_type - FF_I_TYPE;
- pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == FF_B_TYPE ? s->next_picture.pict_type - FF_I_TYPE : 0;
- pic_param->vop_fields.bits.vop_rounding_type = s->no_rounding;
- pic_param->vop_fields.bits.intra_dc_vlc_thr = mpeg4_get_intra_dc_vlc_thr(s);
- pic_param->vop_fields.bits.top_field_first = s->top_field_first;
- pic_param->vop_fields.bits.alternate_vertical_scan_flag = s->alternate_scan;
- pic_param->vop_fcode_forward = s->f_code;
- pic_param->vop_fcode_backward = s->b_code;
- pic_param->vop_time_increment_resolution = avctx->time_base.den;
- pic_param->num_macroblocks_in_gob = s->mb_width * ff_h263_get_gob_height(s);
- pic_param->num_gobs_in_vop = (s->mb_width * s->mb_height) / pic_param->num_macroblocks_in_gob;
- pic_param->TRB = s->pb_time;
- pic_param->TRD = s->pp_time;
+ pic_param->quant_precision = s->quant_precision;
+ pic_param->BFV(vop_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(vop_fields,bits,vop_coding_type) = s->pict_type - FF_I_TYPE;
+ pic_param->BFM(vop_fields,bits,backward_reference_vop_coding_type) = s->pict_type == FF_B_TYPE ? s->next_picture.pict_type - FF_I_TYPE : 0;
+ pic_param->BFM(vop_fields,bits,vop_rounding_type) = s->no_rounding;
+ pic_param->BFM(vop_fields,bits,intra_dc_vlc_thr) = mpeg4_get_intra_dc_vlc_thr(s);
+ pic_param->BFM(vop_fields,bits,top_field_first) = s->top_field_first;
+ pic_param->BFM(vop_fields,bits,alternate_vertical_scan_flag) = s->alternate_scan;
+ pic_param->vop_fcode_forward = s->f_code;
+ pic_param->vop_fcode_backward = s->b_code;
+#if VA_CHECK_VERSION(0,31,1) || (VA_CHECK_VERSION(0,31,0) && VA_SDS_VERSION >= 4)
+ pic_param->vop_time_increment_resolution = avctx->time_base.den;
+#endif
+ pic_param->num_macroblocks_in_gob = s->mb_width * ff_h263_get_gob_height(s);
+ pic_param->num_gobs_in_vop = (s->mb_width * s->mb_height) / pic_param->num_macroblocks_in_gob;
+ pic_param->TRB = s->pb_time;
+ pic_param->TRD = s->pp_time;
if (s->pict_type == FF_B_TYPE)
pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture);
@@ -99,7 +103,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
/* Fill in VAIQMatrixBufferMPEG4 */
/* Only the first inverse quantisation method uses the weighthing matrices */
- if (pic_param->vol_fields.bits.quant_type) {
+ if (pic_param->BFM(vol_fields,bits,quant_type)) {
iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferMPEG4));
if (!iq_matrix)
return -1;
diff --git a/ffmpeg/libavcodec/vaapi_vc1.c b/ffmpeg/libavcodec/vaapi_vc1.c
index 34e9056..b29e50e 100644
--- a/ffmpeg/libavcodec/vaapi_vc1.c
+++ b/ffmpeg/libavcodec/vaapi_vc1.c
@@ -146,101 +146,103 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferVC1));
if (!pic_param)
return -1;
- pic_param->forward_reference_picture = VA_INVALID_ID;
- pic_param->backward_reference_picture = VA_INVALID_ID;
- pic_param->inloop_decoded_picture = VA_INVALID_ID;
- pic_param->sequence_fields.value = 0; /* reset all bits */
- pic_param->sequence_fields.bits.pulldown = v->broadcast;
- pic_param->sequence_fields.bits.interlace = v->interlace;
- pic_param->sequence_fields.bits.tfcntrflag = v->tfcntrflag;
- pic_param->sequence_fields.bits.finterpflag = v->finterpflag;
- pic_param->sequence_fields.bits.psf = v->psf;
- pic_param->sequence_fields.bits.multires = v->multires;
- pic_param->sequence_fields.bits.overlap = v->overlap;
- pic_param->sequence_fields.bits.syncmarker = s->resync_marker;
- pic_param->sequence_fields.bits.rangered = v->rangered;
- pic_param->sequence_fields.bits.max_b_frames = s->avctx->max_b_frames;
- pic_param->sequence_fields.bits.profile = v->profile;
- pic_param->coded_width = s->avctx->coded_width;
- pic_param->coded_height = s->avctx->coded_height;
- pic_param->entrypoint_fields.value = 0; /* reset all bits */
- pic_param->entrypoint_fields.bits.broken_link = v->broken_link;
- pic_param->entrypoint_fields.bits.closed_entry = v->closed_entry;
- pic_param->entrypoint_fields.bits.panscan_flag = v->panscanflag;
- pic_param->entrypoint_fields.bits.loopfilter = s->loop_filter;
- pic_param->conditional_overlap_flag = v->condover;
- pic_param->fast_uvmc_flag = v->fastuvmc;
- pic_param->range_mapping_fields.value = 0; /* reset all bits */
- pic_param->range_mapping_fields.bits.luma_flag = v->range_mapy_flag;
- pic_param->range_mapping_fields.bits.luma = v->range_mapy;
- pic_param->range_mapping_fields.bits.chroma_flag = v->range_mapuv_flag;
- pic_param->range_mapping_fields.bits.chroma = v->range_mapuv;
- pic_param->b_picture_fraction = v->bfraction_lut_index;
- pic_param->cbp_table = v->cbpcy_vlc ? v->cbpcy_vlc - ff_vc1_cbpcy_p_vlc : 0;
- pic_param->mb_mode_table = 0; /* XXX: interlaced frame */
- pic_param->range_reduction_frame = v->rangeredfrm;
- pic_param->rounding_control = v->rnd;
- pic_param->post_processing = v->postproc;
- pic_param->picture_resolution_index = v->respic;
- pic_param->luma_scale = v->lumscale;
- pic_param->luma_shift = v->lumshift;
- pic_param->picture_fields.value = 0; /* reset all bits */
- pic_param->picture_fields.bits.picture_type = vc1_get_PTYPE(v);
- pic_param->picture_fields.bits.frame_coding_mode = v->fcm;
- pic_param->picture_fields.bits.top_field_first = v->tff;
- pic_param->picture_fields.bits.is_first_field = v->fcm == 0; /* XXX: interlaced frame */
- pic_param->picture_fields.bits.intensity_compensation = v->mv_mode == MV_PMODE_INTENSITY_COMP;
- pic_param->raw_coding.value = 0; /* reset all bits */
- pic_param->raw_coding.flags.mv_type_mb = v->mv_type_is_raw;
- pic_param->raw_coding.flags.direct_mb = v->dmb_is_raw;
- pic_param->raw_coding.flags.skip_mb = v->skip_is_raw;
- pic_param->raw_coding.flags.field_tx = 0; /* XXX: interlaced frame */
- pic_param->raw_coding.flags.forward_mb = 0; /* XXX: interlaced frame */
- pic_param->raw_coding.flags.ac_pred = v->acpred_is_raw;
- pic_param->raw_coding.flags.overflags = v->overflg_is_raw;
- pic_param->bitplane_present.value = 0; /* reset all bits */
- pic_param->bitplane_present.flags.bp_mv_type_mb = vc1_has_MVTYPEMB_bitplane(v);
- pic_param->bitplane_present.flags.bp_direct_mb = vc1_has_DIRECTMB_bitplane(v);
- pic_param->bitplane_present.flags.bp_skip_mb = vc1_has_SKIPMB_bitplane(v);
- pic_param->bitplane_present.flags.bp_field_tx = 0; /* XXX: interlaced frame */
- pic_param->bitplane_present.flags.bp_forward_mb = 0; /* XXX: interlaced frame */
- pic_param->bitplane_present.flags.bp_ac_pred = vc1_has_ACPRED_bitplane(v);
- pic_param->bitplane_present.flags.bp_overflags = vc1_has_OVERFLAGS_bitplane(v);
- pic_param->reference_fields.value = 0; /* reset all bits */
- pic_param->reference_fields.bits.reference_distance_flag = v->refdist_flag;
- pic_param->reference_fields.bits.reference_distance = 0; /* XXX: interlaced frame */
- pic_param->reference_fields.bits.num_reference_pictures = 0; /* XXX: interlaced frame */
- pic_param->reference_fields.bits.reference_field_pic_indicator = 0; /* XXX: interlaced frame */
- pic_param->mv_fields.value = 0; /* reset all bits */
- pic_param->mv_fields.bits.mv_mode = vc1_get_MVMODE(v);
- pic_param->mv_fields.bits.mv_mode2 = vc1_get_MVMODE2(v);
- pic_param->mv_fields.bits.mv_table = s->mv_table_index;
- pic_param->mv_fields.bits.two_mv_block_pattern_table = 0; /* XXX: interlaced frame */
- pic_param->mv_fields.bits.four_mv_switch = 0; /* XXX: interlaced frame */
- pic_param->mv_fields.bits.four_mv_block_pattern_table = 0; /* XXX: interlaced frame */
- pic_param->mv_fields.bits.extended_mv_flag = v->extended_mv;
- pic_param->mv_fields.bits.extended_mv_range = v->mvrange;
- pic_param->mv_fields.bits.extended_dmv_flag = v->extended_dmv;
- pic_param->mv_fields.bits.extended_dmv_range = 0; /* XXX: interlaced frame */
- pic_param->pic_quantizer_fields.value = 0; /* reset all bits */
- pic_param->pic_quantizer_fields.bits.dquant = v->dquant;
- pic_param->pic_quantizer_fields.bits.quantizer = v->quantizer_mode;
- pic_param->pic_quantizer_fields.bits.half_qp = v->halfpq;
- pic_param->pic_quantizer_fields.bits.pic_quantizer_scale = v->pq;
- pic_param->pic_quantizer_fields.bits.pic_quantizer_type = v->pquantizer;
- pic_param->pic_quantizer_fields.bits.dq_frame = v->dquantfrm;
- pic_param->pic_quantizer_fields.bits.dq_profile = v->dqprofile;
- pic_param->pic_quantizer_fields.bits.dq_sb_edge = v->dqprofile == DQPROFILE_SINGLE_EDGE ? v->dqsbedge : 0;
- pic_param->pic_quantizer_fields.bits.dq_db_edge = v->dqprofile == DQPROFILE_DOUBLE_EDGES ? v->dqsbedge : 0;
- pic_param->pic_quantizer_fields.bits.dq_binary_level = v->dqbilevel;
- pic_param->pic_quantizer_fields.bits.alt_pic_quantizer = v->altpq;
- pic_param->transform_fields.value = 0; /* reset all bits */
- pic_param->transform_fields.bits.variable_sized_transform_flag = v->vstransform;
- pic_param->transform_fields.bits.mb_level_transform_type_flag = v->ttmbf;
- pic_param->transform_fields.bits.frame_level_transform_type = v->ttfrm;
- pic_param->transform_fields.bits.transform_ac_codingset_idx1 = v->c_ac_table_index;
- pic_param->transform_fields.bits.transform_ac_codingset_idx2 = v->y_ac_table_index;
- pic_param->transform_fields.bits.intra_transform_dc_table = v->s.dc_table_index;
+ pic_param->forward_reference_picture = VA_INVALID_ID;
+ pic_param->backward_reference_picture = VA_INVALID_ID;
+ pic_param->inloop_decoded_picture = VA_INVALID_ID;
+ pic_param->BFV(sequence_fields,value) = 0; /* reset all bits */
+ NEW(pic_param->BFM(sequence_fields,bits,pulldown) = v->broadcast);
+ pic_param->BFM(sequence_fields,bits,interlace) = v->interlace;
+ NEW(pic_param->BFM(sequence_fields,bits,tfcntrflag) = v->tfcntrflag);
+ NEW(pic_param->BFM(sequence_fields,bits,finterpflag) = v->finterpflag);
+ NEW(pic_param->BFM(sequence_fields,bits,psf) = v->psf);
+ NEW(pic_param->BFM(sequence_fields,bits,multires) = v->multires);
+ pic_param->BFM(sequence_fields,bits,overlap) = v->overlap;
+ pic_param->BFM(sequence_fields,bits,syncmarker) = s->resync_marker;
+ NEW(pic_param->BFM(sequence_fields,bits,rangered) = v->rangered);
+ NEW(pic_param->BFM(sequence_fields,bits,max_b_frames) = s->avctx->max_b_frames);
+#if VA_CHECK_VERSION(0,32,0)
+ NEW(pic_param->BFM(sequence_fields,bits,profile) = v->profile);
+#endif
+ pic_param->coded_width = s->avctx->coded_width;
+ pic_param->coded_height = s->avctx->coded_height;
+ NEW(pic_param->BFV(entrypoint_fields,value) = 0); /* reset all bits */
+ pic_param->BFM(entrypoint_fields,bits,broken_link) = v->broken_link;
+ pic_param->BFM(entrypoint_fields,bits,closed_entry) = v->closed_entry;
+ NEW(pic_param->BFM(entrypoint_fields,bits,panscan_flag) = v->panscanflag);
+ pic_param->BFM(entrypoint_fields,bits,loopfilter) = s->loop_filter;
+ pic_param->conditional_overlap_flag = v->condover;
+ pic_param->fast_uvmc_flag = v->fastuvmc;
+ pic_param->BFV(range_mapping_fields,value) = 0; /* reset all bits */
+ pic_param->BFMP(range_mapping,range_mapping_fields,bits,luma_flag) = v->range_mapy_flag;
+ pic_param->BFMP(range_mapping,range_mapping_fields,bits,luma) = v->range_mapy;
+ pic_param->BFMP(range_mapping,range_mapping_fields,bits,chroma_flag) = v->range_mapuv_flag;
+ pic_param->BFMP(range_mapping,range_mapping_fields,bits,chroma) = v->range_mapuv;
+ pic_param->b_picture_fraction = v->bfraction_lut_index;
+ pic_param->cbp_table = v->cbpcy_vlc ? v->cbpcy_vlc - ff_vc1_cbpcy_p_vlc : 0;
+ pic_param->mb_mode_table = 0; /* XXX: interlaced frame */
+ pic_param->range_reduction_frame = v->rangeredfrm;
+ pic_param->rounding_control = v->rnd;
+ pic_param->post_processing = v->postproc;
+ pic_param->picture_resolution_index = v->respic;
+ pic_param->luma_scale = v->lumscale;
+ pic_param->luma_shift = v->lumshift;
+ pic_param->BFV(picture_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(picture_fields,bits,picture_type) = vc1_get_PTYPE(v);
+ pic_param->BFM(picture_fields,bits,frame_coding_mode) = v->fcm;
+ pic_param->BFM(picture_fields,bits,top_field_first) = v->tff;
+ pic_param->BFM(picture_fields,bits,is_first_field) = v->fcm == 0; /* XXX: interlaced frame */
+ pic_param->BFM(picture_fields,bits,intensity_compensation) = v->mv_mode == MV_PMODE_INTENSITY_COMP;
+ pic_param->BFV(V_raw_coding,value) = 0; /* reset all bits */
+ pic_param->BFM(M_raw_coding,flags,mv_type_mb) = v->mv_type_is_raw;
+ pic_param->BFM(M_raw_coding,flags,direct_mb) = v->dmb_is_raw;
+ pic_param->BFM(M_raw_coding,flags,skip_mb) = v->skip_is_raw;
+ pic_param->BFM(M_raw_coding,flags,field_tx) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(M_raw_coding,flags,forward_mb) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(M_raw_coding,flags,ac_pred) = v->acpred_is_raw;
+ pic_param->BFM(M_raw_coding,flags,overflags) = v->overflg_is_raw;
+ pic_param->BFV(V_bitplane_present,value) = 0; /* reset all bits */
+ pic_param->BFM(M_bitplane_present,flags,bp_mv_type_mb) = vc1_has_MVTYPEMB_bitplane(v);
+ pic_param->BFM(M_bitplane_present,flags,bp_direct_mb) = vc1_has_DIRECTMB_bitplane(v);
+ pic_param->BFM(M_bitplane_present,flags,bp_skip_mb) = vc1_has_SKIPMB_bitplane(v);
+ pic_param->BFM(M_bitplane_present,flags,bp_field_tx) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(M_bitplane_present,flags,bp_forward_mb) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(M_bitplane_present,flags,bp_ac_pred) = vc1_has_ACPRED_bitplane(v);
+ pic_param->BFM(M_bitplane_present,flags,bp_overflags) = vc1_has_OVERFLAGS_bitplane(v);
+ pic_param->BFV(reference_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(reference_fields,bits,reference_distance_flag) = v->refdist_flag;
+ pic_param->BFM(reference_fields,bits,reference_distance) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(reference_fields,bits,num_reference_pictures) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(reference_fields,bits,reference_field_pic_indicator) = 0; /* XXX: interlaced frame */
+ pic_param->BFV(mv_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(mv_fields,bits,mv_mode) = vc1_get_MVMODE(v);
+ pic_param->BFM(mv_fields,bits,mv_mode2) = vc1_get_MVMODE2(v);
+ pic_param->BFM(mv_fields,bits,mv_table) = s->mv_table_index;
+ pic_param->BFM(mv_fields,bits,two_mv_block_pattern_table) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(mv_fields,bits,four_mv_switch) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(mv_fields,bits,four_mv_block_pattern_table) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(mv_fields,bits,extended_mv_flag) = v->extended_mv;
+ pic_param->BFM(mv_fields,bits,extended_mv_range) = v->mvrange;
+ pic_param->BFM(mv_fields,bits,extended_dmv_flag) = v->extended_dmv;
+ pic_param->BFM(mv_fields,bits,extended_dmv_range) = 0; /* XXX: interlaced frame */
+ pic_param->BFV(pic_quantizer_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(pic_quantizer_fields,bits,dquant) = v->dquant;
+ pic_param->BFM(pic_quantizer_fields,bits,quantizer) = v->quantizer_mode;
+ pic_param->BFM(pic_quantizer_fields,bits,half_qp) = v->halfpq;
+ pic_param->BFM(pic_quantizer_fields,bits,pic_quantizer_scale) = v->pq;
+ pic_param->BFM(pic_quantizer_fields,bits,pic_quantizer_type) = v->pquantizer;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_frame) = v->dquantfrm;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_profile) = v->dqprofile;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_sb_edge) = v->dqprofile == DQPROFILE_SINGLE_EDGE ? v->dqsbedge : 0;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_db_edge) = v->dqprofile == DQPROFILE_DOUBLE_EDGES ? v->dqsbedge : 0;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_binary_level) = v->dqbilevel;
+ pic_param->BFM(pic_quantizer_fields,bits,alt_pic_quantizer) = v->altpq;
+ pic_param->BFV(transform_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(transform_fields,bits,variable_sized_transform_flag) = v->vstransform;
+ pic_param->BFM(transform_fields,bits,mb_level_transform_type_flag) = v->ttmbf;
+ pic_param->BFM(transform_fields,bits,frame_level_transform_type) = v->ttfrm;
+ pic_param->BFM(transform_fields,bits,transform_ac_codingset_idx1) = v->c_ac_table_index;
+ pic_param->BFM(transform_fields,bits,transform_ac_codingset_idx2) = v->y_ac_table_index;
+ pic_param->BFM(transform_fields,bits,intra_transform_dc_table) = v->s.dc_table_index;
switch (s->pict_type) {
case FF_B_TYPE:
@@ -251,29 +253,29 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
break;
}
- if (pic_param->bitplane_present.value) {
+ if (pic_param->BFV(V_bitplane_present,value)) {
uint8_t *bitplane;
const uint8_t *ff_bp[3];
int x, y, n;
switch (s->pict_type) {
case FF_P_TYPE:
- ff_bp[0] = pic_param->bitplane_present.flags.bp_direct_mb ? v->direct_mb_plane : NULL;
- ff_bp[1] = pic_param->bitplane_present.flags.bp_skip_mb ? s->mbskip_table : NULL;
- ff_bp[2] = pic_param->bitplane_present.flags.bp_mv_type_mb ? v->mv_type_mb_plane : NULL;
+ ff_bp[0] = pic_param->BFM(M_bitplane_present,flags,bp_direct_mb) ? v->direct_mb_plane : NULL;
+ ff_bp[1] = pic_param->BFM(M_bitplane_present,flags,bp_skip_mb) ? s->mbskip_table : NULL;
+ ff_bp[2] = pic_param->BFM(M_bitplane_present,flags,bp_mv_type_mb) ? v->mv_type_mb_plane : NULL;
break;
case FF_B_TYPE:
if (!v->bi_type) {
- ff_bp[0] = pic_param->bitplane_present.flags.bp_direct_mb ? v->direct_mb_plane : NULL;
- ff_bp[1] = pic_param->bitplane_present.flags.bp_skip_mb ? s->mbskip_table : NULL;
+ ff_bp[0] = pic_param->BFM(M_bitplane_present,flags,bp_direct_mb) ? v->direct_mb_plane : NULL;
+ ff_bp[1] = pic_param->BFM(M_bitplane_present,flags,bp_skip_mb) ? s->mbskip_table : NULL;
ff_bp[2] = NULL; /* XXX: interlaced frame (FORWARD plane) */
break;
}
/* fall-through (BI-type) */
case FF_I_TYPE:
ff_bp[0] = NULL; /* XXX: interlaced frame (FIELDTX plane) */
- ff_bp[1] = pic_param->bitplane_present.flags.bp_ac_pred ? v->acpred_plane : NULL;
- ff_bp[2] = pic_param->bitplane_present.flags.bp_overflags ? v->over_flags_plane : NULL;
+ ff_bp[1] = pic_param->BFM(M_bitplane_present,flags,bp_ac_pred) ? v->acpred_plane : NULL;
+ ff_bp[2] = pic_param->BFM(M_bitplane_present,flags,bp_overflags) ? v->over_flags_plane : NULL;
break;
default:
ff_bp[0] = NULL;
diff --git a/libvo/vo_vaapi.c b/libvo/vo_vaapi.c
index 9d46485..1ab47b3 100644
--- a/libvo/vo_vaapi.c
+++ b/libvo/vo_vaapi.c
@@ -45,7 +45,11 @@
#include <assert.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#if CONFIG_VAAPI_OLD
+#include <va_x11.h>
+#else
#include <va/va_x11.h>
+#endif
#if CONFIG_VAAPI_GLX
#include <va/va_glx.h>
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,97 @@
commit 7d70d28f190e37cfa3a9a827877ddd6bb81408d3
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Mon Dec 28 08:52:56 2009 +0000
Add GMA500 workaround for H.264 DPB. This is disabled by default. Enable with GMA500_WORKAROUND=yes environment variable.
diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
index 9f440c0..0139d64 100644
--- a/libavcodec/vaapi_h264.c
+++ b/libavcodec/vaapi_h264.c
@@ -28,6 +28,60 @@
* structures for H.264 decoding.
*/
+/** Parses ENV environment variable expecting "yes" | "no" values. */
+static int getenv_yesno(const char *env, int *pval)
+{
+ int val;
+ const char *env_str;
+
+ env_str = getenv(env);
+ if (!env_str)
+ return -1;
+
+ if (strcmp(env_str, "1") == 0 || strcmp(env_str, "yes") == 0)
+ val = 1;
+ else if (strcmp(env_str, "0") == 0 || strcmp(env_str, "no") == 0)
+ val = 0;
+ else
+ return -1;
+
+ if (pval)
+ *pval = val;
+ return 0;
+}
+
+/**
+ * Use old GMA500 workaround for DPB. It requires other pictures than
+ * those marked as "used for reference".
+ */
+static int get_use_gma500_workaround(struct vaapi_context *vactx)
+{
+ int gma500_workaround_env;
+ const char *vendor_string;
+
+ if (getenv_yesno("GMA500_WORKAROUND", &gma500_workaround_env) < 0)
+ return 0;
+ if (!gma500_workaround_env)
+ return 0;
+
+ vendor_string = vaQueryVendorString(vactx->display);
+ if (vendor_string && strstr(vendor_string, "Intel")) {
+ if (strstr(vendor_string, "GMA500"))
+ return 1;
+ if (strstr(vendor_string, "Embedded Graphics Driver"))
+ return 1;
+ }
+ return 0;
+}
+
+static inline int use_gma500_workaround(struct vaapi_context *vactx)
+{
+ static int gma500_workaround = -1;
+ if (gma500_workaround < 0)
+ gma500_workaround = get_use_gma500_workaround(vactx);
+ return gma500_workaround;
+}
+
/**
* Initializes an empty VA API picture.
*
@@ -123,6 +177,7 @@ static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param,
{
DPB dpb;
int i;
+ unsigned int list;
dpb.size = 0;
dpb.max_size = FF_ARRAY_ELEMS(pic_param->ReferenceFrames);
@@ -130,6 +185,17 @@ static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param,
for (i = 0; i < dpb.max_size; i++)
init_vaapi_pic(&dpb.va_pics[i]);
+ if (use_gma500_workaround(h->s.avctx->hwaccel_context)) {
+ /* XXX: this is really wrong */
+ for (list = 0; list < h->list_count; list++)
+ for (i = 0; i < (int)h->ref_count[list]; i++) {
+ Picture * const pic = &h->ref_list[list][i];
+ if (pic->reference && dpb_add(&dpb, pic) < 0)
+ return -1;
+ }
+ return 0;
+ }
+
for (i = 0; i < h->short_ref_count; i++) {
Picture * const pic = h->short_ref[i];
if (pic && pic->reference && dpb_add(&dpb, pic) < 0)

@ -0,0 +1,675 @@
commit 5fbfa3b77f6b3f55cc61df16533324ebcf8e0b70
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Fri Feb 12 11:03:00 2010 +0000
Add compatibility with original VA-API 0.29.
diff --git a/configure b/configure
index 8011680..f7ce215 100755
--- a/configure
+++ b/configure
@@ -6167,20 +6167,35 @@ fi #if os2
echocheck "VA-API"
if test "$_vaapi" = yes -o "$_vaapi" = auto; then
_vaapi=no
+ _vaapi_old=no
cat > $TMPC <<EOF
#include <va/va_x11.h>
int main(void) { (void) vaGetDisplay(0); return 0; }
EOF
- cc_check -lva-x11 && _vaapi=yes
+ cc_check -lva-x11 && _vaapi=yes || {
+ cat > $TMPC <<EOF
+#include <va_x11.h>
+int main(void) { (void) vaGetDisplay(0); return 0; }
+EOF
+ cc_check -lva && _vaapi=yes _vaapi_old=yes
+ }
fi
if test "$_vaapi" = yes ; then
def_vaapi='#define CONFIG_VAAPI 1'
- libs_mencoder="$libs_mencoder -lva"
- libs_mplayer="$libs_mplayer -lva-x11 -lva"
+ if test "$_vaapi_old" = no ; then
+ def_vaapi_old='#define CONFIG_VAAPI_OLD 0'
+ libs_mencoder="$libs_mencoder -lva"
+ libs_mplayer="$libs_mplayer -lva-x11 -lva"
+ else
+ def_vaapi_old='#define CONFIG_VAAPI_OLD 1'
+ _mencoder="no"
+ libs_mplayer="$libs_mplayer -lva"
+ fi
vomodules="vaapi $vomodules"
else
def_vaapi='#define CONFIG_VAAPI 0'
+ def_vaapi_old='#define CONFIG_VAAPI_OLD 0'
novomodules="vaapi $novomodules"
_libavhwaccels=`echo $_libavhwaccels | sed -e "s/\(MPEG[124]\|H26[34]\|WMV3\|VC1\)_VAAPI_HWACCEL//g"`
fi
@@ -8862,6 +8877,7 @@ CONFIG_MLIB = $_mlib
CONFIG_MUXERS = $_mencoder
CONFIG_POSTPROC = yes
CONFIG_VAAPI = $_vaapi
+CONFIG_VAAPI_OLD= $_vaapi_old
CONFIG_VDPAU = $_vdpau
CONFIG_XVMC = $_xvmc
CONFIG_ZLIB = $_zlib
@@ -9241,6 +9257,7 @@ $def_tdfxvid
$def_tga
$def_v4l2
$def_vaapi
+$def_vaapi_old
$def_vaapi_glx
$def_vdpau
$def_vesa
diff --git a/libavcodec/vaapi_compat.h b/libavcodec/vaapi_compat.h
new file mode 100644
index 0000000..f463118
--- /dev/null
+++ b/libavcodec/vaapi_compat.h
@@ -0,0 +1,92 @@
+/*
+ * Video Acceleration API (video decoding)
+ * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
+ *
+ * Copyright (C) 2008-2009 Splitted-Desktop Systems
+ *
+ * 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_VAAPI_COMPAT_H
+#define AVCODEC_VAAPI_COMPAT_H
+
+/* Compatibility glue with original VA-API 0.29 */
+#if CONFIG_VAAPI_OLD
+typedef struct _VASliceParameterBufferBase {
+ unsigned int slice_data_size;
+ unsigned int slice_data_offset;
+ unsigned int slice_data_flag;
+} VASliceParameterBufferBase;
+#endif
+
+#ifndef VA_CHECK_VERSION
+#define VA_MAJOR_VERSION 0
+#define VA_MINOR_VERSION 29
+#define VA_CHECK_VERSION(major,minor,micro) \
+ (VA_MAJOR_VERSION > (major) || \
+ (VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION > (minor)) || \
+ (VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION == (minor) && VA_MICRO_VERSION >= (micro)))
+#endif
+
+#ifndef VA_FOURCC
+#define VA_FOURCC(ch0, ch1, ch2, ch3) \
+ ((uint32_t)(uint8_t)(ch0) | \
+ ((uint32_t)(uint8_t)(ch1) << 8) | \
+ ((uint32_t)(uint8_t)(ch2) << 16) | \
+ ((uint32_t)(uint8_t)(ch3) << 24 ))
+#endif
+
+#ifndef VA_INVALID_ID
+#define VA_INVALID_ID 0xffffffff
+#endif
+#ifndef VA_INVALID_SURFACE
+#define VA_INVALID_SURFACE VA_INVALID_ID
+#endif
+
+/* Compatibility glue with VA-API >= 0.31 */
+#if VA_CHECK_VERSION(0,31,0)
+#define vaSyncSurface(dpy, context, surface) (vaSyncSurface)((dpy), (surface))
+#define vaPutImage2 vaPutImage
+#define vaAssociateSubpicture2 vaAssociateSubpicture
+#endif
+
+/* Used in codec implementation to set up the right bit-fields */
+#if CONFIG_VAAPI_OLD
+# define BFV(a, b) a
+# define BFM(a, b, c) c
+# define BFMP(p, a, b, c) p##_##c
+# define NEW(x) /* nothing */
+#else
+# define BFV(a, b) a.b
+# define BFM(a, b, c) a.b.c
+# define BFMP(p, a, b, c) a.b.c
+# define NEW(x) x
+#endif
+
+#if CONFIG_VAAPI_OLD
+# define V_raw_coding raw_coding_flag
+# define M_raw_coding raw_coding
+# define V_bitplane_present bitplane_present_flag
+# define M_bitplane_present bitplane_present
+#else
+# define V_raw_coding raw_coding
+# define M_raw_coding raw_coding
+# define V_bitplane_present bitplane_present
+# define M_bitplane_present bitplane_present
+#endif
+
+#endif /* AVCODEC_VAAPI_COMPAT_H */
diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
index b61a9ca..cab6e41 100644
--- a/libavcodec/vaapi_h264.c
+++ b/libavcodec/vaapi_h264.c
@@ -123,8 +123,8 @@ static void fill_vaapi_pic(VAPictureH264 *va_pic,
if (pic_structure == 0)
pic_structure = pic->reference;
- va_pic->picture_id = ff_vaapi_get_surface_id(pic);
- va_pic->frame_idx = pic->long_ref ? pic->pic_id : pic->frame_num;
+ va_pic->picture_id = ff_vaapi_get_surface_id(pic);
+ NEW(va_pic->frame_idx = pic->long_ref ? pic->pic_id : pic->frame_num);
va_pic->flags = 0;
if (pic_structure != PICT_FRAME)
@@ -317,42 +317,42 @@ static int start_frame(AVCodecContext *avctx,
fill_vaapi_pic(&pic_param->CurrPic, s->current_picture_ptr, s->picture_structure);
if (fill_vaapi_ReferenceFrames(pic_param, h) < 0)
return -1;
- pic_param->picture_width_in_mbs_minus1 = s->mb_width - 1;
- pic_param->picture_height_in_mbs_minus1 = s->mb_height - 1;
- pic_param->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8;
- pic_param->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8;
- pic_param->num_ref_frames = h->sps.ref_frame_count;
- pic_param->seq_fields.value = 0; /* reset all bits */
- pic_param->seq_fields.bits.chroma_format_idc = h->sps.chroma_format_idc;
- pic_param->seq_fields.bits.residual_colour_transform_flag = h->sps.residual_color_transform_flag; /* XXX: only for 4:4:4 high profile? */
- pic_param->seq_fields.bits.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag;
- pic_param->seq_fields.bits.frame_mbs_only_flag = h->sps.frame_mbs_only_flag;
- pic_param->seq_fields.bits.mb_adaptive_frame_field_flag = h->sps.mb_aff;
- pic_param->seq_fields.bits.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag;
- pic_param->seq_fields.bits.MinLumaBiPredSize8x8 = h->sps.level_idc >= 31; /* A.3.3.2 */
- pic_param->seq_fields.bits.log2_max_frame_num_minus4 = h->sps.log2_max_frame_num - 4;
- pic_param->seq_fields.bits.pic_order_cnt_type = h->sps.poc_type;
- pic_param->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4;
- pic_param->seq_fields.bits.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag;
- pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1;
- pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type;
- pic_param->slice_group_change_rate_minus1 = 0; /* XXX: unimplemented in FFmpeg */
- pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26;
- pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26;
- pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0];
- pic_param->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1];
- pic_param->pic_fields.value = 0; /* reset all bits */
- pic_param->pic_fields.bits.entropy_coding_mode_flag = h->pps.cabac;
- pic_param->pic_fields.bits.weighted_pred_flag = h->pps.weighted_pred;
- pic_param->pic_fields.bits.weighted_bipred_idc = h->pps.weighted_bipred_idc;
- pic_param->pic_fields.bits.transform_8x8_mode_flag = h->pps.transform_8x8_mode;
- pic_param->pic_fields.bits.field_pic_flag = s->picture_structure != PICT_FRAME;
- pic_param->pic_fields.bits.constrained_intra_pred_flag = h->pps.constrained_intra_pred;
- pic_param->pic_fields.bits.pic_order_present_flag = h->pps.pic_order_present;
- pic_param->pic_fields.bits.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present;
- pic_param->pic_fields.bits.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present;
- pic_param->pic_fields.bits.reference_pic_flag = h->nal_ref_idc != 0;
- pic_param->frame_num = h->frame_num;
+ pic_param->picture_width_in_mbs_minus1 = s->mb_width - 1;
+ pic_param->picture_height_in_mbs_minus1 = s->mb_height - 1;
+ pic_param->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8;
+ pic_param->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8;
+ pic_param->num_ref_frames = h->sps.ref_frame_count;
+ pic_param->BFV(seq_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(seq_fields,bits,chroma_format_idc) = h->sps.chroma_format_idc;
+ pic_param->BFM(seq_fields,bits,residual_colour_transform_flag) = h->sps.residual_color_transform_flag; /* XXX: only for 4:4:4 high profile? */
+ NEW(pic_param->BFM(seq_fields,bits,gaps_in_frame_num_value_allowed_flag) = h->sps.gaps_in_frame_num_allowed_flag);
+ pic_param->BFM(seq_fields,bits,frame_mbs_only_flag) = h->sps.frame_mbs_only_flag;
+ pic_param->BFM(seq_fields,bits,mb_adaptive_frame_field_flag) = h->sps.mb_aff;
+ pic_param->BFM(seq_fields,bits,direct_8x8_inference_flag) = h->sps.direct_8x8_inference_flag;
+ pic_param->BFM(seq_fields,bits,MinLumaBiPredSize8x8) = h->sps.level_idc >= 31; /* A.3.3.2 */
+ NEW(pic_param->BFM(seq_fields,bits,log2_max_frame_num_minus4) = h->sps.log2_max_frame_num - 4);
+ NEW(pic_param->BFM(seq_fields,bits,pic_order_cnt_type) = h->sps.poc_type);
+ NEW(pic_param->BFM(seq_fields,bits,log2_max_pic_order_cnt_lsb_minus4) = h->sps.log2_max_poc_lsb - 4);
+ NEW(pic_param->BFM(seq_fields,bits,delta_pic_order_always_zero_flag) = h->sps.delta_pic_order_always_zero_flag);
+ pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1;
+ pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type;
+ NEW(pic_param->slice_group_change_rate_minus1 = 0); /* XXX: unimplemented in FFmpeg */
+ pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26;
+ NEW(pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26);
+ pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0];
+ pic_param->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1];
+ pic_param->BFV(pic_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(pic_fields,bits,entropy_coding_mode_flag) = h->pps.cabac;
+ pic_param->BFM(pic_fields,bits,weighted_pred_flag) = h->pps.weighted_pred;
+ pic_param->BFM(pic_fields,bits,weighted_bipred_idc) = h->pps.weighted_bipred_idc;
+ pic_param->BFM(pic_fields,bits,transform_8x8_mode_flag) = h->pps.transform_8x8_mode;
+ pic_param->BFM(pic_fields,bits,field_pic_flag) = s->picture_structure != PICT_FRAME;
+ pic_param->BFM(pic_fields,bits,constrained_intra_pred_flag) = h->pps.constrained_intra_pred;
+ NEW(pic_param->BFM(pic_fields,bits,pic_order_present_flag) = h->pps.pic_order_present);
+ NEW(pic_param->BFM(pic_fields,bits,deblocking_filter_control_present_flag) = h->pps.deblocking_filter_parameters_present);
+ NEW(pic_param->BFM(pic_fields,bits,redundant_pic_cnt_present_flag) = h->pps.redundant_pic_cnt_present);
+ NEW(pic_param->BFM(pic_fields,bits,reference_pic_flag) = h->nal_ref_idc != 0);
+ pic_param->frame_num = h->frame_num;
/* Fill in VAIQMatrixBufferH264. */
iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferH264));
diff --git a/libavcodec/vaapi_internal.h b/libavcodec/vaapi_internal.h
index 2c0fdf9..ff83b96 100644
--- a/libavcodec/vaapi_internal.h
+++ b/libavcodec/vaapi_internal.h
@@ -24,8 +24,14 @@
#ifndef AVCODEC_VAAPI_INTERNAL_H
#define AVCODEC_VAAPI_INTERNAL_H
+#include "config.h"
+#if CONFIG_VAAPI_OLD
+#include <va.h>
+#else
#include <va/va.h>
+#endif
#include "vaapi.h"
+#include "vaapi_compat.h"
#include "avcodec.h"
#include "mpegvideo.h"
diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
index 2e870dc..637546a 100644
--- a/libavcodec/vaapi_mpeg2.c
+++ b/libavcodec/vaapi_mpeg2.c
@@ -52,24 +52,24 @@ static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_
pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferMPEG2));
if (!pic_param)
return -1;
- pic_param->horizontal_size = s->width;
- pic_param->vertical_size = s->height;
- pic_param->forward_reference_picture = VA_INVALID_ID;
- pic_param->backward_reference_picture = VA_INVALID_ID;
- pic_param->picture_coding_type = s->pict_type;
- pic_param->f_code = mpeg2_get_f_code(s);
- pic_param->picture_coding_extension.value = 0; /* reset all bits */
- pic_param->picture_coding_extension.bits.intra_dc_precision = s->intra_dc_precision;
- pic_param->picture_coding_extension.bits.picture_structure = s->picture_structure;
- pic_param->picture_coding_extension.bits.top_field_first = s->top_field_first;
- pic_param->picture_coding_extension.bits.frame_pred_frame_dct = s->frame_pred_frame_dct;
- pic_param->picture_coding_extension.bits.concealment_motion_vectors = s->concealment_motion_vectors;
- pic_param->picture_coding_extension.bits.q_scale_type = s->q_scale_type;
- pic_param->picture_coding_extension.bits.intra_vlc_format = s->intra_vlc_format;
- pic_param->picture_coding_extension.bits.alternate_scan = s->alternate_scan;
- pic_param->picture_coding_extension.bits.repeat_first_field = s->repeat_first_field;
- pic_param->picture_coding_extension.bits.progressive_frame = s->progressive_frame;
- pic_param->picture_coding_extension.bits.is_first_field = mpeg2_get_is_frame_start(s);
+ pic_param->horizontal_size = s->width;
+ pic_param->vertical_size = s->height;
+ pic_param->forward_reference_picture = VA_INVALID_ID;
+ pic_param->backward_reference_picture = VA_INVALID_ID;
+ pic_param->picture_coding_type = s->pict_type;
+ pic_param->f_code = mpeg2_get_f_code(s);
+ pic_param->BFV(picture_coding_extension,value) = 0; /* reset all bits */
+ pic_param->BFM(picture_coding_extension,bits,intra_dc_precision) = s->intra_dc_precision;
+ pic_param->BFM(picture_coding_extension,bits,picture_structure) = s->picture_structure;
+ pic_param->BFM(picture_coding_extension,bits,top_field_first) = s->top_field_first;
+ pic_param->BFM(picture_coding_extension,bits,frame_pred_frame_dct) = s->frame_pred_frame_dct;
+ pic_param->BFM(picture_coding_extension,bits,concealment_motion_vectors) = s->concealment_motion_vectors;
+ pic_param->BFM(picture_coding_extension,bits,q_scale_type) = s->q_scale_type;
+ pic_param->BFM(picture_coding_extension,bits,intra_vlc_format) = s->intra_vlc_format;
+ pic_param->BFM(picture_coding_extension,bits,alternate_scan) = s->alternate_scan;
+ pic_param->BFM(picture_coding_extension,bits,repeat_first_field) = s->repeat_first_field;
+ pic_param->BFM(picture_coding_extension,bits,progressive_frame) = s->progressive_frame;
+ pic_param->BFM(picture_coding_extension,bits,is_first_field) = mpeg2_get_is_frame_start(s);
switch (s->pict_type) {
case FF_B_TYPE:
@@ -131,7 +131,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
if (!slice_param)
return -1;
slice_param->macroblock_offset = macroblock_offset;
- slice_param->slice_horizontal_position = s->mb_x;
+ NEW(slice_param->slice_horizontal_position = s->mb_x);
slice_param->slice_vertical_position = s->mb_y;
slice_param->quantiser_scale_code = quantiser_scale_code;
slice_param->intra_slice_flag = intra_slice_flag;
diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
index 466ce2f..ea306a4 100644
--- a/libavcodec/vaapi_mpeg4.c
+++ b/libavcodec/vaapi_mpeg4.c
@@ -54,42 +54,42 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferMPEG4));
if (!pic_param)
return -1;
- pic_param->vop_width = s->width;
- pic_param->vop_height = s->height;
- pic_param->forward_reference_picture = VA_INVALID_ID;
- pic_param->backward_reference_picture = VA_INVALID_ID;
- pic_param->vol_fields.value = 0; /* reset all bits */
- pic_param->vol_fields.bits.short_video_header = avctx->codec->id == CODEC_ID_H263;
- pic_param->vol_fields.bits.chroma_format = CHROMA_420;
- pic_param->vol_fields.bits.interlaced = !s->progressive_sequence;
- pic_param->vol_fields.bits.obmc_disable = 1;
- pic_param->vol_fields.bits.sprite_enable = s->vol_sprite_usage;
- pic_param->vol_fields.bits.sprite_warping_accuracy = s->sprite_warping_accuracy;
- pic_param->vol_fields.bits.quant_type = s->mpeg_quant;
- pic_param->vol_fields.bits.quarter_sample = s->quarter_sample;
- pic_param->vol_fields.bits.data_partitioned = s->data_partitioning;
- pic_param->vol_fields.bits.reversible_vlc = s->rvlc;
- pic_param->vol_fields.bits.resync_marker_disable = !s->resync_marker;
- pic_param->no_of_sprite_warping_points = s->num_sprite_warping_points;
+ pic_param->vop_width = s->width;
+ pic_param->vop_height = s->height;
+ pic_param->forward_reference_picture = VA_INVALID_ID;
+ pic_param->backward_reference_picture = VA_INVALID_ID;
+ pic_param->BFV(vol_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(vol_fields,bits,short_video_header) = avctx->codec->id == CODEC_ID_H263;
+ pic_param->BFM(vol_fields,bits,chroma_format) = CHROMA_420;
+ pic_param->BFM(vol_fields,bits,interlaced) = !s->progressive_sequence;
+ pic_param->BFM(vol_fields,bits,obmc_disable) = 1;
+ pic_param->BFM(vol_fields,bits,sprite_enable) = s->vol_sprite_usage;
+ pic_param->BFM(vol_fields,bits,sprite_warping_accuracy) = s->sprite_warping_accuracy;
+ pic_param->BFM(vol_fields,bits,quant_type) = s->mpeg_quant;
+ pic_param->BFM(vol_fields,bits,quarter_sample) = s->quarter_sample;
+ pic_param->BFM(vol_fields,bits,data_partitioned) = s->data_partitioning;
+ pic_param->BFM(vol_fields,bits,reversible_vlc) = s->rvlc;
+ NEW(pic_param->BFM(vol_fields,bits,resync_marker_disable) = !s->resync_marker);
+ pic_param->no_of_sprite_warping_points = s->num_sprite_warping_points;
for (i = 0; i < s->num_sprite_warping_points && i < 3; i++) {
- pic_param->sprite_trajectory_du[i] = s->sprite_traj[i][0];
- pic_param->sprite_trajectory_dv[i] = s->sprite_traj[i][1];
+ pic_param->sprite_trajectory_du[i] = s->sprite_traj[i][0];
+ pic_param->sprite_trajectory_dv[i] = s->sprite_traj[i][1];
}
- pic_param->quant_precision = s->quant_precision;
- pic_param->vop_fields.value = 0; /* reset all bits */
- pic_param->vop_fields.bits.vop_coding_type = s->pict_type - FF_I_TYPE;
- pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == FF_B_TYPE ? s->next_picture.pict_type - FF_I_TYPE : 0;
- pic_param->vop_fields.bits.vop_rounding_type = s->no_rounding;
- pic_param->vop_fields.bits.intra_dc_vlc_thr = mpeg4_get_intra_dc_vlc_thr(s);
- pic_param->vop_fields.bits.top_field_first = s->top_field_first;
- pic_param->vop_fields.bits.alternate_vertical_scan_flag = s->alternate_scan;
- pic_param->vop_fcode_forward = s->f_code;
- pic_param->vop_fcode_backward = s->b_code;
- pic_param->vop_time_increment_resolution = avctx->time_base.den;
- pic_param->num_macroblocks_in_gob = s->mb_width * ff_h263_get_gob_height(s);
- pic_param->num_gobs_in_vop = (s->mb_width * s->mb_height) / pic_param->num_macroblocks_in_gob;
- pic_param->TRB = s->pb_time;
- pic_param->TRD = s->pp_time;
+ pic_param->quant_precision = s->quant_precision;
+ pic_param->BFV(vop_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(vop_fields,bits,vop_coding_type) = s->pict_type - FF_I_TYPE;
+ pic_param->BFM(vop_fields,bits,backward_reference_vop_coding_type) = s->pict_type == FF_B_TYPE ? s->next_picture.pict_type - FF_I_TYPE : 0;
+ pic_param->BFM(vop_fields,bits,vop_rounding_type) = s->no_rounding;
+ pic_param->BFM(vop_fields,bits,intra_dc_vlc_thr) = mpeg4_get_intra_dc_vlc_thr(s);
+ pic_param->BFM(vop_fields,bits,top_field_first) = s->top_field_first;
+ pic_param->BFM(vop_fields,bits,alternate_vertical_scan_flag) = s->alternate_scan;
+ pic_param->vop_fcode_forward = s->f_code;
+ pic_param->vop_fcode_backward = s->b_code;
+ NEW(pic_param->vop_time_increment_resolution = avctx->time_base.den);
+ pic_param->num_macroblocks_in_gob = s->mb_width * ff_h263_get_gob_height(s);
+ pic_param->num_gobs_in_vop = (s->mb_width * s->mb_height) / pic_param->num_macroblocks_in_gob;
+ pic_param->TRB = s->pb_time;
+ pic_param->TRD = s->pp_time;
if (s->pict_type == FF_B_TYPE)
pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture);
@@ -98,7 +98,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
/* Fill in VAIQMatrixBufferMPEG4 */
/* Only the first inverse quantisation method uses the weighthing matrices */
- if (pic_param->vol_fields.bits.quant_type) {
+ if (pic_param->BFM(vol_fields,bits,quant_type)) {
iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferMPEG4));
if (!iq_matrix)
return -1;
diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
index 992e1da..8264dd9 100644
--- a/libavcodec/vaapi_vc1.c
+++ b/libavcodec/vaapi_vc1.c
@@ -146,100 +146,100 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferVC1));
if (!pic_param)
return -1;
- pic_param->forward_reference_picture = VA_INVALID_ID;
- pic_param->backward_reference_picture = VA_INVALID_ID;
- pic_param->inloop_decoded_picture = VA_INVALID_ID;
- pic_param->sequence_fields.value = 0; /* reset all bits */
- pic_param->sequence_fields.bits.pulldown = v->broadcast;
- pic_param->sequence_fields.bits.interlace = v->interlace;
- pic_param->sequence_fields.bits.tfcntrflag = v->tfcntrflag;
- pic_param->sequence_fields.bits.finterpflag = v->finterpflag;
- pic_param->sequence_fields.bits.psf = v->psf;
- pic_param->sequence_fields.bits.multires = v->multires;
- pic_param->sequence_fields.bits.overlap = v->overlap;
- pic_param->sequence_fields.bits.syncmarker = s->resync_marker;
- pic_param->sequence_fields.bits.rangered = v->rangered;
- pic_param->sequence_fields.bits.max_b_frames = s->avctx->max_b_frames;
- pic_param->coded_width = s->avctx->coded_width;
- pic_param->coded_height = s->avctx->coded_height;
- pic_param->entrypoint_fields.value = 0; /* reset all bits */
- pic_param->entrypoint_fields.bits.broken_link = v->broken_link;
- pic_param->entrypoint_fields.bits.closed_entry = v->closed_entry;
- pic_param->entrypoint_fields.bits.panscan_flag = v->panscanflag;
- pic_param->entrypoint_fields.bits.loopfilter = s->loop_filter;
- pic_param->conditional_overlap_flag = v->condover;
- pic_param->fast_uvmc_flag = v->fastuvmc;
- pic_param->range_mapping_fields.value = 0; /* reset all bits */
- pic_param->range_mapping_fields.bits.luma_flag = v->range_mapy_flag;
- pic_param->range_mapping_fields.bits.luma = v->range_mapy;
- pic_param->range_mapping_fields.bits.chroma_flag = v->range_mapuv_flag;
- pic_param->range_mapping_fields.bits.chroma = v->range_mapuv;
- pic_param->b_picture_fraction = v->bfraction_lut_index;
- pic_param->cbp_table = v->cbpcy_vlc ? v->cbpcy_vlc - ff_vc1_cbpcy_p_vlc : 0;
- pic_param->mb_mode_table = 0; /* XXX: interlaced frame */
- pic_param->range_reduction_frame = v->rangeredfrm;
- pic_param->rounding_control = v->rnd;
- pic_param->post_processing = v->postproc;
- pic_param->picture_resolution_index = v->respic;
- pic_param->luma_scale = v->lumscale;
- pic_param->luma_shift = v->lumshift;
- pic_param->picture_fields.value = 0; /* reset all bits */
- pic_param->picture_fields.bits.picture_type = vc1_get_PTYPE(v);
- pic_param->picture_fields.bits.frame_coding_mode = v->fcm;
- pic_param->picture_fields.bits.top_field_first = v->tff;
- pic_param->picture_fields.bits.is_first_field = v->fcm == 0; /* XXX: interlaced frame */
- pic_param->picture_fields.bits.intensity_compensation = v->mv_mode == MV_PMODE_INTENSITY_COMP;
- pic_param->raw_coding.value = 0; /* reset all bits */
- pic_param->raw_coding.flags.mv_type_mb = v->mv_type_is_raw;
- pic_param->raw_coding.flags.direct_mb = v->dmb_is_raw;
- pic_param->raw_coding.flags.skip_mb = v->skip_is_raw;
- pic_param->raw_coding.flags.field_tx = 0; /* XXX: interlaced frame */
- pic_param->raw_coding.flags.forward_mb = 0; /* XXX: interlaced frame */
- pic_param->raw_coding.flags.ac_pred = v->acpred_is_raw;
- pic_param->raw_coding.flags.overflags = v->overflg_is_raw;
- pic_param->bitplane_present.value = 0; /* reset all bits */
- pic_param->bitplane_present.flags.bp_mv_type_mb = vc1_has_MVTYPEMB_bitplane(v);
- pic_param->bitplane_present.flags.bp_direct_mb = vc1_has_DIRECTMB_bitplane(v);
- pic_param->bitplane_present.flags.bp_skip_mb = vc1_has_SKIPMB_bitplane(v);
- pic_param->bitplane_present.flags.bp_field_tx = 0; /* XXX: interlaced frame */
- pic_param->bitplane_present.flags.bp_forward_mb = 0; /* XXX: interlaced frame */
- pic_param->bitplane_present.flags.bp_ac_pred = vc1_has_ACPRED_bitplane(v);
- pic_param->bitplane_present.flags.bp_overflags = vc1_has_OVERFLAGS_bitplane(v);
- pic_param->reference_fields.value = 0; /* reset all bits */
- pic_param->reference_fields.bits.reference_distance_flag = v->refdist_flag;
- pic_param->reference_fields.bits.reference_distance = 0; /* XXX: interlaced frame */
- pic_param->reference_fields.bits.num_reference_pictures = 0; /* XXX: interlaced frame */
- pic_param->reference_fields.bits.reference_field_pic_indicator = 0; /* XXX: interlaced frame */
- pic_param->mv_fields.value = 0; /* reset all bits */
- pic_param->mv_fields.bits.mv_mode = vc1_get_MVMODE(v);
- pic_param->mv_fields.bits.mv_mode2 = vc1_get_MVMODE2(v);
- pic_param->mv_fields.bits.mv_table = s->mv_table_index;
- pic_param->mv_fields.bits.two_mv_block_pattern_table = 0; /* XXX: interlaced frame */
- pic_param->mv_fields.bits.four_mv_switch = 0; /* XXX: interlaced frame */
- pic_param->mv_fields.bits.four_mv_block_pattern_table = 0; /* XXX: interlaced frame */
- pic_param->mv_fields.bits.extended_mv_flag = v->extended_mv;
- pic_param->mv_fields.bits.extended_mv_range = v->mvrange;
- pic_param->mv_fields.bits.extended_dmv_flag = v->extended_dmv;
- pic_param->mv_fields.bits.extended_dmv_range = 0; /* XXX: interlaced frame */
- pic_param->pic_quantizer_fields.value = 0; /* reset all bits */
- pic_param->pic_quantizer_fields.bits.dquant = v->dquant;
- pic_param->pic_quantizer_fields.bits.quantizer = v->quantizer_mode;
- pic_param->pic_quantizer_fields.bits.half_qp = v->halfpq;
- pic_param->pic_quantizer_fields.bits.pic_quantizer_scale = v->pq;
- pic_param->pic_quantizer_fields.bits.pic_quantizer_type = v->pquantizer;
- pic_param->pic_quantizer_fields.bits.dq_frame = v->dquantfrm;
- pic_param->pic_quantizer_fields.bits.dq_profile = v->dqprofile;
- pic_param->pic_quantizer_fields.bits.dq_sb_edge = v->dqprofile == DQPROFILE_SINGLE_EDGE ? v->dqsbedge : 0;
- pic_param->pic_quantizer_fields.bits.dq_db_edge = v->dqprofile == DQPROFILE_DOUBLE_EDGES ? v->dqsbedge : 0;
- pic_param->pic_quantizer_fields.bits.dq_binary_level = v->dqbilevel;
- pic_param->pic_quantizer_fields.bits.alt_pic_quantizer = v->altpq;
- pic_param->transform_fields.value = 0; /* reset all bits */
- pic_param->transform_fields.bits.variable_sized_transform_flag = v->vstransform;
- pic_param->transform_fields.bits.mb_level_transform_type_flag = v->ttmbf;
- pic_param->transform_fields.bits.frame_level_transform_type = v->ttfrm;
- pic_param->transform_fields.bits.transform_ac_codingset_idx1 = v->c_ac_table_index;
- pic_param->transform_fields.bits.transform_ac_codingset_idx2 = v->y_ac_table_index;
- pic_param->transform_fields.bits.intra_transform_dc_table = v->s.dc_table_index;
+ pic_param->forward_reference_picture = VA_INVALID_ID;
+ pic_param->backward_reference_picture = VA_INVALID_ID;
+ pic_param->inloop_decoded_picture = VA_INVALID_ID;
+ pic_param->BFV(sequence_fields,value) = 0; /* reset all bits */
+ NEW(pic_param->BFM(sequence_fields,bits,pulldown) = v->broadcast);
+ pic_param->BFM(sequence_fields,bits,interlace) = v->interlace;
+ NEW(pic_param->BFM(sequence_fields,bits,tfcntrflag) = v->tfcntrflag);
+ NEW(pic_param->BFM(sequence_fields,bits,finterpflag) = v->finterpflag);
+ NEW(pic_param->BFM(sequence_fields,bits,psf) = v->psf);
+ NEW(pic_param->BFM(sequence_fields,bits,multires) = v->multires);
+ pic_param->BFM(sequence_fields,bits,overlap) = v->overlap;
+ pic_param->BFM(sequence_fields,bits,syncmarker) = s->resync_marker;
+ NEW(pic_param->BFM(sequence_fields,bits,rangered) = v->rangered);
+ NEW(pic_param->BFM(sequence_fields,bits,max_b_frames) = s->avctx->max_b_frames);
+ pic_param->coded_width = s->avctx->coded_width;
+ pic_param->coded_height = s->avctx->coded_height;
+ NEW(pic_param->BFV(entrypoint_fields,value) = 0); /* reset all bits */
+ pic_param->BFM(entrypoint_fields,bits,broken_link) = v->broken_link;
+ pic_param->BFM(entrypoint_fields,bits,closed_entry) = v->closed_entry;
+ NEW(pic_param->BFM(entrypoint_fields,bits,panscan_flag) = v->panscanflag);
+ pic_param->BFM(entrypoint_fields,bits,loopfilter) = s->loop_filter;
+ pic_param->conditional_overlap_flag = v->condover;
+ pic_param->fast_uvmc_flag = v->fastuvmc;
+ pic_param->BFV(range_mapping_fields,value) = 0; /* reset all bits */
+ pic_param->BFMP(range_mapping,range_mapping_fields,bits,luma_flag) = v->range_mapy_flag;
+ pic_param->BFMP(range_mapping,range_mapping_fields,bits,luma) = v->range_mapy;
+ pic_param->BFMP(range_mapping,range_mapping_fields,bits,chroma_flag) = v->range_mapuv_flag;
+ pic_param->BFMP(range_mapping,range_mapping_fields,bits,chroma) = v->range_mapuv;
+ pic_param->b_picture_fraction = v->bfraction_lut_index;
+ pic_param->cbp_table = v->cbpcy_vlc ? v->cbpcy_vlc - ff_vc1_cbpcy_p_vlc : 0;
+ pic_param->mb_mode_table = 0; /* XXX: interlaced frame */
+ pic_param->range_reduction_frame = v->rangeredfrm;
+ pic_param->rounding_control = v->rnd;
+ pic_param->post_processing = v->postproc;
+ pic_param->picture_resolution_index = v->respic;
+ pic_param->luma_scale = v->lumscale;
+ pic_param->luma_shift = v->lumshift;
+ pic_param->BFV(picture_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(picture_fields,bits,picture_type) = vc1_get_PTYPE(v);
+ pic_param->BFM(picture_fields,bits,frame_coding_mode) = v->fcm;
+ pic_param->BFM(picture_fields,bits,top_field_first) = v->tff;
+ pic_param->BFM(picture_fields,bits,is_first_field) = v->fcm == 0; /* XXX: interlaced frame */
+ pic_param->BFM(picture_fields,bits,intensity_compensation) = v->mv_mode == MV_PMODE_INTENSITY_COMP;
+ pic_param->BFV(V_raw_coding,value) = 0; /* reset all bits */
+ pic_param->BFM(M_raw_coding,flags,mv_type_mb) = v->mv_type_is_raw;
+ pic_param->BFM(M_raw_coding,flags,direct_mb) = v->dmb_is_raw;
+ pic_param->BFM(M_raw_coding,flags,skip_mb) = v->skip_is_raw;
+ pic_param->BFM(M_raw_coding,flags,field_tx) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(M_raw_coding,flags,forward_mb) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(M_raw_coding,flags,ac_pred) = v->acpred_is_raw;
+ pic_param->BFM(M_raw_coding,flags,overflags) = v->overflg_is_raw;
+ pic_param->BFV(V_bitplane_present,value) = 0; /* reset all bits */
+ pic_param->BFM(M_bitplane_present,flags,bp_mv_type_mb) = vc1_has_MVTYPEMB_bitplane(v);
+ pic_param->BFM(M_bitplane_present,flags,bp_direct_mb) = vc1_has_DIRECTMB_bitplane(v);
+ pic_param->BFM(M_bitplane_present,flags,bp_skip_mb) = vc1_has_SKIPMB_bitplane(v);
+ pic_param->BFM(M_bitplane_present,flags,bp_field_tx) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(M_bitplane_present,flags,bp_forward_mb) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(M_bitplane_present,flags,bp_ac_pred) = vc1_has_ACPRED_bitplane(v);
+ pic_param->BFM(M_bitplane_present,flags,bp_overflags) = vc1_has_OVERFLAGS_bitplane(v);
+ pic_param->BFV(reference_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(reference_fields,bits,reference_distance_flag) = v->refdist_flag;
+ pic_param->BFM(reference_fields,bits,reference_distance) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(reference_fields,bits,num_reference_pictures) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(reference_fields,bits,reference_field_pic_indicator) = 0; /* XXX: interlaced frame */
+ pic_param->BFV(mv_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(mv_fields,bits,mv_mode) = vc1_get_MVMODE(v);
+ pic_param->BFM(mv_fields,bits,mv_mode2) = vc1_get_MVMODE2(v);
+ pic_param->BFM(mv_fields,bits,mv_table) = s->mv_table_index;
+ pic_param->BFM(mv_fields,bits,two_mv_block_pattern_table) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(mv_fields,bits,four_mv_switch) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(mv_fields,bits,four_mv_block_pattern_table) = 0; /* XXX: interlaced frame */
+ pic_param->BFM(mv_fields,bits,extended_mv_flag) = v->extended_mv;
+ pic_param->BFM(mv_fields,bits,extended_mv_range) = v->mvrange;
+ pic_param->BFM(mv_fields,bits,extended_dmv_flag) = v->extended_dmv;
+ pic_param->BFM(mv_fields,bits,extended_dmv_range) = 0; /* XXX: interlaced frame */
+ pic_param->BFV(pic_quantizer_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(pic_quantizer_fields,bits,dquant) = v->dquant;
+ pic_param->BFM(pic_quantizer_fields,bits,quantizer) = v->quantizer_mode;
+ pic_param->BFM(pic_quantizer_fields,bits,half_qp) = v->halfpq;
+ pic_param->BFM(pic_quantizer_fields,bits,pic_quantizer_scale) = v->pq;
+ pic_param->BFM(pic_quantizer_fields,bits,pic_quantizer_type) = v->pquantizer;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_frame) = v->dquantfrm;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_profile) = v->dqprofile;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_sb_edge) = v->dqprofile == DQPROFILE_SINGLE_EDGE ? v->dqsbedge : 0;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_db_edge) = v->dqprofile == DQPROFILE_DOUBLE_EDGES ? v->dqsbedge : 0;
+ pic_param->BFM(pic_quantizer_fields,bits,dq_binary_level) = v->dqbilevel;
+ pic_param->BFM(pic_quantizer_fields,bits,alt_pic_quantizer) = v->altpq;
+ pic_param->BFV(transform_fields,value) = 0; /* reset all bits */
+ pic_param->BFM(transform_fields,bits,variable_sized_transform_flag) = v->vstransform;
+ pic_param->BFM(transform_fields,bits,mb_level_transform_type_flag) = v->ttmbf;
+ pic_param->BFM(transform_fields,bits,frame_level_transform_type) = v->ttfrm;
+ pic_param->BFM(transform_fields,bits,transform_ac_codingset_idx1) = v->c_ac_table_index;
+ pic_param->BFM(transform_fields,bits,transform_ac_codingset_idx2) = v->y_ac_table_index;
+ pic_param->BFM(transform_fields,bits,intra_transform_dc_table) = v->s.dc_table_index;
switch (s->pict_type) {
case FF_B_TYPE:
@@ -250,29 +250,29 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
break;
}
- if (pic_param->bitplane_present.value) {
+ if (pic_param->BFV(V_bitplane_present,value)) {
uint8_t *bitplane;
const uint8_t *ff_bp[3];
int x, y, n;
switch (s->pict_type) {
case FF_P_TYPE:
- ff_bp[0] = pic_param->bitplane_present.flags.bp_direct_mb ? v->direct_mb_plane : NULL;
- ff_bp[1] = pic_param->bitplane_present.flags.bp_skip_mb ? s->mbskip_table : NULL;
- ff_bp[2] = pic_param->bitplane_present.flags.bp_mv_type_mb ? v->mv_type_mb_plane : NULL;
+ ff_bp[0] = pic_param->BFM(M_bitplane_present,flags,bp_direct_mb) ? v->direct_mb_plane : NULL;
+ ff_bp[1] = pic_param->BFM(M_bitplane_present,flags,bp_skip_mb) ? s->mbskip_table : NULL;
+ ff_bp[2] = pic_param->BFM(M_bitplane_present,flags,bp_mv_type_mb) ? v->mv_type_mb_plane : NULL;
break;
case FF_B_TYPE:
if (!v->bi_type) {
- ff_bp[0] = pic_param->bitplane_present.flags.bp_direct_mb ? v->direct_mb_plane : NULL;
- ff_bp[1] = pic_param->bitplane_present.flags.bp_skip_mb ? s->mbskip_table : NULL;
+ ff_bp[0] = pic_param->BFM(M_bitplane_present,flags,bp_direct_mb) ? v->direct_mb_plane : NULL;
+ ff_bp[1] = pic_param->BFM(M_bitplane_present,flags,bp_skip_mb) ? s->mbskip_table : NULL;
ff_bp[2] = NULL; /* XXX: interlaced frame (FORWARD plane) */
break;
}
/* fall-through (BI-type) */
case FF_I_TYPE:
ff_bp[0] = NULL; /* XXX: interlaced frame (FIELDTX plane) */
- ff_bp[1] = pic_param->bitplane_present.flags.bp_ac_pred ? v->acpred_plane : NULL;
- ff_bp[2] = pic_param->bitplane_present.flags.bp_overflags ? v->over_flags_plane : NULL;
+ ff_bp[1] = pic_param->BFM(M_bitplane_present,flags,bp_ac_pred) ? v->acpred_plane : NULL;
+ ff_bp[2] = pic_param->BFM(M_bitplane_present,flags,bp_overflags) ? v->over_flags_plane : NULL;
break;
default:
ff_bp[0] = NULL;
diff --git a/libvo/vo_vaapi.c b/libvo/vo_vaapi.c
index 5f75b09..bbc95ff 100644
--- a/libvo/vo_vaapi.c
+++ b/libvo/vo_vaapi.c
@@ -45,7 +45,11 @@
#include <assert.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#if CONFIG_VAAPI_OLD
+#include <va_x11.h>
+#else
#include <va/va_x11.h>
+#endif
#if CONFIG_VAAPI_GLX
#include <va/va_glx.h>
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>video</herd>
<maintainer>
<email>media-video@gentoo.org</email>
</maintainer>
<use>
<flag name="3dnowext">Enable 3dnowext cpu instructions</flag>
<flag name="ass">Internal SRT/SSA/ASS (SubRip / SubStation Alpha) subtitle support</flag>
<flag name="bl">Blinkenlights video output</flag>
<flag name="bs2b">Enable Bauer stereophonic-to-binaural headphone filter</flag>
<flag name="cdio">Use libcdio for CD support (instead of cdparanoia)</flag>
<flag name="cpudetection">Enables runtime cpudetection (useful for bindist, compatability on other CPUs)</flag>
<flag name="custom-cpuopts">Fine-tune custom CPU optimizations (UNSUPPORTED)</flag>
<flag name="dirac">Enable Dirac video support (an advanced royalty-free video compression format) via the reference library: dirac.</flag>
<flag name="dvdnav">Use forked libdvdnav, navigate menus in GUIs</flag>
<flag name="dxr3">Enable DXR3/H+ video output</flag>
<flag name="enca">Enables support for charset discovery and conversion</flag>
<flag name="external-ffmpeg">Use shared FFmpeg libraries instead of static bundled ones. Discouraged by upstream.</flag>
<flag name="faac">Use external faac library for AAC encoding</flag>
<flag name="faad">Use external faad library for AAC decoding</flag>
<flag name="gmplayer">Build gmplayer, a GTK+ MPlayer gui (UNSUPPORTED)</flag>
<flag name="live">Enables live.com streaming media support</flag>
<flag name="md5sum">Enables md5sum video output</flag>
<flag name="mmxext">Enables mmx2 support</flag>
<flag name="mng">MNG input support</flag>
<flag name="network">Enables network streaming support</flag>
<flag name="nut">Enables support for the NUT container format</flag>
<flag name="opencore-amr">Enables Adaptive Multi-Rate format support</flag>
<flag name="osdmenu">Enables support for on-screen display (OSD) menus</flag>
<flag name="pnm">Add PNM video output option, to create PPM/PGM/PGMYUV images</flag>
<flag name="pvr">Enable Video4Linux2 MPEG PVR</flag>
<flag name="radio">Enable V4L2 radio interface and support</flag>
<flag name="rar">Enable Unique RAR File Library</flag>
<flag name="real">Adds real audo/video support</flag>
<flag name="rtc">Enables usage of the linux real time clock. The alternative is software emulation of rtc</flag>
<flag name="schroedinger">Enable Dirac video support (an advanced royalty-free video compression format) via libschroedinger (high-speed implementation in C of the Dirac codec).</flag>
<flag name="shm">Enable support for shm</flag>
<flag name="ssse3">faster floating point optimization for SSSE3 capable chips (Intel Core 2 and later chips)</flag>
<flag name="teletext">Support for TV teletext interface</flag>
<flag name="tga">Enables Targa video output</flag>
<flag name="toolame">Enable toolame MPEG-2 encoding</flag>
<flag name="tremor">Enable internal support for Vorbis</flag>
<flag name="twolame">Enable twolame MPEG-2 encoding</flag>
<flag name="vdpau">Enables experimental VDPAU support (requires nVidia video cards) to offload MPEG2/MPEG4/VC1/WMV CPU processing to video card</flag>
<flag name="vidix">Support for vidix video output</flag>
<flag name="xanim">Enables support for xanim based codecs</flag>
<flag name="xvmc">Enables X-Video Motion Compensation support</flag>
<flag name="zoran">Enables ZR360[56]7/ZR36060 video output</flag>
</use>
</pkgmetadata>

@ -0,0 +1,755 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/mplayer/mplayer-1.0_rc4_p20100612.ebuild,v 1.7 2010/11/07 19:37:38 anarchy Exp $
EAPI="2"
ESVN_REPO_URI="svn://svn.mplayerhq.hu/mplayer/trunk"
[[ ${PV} = *9999* ]] && SVN_ECLASS="subversion" || SVN_ECLASS=""
inherit toolchain-funcs eutils flag-o-matic multilib base ${SVN_ECLASS}
[[ ${PV} != *9999* ]] && MPLAYER_REVISION=SVN-r30554
IUSE="3dnow 3dnowext +a52 aalib +alsa altivec +ass bidi bindist bl bs2b
+cddb +cdio cdparanoia cpudetection custom-cpuopts debug dga +dirac directfb
doc +dts +dv dvb +dvd +dvdnav dxr3 +enca +encode esd +faac +faad fbcon ftp
gif ggi -gmplayer +iconv ipv6 jack joystick jpeg jpeg2k kernel_linux ladspa
libcaca lirc +live lzo mad md5sum +mmx mmxext mng +mp3 nas +network nut openal
amr +opengl +osdmenu oss png pnm pulseaudio pvr +quicktime radio +rar +real +rtc
samba +shm +schroedinger sdl +speex sse sse2 ssse3 svga tga +theora +tremor
+truetype +toolame +twolame +unicode v4l v4l2 vaapi vdpau vidix +vorbis vpx
win32codecs +X +x264 xanim xinerama +xscreensaver +xv +xvid xvmc zoran"
[[ ${PV} == *9999* ]] && IUSE+=" external-ffmpeg"
VIDEO_CARDS="s3virge mga tdfx vesa"
for x in ${VIDEO_CARDS}; do
IUSE+=" video_cards_${x}"
done
BLUV="1.7"
SVGV="1.9.17"
AMR_URI="http://www.3gpp.org/ftp/Specs/archive"
FONT_URI="
mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2
mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2
"
if [[ ${PV} == *9999* ]]; then
RELEASE_URI=""
else
RELEASE_URI="mirror://gentoo/${P}.tbz2"
fi
SRC_URI="${RELEASE_URI}
!truetype? ( ${FONT_URI} )
gmplayer? ( mirror://mplayer/skins/Blue-${BLUV}.tar.bz2 )
svga? ( mirror://gentoo/svgalib_helper-${SVGV}-mplayer.tar.gz )"
DESCRIPTION="Media Player for Linux"
HOMEPAGE="http://www.mplayerhq.hu/"
FONT_RDEPS="
virtual/ttf-fonts
media-libs/fontconfig
>=media-libs/freetype-2.2.1:2
"
X_RDEPS="
x11-libs/libXext
x11-libs/libXxf86vm
"
[[ ${PV} == *9999* ]] && RDEPEND+=" external-ffmpeg? ( media-video/ffmpeg )"
# Rar: althrought -gpl version is nice, it cant do most functions normal rars can
# nemesi? ( net-libs/libnemesi )
RDEPEND+="
sys-libs/ncurses
app-arch/bzip2
sys-libs/zlib
!bindist? (
x86? (
win32codecs? ( media-libs/win32codecs )
)
)
X? (
${X_RDEPS}
dga? ( x11-libs/libXxf86dga )
ggi? (
media-libs/libggi
media-libs/libggiwmh
)
gmplayer? (
media-libs/libpng
x11-libs/gtk+:2
x11-libs/libXi
)
opengl? ( virtual/opengl )
vdpau? ( || ( x11-libs/libvdpau >=x11-drivers/nvidia-drivers-180.51 ) )
xinerama? ( x11-libs/libXinerama )
xscreensaver? ( x11-libs/libXScrnSaver )
xv? (
x11-libs/libXv
xvmc? ( x11-libs/libXvMC )
)
)
a52? ( media-libs/a52dec )
aalib? ( media-libs/aalib )
alsa? ( media-libs/alsa-lib )
amr? ( !bindist? ( media-libs/opencore-amr ) )
ass? ( ${FONT_RDEPS} media-libs/libass )
bidi? ( dev-libs/fribidi )
bs2b? ( media-libs/libbs2b )
cdio? ( dev-libs/libcdio )
cdparanoia? ( !cdio? ( media-sound/cdparanoia ) )
dirac? ( media-video/dirac )
directfb? ( dev-libs/DirectFB )
dts? ( media-libs/libdca )
dv? ( media-libs/libdv )
dvb? ( media-tv/linuxtv-dvb-headers )
encode? (
!twolame? ( toolame? ( media-sound/toolame ) )
twolame? ( media-sound/twolame )
faac? ( media-libs/faac )
mp3? ( media-sound/lame )
x264? ( >=media-libs/x264-0.0.20100423 )
xvid? ( media-libs/xvid )
)
esd? ( media-sound/esound )
enca? ( app-i18n/enca )
faad? ( media-libs/faad2 )
gif? ( media-libs/giflib )
iconv? ( virtual/libiconv )
jack? ( media-sound/jack-audio-connection-kit )
jpeg? ( virtual/jpeg )
jpeg2k? ( media-libs/openjpeg )
ladspa? ( media-libs/ladspa-sdk )
libcaca? ( media-libs/libcaca )
lirc? ( app-misc/lirc )
live? ( media-plugins/live )
lzo? ( >=dev-libs/lzo-2 )
mad? ( media-libs/libmad )
mng? ( media-libs/libmng )
nas? ( media-libs/nas )
nut? ( >=media-libs/libnut-661 )
openal? ( media-libs/openal )
png? ( media-libs/libpng )
pnm? ( media-libs/netpbm )
pulseaudio? ( media-sound/pulseaudio )
rar? (
|| (
app-arch/unrar
app-arch/rar
)
)
samba? ( net-fs/samba )
schroedinger? ( media-libs/schroedinger )
sdl? ( media-libs/libsdl )
speex? ( media-libs/speex )
svga? ( media-libs/svgalib )
theora? ( media-libs/libtheora[encode?] )
truetype? ( ${FONT_RDEPS} )
vaapi? ( x11-libs/libva )
vorbis? ( media-libs/libvorbis )
vpx? ( media-libs/libvpx )
xanim? ( media-video/xanim )
"
X_DEPS="
x11-proto/videoproto
x11-proto/xf86vidmodeproto
"
ASM_DEP="dev-lang/yasm"
DEPEND="${RDEPEND}
dev-util/pkgconfig
X? (
${X_DEPS}
dga? ( x11-proto/xf86dgaproto )
dxr3? ( media-video/em8300-libraries )
gmplayer? ( x11-proto/xextproto )
xinerama? ( x11-proto/xineramaproto )
xscreensaver? ( x11-proto/scrnsaverproto )
)
amd64? ( ${ASM_DEP} )
doc? (
dev-libs/libxslt app-text/docbook-xml-dtd
app-text/docbook-xsl-stylesheets
)
x86? ( ${ASM_DEP} )
x86-fbsd? ( ${ASM_DEP} )
"
SLOT="0"
LICENSE="GPL-2"
if [[ ${PV} != *9999* ]]; then
KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~sparc ~x86"
else
KEYWORDS=""
fi
PATCHES=( "${FILESDIR}"/vaapi/*.patch)
pkg_setup() {
if [[ ${PV} == *9999* ]]; then
elog ""
elog "This is a live ebuild which installs the latest from upstream's"
elog "subversion repository, and is unsupported by Gentoo."
elog "Everything but bugs in the ebuild itself will be ignored."
elog ""
fi
if use gmplayer; then
ewarn ""
ewarn "GMPlayer is no longer actively developed upstream"
ewarn "and is not supported by Gentoo. There are alternatives"
ewarn "for a GUI frontend: smplayer, gnome-mplayer or kmplayer."
fi
if use cpudetection; then
ewarn ""
ewarn "You've enabled the cpudetection flag. This feature is"
ewarn "included mainly for people who want to use the same"
ewarn "binary on another system with a different CPU architecture."
ewarn "MPlayer will already detect your CPU settings by default at"
ewarn "buildtime; this flag is used for runtime detection."
ewarn "You won't need this turned on if you are only building"
ewarn "mplayer for this system. Also, if your compile fails, try"
ewarn "disabling this use flag."
fi
if use custom-cpuopts; then
ewarn ""
ewarn "You are using the custom-cpuopts flag which will"
ewarn "specifically allow you to enable / disable certain"
ewarn "CPU optimizations."
ewarn ""
ewarn "Most desktop users won't need this functionality, but it"
ewarn "is included for corner cases like cross-compiling and"
ewarn "certain profiles. If unsure, disable this flag and MPlayer"
ewarn "will automatically detect and use your available CPU"
ewarn "optimizations."
ewarn ""
ewarn "Using this flag means your build is unsupported, so"
ewarn "please make sure your CPU optimization use flags (3dnow"
ewarn "3dnowext mmx mmxext sse sse2 ssse3) are properly set."
fi
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
subversion_src_unpack
cd "${WORKDIR}"
else
unpack ${A}
fi
if ! use truetype; then
unpack font-arial-iso-8859-1.tar.bz2 \
font-arial-iso-8859-2.tar.bz2 \
font-arial-cp1250.tar.bz2
fi
use gmplayer && unpack "Blue-${BLUV}.tar.bz2"
use svga && unpack "svgalib_helper-${SVGV}-mplayer.tar.gz"
}
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# Set SVN version manually
subversion_wc_info
sed -i -e "s/UNKNOWN/${ESVN_WC_REVISION}/" "${S}/version.sh" || die
else
# Set version #
sed -i -e "s/UNKNOWN/${MPLAYER_REVISION}/" "${S}/version.sh" || die
fi
if use svga; then
echo
einfo "Enabling vidix non-root mode."
einfo "(You need a proper svgalib_helper.o module for your kernel"
einfo "to actually use this)"
echo
mv "${WORKDIR}/svgalib_helper" "${S}/libdha"
fi
base_src_prepare
}
src_configure() {
local myconf=""
local uses i
# set LINGUAS
[[ -n $LINGUAS ]] && LINGUAS="${LINGUAS/da/dk}"
# mplayer ebuild uses "use foo || --disable-foo" to forcibly disable
# compilation in almost every situation. The reason for this is
# because if --enable is used, it will force the build of that option,
# regardless of whether the dependency is available or not.
###################
#Optional features#
###################
myconf+="
--disable-arts
--disable-kai
$(use_enable network)
$(use_enable joystick)
"
uses="ass bl enca ftp rtc" # nemesi <- not working with in-tree ebuild
myconf+=" --disable-nemesi" # nemesi automagic disable
myconf+=" --disable-ass-internal" # always use system libass
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use bidi || myconf+=" --disable-fribidi"
use ipv6 || myconf+=" --disable-inet6"
use nut || myconf+=" --disable-libnut"
use rar || myconf+=" --disable-unrarexec"
use samba || myconf+=" --disable-smb"
use svga || myconf+=" --disable-svga --disable-svgalib_helper"
if ! use lirc; then
myconf+="
--disable-lirc
--disable-lircc
--disable-apple-ir
"
fi
# libcdio support: prefer libcdio over cdparanoia
# don't check for cddb w/cdio
if use cdio; then
myconf+=" --disable-cdparanoia"
else
myconf+=" --disable-libcdio"
use cdparanoia || myconf+=" --disable-cdparanoia"
use cddb || myconf+=" --disable-cddb"
fi
################################
# DVD read, navigation support #
################################
#
# dvdread - accessing a DVD
# dvdnav - navigation of menus
#
# internal dvdread and dvdnav use flags enable internal
# versions of the libraries, which are snapshots of the fork.
if use dvd; then
use dvdnav || myconf+=" --disable-dvdnav"
else
myconf+="
--disable-dvdnav
--disable-dvdread
--disable-dvdread-internal
--disable-libdvdcss-internal
"
fi
#############
# Subtitles #
#############
#
# SRT/ASS/SSA (subtitles) requires freetype support
# freetype support requires iconv
# iconv optionally can use unicode
if ! use ass; then
if ! use truetype; then
myconf+=" --disable-freetype"
if ! use iconv; then
myconf+="
--disable-iconv
--charset=noconv
"
fi
fi
fi
use iconv && use unicode && myconf+=" --charset=UTF-8"
#####################################
# DVB / Video4Linux / Radio support #
#####################################
myconf+=" --disable-tv-bsdbt848"
# broken upstream, won't work with recent kernels
myconf+=" --disable-ivtv"
if { use dvb || use v4l || use v4l2 || use pvr || use radio; }; then
use dvb || myconf+=" --disable-dvb"
use pvr || myconf+=" --disable-pvr"
use v4l || myconf+=" --disable-tv-v4l1"
use v4l2 || myconf+=" --disable-tv-v4l2"
if use radio && { use dvb || use v4l || use v4l2; }; then
myconf+="
--enable-radio
$(use_enable encode radio-capture)
"
else
myconf+="
--disable-radio-v4l2
--disable-radio-bsdbt848
"
fi
else
myconf+="
--disable-tv
--disable-tv-v4l1
--disable-tv-v4l2
--disable-radio
--disable-radio-v4l2
--disable-radio-bsdbt848
--disable-dvb
--disable-v4l2
--disable-pvr"
fi
##########
# Codecs #
##########
myconf+=" --disable-musepack" # Use internal musepack codecs for SV7 and SV8 support
myconf+=" --disable-faad-internal" # always use system media-libs/faad2
use dirac || myconf+=" --disable-libdirac-lavc"
use dts || myconf+=" --disable-libdca"
if ! use mp3; then
myconf+="
--disable-mp3lame
--disable-mp3lame-lavc
--disable-mp3lib
"
fi
uses="a52 bs2b dv lzo"
for i in ${uses}; do
use ${i} || myconf+=" --disable-lib${i}"
done
use schroedinger || myconf+=" --disable-libschroedinger-lavc"
# Disable opencore-amr with bindist
# https://bugs.gentoo.org/show_bug.cgi?id=299405#c6
{ use amr && use !bindist ; } || myconf+=" --disable-libopencore_amrnb --disable-libopencore_amrwb"
if ! use png && ! use gmplayer; then
myconf+=" --disable-png"
fi
uses="faad gif jpeg live mad mng pnm speex tga theora xanim"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use jpeg2k || myconf+=" --disable-libopenjpeg"
if use vorbis || use tremor; then
use tremor || myconf+=" --disable-tremor-internal"
use vorbis || myconf+=" --disable-libvorbis"
else
myconf+="
--disable-tremor-internal
--disable-tremor
--disable-libvorbis
"
fi
use vaapi && myconf+=" --enable-vaapi"
use vpx || myconf+=" --disable-libvpx-lavc"
# Encoding
uses="faac x264 xvid toolame twolame"
if use encode; then
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use faac || myconf+=" --disable-faac-lavc"
else
myconf+=" --disable-mencoder"
myconf+=" --disable-faac-lavc"
for i in ${uses}; do
myconf+=" --disable-${i}"
use ${i} && elog "Useflag \"${i}\" require \"encode\" useflag enabled to work."
done
fi
#################
# Binary codecs #
#################
# bug 213836
if ! use x86 || ! use win32codecs; then
use quicktime || myconf+=" --disable-qtx"
fi
######################
# RealPlayer support #
######################
# Realplayer support shows up in four places:
# - libavcodec (internal)
# - win32codecs
# - realcodecs (win32codecs libs)
# - realcodecs (realplayer libs)
# internal
use real || myconf+=" --disable-real"
# Real binary codec support only available on x86, amd64
if use real; then
use x86 && myconf+=" --codecsdir=/opt/RealPlayer/codecs"
use amd64 && myconf+=" --codecsdir=/usr/$(get_libdir)/codecs"
elif ! use bindist; then
myconf+=" $(use_enable win32codecs win32dll)"
fi
################
# Video Output #
################
uses="directfb md5sum sdl"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use aalib || myconf+=" --disable-aa"
use fbcon || myconf+=" --disable-fbdev"
use fbcon && use video_cards_s3virge && myconf+=" --enable-s3fb"
use libcaca || myconf+=" --disable-caca"
use zoran || myconf+=" --disable-zr"
if ! use kernel_linux && ! use video_cards_mga; then
myconf+=" --disable-mga --disable-xmga"
fi
if use video_cards_tdfx; then
myconf+="
$(use_enable video_cards_tdfx tdfxvid)
$(use_enable fbcon tdfxfb)
"
else
myconf+="
--disable-3dfx
--disable-tdfxvid
--disable-tdfxfb
"
fi
################
# Audio Output #
################
uses="alsa esd jack ladspa nas openal"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use pulseaudio || myconf+=" --disable-pulse"
if ! use radio; then
use oss || myconf+=" --disable-ossaudio"
fi
####################
# Advanced Options #
####################
# Platform specific flags, hardcoded on amd64 (see below)
if use cpudetection; then
myconf+=" --enable-runtime-cpudetection"
fi
# Turning off CPU optimizations usually will break the build.
# However, this use flag, if enabled, will allow users to completely
# specify which ones to use. If disabled, mplayer will automatically
# enable all CPU optimizations that the host build supports.
if use custom-cpuopts; then
uses="3dnow 3dnowext altivec mmx mmxext shm sse sse2 ssse3"
for i in ${uses}; do
myconf+=" $(use_enable ${i})"
done
fi
use debug && myconf+=" --enable-debug=3"
if use x86 && gcc-specs-pie; then
filter-flags -fPIC -fPIE
append-ldflags -nopie
fi
is-flag -O? || append-flags -O2
if use x86 || use x86-fbsd; then
use debug || append-flags -fomit-frame-pointer
fi
###########################
# X enabled configuration #
###########################
if use X; then
uses="dxr3 ggi xinerama"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use dga || myconf+=" --disable-dga1 --disable-dga2"
use opengl || myconf+=" --disable-gl"
use osdmenu && myconf+=" --enable-menu"
use vdpau || myconf+=" --disable-vdpau"
use video_cards_vesa || myconf+=" --disable-vesa"
use vidix || myconf+=" --disable-vidix --disable-vidix-pcidb"
use xscreensaver || myconf+=" --disable-xss"
# GTK gmplayer gui
# Unsupported by Gentoo, upstream has dropped development
myconf+=" $(use_enable gmplayer gui)"
if use xv; then
if use xvmc; then
myconf+=" --enable-xvmc --with-xvmclib=XvMCW"
else
myconf+=" --disable-xvmc"
fi
else
myconf+="
--disable-xv
--disable-xvmc
"
use xvmc && elog "Disabling xvmc because it requires \"xv\" useflag enabled."
fi
else
myconf+="
--disable-dga1
--disable-dga2
--disable-dxr3
--disable-ggi
--disable-gl
--disable-vdpau
--disable-vidix
--disable-vidix-pcidb
--disable-xinerama
--disable-xss
--disable-xv
--disable-xvmc
--disable-x11
"
uses="dga dxr3 ggi opengl osdmenu vdpau vidix xinerama xscreensaver xv"
for i in ${uses}; do
use ${i} && elog "Useflag \"${i}\" require \"X\" useflag enabled to work."
done
fi
if [[ ${PV} == *9999* ]]; then
###################
# External FFmpeg #
###################
use external-ffmpeg && myconf+=" --disable-libavutil_a --disable-libavcodec_a --disable-libavformat_a --disable-libpostproc_a --disable-libswscale_a"
fi
myconf="--cc=$(tc-getCC) \
--host-cc=$(tc-getBUILD_CC) \
--prefix=/usr \
--confdir=/etc/mplayer \
--datadir=/usr/share/mplayer \
--libdir=/usr/$(get_libdir) \
${myconf}"
CFLAGS="${CFLAGS}" ./configure ${myconf} || die "configure died"
}
src_compile() {
base_src_compile
# Build only user-requested docs if they're available.
if use doc ; then
# select available languages from $LINGUAS
LINGUAS=${LINGUAS/zh/zh_CN}
local ALLOWED_LINGUAS="cs de en es fr hu it pl ru zh_CN"
local BUILT_DOCS=""
for i in ${LINGUAS} ; do
hasq ${i} ${ALLOWED_LINGUAS} && BUILT_DOCS+=" ${i}"
done
if [[ -z $BUILT_DOCS ]]
then
emake -j1 -C DOCS/xml html-chunked || die "Failed to generate html docs"
else
for i in ${BUILT_DOCS} ; do
emake -j1 -C DOCS/xml html-chunked-${i} || die "Failed to generate html docs for ${i}"
done
fi
fi
}
src_install() {
local i
emake prefix="${D}/usr" \
BINDIR="${D}/usr/bin" \
LIBDIR="${D}/usr/$(get_libdir)" \
CONFDIR="${D}/etc/mplayer" \
DATADIR="${D}/usr/share/mplayer" \
MANDIR="${D}/usr/share/man" \
INSTALLSTRIP="" \
install || die "emake install failed"
dodoc AUTHORS Changelog Copyright README etc/codecs.conf || die
docinto tech/
dodoc DOCS/tech/{*.txt,MAINTAINERS,mpsub.sub,playtree,TODO,wishlist} || die
docinto TOOLS/
dodoc TOOLS/* || die
if use real; then
docinto tech/realcodecs/
dodoc DOCS/tech/realcodecs/* || die
docinto TOOLS/realcodecs/
dodoc TOOLS/realcodecs/* || die
fi
docinto tech/mirrors/
dodoc DOCS/tech/mirrors/* || die
if use doc; then
docinto html/
dohtml -r "${S}"/DOCS/HTML/* || die
fi
# Install the default Skin and Gnome menu entry
if use gmplayer; then
dodir /usr/share/mplayer/skins
cp -r "${WORKDIR}/Blue" \
"${D}/usr/share/mplayer/skins/default" || die "cp skins died"
# Fix the symlink
rm -rf "${D}/usr/bin/gmplayer"
dosym mplayer /usr/bin/gmplayer
fi
if ! use ass && ! use truetype; then
dodir /usr/share/mplayer/fonts
# Do this generic, as the mplayer people like to change the structure
# of their zips ...
for i in $(find "${WORKDIR}/" -type d -name 'font-arial-*'); do
cp -pPR "${i}" "${D}/usr/share/mplayer/fonts"
done
# Fix the font symlink ...
rm -rf "${D}/usr/share/mplayer/font"
dosym fonts/font-arial-14-iso-8859-1 /usr/share/mplayer/font
fi
insinto /etc/mplayer
newins "${S}/etc/example.conf" mplayer.conf || die
doins "${S}/etc/input.conf" || die
if use osdmenu; then
doins "${S}/etc/menu.conf" || die
fi
if use ass || use truetype; then
cat >> "${D}/etc/mplayer/mplayer.conf" << _EOF_
fontconfig=1
subfont-osd-scale=4
subfont-text-scale=3
_EOF_
fi
# bug 256203
if use rar; then
cat >> "${D}/etc/mplayer/mplayer.conf" << _EOF_
unrarexec=/usr/bin/unrar
_EOF_
fi
dosym ../../../etc/mplayer/mplayer.conf /usr/share/mplayer/mplayer.conf
newbin "${S}/TOOLS/midentify.sh" midentify || die
}
pkg_preinst() {
[[ -d ${ROOT}/usr/share/mplayer/Skin/default ]] && \
rm -rf "${ROOT}/usr/share/mplayer/Skin/default"
}
pkg_postrm() {
# Cleanup stale symlinks
[ -L "${ROOT}/usr/share/mplayer/font" -a \
! -e "${ROOT}/usr/share/mplayer/font" ] && \
rm -f "${ROOT}/usr/share/mplayer/font"
[ -L "${ROOT}/usr/share/mplayer/subfont.ttf" -a \
! -e "${ROOT}/usr/share/mplayer/subfont.ttf" ] && \
rm -f "${ROOT}/usr/share/mplayer/subfont.ttf"
}

@ -0,0 +1,740 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/mplayer/mplayer-1.0_rc4_p20101114.ebuild,v 1.1 2010/11/14 15:13:00 polynomial-c Exp $
EAPI=3
ESVN_REPO_URI="svn://svn.mplayerhq.hu/mplayer/trunk"
[[ ${PV} = *9999* ]] && SVN_ECLASS="subversion" || SVN_ECLASS=""
inherit toolchain-funcs eutils flag-o-matic multilib base ${SVN_ECLASS}
# BUMP ME PLZ, NO COOKIES OTHERWISE
[[ ${PV} != *9999* ]] && MPLAYER_REVISION=SVN-r32624
IUSE="3dnow 3dnowext +a52 aalib +alsa altivec aqua +ass bidi bindist bl bluray
bs2b +cddb +cdio cdparanoia cpudetection custom-cpuopts debug dga +dirac
directfb doc +dts +dv dvb +dvd +dvdnav dxr3 +enca +encode esd +faac +faad fbcon
ftp gif ggi gsm +iconv ipv6 jack joystick jpeg jpeg2k kernel_linux ladspa
libcaca libmpeg2 lirc +live lzo mad md5sum +mmx mmxext mng +mp3 mpg123 nas
+network nut openal amr +opengl +osdmenu oss png pnm pulseaudio pvr +quicktime
radio +rar +real +rtc rtmp samba +shm +schroedinger sdl +speex sse sse2 ssse3
tga +theora +tremor +truetype +toolame +twolame +unicode v4l v4l2 vaapi vdpau vidix
+vorbis vpx win32codecs +X +x264 xanim xinerama +xscreensaver +xv +xvid xvmc
zoran"
[[ ${PV} == *9999* ]] && IUSE+=" external-ffmpeg"
VIDEO_CARDS="s3virge mga tdfx vesa"
for x in ${VIDEO_CARDS}; do
IUSE+=" video_cards_${x}"
done
FONT_URI="
mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2
mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2
"
if [[ ${PV} == *9999* ]]; then
RELEASE_URI=""
else
RELEASE_URI="mirror://gentoo/${P}.tar.xz"
fi
SRC_URI="${RELEASE_URI}
!truetype? ( ${FONT_URI} )"
DESCRIPTION="Media Player for Linux"
HOMEPAGE="http://www.mplayerhq.hu/"
FONT_RDEPS="
virtual/ttf-fonts
media-libs/fontconfig
>=media-libs/freetype-2.2.1:2
"
X_RDEPS="
x11-libs/libXext
x11-libs/libXxf86vm
"
[[ ${PV} == *9999* ]] && RDEPEND+=" external-ffmpeg? ( media-video/ffmpeg )"
# Rar: althrought -gpl version is nice, it cant do most functions normal rars can
# nemesi? ( net-libs/libnemesi )
RDEPEND+="
sys-libs/ncurses
app-arch/bzip2
sys-libs/zlib
!bindist? (
x86? (
win32codecs? ( media-libs/win32codecs )
)
)
X? (
${X_RDEPS}
dga? ( x11-libs/libXxf86dga )
ggi? (
media-libs/libggi
media-libs/libggiwmh
)
opengl? ( virtual/opengl )
vdpau? ( || ( x11-libs/libvdpau >=x11-drivers/nvidia-drivers-180.51 ) )
xinerama? ( x11-libs/libXinerama )
xscreensaver? ( x11-libs/libXScrnSaver )
xv? (
x11-libs/libXv
xvmc? ( x11-libs/libXvMC )
)
)
a52? ( media-libs/a52dec )
aalib? ( media-libs/aalib )
alsa? ( media-libs/alsa-lib )
amr? ( !bindist? ( media-libs/opencore-amr ) )
ass? ( ${FONT_RDEPS} >=media-libs/libass-0.9.10[enca?] )
bidi? ( dev-libs/fribidi )
bluray? ( media-libs/libbluray )
bs2b? ( media-libs/libbs2b )
cdio? ( dev-libs/libcdio )
cdparanoia? ( !cdio? ( media-sound/cdparanoia ) )
dirac? ( media-video/dirac )
directfb? ( dev-libs/DirectFB )
dts? ( media-libs/libdca )
dv? ( media-libs/libdv )
dvb? ( media-tv/linuxtv-dvb-headers )
dvd? (
>=media-libs/libdvdread-4.1.3
dvdnav? ( >=media-libs/libdvdnav-4.1.3 )
)
encode? (
!twolame? ( toolame? ( media-sound/toolame ) )
twolame? ( media-sound/twolame )
faac? ( !bindist? ( media-libs/faac ) )
mp3? ( media-sound/lame )
x264? ( >=media-libs/x264-0.0.20100423 )
xvid? ( media-libs/xvid )
)
esd? ( media-sound/esound )
enca? ( app-i18n/enca )
faad? ( media-libs/faad2 )
gif? ( media-libs/giflib )
gsm? ( media-sound/gsm )
iconv? ( virtual/libiconv )
jack? ( media-sound/jack-audio-connection-kit )
jpeg? ( virtual/jpeg )
jpeg2k? ( media-libs/openjpeg )
ladspa? ( media-libs/ladspa-sdk )
libcaca? ( media-libs/libcaca )
libmpeg2? ( media-libs/libmpeg2 )
lirc? ( app-misc/lirc )
live? ( media-plugins/live )
lzo? ( >=dev-libs/lzo-2 )
mad? ( media-libs/libmad )
mng? ( media-libs/libmng )
mpg123? ( media-sound/mpg123 )
nas? ( media-libs/nas )
nut? ( >=media-libs/libnut-661 )
openal? ( media-libs/openal )
png? ( media-libs/libpng )
pnm? ( media-libs/netpbm )
pulseaudio? ( media-sound/pulseaudio )
rar? (
|| (
app-arch/unrar
app-arch/rar
)
)
rtmp? ( media-video/rtmpdump )
samba? ( net-fs/samba )
schroedinger? ( media-libs/schroedinger )
sdl? ( media-libs/libsdl )
speex? ( media-libs/speex )
theora? ( media-libs/libtheora[encode?] )
truetype? ( ${FONT_RDEPS} )
vaapi? ( x11-libs/libva )
vorbis? ( media-libs/libvorbis )
vpx? ( media-libs/libvpx )
xanim? ( media-video/xanim )
"
X_DEPS="
x11-proto/videoproto
x11-proto/xf86vidmodeproto
"
ASM_DEP="dev-lang/yasm"
DEPEND="${RDEPEND}
dev-util/pkgconfig
X? (
${X_DEPS}
dga? ( x11-proto/xf86dgaproto )
dxr3? ( media-video/em8300-libraries )
xinerama? ( x11-proto/xineramaproto )
xscreensaver? ( x11-proto/scrnsaverproto )
)
amd64? ( ${ASM_DEP} )
doc? (
dev-libs/libxslt app-text/docbook-xml-dtd
app-text/docbook-xsl-stylesheets
)
x86? ( ${ASM_DEP} )
x86-fbsd? ( ${ASM_DEP} )
"
SLOT="0"
LICENSE="GPL-2"
if [[ ${PV} != *9999* ]]; then
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
else
KEYWORDS=""
fi
PATCHES=( "${FILESDIR}"/vaapi-take2/*.patch )
pkg_setup() {
if [[ ${PV} == *9999* ]]; then
elog
elog "This is a live ebuild which installs the latest from upstream's"
elog "subversion repository, and is unsupported by Gentoo."
elog "Everything but bugs in the ebuild itself will be ignored."
elog
fi
if use cpudetection; then
ewarn
ewarn "You've enabled the cpudetection flag. This feature is"
ewarn "included mainly for people who want to use the same"
ewarn "binary on another system with a different CPU architecture."
ewarn "MPlayer will already detect your CPU settings by default at"
ewarn "buildtime; this flag is used for runtime detection."
ewarn "You won't need this turned on if you are only building"
ewarn "mplayer for this system. Also, if your compile fails, try"
ewarn "disabling this use flag."
fi
if use custom-cpuopts; then
ewarn
ewarn "You are using the custom-cpuopts flag which will"
ewarn "specifically allow you to enable / disable certain"
ewarn "CPU optimizations."
ewarn
ewarn "Most desktop users won't need this functionality, but it"
ewarn "is included for corner cases like cross-compiling and"
ewarn "certain profiles. If unsure, disable this flag and MPlayer"
ewarn "will automatically detect and use your available CPU"
ewarn "optimizations."
ewarn
ewarn "Using this flag means your build is unsupported, so"
ewarn "please make sure your CPU optimization use flags (3dnow"
ewarn "3dnowext mmx mmxext sse sse2 ssse3) are properly set."
fi
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
subversion_src_unpack
cd "${WORKDIR}"
else
unpack ${A}
fi
if ! use truetype; then
unpack font-arial-iso-8859-1.tar.bz2 \
font-arial-iso-8859-2.tar.bz2 \
font-arial-cp1250.tar.bz2
fi
}
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# Set SVN version manually
subversion_wc_info
sed -i -e "s/UNKNOWN/${ESVN_WC_REVISION}/" "${S}/version.sh" || die
else
# Set version #
sed -i -e "s/UNKNOWN/${MPLAYER_REVISION}/" "${S}/version.sh" || die
fi
# fix path to bash executable in configure scripts
sed -i -e "1c\#!${EPREFIX}/bin/bash" configure version.sh || die
base_src_prepare
}
src_configure() {
local myconf=""
local uses i
# set LINGUAS
[[ -n $LINGUAS ]] && LINGUAS="${LINGUAS/da/dk}"
# mplayer ebuild uses "use foo || --disable-foo" to forcibly disable
# compilation in almost every situation. The reason for this is
# because if --enable is used, it will force the build of that option,
# regardless of whether the dependency is available or not.
###################
#Optional features#
###################
# disable svga since we don't want it
# disable arts since we don't have kde3
# always disable internal ass
myconf+="
--disable-svga --disable-svgalib_helper
--disable-ass-internal
--disable-arts
--disable-kai
$(use_enable network networking)
$(use_enable joystick)
"
uses="ass bl bluray enca ftp rtc" # nemesi <- not working with in-tree ebuild
myconf+=" --disable-nemesi" # nemesi automagic disable
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use bidi || myconf+=" --disable-fribidi"
use ipv6 || myconf+=" --disable-inet6"
use nut || myconf+=" --disable-libnut"
use rar || myconf+=" --disable-unrarexec"
use samba || myconf+=" --disable-smb"
if ! use lirc; then
myconf+="
--disable-lirc
--disable-lircc
--disable-apple-ir
"
fi
# libcdio support: prefer libcdio over cdparanoia
# don't check for cddb w/cdio
if use cdio; then
myconf+=" --disable-cdparanoia"
else
myconf+=" --disable-libcdio"
use cdparanoia || myconf+=" --disable-cdparanoia"
use cddb || myconf+=" --disable-cddb"
fi
################################
# DVD read, navigation support #
################################
#
# dvdread - accessing a DVD
# dvdnav - navigation of menus
#
# use external libdvdcss, dvdread and dvdnav
myconf+=" --disable-dvdread-internal --disable-libdvdcss-internal"
if use dvd; then
use dvdnav || myconf+=" --disable-dvdnav"
else
myconf+="
--disable-dvdnav
--disable-dvdread
"
fi
#############
# Subtitles #
#############
#
# SRT/ASS/SSA (subtitles) requires freetype support
# freetype support requires iconv
# iconv optionally can use unicode
if ! use ass && ! use truetype; then
myconf+=" --disable-freetype"
if ! use iconv; then
myconf+="
--disable-iconv
--charset=noconv
"
fi
fi
use iconv && use unicode && myconf+=" --charset=UTF-8"
#####################################
# DVB / Video4Linux / Radio support #
#####################################
myconf+=" --disable-tv-bsdbt848"
# broken upstream, won't work with recent kernels
myconf+=" --disable-ivtv"
if { use dvb || use v4l || use v4l2 || use pvr || use radio; }; then
use dvb || myconf+=" --disable-dvb"
use pvr || myconf+=" --disable-pvr"
use v4l || myconf+=" --disable-tv-v4l1"
use v4l2 || myconf+=" --disable-tv-v4l2"
if use radio && { use dvb || use v4l || use v4l2; }; then
myconf+="
--enable-radio
$(use_enable encode radio-capture)
"
else
myconf+="
--disable-radio-v4l2
--disable-radio-bsdbt848
"
fi
else
myconf+="
--disable-tv
--disable-tv-v4l1
--disable-tv-v4l2
--disable-radio
--disable-radio-v4l2
--disable-radio-bsdbt848
--disable-dvb
--disable-v4l2
--disable-pvr"
fi
##########
# Codecs #
##########
myconf+=" --disable-musepack" # Use internal musepack codecs for SV7 and SV8 support
myconf+=" --disable-faad-internal" # always use system media-libs/faad2
myconf+=" --disable-libmpeg2-internal" # always use system media-libs/libmpeg2
use dirac || myconf+=" --disable-libdirac-lavc"
use dts || myconf+=" --disable-libdca"
if ! use mp3; then
myconf+="
--disable-mp3lame
--disable-mp3lame-lavc
--disable-mp3lib
"
fi
uses="a52 bs2b dv gsm lzo rtmp"
for i in ${uses}; do
use ${i} || myconf+=" --disable-lib${i}"
done
use schroedinger || myconf+=" --disable-libschroedinger-lavc"
# Disable opencore-amr with bindist
# https://bugs.gentoo.org/show_bug.cgi?id=299405#c6
{ use amr && use !bindist ; } || myconf+=" --disable-libopencore_amrnb --disable-libopencore_amrwb"
uses="faad gif jpeg libmpeg2 live mad mng mpg123 png pnm speex tga theora xanim"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use jpeg2k || myconf+=" --disable-libopenjpeg"
if use vorbis || use tremor; then
use tremor || myconf+=" --disable-tremor-internal"
use vorbis || myconf+=" --disable-libvorbis"
else
myconf+="
--disable-tremor-internal
--disable-tremor
--disable-libvorbis
"
fi
use vaapi && myconf+=" --enable-vaapi"
use vpx || myconf+=" --disable-libvpx-lavc"
# Encoding
uses="faac x264 xvid toolame twolame"
if use encode; then
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use faac || myconf+=" --disable-faac-lavc"
if use bindist && use faac; then
ewarn "faac is nonfree and cannot be distributed; disabling faac support."
myconf+=" --disable-faac --disable-faac-lavc"
fi
else
myconf+=" --disable-mencoder"
myconf+=" --disable-faac-lavc"
for i in ${uses}; do
myconf+=" --disable-${i}"
use ${i} && elog "Useflag \"${i}\" require \"encode\" useflag enabled to work."
done
fi
#################
# Binary codecs #
#################
# bug 213836
if ! use x86 || ! use win32codecs; then
use quicktime || myconf+=" --disable-qtx"
fi
######################
# RealPlayer support #
######################
# Realplayer support shows up in four places:
# - libavcodec (internal)
# - win32codecs
# - realcodecs (win32codecs libs)
# - realcodecs (realplayer libs)
# internal
use real || myconf+=" --disable-real"
# Real binary codec support only available on x86, amd64
if use real; then
use x86 && myconf+=" --codecsdir=/opt/RealPlayer/codecs"
use amd64 && myconf+=" --codecsdir=/usr/$(get_libdir)/codecs"
elif ! use bindist; then
myconf+=" $(use_enable win32codecs win32dll)"
fi
################
# Video Output #
################
uses="directfb md5sum sdl"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use aalib || myconf+=" --disable-aa"
use fbcon || myconf+=" --disable-fbdev"
use fbcon && use video_cards_s3virge && myconf+=" --enable-s3fb"
use libcaca || myconf+=" --disable-caca"
use zoran || myconf+=" --disable-zr"
if ! use kernel_linux || ! use video_cards_mga; then
myconf+=" --disable-mga --disable-xmga"
fi
if use video_cards_tdfx; then
myconf+="
$(use_enable video_cards_tdfx tdfxvid)
$(use_enable fbcon tdfxfb)
"
else
myconf+="
--disable-3dfx
--disable-tdfxvid
--disable-tdfxfb
"
fi
# sun card, disable by default, see bug #258729
myconf+=" --disable-xvr100"
################
# Audio Output #
################
uses="alsa esd jack ladspa nas openal"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use pulseaudio || myconf+=" --disable-pulse"
if ! use radio; then
use oss || myconf+=" --disable-ossaudio"
fi
####################
# Advanced Options #
####################
# Platform specific flags, hardcoded on amd64 (see below)
if use cpudetection; then
myconf+=" --enable-runtime-cpudetection"
fi
# Turning off CPU optimizations usually will break the build.
# However, this use flag, if enabled, will allow users to completely
# specify which ones to use. If disabled, mplayer will automatically
# enable all CPU optimizations that the host build supports.
if use custom-cpuopts; then
uses="3dnow 3dnowext altivec mmx mmxext shm sse sse2 ssse3"
for i in ${uses}; do
myconf+=" $(use_enable ${i})"
done
fi
use debug && myconf+=" --enable-debug=3"
if use x86 && gcc-specs-pie; then
filter-flags -fPIC -fPIE
append-ldflags -nopie
fi
is-flag -O? || append-flags -O2
if use x86 || use x86-fbsd; then
use debug || append-flags -fomit-frame-pointer
fi
# workaround bug, x86 just has too few registers, see c.f.
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=402950#44
# and 32b osx, bug 329861
[[ ${CHOST} == i?86-*solaris* || ${CHOST} == i?86-*darwin* ]] && append-flags -fomit-frame-pointer
###########################
# X enabled configuration #
###########################
myconf+=" --disable-gui"
if use X; then
uses="dxr3 ggi xinerama"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use dga || myconf+=" --disable-dga1 --disable-dga2"
use opengl || myconf+=" --disable-gl"
use osdmenu && myconf+=" --enable-menu"
use vdpau || myconf+=" --disable-vdpau"
use video_cards_vesa || myconf+=" --disable-vesa"
use vidix || myconf+=" --disable-vidix --disable-vidix-pcidb"
use xscreensaver || myconf+=" --disable-xss"
if use xv; then
if use xvmc; then
myconf+=" --enable-xvmc --with-xvmclib=XvMCW"
else
myconf+=" --disable-xvmc"
fi
else
myconf+="
--disable-xv
--disable-xvmc
"
use xvmc && elog "Disabling xvmc because it requires \"xv\" useflag enabled."
fi
else
myconf+="
--disable-dga1
--disable-dga2
--disable-dxr3
--disable-ggi
--disable-gl
--disable-vdpau
--disable-vidix
--disable-vidix-pcidb
--disable-xinerama
--disable-xss
--disable-xv
--disable-xvmc
--disable-x11
"
uses="dga dxr3 ggi opengl osdmenu vdpau vidix xinerama xscreensaver xv"
for i in ${uses}; do
use ${i} && elog "Useflag \"${i}\" require \"X\" useflag enabled to work."
done
fi
############################
# OSX (aqua) configuration #
############################
if use aqua; then
myconf+="
--enable-macosx-finder
--enable-macosx-bundle
"
fi
###################
# External FFmpeg #
###################
if [[ ${PV} == *9999* ]]; then
use external-ffmpeg && myconf+=" --disable-ffmpeg_a"
fi
myconf="--cc=$(tc-getCC)
--host-cc=$(tc-getBUILD_CC)
--prefix=${EPREFIX}/usr
--confdir=${EPREFIX}/etc/mplayer
--datadir=${EPREFIX}/usr/share/mplayer
--libdir=${EPREFIX}/usr/$(get_libdir)
${myconf}"
CFLAGS="${CFLAGS}" ./configure ${myconf} || die "configure died"
}
src_compile() {
base_src_compile
# Build only user-requested docs if they're available.
if use doc ; then
# select available languages from $LINGUAS
LINGUAS=${LINGUAS/zh/zh_CN}
local ALLOWED_LINGUAS="cs de en es fr hu it pl ru zh_CN"
local BUILT_DOCS=""
for i in ${LINGUAS} ; do
hasq ${i} ${ALLOWED_LINGUAS} && BUILT_DOCS+=" ${i}"
done
if [[ -z $BUILT_DOCS ]]; then
emake -j1 -C DOCS/xml html-chunked || die "Failed to generate html docs"
else
for i in ${BUILT_DOCS}; do
emake -j1 -C DOCS/xml html-chunked-${i} || die "Failed to generate html docs for ${i}"
done
fi
fi
}
src_install() {
local i
emake prefix="${ED}/usr" \
BINDIR="${ED}/usr/bin" \
LIBDIR="${ED}/usr/$(get_libdir)" \
CONFDIR="${ED}/etc/mplayer" \
DATADIR="${ED}/usr/share/mplayer" \
MANDIR="${ED}/usr/share/man" \
INSTALLSTRIP="" \
install || die "emake install failed"
dodoc AUTHORS Changelog Copyright README etc/codecs.conf || die
docinto tech/
dodoc DOCS/tech/{*.txt,MAINTAINERS,mpsub.sub,playtree,TODO,wishlist} || die
docinto TOOLS/
dodoc TOOLS/* || die
if use real; then
docinto tech/realcodecs/
dodoc DOCS/tech/realcodecs/* || die
docinto TOOLS/realcodecs/
dodoc TOOLS/realcodecs/* || die
fi
docinto tech/mirrors/
dodoc DOCS/tech/mirrors/* || die
if use doc; then
docinto html/
dohtml -r "${S}"/DOCS/HTML/* || die
fi
if ! use ass && ! use truetype; then
dodir /usr/share/mplayer/fonts
# Do this generic, as the mplayer people like to change the structure
# of their zips ...
for i in $(find "${WORKDIR}/" -type d -name 'font-arial-*'); do
cp -pPR "${i}" "${ED}/usr/share/mplayer/fonts"
done
# Fix the font symlink ...
rm -rf "${ED}/usr/share/mplayer/font"
dosym fonts/font-arial-14-iso-8859-1 /usr/share/mplayer/font
fi
insinto /etc/mplayer
newins "${S}/etc/example.conf" mplayer.conf || die
doins "${S}/etc/input.conf" || die
if use osdmenu; then
doins "${S}/etc/menu.conf" || die
fi
if use ass || use truetype; then
cat >> "${ED}/etc/mplayer/mplayer.conf" << _EOF_
fontconfig=1
subfont-osd-scale=4
subfont-text-scale=3
_EOF_
fi
# bug 256203
if use rar; then
cat >> "${ED}/etc/mplayer/mplayer.conf" << _EOF_
unrarexec=${EPREFIX}/usr/bin/unrar
_EOF_
fi
dosym ../../../etc/mplayer/mplayer.conf /usr/share/mplayer/mplayer.conf
newbin "${S}/TOOLS/midentify.sh" midentify || die
}
pkg_preinst() {
[[ -d ${EROOT}/usr/share/mplayer/Skin/default ]] && \
rm -rf "${EROOT}/usr/share/mplayer/Skin/default"
}
pkg_postrm() {
# Cleanup stale symlinks
[ -L "${EROOT}/usr/share/mplayer/font" -a \
! -e "${EROOT}/usr/share/mplayer/font" ] && \
rm -f "${EROOT}/usr/share/mplayer/font"
[ -L "${EROOT}/usr/share/mplayer/subfont.ttf" -a \
! -e "${EROOT}/usr/share/mplayer/subfont.ttf" ] && \
rm -f "${EROOT}/usr/share/mplayer/subfont.ttf"
}

@ -0,0 +1,740 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/mplayer/mplayer-1.0_rc4_p20101114.ebuild,v 1.1 2010/11/14 15:13:00 polynomial-c Exp $
EAPI=3
ESVN_REPO_URI="svn://svn.mplayerhq.hu/mplayer/trunk"
[[ ${PV} = *9999* ]] && SVN_ECLASS="subversion" || SVN_ECLASS=""
inherit toolchain-funcs eutils flag-o-matic multilib base ${SVN_ECLASS}
# BUMP ME PLZ, NO COOKIES OTHERWISE
[[ ${PV} != *9999* ]] && MPLAYER_REVISION=SVN-r32719
IUSE="3dnow 3dnowext +a52 aalib +alsa altivec aqua +ass bidi bindist bl bluray
bs2b +cddb +cdio cdparanoia cpudetection custom-cpuopts debug dga +dirac
directfb doc +dts +dv dvb +dvd +dvdnav dxr3 +enca +encode esd +faac +faad fbcon
ftp gif ggi gsm +iconv ipv6 jack joystick jpeg jpeg2k kernel_linux ladspa
libcaca libmpeg2 lirc +live lzo mad md5sum +mmx mmxext mng +mp3 mpg123 nas
+network nut openal amr +opengl +osdmenu oss png pnm pulseaudio pvr +quicktime
radio +rar +real +rtc rtmp samba +shm +schroedinger sdl +speex sse sse2 ssse3
tga +theora +tremor +truetype +toolame +twolame +unicode v4l v4l2 vaapi vdpau vidix
+vorbis vpx win32codecs +X +x264 xanim xinerama +xscreensaver +xv +xvid xvmc
zoran"
[[ ${PV} == *9999* ]] && IUSE+=" external-ffmpeg"
VIDEO_CARDS="s3virge mga tdfx vesa"
for x in ${VIDEO_CARDS}; do
IUSE+=" video_cards_${x}"
done
FONT_URI="
mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2
mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2
"
if [[ ${PV} == *9999* ]]; then
RELEASE_URI=""
else
RELEASE_URI="mirror://gentoo/${P}.tar.xz"
fi
SRC_URI="${RELEASE_URI}
!truetype? ( ${FONT_URI} )"
DESCRIPTION="Media Player for Linux"
HOMEPAGE="http://www.mplayerhq.hu/"
FONT_RDEPS="
virtual/ttf-fonts
media-libs/fontconfig
>=media-libs/freetype-2.2.1:2
"
X_RDEPS="
x11-libs/libXext
x11-libs/libXxf86vm
"
[[ ${PV} == *9999* ]] && RDEPEND+=" external-ffmpeg? ( media-video/ffmpeg )"
# Rar: althrought -gpl version is nice, it cant do most functions normal rars can
# nemesi? ( net-libs/libnemesi )
RDEPEND+="
sys-libs/ncurses
app-arch/bzip2
sys-libs/zlib
!bindist? (
x86? (
win32codecs? ( media-libs/win32codecs )
)
)
X? (
${X_RDEPS}
dga? ( x11-libs/libXxf86dga )
ggi? (
media-libs/libggi
media-libs/libggiwmh
)
opengl? ( virtual/opengl )
vdpau? ( || ( x11-libs/libvdpau >=x11-drivers/nvidia-drivers-180.51 ) )
xinerama? ( x11-libs/libXinerama )
xscreensaver? ( x11-libs/libXScrnSaver )
xv? (
x11-libs/libXv
xvmc? ( x11-libs/libXvMC )
)
)
a52? ( media-libs/a52dec )
aalib? ( media-libs/aalib )
alsa? ( media-libs/alsa-lib )
amr? ( !bindist? ( media-libs/opencore-amr ) )
ass? ( ${FONT_RDEPS} >=media-libs/libass-0.9.10[enca?] )
bidi? ( dev-libs/fribidi )
bluray? ( media-libs/libbluray )
bs2b? ( media-libs/libbs2b )
cdio? ( dev-libs/libcdio )
cdparanoia? ( !cdio? ( media-sound/cdparanoia ) )
dirac? ( media-video/dirac )
directfb? ( dev-libs/DirectFB )
dts? ( media-libs/libdca )
dv? ( media-libs/libdv )
dvb? ( media-tv/linuxtv-dvb-headers )
dvd? (
>=media-libs/libdvdread-4.1.3
dvdnav? ( >=media-libs/libdvdnav-4.1.3 )
)
encode? (
!twolame? ( toolame? ( media-sound/toolame ) )
twolame? ( media-sound/twolame )
faac? ( !bindist? ( media-libs/faac ) )
mp3? ( media-sound/lame )
x264? ( >=media-libs/x264-0.0.20100423 )
xvid? ( media-libs/xvid )
)
esd? ( media-sound/esound )
enca? ( app-i18n/enca )
faad? ( media-libs/faad2 )
gif? ( media-libs/giflib )
gsm? ( media-sound/gsm )
iconv? ( virtual/libiconv )
jack? ( media-sound/jack-audio-connection-kit )
jpeg? ( virtual/jpeg )
jpeg2k? ( media-libs/openjpeg )
ladspa? ( media-libs/ladspa-sdk )
libcaca? ( media-libs/libcaca )
libmpeg2? ( media-libs/libmpeg2 )
lirc? ( app-misc/lirc )
live? ( media-plugins/live )
lzo? ( >=dev-libs/lzo-2 )
mad? ( media-libs/libmad )
mng? ( media-libs/libmng )
mpg123? ( media-sound/mpg123 )
nas? ( media-libs/nas )
nut? ( >=media-libs/libnut-661 )
openal? ( media-libs/openal )
png? ( media-libs/libpng )
pnm? ( media-libs/netpbm )
pulseaudio? ( media-sound/pulseaudio )
rar? (
|| (
app-arch/unrar
app-arch/rar
)
)
rtmp? ( media-video/rtmpdump )
samba? ( net-fs/samba )
schroedinger? ( media-libs/schroedinger )
sdl? ( media-libs/libsdl )
speex? ( media-libs/speex )
theora? ( media-libs/libtheora[encode?] )
truetype? ( ${FONT_RDEPS} )
vaapi? ( x11-libs/libva )
vorbis? ( media-libs/libvorbis )
vpx? ( media-libs/libvpx )
xanim? ( media-video/xanim )
"
X_DEPS="
x11-proto/videoproto
x11-proto/xf86vidmodeproto
"
ASM_DEP="dev-lang/yasm"
DEPEND="${RDEPEND}
dev-util/pkgconfig
X? (
${X_DEPS}
dga? ( x11-proto/xf86dgaproto )
dxr3? ( media-video/em8300-libraries )
xinerama? ( x11-proto/xineramaproto )
xscreensaver? ( x11-proto/scrnsaverproto )
)
amd64? ( ${ASM_DEP} )
doc? (
dev-libs/libxslt app-text/docbook-xml-dtd
app-text/docbook-xsl-stylesheets
)
x86? ( ${ASM_DEP} )
x86-fbsd? ( ${ASM_DEP} )
"
SLOT="0"
LICENSE="GPL-2"
if [[ ${PV} != *9999* ]]; then
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
else
KEYWORDS=""
fi
PATCHES=( "${FILESDIR}"/vaapi-take2/*.patch )
pkg_setup() {
if [[ ${PV} == *9999* ]]; then
elog
elog "This is a live ebuild which installs the latest from upstream's"
elog "subversion repository, and is unsupported by Gentoo."
elog "Everything but bugs in the ebuild itself will be ignored."
elog
fi
if use cpudetection; then
ewarn
ewarn "You've enabled the cpudetection flag. This feature is"
ewarn "included mainly for people who want to use the same"
ewarn "binary on another system with a different CPU architecture."
ewarn "MPlayer will already detect your CPU settings by default at"
ewarn "buildtime; this flag is used for runtime detection."
ewarn "You won't need this turned on if you are only building"
ewarn "mplayer for this system. Also, if your compile fails, try"
ewarn "disabling this use flag."
fi
if use custom-cpuopts; then
ewarn
ewarn "You are using the custom-cpuopts flag which will"
ewarn "specifically allow you to enable / disable certain"
ewarn "CPU optimizations."
ewarn
ewarn "Most desktop users won't need this functionality, but it"
ewarn "is included for corner cases like cross-compiling and"
ewarn "certain profiles. If unsure, disable this flag and MPlayer"
ewarn "will automatically detect and use your available CPU"
ewarn "optimizations."
ewarn
ewarn "Using this flag means your build is unsupported, so"
ewarn "please make sure your CPU optimization use flags (3dnow"
ewarn "3dnowext mmx mmxext sse sse2 ssse3) are properly set."
fi
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
subversion_src_unpack
cd "${WORKDIR}"
else
unpack ${A}
fi
if ! use truetype; then
unpack font-arial-iso-8859-1.tar.bz2 \
font-arial-iso-8859-2.tar.bz2 \
font-arial-cp1250.tar.bz2
fi
}
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# Set SVN version manually
subversion_wc_info
sed -i -e "s/UNKNOWN/${ESVN_WC_REVISION}/" "${S}/version.sh" || die
else
# Set version #
sed -i -e "s/UNKNOWN/${MPLAYER_REVISION}/" "${S}/version.sh" || die
fi
# fix path to bash executable in configure scripts
sed -i -e "1c\#!${EPREFIX}/bin/bash" configure version.sh || die
base_src_prepare
}
src_configure() {
local myconf=""
local uses i
# set LINGUAS
[[ -n $LINGUAS ]] && LINGUAS="${LINGUAS/da/dk}"
# mplayer ebuild uses "use foo || --disable-foo" to forcibly disable
# compilation in almost every situation. The reason for this is
# because if --enable is used, it will force the build of that option,
# regardless of whether the dependency is available or not.
###################
#Optional features#
###################
# disable svga since we don't want it
# disable arts since we don't have kde3
# always disable internal ass
myconf+="
--disable-svga --disable-svgalib_helper
--disable-ass-internal
--disable-arts
--disable-kai
$(use_enable network networking)
$(use_enable joystick)
"
uses="ass bl bluray enca ftp rtc" # nemesi <- not working with in-tree ebuild
myconf+=" --disable-nemesi" # nemesi automagic disable
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use bidi || myconf+=" --disable-fribidi"
use ipv6 || myconf+=" --disable-inet6"
use nut || myconf+=" --disable-libnut"
use rar || myconf+=" --disable-unrarexec"
use samba || myconf+=" --disable-smb"
if ! use lirc; then
myconf+="
--disable-lirc
--disable-lircc
--disable-apple-ir
"
fi
# libcdio support: prefer libcdio over cdparanoia
# don't check for cddb w/cdio
if use cdio; then
myconf+=" --disable-cdparanoia"
else
myconf+=" --disable-libcdio"
use cdparanoia || myconf+=" --disable-cdparanoia"
use cddb || myconf+=" --disable-cddb"
fi
################################
# DVD read, navigation support #
################################
#
# dvdread - accessing a DVD
# dvdnav - navigation of menus
#
# use external libdvdcss, dvdread and dvdnav
myconf+=" --disable-dvdread-internal --disable-libdvdcss-internal"
if use dvd; then
use dvdnav || myconf+=" --disable-dvdnav"
else
myconf+="
--disable-dvdnav
--disable-dvdread
"
fi
#############
# Subtitles #
#############
#
# SRT/ASS/SSA (subtitles) requires freetype support
# freetype support requires iconv
# iconv optionally can use unicode
if ! use ass && ! use truetype; then
myconf+=" --disable-freetype"
if ! use iconv; then
myconf+="
--disable-iconv
--charset=noconv
"
fi
fi
use iconv && use unicode && myconf+=" --charset=UTF-8"
#####################################
# DVB / Video4Linux / Radio support #
#####################################
myconf+=" --disable-tv-bsdbt848"
# broken upstream, won't work with recent kernels
myconf+=" --disable-ivtv"
if { use dvb || use v4l || use v4l2 || use pvr || use radio; }; then
use dvb || myconf+=" --disable-dvb"
use pvr || myconf+=" --disable-pvr"
use v4l || myconf+=" --disable-tv-v4l1"
use v4l2 || myconf+=" --disable-tv-v4l2"
if use radio && { use dvb || use v4l || use v4l2; }; then
myconf+="
--enable-radio
$(use_enable encode radio-capture)
"
else
myconf+="
--disable-radio-v4l2
--disable-radio-bsdbt848
"
fi
else
myconf+="
--disable-tv
--disable-tv-v4l1
--disable-tv-v4l2
--disable-radio
--disable-radio-v4l2
--disable-radio-bsdbt848
--disable-dvb
--disable-v4l2
--disable-pvr"
fi
##########
# Codecs #
##########
myconf+=" --disable-musepack" # Use internal musepack codecs for SV7 and SV8 support
myconf+=" --disable-faad-internal" # always use system media-libs/faad2
myconf+=" --disable-libmpeg2-internal" # always use system media-libs/libmpeg2
use dirac || myconf+=" --disable-libdirac-lavc"
use dts || myconf+=" --disable-libdca"
if ! use mp3; then
myconf+="
--disable-mp3lame
--disable-mp3lame-lavc
--disable-mp3lib
"
fi
uses="a52 bs2b dv gsm lzo rtmp"
for i in ${uses}; do
use ${i} || myconf+=" --disable-lib${i}"
done
use schroedinger || myconf+=" --disable-libschroedinger-lavc"
# Disable opencore-amr with bindist
# https://bugs.gentoo.org/show_bug.cgi?id=299405#c6
{ use amr && use !bindist ; } || myconf+=" --disable-libopencore_amrnb --disable-libopencore_amrwb"
uses="faad gif jpeg libmpeg2 live mad mng mpg123 png pnm speex tga theora xanim"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use jpeg2k || myconf+=" --disable-libopenjpeg"
if use vorbis || use tremor; then
use tremor || myconf+=" --disable-tremor-internal"
use vorbis || myconf+=" --disable-libvorbis"
else
myconf+="
--disable-tremor-internal
--disable-tremor
--disable-libvorbis
"
fi
use vaapi && myconf+=" --enable-vaapi"
use vpx || myconf+=" --disable-libvpx-lavc"
# Encoding
uses="faac x264 xvid toolame twolame"
if use encode; then
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use faac || myconf+=" --disable-faac-lavc"
if use bindist && use faac; then
ewarn "faac is nonfree and cannot be distributed; disabling faac support."
myconf+=" --disable-faac --disable-faac-lavc"
fi
else
myconf+=" --disable-mencoder"
myconf+=" --disable-faac-lavc"
for i in ${uses}; do
myconf+=" --disable-${i}"
use ${i} && elog "Useflag \"${i}\" require \"encode\" useflag enabled to work."
done
fi
#################
# Binary codecs #
#################
# bug 213836
if ! use x86 || ! use win32codecs; then
use quicktime || myconf+=" --disable-qtx"
fi
######################
# RealPlayer support #
######################
# Realplayer support shows up in four places:
# - libavcodec (internal)
# - win32codecs
# - realcodecs (win32codecs libs)
# - realcodecs (realplayer libs)
# internal
use real || myconf+=" --disable-real"
# Real binary codec support only available on x86, amd64
if use real; then
use x86 && myconf+=" --codecsdir=/opt/RealPlayer/codecs"
use amd64 && myconf+=" --codecsdir=/usr/$(get_libdir)/codecs"
elif ! use bindist; then
myconf+=" $(use_enable win32codecs win32dll)"
fi
################
# Video Output #
################
uses="directfb md5sum sdl"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use aalib || myconf+=" --disable-aa"
use fbcon || myconf+=" --disable-fbdev"
use fbcon && use video_cards_s3virge && myconf+=" --enable-s3fb"
use libcaca || myconf+=" --disable-caca"
use zoran || myconf+=" --disable-zr"
if ! use kernel_linux || ! use video_cards_mga; then
myconf+=" --disable-mga --disable-xmga"
fi
if use video_cards_tdfx; then
myconf+="
$(use_enable video_cards_tdfx tdfxvid)
$(use_enable fbcon tdfxfb)
"
else
myconf+="
--disable-3dfx
--disable-tdfxvid
--disable-tdfxfb
"
fi
# sun card, disable by default, see bug #258729
myconf+=" --disable-xvr100"
################
# Audio Output #
################
uses="alsa esd jack ladspa nas openal"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use pulseaudio || myconf+=" --disable-pulse"
if ! use radio; then
use oss || myconf+=" --disable-ossaudio"
fi
####################
# Advanced Options #
####################
# Platform specific flags, hardcoded on amd64 (see below)
if use cpudetection; then
myconf+=" --enable-runtime-cpudetection"
fi
# Turning off CPU optimizations usually will break the build.
# However, this use flag, if enabled, will allow users to completely
# specify which ones to use. If disabled, mplayer will automatically
# enable all CPU optimizations that the host build supports.
if use custom-cpuopts; then
uses="3dnow 3dnowext altivec mmx mmxext shm sse sse2 ssse3"
for i in ${uses}; do
myconf+=" $(use_enable ${i})"
done
fi
use debug && myconf+=" --enable-debug=3"
if use x86 && gcc-specs-pie; then
filter-flags -fPIC -fPIE
append-ldflags -nopie
fi
is-flag -O? || append-flags -O2
if use x86 || use x86-fbsd; then
use debug || append-flags -fomit-frame-pointer
fi
# workaround bug, x86 just has too few registers, see c.f.
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=402950#44
# and 32b osx, bug 329861
[[ ${CHOST} == i?86-*solaris* || ${CHOST} == i?86-*darwin* ]] && append-flags -fomit-frame-pointer
###########################
# X enabled configuration #
###########################
myconf+=" --disable-gui"
if use X; then
uses="dxr3 ggi xinerama"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use dga || myconf+=" --disable-dga1 --disable-dga2"
use opengl || myconf+=" --disable-gl"
use osdmenu && myconf+=" --enable-menu"
use vdpau || myconf+=" --disable-vdpau"
use video_cards_vesa || myconf+=" --disable-vesa"
use vidix || myconf+=" --disable-vidix --disable-vidix-pcidb"
use xscreensaver || myconf+=" --disable-xss"
if use xv; then
if use xvmc; then
myconf+=" --enable-xvmc --with-xvmclib=XvMCW"
else
myconf+=" --disable-xvmc"
fi
else
myconf+="
--disable-xv
--disable-xvmc
"
use xvmc && elog "Disabling xvmc because it requires \"xv\" useflag enabled."
fi
else
myconf+="
--disable-dga1
--disable-dga2
--disable-dxr3
--disable-ggi
--disable-gl
--disable-vdpau
--disable-vidix
--disable-vidix-pcidb
--disable-xinerama
--disable-xss
--disable-xv
--disable-xvmc
--disable-x11
"
uses="dga dxr3 ggi opengl osdmenu vdpau vidix xinerama xscreensaver xv"
for i in ${uses}; do
use ${i} && elog "Useflag \"${i}\" require \"X\" useflag enabled to work."
done
fi
############################
# OSX (aqua) configuration #
############################
if use aqua; then
myconf+="
--enable-macosx-finder
--enable-macosx-bundle
"
fi
###################
# External FFmpeg #
###################
if [[ ${PV} == *9999* ]]; then
use external-ffmpeg && myconf+=" --disable-ffmpeg_a"
fi
myconf="--cc=$(tc-getCC)
--host-cc=$(tc-getBUILD_CC)
--prefix=${EPREFIX}/usr
--confdir=${EPREFIX}/etc/mplayer
--datadir=${EPREFIX}/usr/share/mplayer
--libdir=${EPREFIX}/usr/$(get_libdir)
${myconf}"
CFLAGS="${CFLAGS}" ./configure ${myconf} || die "configure died"
}
src_compile() {
base_src_compile
# Build only user-requested docs if they're available.
if use doc ; then
# select available languages from $LINGUAS
LINGUAS=${LINGUAS/zh/zh_CN}
local ALLOWED_LINGUAS="cs de en es fr hu it pl ru zh_CN"
local BUILT_DOCS=""
for i in ${LINGUAS} ; do
hasq ${i} ${ALLOWED_LINGUAS} && BUILT_DOCS+=" ${i}"
done
if [[ -z $BUILT_DOCS ]]; then
emake -j1 -C DOCS/xml html-chunked || die "Failed to generate html docs"
else
for i in ${BUILT_DOCS}; do
emake -j1 -C DOCS/xml html-chunked-${i} || die "Failed to generate html docs for ${i}"
done
fi
fi
}
src_install() {
local i
emake prefix="${ED}/usr" \
BINDIR="${ED}/usr/bin" \
LIBDIR="${ED}/usr/$(get_libdir)" \
CONFDIR="${ED}/etc/mplayer" \
DATADIR="${ED}/usr/share/mplayer" \
MANDIR="${ED}/usr/share/man" \
INSTALLSTRIP="" \
install || die "emake install failed"
dodoc AUTHORS Changelog Copyright README etc/codecs.conf || die
docinto tech/
dodoc DOCS/tech/{*.txt,MAINTAINERS,mpsub.sub,playtree,TODO,wishlist} || die
docinto TOOLS/
dodoc TOOLS/* || die
if use real; then
docinto tech/realcodecs/
dodoc DOCS/tech/realcodecs/* || die
docinto TOOLS/realcodecs/
dodoc TOOLS/realcodecs/* || die
fi
docinto tech/mirrors/
dodoc DOCS/tech/mirrors/* || die
if use doc; then
docinto html/
dohtml -r "${S}"/DOCS/HTML/* || die
fi
if ! use ass && ! use truetype; then
dodir /usr/share/mplayer/fonts
# Do this generic, as the mplayer people like to change the structure
# of their zips ...
for i in $(find "${WORKDIR}/" -type d -name 'font-arial-*'); do
cp -pPR "${i}" "${ED}/usr/share/mplayer/fonts"
done
# Fix the font symlink ...
rm -rf "${ED}/usr/share/mplayer/font"
dosym fonts/font-arial-14-iso-8859-1 /usr/share/mplayer/font
fi
insinto /etc/mplayer
newins "${S}/etc/example.conf" mplayer.conf || die
doins "${S}/etc/input.conf" || die
if use osdmenu; then
doins "${S}/etc/menu.conf" || die
fi
if use ass || use truetype; then
cat >> "${ED}/etc/mplayer/mplayer.conf" << _EOF_
fontconfig=1
subfont-osd-scale=4
subfont-text-scale=3
_EOF_
fi
# bug 256203
if use rar; then
cat >> "${ED}/etc/mplayer/mplayer.conf" << _EOF_
unrarexec=${EPREFIX}/usr/bin/unrar
_EOF_
fi
dosym ../../../etc/mplayer/mplayer.conf /usr/share/mplayer/mplayer.conf
newbin "${S}/TOOLS/midentify.sh" midentify || die
}
pkg_preinst() {
[[ -d ${EROOT}/usr/share/mplayer/Skin/default ]] && \
rm -rf "${EROOT}/usr/share/mplayer/Skin/default"
}
pkg_postrm() {
# Cleanup stale symlinks
[ -L "${EROOT}/usr/share/mplayer/font" -a \
! -e "${EROOT}/usr/share/mplayer/font" ] && \
rm -f "${EROOT}/usr/share/mplayer/font"
[ -L "${EROOT}/usr/share/mplayer/subfont.ttf" -a \
! -e "${EROOT}/usr/share/mplayer/subfont.ttf" ] && \
rm -f "${EROOT}/usr/share/mplayer/subfont.ttf"
}

@ -0,0 +1,752 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/mplayer/mplayer-1.0_rc4_p20110322.ebuild,v 1.2 2011/03/22 23:58:03 scarabeus Exp $
EAPI=4
EGIT_REPO_URI="git://git.libav.org/libav.git"
EGIT_PROJECT="ffmpeg"
ESVN_REPO_URI="svn://svn.mplayerhq.hu/mplayer/trunk"
[[ ${PV} = *9999* ]] && SVN_ECLASS="subversion git" || SVN_ECLASS=""
inherit toolchain-funcs eutils flag-o-matic multilib base ${SVN_ECLASS}
# BUMP ME PLZ, NO COOKIES OTHERWISE
[[ ${PV} != *9999* ]] && MPLAYER_REVISION=SVN-r33094
IUSE="3dnow 3dnowext +a52 aalib +alsa altivec aqua +ass bidi bindist bl bluray
bs2b cddb +cdio cdparanoia cpudetection custom-cpuopts debug dga +dirac
directfb doc +dts +dv dvb +dvd +dvdnav dxr3 +enca +encode esd +faac +faad fbcon
ftp gif ggi gsm +iconv ipv6 jack joystick jpeg jpeg2k kernel_linux ladspa
libcaca libmpeg2 lirc +live lzo mad md5sum +mmx mmxext mng +mp3 mpg123 nas
+network nut openal amr +opengl +osdmenu oss png pnm pulseaudio pvr +quicktime
radio +rar +real +rtc rtmp samba +shm +schroedinger sdl +speex sse sse2 ssse3
tga +theora +tremor +truetype +toolame +twolame +unicode v4l v4l2 vaapi vdpau
vidix +vorbis vpx win32codecs +X +x264 xanim xinerama +xscreensaver +xv +xvid
xvmc zoran"
[[ ${PV} == *9999* ]] && IUSE+=" external-ffmpeg"
VIDEO_CARDS="s3virge mga tdfx vesa"
for x in ${VIDEO_CARDS}; do
IUSE+=" video_cards_${x}"
done
FONT_URI="
mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2
mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2
"
if [[ ${PV} == *9999* ]]; then
RELEASE_URI=""
else
RELEASE_URI="http://dev.gentoo.org/~scarabeus/${P}.tar.xz
mirror://gentoo/${P}.tar.xz"
fi
SRC_URI="${RELEASE_URI}
!truetype? ( ${FONT_URI} )"
DESCRIPTION="Media Player for Linux"
HOMEPAGE="http://www.mplayerhq.hu/"
FONT_RDEPS="
virtual/ttf-fonts
media-libs/fontconfig
>=media-libs/freetype-2.2.1:2
"
X_RDEPS="
x11-libs/libXext
x11-libs/libXxf86vm
"
[[ ${PV} == *9999* ]] && RDEPEND+=" external-ffmpeg? ( media-video/ffmpeg )"
# Rar: althrought -gpl version is nice, it cant do most functions normal rars can
# nemesi? ( net-libs/libnemesi )
RDEPEND+="
sys-libs/ncurses
app-arch/bzip2
sys-libs/zlib
!bindist? (
x86? (
win32codecs? ( media-libs/win32codecs )
)
)
X? (
${X_RDEPS}
dga? ( x11-libs/libXxf86dga )
ggi? (
media-libs/libggi
media-libs/libggiwmh
)
opengl? ( virtual/opengl )
vdpau? ( x11-libs/libvdpau )
xinerama? ( x11-libs/libXinerama )
xscreensaver? ( x11-libs/libXScrnSaver )
xv? (
x11-libs/libXv
xvmc? ( x11-libs/libXvMC )
)
)
a52? ( media-libs/a52dec )
aalib? ( media-libs/aalib )
alsa? ( media-libs/alsa-lib )
amr? ( !bindist? ( media-libs/opencore-amr ) )
ass? ( ${FONT_RDEPS} >=media-libs/libass-0.9.10[enca?] )
bidi? ( dev-libs/fribidi )
bluray? ( media-libs/libbluray )
bs2b? ( media-libs/libbs2b )
cdio? ( dev-libs/libcdio )
cdparanoia? ( !cdio? ( media-sound/cdparanoia ) )
dirac? ( media-video/dirac )
directfb? ( dev-libs/DirectFB )
dts? ( media-libs/libdca )
dv? ( media-libs/libdv )
dvb? ( media-tv/linuxtv-dvb-headers )
dvd? (
>=media-libs/libdvdread-4.1.3
dvdnav? ( >=media-libs/libdvdnav-4.1.3 )
)
encode? (
!twolame? ( toolame? ( media-sound/toolame ) )
twolame? ( media-sound/twolame )
faac? ( !bindist? ( media-libs/faac ) )
mp3? ( media-sound/lame )
x264? ( >=media-libs/x264-0.0.20100423 )
xvid? ( media-libs/xvid )
)
esd? ( media-sound/esound )
enca? ( app-i18n/enca )
faad? ( media-libs/faad2 )
gif? ( media-libs/giflib )
gsm? ( media-sound/gsm )
iconv? ( virtual/libiconv )
jack? ( media-sound/jack-audio-connection-kit )
jpeg? ( virtual/jpeg )
jpeg2k? ( media-libs/openjpeg )
ladspa? ( media-libs/ladspa-sdk )
libcaca? ( media-libs/libcaca )
libmpeg2? ( media-libs/libmpeg2 )
lirc? ( app-misc/lirc )
live? ( media-plugins/live )
lzo? ( >=dev-libs/lzo-2 )
mad? ( media-libs/libmad )
mng? ( media-libs/libmng )
mpg123? ( media-sound/mpg123 )
nas? ( media-libs/nas )
nut? ( >=media-libs/libnut-661 )
openal? ( media-libs/openal )
png? ( media-libs/libpng )
pnm? ( media-libs/netpbm )
pulseaudio? ( media-sound/pulseaudio )
rar? (
|| (
app-arch/unrar
app-arch/rar
)
)
rtmp? ( media-video/rtmpdump )
samba? ( net-fs/samba )
schroedinger? ( media-libs/schroedinger )
sdl? ( media-libs/libsdl )
speex? ( media-libs/speex )
theora? ( media-libs/libtheora[encode?] )
truetype? ( ${FONT_RDEPS} )
vorbis? ( media-libs/libvorbis )
vpx? ( media-libs/libvpx )
xanim? ( media-video/xanim )
"
X_DEPS="
x11-proto/videoproto
x11-proto/xf86vidmodeproto
"
ASM_DEP="dev-lang/yasm"
DEPEND="${RDEPEND}
dev-util/pkgconfig
X? (
${X_DEPS}
dga? ( x11-proto/xf86dgaproto )
dxr3? ( media-video/em8300-libraries )
xinerama? ( x11-proto/xineramaproto )
xscreensaver? ( x11-proto/scrnsaverproto )
)
amd64? ( ${ASM_DEP} )
doc? (
dev-libs/libxslt app-text/docbook-xml-dtd
app-text/docbook-xsl-stylesheets
)
x86? ( ${ASM_DEP} )
x86-fbsd? ( ${ASM_DEP} )
"
SLOT="0"
LICENSE="GPL-2"
if [[ ${PV} != *9999* ]]; then
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
else
KEYWORDS=""
fi
# bindist does not cope with amr codecs (#299405#c6), faac codecs are nonfree, win32codecs are nonfree
# libcdio support: prefer libcdio over cdparanoia and don't check for cddb w/cdio
# dvd navigation requires dvd read support
# ass and freetype font require iconv and ass requires freetype fonts
# unicode transformations are usefull only with iconv
# libvorbis require external tremor to work
# radio requires oss or alsa backend
# xvmc requires xvideo support
REQUIRED_USE="bindist? ( !amr !faac !win32codecs )"
if use vaapi; then
PATCHES=( "${FILESDIR}"/vaapi-take3/*.patch )
else
PATCHES=(
)
fi
pkg_setup() {
if [[ ${PV} == *9999* ]]; then
elog
elog "This is a live ebuild which installs the latest from upstream's"
elog "subversion repository, and is unsupported by Gentoo."
elog "Everything but bugs in the ebuild itself will be ignored."
elog
fi
if use cpudetection; then
ewarn
ewarn "You've enabled the cpudetection flag. This feature is"
ewarn "included mainly for people who want to use the same"
ewarn "binary on another system with a different CPU architecture."
ewarn "MPlayer will already detect your CPU settings by default at"
ewarn "buildtime; this flag is used for runtime detection."
ewarn "You won't need this turned on if you are only building"
ewarn "mplayer for this system. Also, if your compile fails, try"
ewarn "disabling this use flag."
fi
if use custom-cpuopts; then
ewarn
ewarn "You are using the custom-cpuopts flag which will"
ewarn "specifically allow you to enable / disable certain"
ewarn "CPU optimizations."
ewarn
ewarn "Most desktop users won't need this functionality, but it"
ewarn "is included for corner cases like cross-compiling and"
ewarn "certain profiles. If unsure, disable this flag and MPlayer"
ewarn "will automatically detect and use your available CPU"
ewarn "optimizations."
ewarn
ewarn "Using this flag means your build is unsupported, so"
ewarn "please make sure your CPU optimization use flags (3dnow"
ewarn "3dnowext mmx mmxext sse sse2 ssse3) are properly set."
fi
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
subversion_src_unpack
cd "${WORKDIR}"
rm -rf "${WORKDIR}/${P}/ffmpeg/"
( S="${WORKDIR}/${P}/ffmpeg/" git_src_unpack )
else
unpack ${A}
fi
if ! use truetype; then
unpack font-arial-iso-8859-1.tar.bz2 \
font-arial-iso-8859-2.tar.bz2 \
font-arial-cp1250.tar.bz2
fi
}
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# Set SVN version manually
subversion_wc_info
sed -i -e "s/UNKNOWN/${ESVN_WC_REVISION}/" "${S}/version.sh" || die
else
# Set version #
sed -i -e "s/UNKNOWN/${MPLAYER_REVISION}/" "${S}/version.sh" || die
fi
# fix path to bash executable in configure scripts
sed -i -e "1c\#!${EPREFIX}/bin/bash" configure version.sh || die
base_src_prepare
}
src_configure() {
local myconf=""
local uses i
# set LINGUAS
[[ -n $LINGUAS ]] && LINGUAS="${LINGUAS/da/dk}"
# mplayer ebuild uses "use foo || --disable-foo" to forcibly disable
# compilation in almost every situation. The reason for this is
# because if --enable is used, it will force the build of that option,
# regardless of whether the dependency is available or not.
###################
#Optional features#
###################
# disable svga since we don't want it
# disable arts since we don't have kde3
# always disable internal ass
myconf+="
--disable-svga --disable-svgalib_helper
--disable-ass-internal
--disable-arts
--disable-kai
$(use_enable network networking)
$(use_enable joystick)
"
uses="ass bl bluray enca ftp rtc" # nemesi <- not working with in-tree ebuild
myconf+=" --disable-nemesi" # nemesi automagic disable
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use bidi || myconf+=" --disable-fribidi"
use ipv6 || myconf+=" --disable-inet6"
use nut || myconf+=" --disable-libnut"
use rar || myconf+=" --disable-unrarexec"
use samba || myconf+=" --disable-smb"
if ! use lirc; then
myconf+="
--disable-lirc
--disable-lircc
--disable-apple-ir
"
fi
# libcdio support: prefer libcdio over cdparanoia
# don't check for cddb w/cdio
if use cdio; then
myconf+=" --disable-cdparanoia"
else
myconf+=" --disable-libcdio"
use cdparanoia || myconf+=" --disable-cdparanoia"
use cddb || myconf+=" --disable-cddb"
fi
################################
# DVD read, navigation support #
################################
#
# dvdread - accessing a DVD
# dvdnav - navigation of menus
#
# use external libdvdcss, dvdread and dvdnav
myconf+=" --disable-dvdread-internal --disable-libdvdcss-internal"
if use dvd; then
use dvdnav || myconf+=" --disable-dvdnav"
else
myconf+="
--disable-dvdnav
--disable-dvdread
"
fi
#############
# Subtitles #
#############
#
# SRT/ASS/SSA (subtitles) requires freetype support
# freetype support requires iconv
# iconv optionally can use unicode
if ! use ass && ! use truetype; then
myconf+=" --disable-freetype"
if ! use iconv; then
myconf+="
--disable-iconv
--charset=noconv
"
fi
fi
use iconv && use unicode && myconf+=" --charset=UTF-8"
#####################################
# DVB / Video4Linux / Radio support #
#####################################
myconf+=" --disable-tv-bsdbt848"
# broken upstream, won't work with recent kernels
myconf+=" --disable-ivtv"
if { use dvb || use v4l || use v4l2 || use pvr || use radio; }; then
use dvb || myconf+=" --disable-dvb"
use pvr || myconf+=" --disable-pvr"
use v4l || myconf+=" --disable-tv-v4l1"
use v4l2 || myconf+=" --disable-tv-v4l2"
if use radio && { use dvb || use v4l || use v4l2; }; then
myconf+="
--enable-radio
$(use_enable encode radio-capture)
"
else
myconf+="
--disable-radio-v4l2
--disable-radio-bsdbt848
"
fi
else
myconf+="
--disable-tv
--disable-tv-v4l1
--disable-tv-v4l2
--disable-radio
--disable-radio-v4l2
--disable-radio-bsdbt848
--disable-dvb
--disable-v4l2
--disable-pvr"
fi
##########
# Codecs #
##########
myconf+=" --disable-musepack" # Use internal musepack codecs for SV7 and SV8 support
myconf+=" --disable-libmpeg2-internal" # always use system media-libs/libmpeg2
use dirac || myconf+=" --disable-libdirac-lavc"
use dts || myconf+=" --disable-libdca"
if ! use mp3; then
myconf+="
--disable-mp3lame
--disable-mp3lame-lavc
--disable-mp3lib
"
fi
uses="a52 bs2b dv gsm lzo rtmp"
for i in ${uses}; do
use ${i} || myconf+=" --disable-lib${i}"
done
use schroedinger || myconf+=" --disable-libschroedinger-lavc"
use amr || myconf+=" --disable-libopencore_amrnb --disable-libopencore_amrwb"
uses="faad gif jpeg libmpeg2 live mad mng mpg123 png pnm speex tga theora xanim"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use jpeg2k || myconf+=" --disable-libopenjpeg"
if use vorbis || use tremor; then
use tremor || myconf+=" --disable-tremor-internal"
use vorbis || myconf+=" --disable-libvorbis"
else
myconf+="
--disable-tremor-internal
--disable-tremor
--disable-libvorbis
"
fi
use vaapi && myconf+=" --enable-vaapi"
use vpx || myconf+=" --disable-libvpx-lavc"
# Encoding
uses="faac x264 xvid toolame twolame"
if use encode; then
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use faac || myconf+=" --disable-faac-lavc"
if use bindist && use faac; then
ewarn "faac is nonfree and cannot be distributed; disabling faac support."
myconf+=" --disable-faac --disable-faac-lavc"
fi
else
myconf+=" --disable-mencoder"
myconf+=" --disable-faac-lavc"
for i in ${uses}; do
myconf+=" --disable-${i}"
use ${i} && elog "Useflag \"${i}\" require \"encode\" useflag enabled to work."
done
fi
#################
# Binary codecs #
#################
# bug 213836
if ! use x86 || ! use win32codecs; then
use quicktime || myconf+=" --disable-qtx"
fi
######################
# RealPlayer support #
######################
# Realplayer support shows up in four places:
# - libavcodec (internal)
# - win32codecs
# - realcodecs (win32codecs libs)
# - realcodecs (realplayer libs)
# internal
use real || myconf+=" --disable-real"
# Real binary codec support only available on x86, amd64
if use real; then
use x86 && myconf+=" --codecsdir=/opt/RealPlayer/codecs"
use amd64 && myconf+=" --codecsdir=/usr/$(get_libdir)/codecs"
fi
myconf+=" $(use_enable win32codecs win32dll)"
################
# Video Output #
################
uses="directfb md5sum sdl"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use aalib || myconf+=" --disable-aa"
use fbcon || myconf+=" --disable-fbdev"
use fbcon && use video_cards_s3virge && myconf+=" --enable-s3fb"
use libcaca || myconf+=" --disable-caca"
use zoran || myconf+=" --disable-zr"
if ! use kernel_linux || ! use video_cards_mga; then
myconf+=" --disable-mga --disable-xmga"
fi
if use video_cards_tdfx; then
myconf+="
$(use_enable video_cards_tdfx tdfxvid)
$(use_enable fbcon tdfxfb)
"
else
myconf+="
--disable-3dfx
--disable-tdfxvid
--disable-tdfxfb
"
fi
# sun card, disable by default, see bug #258729
myconf+=" --disable-xvr100"
################
# Audio Output #
################
uses="alsa esd jack ladspa nas openal"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use pulseaudio || myconf+=" --disable-pulse"
if ! use radio; then
use oss || myconf+=" --disable-ossaudio"
fi
####################
# Advanced Options #
####################
# Platform specific flags, hardcoded on amd64 (see below)
use cpudetection && myconf+=" --enable-runtime-cpudetection"
# Turning off CPU optimizations usually will break the build.
# However, this use flag, if enabled, will allow users to completely
# specify which ones to use. If disabled, mplayer will automatically
# enable all CPU optimizations that the host build supports.
if use custom-cpuopts; then
uses="3dnow 3dnowext altivec mmx mmxext shm sse sse2 ssse3"
for i in ${uses}; do
myconf+=" $(use_enable ${i})"
done
fi
use debug && myconf+=" --enable-debug=3"
if use x86 && gcc-specs-pie; then
filter-flags -fPIC -fPIE
append-ldflags -nopie
fi
is-flag -O? || append-flags -O2
# workaround bug, x86 just has too few registers, see c.f.
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=402950#44
# and 32-bits OSX, bug 329861
if [[ ${CHOST} == i?86-* ]] ; then
use debug || append-flags -fomit-frame-pointer
fi
###########################
# X enabled configuration #
###########################
myconf+=" --disable-gui"
if use X; then
uses="dxr3 ggi xinerama"
for i in ${uses}; do
use ${i} || myconf+=" --disable-${i}"
done
use dga || myconf+=" --disable-dga1 --disable-dga2"
use opengl || myconf+=" --disable-gl"
use osdmenu && myconf+=" --enable-menu"
use vdpau || myconf+=" --disable-vdpau"
use video_cards_vesa || myconf+=" --disable-vesa"
use vidix || myconf+=" --disable-vidix --disable-vidix-pcidb"
use xscreensaver || myconf+=" --disable-xss"
if use xv; then
if use xvmc; then
myconf+=" --enable-xvmc --with-xvmclib=XvMCW"
else
myconf+=" --disable-xvmc"
fi
else
myconf+="
--disable-xv
--disable-xvmc
"
use xvmc && elog "Disabling xvmc because it requires \"xv\" useflag enabled."
fi
else
myconf+="
--disable-dga1
--disable-dga2
--disable-dxr3
--disable-ggi
--disable-gl
--disable-vdpau
--disable-vidix
--disable-vidix-pcidb
--disable-xinerama
--disable-xss
--disable-xv
--disable-xvmc
--disable-x11
"
uses="dga dxr3 ggi opengl osdmenu vdpau vidix xinerama xscreensaver xv"
for i in ${uses}; do
use ${i} && elog "Useflag \"${i}\" require \"X\" useflag enabled to work."
done
fi
############################
# OSX (aqua) configuration #
############################
if use aqua; then
myconf+="
--enable-macosx-finder
--enable-macosx-bundle
"
fi
###################
# External FFmpeg #
###################
if [[ ${PV} == *9999* ]]; then
use external-ffmpeg && myconf+=" --disable-ffmpeg_a"
fi
myconf="--cc=$(tc-getCC)
--host-cc=$(tc-getBUILD_CC)
--prefix=${EPREFIX}/usr
--bindir=${EPREFIX}/usr/bin
--libdir=${EPREFIX}/usr/$(get_libdir)
--confdir=${EPREFIX}/etc/mplayer
--datadir=${EPREFIX}/usr/share/mplayer${namesuf}
--mandir=${EPREFIX}/usr/share/man
${myconf}"
CFLAGS="${CFLAGS}" ./configure ${myconf} || die
}
src_compile() {
base_src_compile
# Build only user-requested docs if they're available.
if use doc ; then
# select available languages from $LINGUAS
LINGUAS=${LINGUAS/zh/zh_CN}
local ALLOWED_LINGUAS="cs de en es fr hu it pl ru zh_CN"
local BUILT_DOCS=""
for i in ${LINGUAS} ; do
hasq ${i} ${ALLOWED_LINGUAS} && BUILT_DOCS+=" ${i}"
done
if [[ -z $BUILT_DOCS ]]; then
emake -j1 -C DOCS/xml html-chunked
else
for i in ${BUILT_DOCS}; do
emake -j1 -C DOCS/xml html-chunked-${i}
done
fi
fi
}
src_install() {
local i
emake \
DESTDIR="${D}" \
INSTALLSTRIP="" \
install
dodoc AUTHORS Changelog Copyright README etc/codecs.conf
docinto tech/
dodoc DOCS/tech/{*.txt,MAINTAINERS,mpsub.sub,playtree,TODO,wishlist}
docinto TOOLS/
dodoc -r TOOLS
if use real; then
docinto tech/realcodecs/
dodoc DOCS/tech/realcodecs/*
fi
docinto tech/mirrors/
dodoc DOCS/tech/mirrors/*
if use doc; then
docinto html/
dohtml -r "${S}"/DOCS/HTML/*
fi
if ! use ass && ! use truetype; then
dodir /usr/share/mplayer/fonts
# Do this generic, as the mplayer people like to change the structure
# of their zips ...
for i in $(find "${WORKDIR}/" -type d -name 'font-arial-*'); do
cp -pPR "${i}" "${ED}/usr/share/mplayer/fonts"
done
# Fix the font symlink ...
rm -rf "${ED}/usr/share/mplayer/font"
dosym fonts/font-arial-14-iso-8859-1 /usr/share/mplayer/font
fi
insinto /etc/mplayer
newins "${S}/etc/example.conf" mplayer.conf
cat >> "${ED}/etc/mplayer/mplayer.conf" << _EOF_
# Config options can be section specific, global
# options should go in the default section
[default]
_EOF_
doins "${S}/etc/input.conf"
if use osdmenu; then
doins "${S}/etc/menu.conf"
fi
if use ass || use truetype; then
cat >> "${ED}/etc/mplayer/mplayer.conf" << _EOF_
fontconfig=1
subfont-osd-scale=4
subfont-text-scale=3
_EOF_
fi
# bug 256203
if use rar; then
cat >> "${ED}/etc/mplayer/mplayer.conf" << _EOF_
unrarexec=${EPREFIX}/usr/bin/unrar
_EOF_
fi
dosym ../../../etc/mplayer/mplayer.conf /usr/share/mplayer/mplayer.conf
newbin "${S}/TOOLS/midentify.sh" midentify
}
pkg_preinst() {
[[ -d ${EROOT}/usr/share/mplayer/Skin/default ]] && \
rm -rf "${EROOT}/usr/share/mplayer/Skin/default"
}
pkg_postrm() {
# Cleanup stale symlinks
[ -L "${EROOT}/usr/share/mplayer/font" -a \
! -e "${EROOT}/usr/share/mplayer/font" ] && \
rm -f "${EROOT}/usr/share/mplayer/font"
[ -L "${EROOT}/usr/share/mplayer/subfont.ttf" -a \
! -e "${EROOT}/usr/share/mplayer/subfont.ttf" ] && \
rm -f "${EROOT}/usr/share/mplayer/subfont.ttf"
}
Loading…
Cancel
Save