summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/Makefile.am8
-rw-r--r--ext/cog/generate_tables.c1
-rw-r--r--ext/cog/gstcms.c1
-rw-r--r--ext/cog/gstcogdownsample.c1
-rw-r--r--ext/cog/gstcogorc-dist.c973
-rw-r--r--ext/cog/gstcogorc-dist.h6
-rw-r--r--ext/cog/gstcogutils.c1
-rw-r--r--ext/cog/gstcolorconvert.c2
-rw-r--r--ext/directfb/dfb-example.c3
-rw-r--r--ext/faac/gstfaac.c1
-rw-r--r--ext/jack/.gitignore1
-rw-r--r--ext/jack/Makefile.am12
-rw-r--r--ext/jack/README4
-rw-r--r--ext/jack/gstjack.c95
-rw-r--r--ext/jack/gstjack.h55
-rw-r--r--ext/jack/gstjackaudioclient.c525
-rw-r--r--ext/jack/gstjackaudioclient.h59
-rw-r--r--ext/jack/gstjackaudiosink.c852
-rw-r--r--ext/jack/gstjackaudiosink.h78
-rw-r--r--ext/jack/gstjackaudiosrc.c874
-rw-r--r--ext/jack/gstjackaudiosrc.h97
-rw-r--r--ext/jack/gstjackringbuffer.h88
-rw-r--r--ext/jack/gstjackutil.c114
-rw-r--r--ext/jack/gstjackutil.h30
-rw-r--r--ext/jp2k/gstjasperdec.c6
-rw-r--r--ext/jp2k/gstjasperenc.c2
-rw-r--r--ext/kate/Makefile.am2
-rw-r--r--ext/kate/gstkate.c5
-rw-r--r--ext/kate/gstkatedec.c111
-rw-r--r--ext/kate/gstkatedec.h4
-rw-r--r--ext/kate/gstkateparse.c5
-rw-r--r--ext/kate/gstkatespu.c8
-rw-r--r--ext/kate/gstkatetiger.c414
-rw-r--r--ext/kate/gstkatetiger.h10
-rw-r--r--ext/kate/gstkateutil.c208
-rw-r--r--ext/kate/gstkateutil.h30
-rw-r--r--ext/resindvd/resindvdsrc.c55
-rw-r--r--ext/resindvd/resindvdsrc.h1
-rw-r--r--ext/rsvg/gstrsvgdec.c12
-rw-r--r--ext/rsvg/gstrsvgoverlay.c198
-rw-r--r--ext/rsvg/gstrsvgoverlay.h13
-rw-r--r--ext/schroedinger/Makefile.am1
-rw-r--r--ext/schroedinger/gstschro.c3
-rw-r--r--ext/schroedinger/gstschroenc.c1
-rw-r--r--ext/schroedinger/gstschroparse.c585
-rw-r--r--ext/schroedinger/gstschroutils.c1
-rw-r--r--ext/vp8/gstvp8enc.c2
-rw-r--r--ext/xvid/gstxviddec.c13
-rw-r--r--ext/xvid/gstxvidenc.c24
49 files changed, 1266 insertions, 4329 deletions
diff --git a/ext/Makefile.am b/ext/Makefile.am
index a9a7c8b5f..9b670d4db 100644
--- a/ext/Makefile.am
+++ b/ext/Makefile.am
@@ -136,12 +136,6 @@ endif
HERMES_DIR=
# endif
-if USE_JACK
-JACK_DIR=jack
-else
-JACK_DIR=
-endif
-
if USE_JP2K
JP2K_DIR = jp2k
else
@@ -398,7 +392,6 @@ SUBDIRS=\
$(GSM_DIR) \
$(G729_DIR) \
$(HERMES_DIR) \
- $(JACK_DIR) \
$(JP2K_DIR) \
$(KATE_DIR) \
$(LADSPA_DIR) \
@@ -453,7 +446,6 @@ DIST_SUBDIRS = \
gsettings \
gsm \
ladspa \
- jack \
jp2k \
kate \
libmms \
diff --git a/ext/cog/generate_tables.c b/ext/cog/generate_tables.c
index d775bcc21..033f23c39 100644
--- a/ext/cog/generate_tables.c
+++ b/ext/cog/generate_tables.c
@@ -2,6 +2,7 @@
#include "config.h"
#include <glib.h>
+#include <gst/math-compat.h>
#include <math.h>
#include "gstcms.h"
diff --git a/ext/cog/gstcms.c b/ext/cog/gstcms.c
index 8fd28c6ba..27648cbf8 100644
--- a/ext/cog/gstcms.c
+++ b/ext/cog/gstcms.c
@@ -22,6 +22,7 @@
#endif
#include <gst/gst.h>
+#include <gst/math-compat.h>
#include "gstcms.h"
#include "cogutils.h"
diff --git a/ext/cog/gstcogdownsample.c b/ext/cog/gstcogdownsample.c
index 5d6b4f9ed..8bec086c0 100644
--- a/ext/cog/gstcogdownsample.c
+++ b/ext/cog/gstcogdownsample.c
@@ -357,6 +357,7 @@ gst_cogdownsample_transform (GstBaseTransform * base_transform,
break;
default:
g_assert_not_reached ();
+ return GST_FLOW_ERROR;
}
frame = cog_virt_frame_new_unpack (frame);
diff --git a/ext/cog/gstcogorc-dist.c b/ext/cog/gstcogorc-dist.c
index 01d791e39..4cd43b5be 100644
--- a/ext/cog/gstcogorc-dist.c
+++ b/ext/cog/gstcogorc-dist.c
@@ -21,6 +21,7 @@ typedef uint8_t orc_uint8;
typedef uint16_t orc_uint16;
typedef uint32_t orc_uint32;
typedef uint64_t orc_uint64;
+#define ORC_UINT64_C(x) UINT64_C(x)
#elif defined(_MSC_VER)
typedef signed __int8 orc_int8;
typedef signed __int16 orc_int16;
@@ -30,6 +31,7 @@ typedef unsigned __int8 orc_uint8;
typedef unsigned __int16 orc_uint16;
typedef unsigned __int32 orc_uint32;
typedef unsigned __int64 orc_uint64;
+#define ORC_UINT64_C(x) (x##Ui64)
#else
#include <limits.h>
typedef signed char orc_int8;
@@ -41,9 +43,11 @@ typedef unsigned int orc_uint32;
#if INT_MAX == LONG_MAX
typedef long long orc_int64;
typedef unsigned long long orc_uint64;
+#define ORC_UINT64_C(x) (x##ULL)
#else
typedef long orc_int64;
typedef unsigned long orc_uint64;
+#define ORC_UINT64_C(x) (x##UL)
#endif
#endif
typedef union
@@ -63,6 +67,7 @@ typedef union
orc_int64 i;
double f;
orc_int32 x2[2];
+ float x2f[2];
orc_int16 x4[4];
} orc_union64;
#endif
@@ -252,12 +257,12 @@ void cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1,
#define ORC_CLAMP_UL(x) ORC_CLAMP(x,ORC_UL_MIN,ORC_UL_MAX)
#define ORC_SWAP_W(x) ((((x)&0xff)<<8) | (((x)&0xff00)>>8))
#define ORC_SWAP_L(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | (((x)&0xff0000)>>8) | (((x)&0xff000000)>>24))
-#define ORC_SWAP_Q(x) ((((x)&0xffULL)<<56) | (((x)&0xff00ULL)<<40) | (((x)&0xff0000ULL)<<24) | (((x)&0xff000000ULL)<<8) | (((x)&0xff00000000ULL)>>8) | (((x)&0xff0000000000ULL)>>24) | (((x)&0xff000000000000ULL)>>40) | (((x)&0xff00000000000000ULL)>>56))
+#define ORC_SWAP_Q(x) ((((x)&ORC_UINT64_C(0xff))<<56) | (((x)&ORC_UINT64_C(0xff00))<<40) | (((x)&ORC_UINT64_C(0xff0000))<<24) | (((x)&ORC_UINT64_C(0xff000000))<<8) | (((x)&ORC_UINT64_C(0xff00000000))>>8) | (((x)&ORC_UINT64_C(0xff0000000000))>>24) | (((x)&ORC_UINT64_C(0xff000000000000))>>40) | (((x)&ORC_UINT64_C(0xff00000000000000))>>56))
#define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))
#define ORC_DENORMAL(x) ((x) & ((((x)&0x7f800000) == 0) ? 0xff800000 : 0xffffffff))
#define ORC_ISNAN(x) ((((x)&0x7f800000) == 0x7f800000) && (((x)&0x007fffff) != 0))
-#define ORC_DENORMAL_DOUBLE(x) ((x) & ((((x)&0x7ff0000000000000ULL) == 0) ? 0xfff0000000000000ULL : 0xffffffffffffffffULL))
-#define ORC_ISNAN_DOUBLE(x) ((((x)&0x7ff0000000000000ULL) == 0x7ff0000000000000ULL) && (((x)&0x000fffffffffffffULL) != 0))
+#define ORC_DENORMAL_DOUBLE(x) ((x) & ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == 0) ? ORC_UINT64_C(0xfff0000000000000) : ORC_UINT64_C(0xffffffffffffffff)))
+#define ORC_ISNAN_DOUBLE(x) ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == ORC_UINT64_C(0x7ff0000000000000)) && (((x)&ORC_UINT64_C(0x000fffffffffffff)) != 0))
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define ORC_RESTRICT restrict
#elif defined(__GNUC__) && __GNUC__ >= 4
@@ -349,14 +354,6 @@ cogorc_memcpy_2d (orc_uint8 * d1, int d1_stride, const orc_uint8 * s1,
orc_program_set_backup_function (p, _backup_cogorc_memcpy_2d);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 1, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_append_2 (p, "copyb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
ORC_VAR_D1);
@@ -454,14 +451,6 @@ cogorc_downsample_horiz_cosite_1tap (orc_uint8 * d1, const orc_uint16 * s1,
_backup_cogorc_downsample_horiz_cosite_1tap);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 2, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_S1,
ORC_VAR_D1, ORC_VAR_D1);
@@ -652,13 +641,6 @@ cogorc_downsample_horiz_cosite_3tap (orc_uint8 * d1, const orc_uint16 * s1,
orc_program_add_source (p, 2, "s1");
orc_program_add_source (p, 2, "s2");
orc_program_add_constant (p, 4, 0x00000002, "c1");
- orc_program_add_constant (p, 0, 0x00000002, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 1, "t1");
orc_program_add_temporary (p, 1, "t2");
orc_program_add_temporary (p, 1, "t3");
@@ -842,14 +824,6 @@ cogorc_downsample_420_jpeg (orc_uint8 * d1, const orc_uint16 * s1,
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 2, "s1");
orc_program_add_source (p, 2, "s2");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 1, "t2");
orc_program_add_temporary (p, 1, "t3");
@@ -977,14 +951,6 @@ cogorc_downsample_vert_halfsite_2tap (orc_uint8 * d1, const orc_uint8 * s1,
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 1, "s1");
orc_program_add_source (p, 1, "s2");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2,
ORC_VAR_D1);
@@ -1163,13 +1129,6 @@ cogorc_downsample_vert_cosite_3tap (orc_uint8 * d1, const orc_uint8 * s1,
orc_program_add_source (p, 1, "s2");
orc_program_add_source (p, 1, "s3");
orc_program_add_constant (p, 4, 0x00000002, "c1");
- orc_program_add_constant (p, 0, 0x00000002, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 2, "t3");
@@ -1405,11 +1364,6 @@ cogorc_downsample_vert_halfsite_4tap (orc_uint8 * d1, const orc_uint8 * s1,
orc_program_add_constant (p, 4, 0x0000001a, "c1");
orc_program_add_constant (p, 4, 0x00000006, "c2");
orc_program_add_constant (p, 4, 0x00000020, "c3");
- orc_program_add_constant (p, 0, 0x00000006, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 2, "t3");
@@ -1482,7 +1436,7 @@ cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const orc_uint8 * s1, int n)
/* 1: copyb */
var35 = var33;
/* 2: mergebw */
- var34.i = ((orc_uint8) var35) | ((orc_uint8) var35 << 8);
+ var34.i = ((orc_uint8) var35 & 0x00ff) | ((orc_uint8) var35 << 8);
/* 3: storew */
ptr0[i] = var34;
}
@@ -1511,7 +1465,7 @@ _backup_cogorc_upsample_horiz_cosite_1tap (OrcExecutor * ex)
/* 1: copyb */
var35 = var33;
/* 2: mergebw */
- var34.i = ((orc_uint8) var35) | ((orc_uint8) var35 << 8);
+ var34.i = ((orc_uint8) var35 & 0x00ff) | ((orc_uint8) var35 << 8);
/* 3: storew */
ptr0[i] = var34;
}
@@ -1537,14 +1491,6 @@ cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const orc_uint8 * s1, int n)
_backup_cogorc_upsample_horiz_cosite_1tap);
orc_program_add_destination (p, 2, "d1");
orc_program_add_source (p, 1, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 1, "t1");
orc_program_append_2 (p, "copyb", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
@@ -1600,7 +1546,7 @@ cogorc_upsample_horiz_cosite (guint8 * d1, const orc_uint8 * s1,
/* 3: avgub */
var38 = ((orc_uint8) var37 + (orc_uint8) var35 + 1) >> 1;
/* 4: mergebw */
- var36.i = ((orc_uint8) var37) | ((orc_uint8) var38 << 8);
+ var36.i = ((orc_uint8) var37 & 0x00ff) | ((orc_uint8) var38 << 8);
/* 5: storew */
ptr0[i] = var36;
}
@@ -1637,7 +1583,7 @@ _backup_cogorc_upsample_horiz_cosite (OrcExecutor * ex)
/* 3: avgub */
var38 = ((orc_uint8) var37 + (orc_uint8) var35 + 1) >> 1;
/* 4: mergebw */
- var36.i = ((orc_uint8) var37) | ((orc_uint8) var38 << 8);
+ var36.i = ((orc_uint8) var37 & 0x00ff) | ((orc_uint8) var38 << 8);
/* 5: storew */
ptr0[i] = var36;
}
@@ -1664,14 +1610,6 @@ cogorc_upsample_horiz_cosite (guint8 * d1, const orc_uint8 * s1,
orc_program_add_destination (p, 2, "d1");
orc_program_add_source (p, 1, "s1");
orc_program_add_source (p, 1, "s2");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 1, "t1");
orc_program_add_temporary (p, 1, "t2");
@@ -1783,14 +1721,6 @@ cogorc_upsample_vert_avgub (orc_uint8 * d1, const orc_uint8 * s1,
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 1, "s1");
orc_program_add_source (p, 1, "s2");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2,
ORC_VAR_D1);
@@ -1883,14 +1813,6 @@ orc_unpack_yuyv_y (orc_uint8 * d1, const orc_uint16 * s1, int n)
orc_program_set_backup_function (p, _backup_orc_unpack_yuyv_y);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 2, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_S1,
ORC_VAR_D1, ORC_VAR_D1);
@@ -1988,14 +1910,6 @@ orc_unpack_yuyv_u (orc_uint8 * d1, const orc_uint32 * s1, int n)
orc_program_set_backup_function (p, _backup_orc_unpack_yuyv_u);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "select0lw", 0, ORC_VAR_T1, ORC_VAR_S1,
@@ -2096,14 +2010,6 @@ orc_unpack_yuyv_v (orc_uint8 * d1, const orc_uint32 * s1, int n)
orc_program_set_backup_function (p, _backup_orc_unpack_yuyv_v);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "select1lw", 0, ORC_VAR_T1, ORC_VAR_S1,
@@ -2167,13 +2073,14 @@ orc_pack_yuyv (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2,
/* 4: loadb */
var38 = ptr5[i];
/* 5: mergebw */
- var44.i = ((orc_uint8) var42) | ((orc_uint8) var38 << 8);
+ var44.i = ((orc_uint8) var42 & 0x00ff) | ((orc_uint8) var38 << 8);
/* 6: loadb */
var39 = ptr6[i];
/* 7: mergebw */
- var45.i = ((orc_uint8) var43) | ((orc_uint8) var39 << 8);
+ var45.i = ((orc_uint8) var43 & 0x00ff) | ((orc_uint8) var39 << 8);
/* 8: mergewl */
- var40.i = ((orc_uint16) var44.i) | ((orc_uint16) var45.i << 16);
+ var40.i =
+ ((orc_uint16) var44.i & 0x0000ffff) | ((orc_uint16) var45.i << 16);
/* 9: storel */
ptr0[i] = var40;
}
@@ -2218,13 +2125,14 @@ _backup_orc_pack_yuyv (OrcExecutor * ex)
/* 4: loadb */
var38 = ptr5[i];
/* 5: mergebw */
- var44.i = ((orc_uint8) var42) | ((orc_uint8) var38 << 8);
+ var44.i = ((orc_uint8) var42 & 0x00ff) | ((orc_uint8) var38 << 8);
/* 6: loadb */
var39 = ptr6[i];
/* 7: mergebw */
- var45.i = ((orc_uint8) var43) | ((orc_uint8) var39 << 8);
+ var45.i = ((orc_uint8) var43 & 0x00ff) | ((orc_uint8) var39 << 8);
/* 8: mergewl */
- var40.i = ((orc_uint16) var44.i) | ((orc_uint16) var45.i << 16);
+ var40.i =
+ ((orc_uint16) var44.i & 0x0000ffff) | ((orc_uint16) var45.i << 16);
/* 9: storel */
ptr0[i] = var40;
}
@@ -2252,14 +2160,6 @@ orc_pack_yuyv (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2,
orc_program_add_source (p, 2, "s1");
orc_program_add_source (p, 1, "s2");
orc_program_add_source (p, 1, "s3");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 1, "t1");
orc_program_add_temporary (p, 1, "t2");
orc_program_add_temporary (p, 2, "t3");
@@ -2368,14 +2268,6 @@ orc_unpack_uyvy_y (orc_uint8 * d1, const orc_uint16 * s1, int n)
orc_program_set_backup_function (p, _backup_orc_unpack_uyvy_y);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 2, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_S1,
ORC_VAR_D1, ORC_VAR_D1);
@@ -2473,14 +2365,6 @@ orc_unpack_uyvy_u (orc_uint8 * d1, const orc_uint32 * s1, int n)
orc_program_set_backup_function (p, _backup_orc_unpack_uyvy_u);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "select0lw", 0, ORC_VAR_T1, ORC_VAR_S1,
@@ -2581,14 +2465,6 @@ orc_unpack_uyvy_v (orc_uint8 * d1, const orc_uint32 * s1, int n)
orc_program_set_backup_function (p, _backup_orc_unpack_uyvy_v);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "select1lw", 0, ORC_VAR_T1, ORC_VAR_S1,
@@ -2652,13 +2528,14 @@ orc_pack_uyvy (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2,
/* 4: loadb */
var38 = ptr5[i];
/* 5: mergebw */
- var44.i = ((orc_uint8) var38) | ((orc_uint8) var42 << 8);
+ var44.i = ((orc_uint8) var38 & 0x00ff) | ((orc_uint8) var42 << 8);
/* 6: loadb */
var39 = ptr6[i];
/* 7: mergebw */
- var45.i = ((orc_uint8) var39) | ((orc_uint8) var43 << 8);
+ var45.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var43 << 8);
/* 8: mergewl */
- var40.i = ((orc_uint16) var44.i) | ((orc_uint16) var45.i << 16);
+ var40.i =
+ ((orc_uint16) var44.i & 0x0000ffff) | ((orc_uint16) var45.i << 16);
/* 9: storel */
ptr0[i] = var40;
}
@@ -2703,13 +2580,14 @@ _backup_orc_pack_uyvy (OrcExecutor * ex)
/* 4: loadb */
var38 = ptr5[i];
/* 5: mergebw */
- var44.i = ((orc_uint8) var38) | ((orc_uint8) var42 << 8);
+ var44.i = ((orc_uint8) var38 & 0x00ff) | ((orc_uint8) var42 << 8);
/* 6: loadb */
var39 = ptr6[i];
/* 7: mergebw */
- var45.i = ((orc_uint8) var39) | ((orc_uint8) var43 << 8);
+ var45.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var43 << 8);
/* 8: mergewl */
- var40.i = ((orc_uint16) var44.i) | ((orc_uint16) var45.i << 16);
+ var40.i =
+ ((orc_uint16) var44.i & 0x0000ffff) | ((orc_uint16) var45.i << 16);
/* 9: storel */
ptr0[i] = var40;
}
@@ -2737,14 +2615,6 @@ orc_pack_uyvy (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2,
orc_program_add_source (p, 2, "s1");
orc_program_add_source (p, 1, "s2");
orc_program_add_source (p, 1, "s3");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 1, "t1");
orc_program_add_temporary (p, 1, "t2");
orc_program_add_temporary (p, 2, "t3");
@@ -2866,13 +2736,6 @@ orc_addc_convert_u8_s16 (orc_uint8 * d1, const gint16 * s1, int n)
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 2, "s1");
orc_program_add_constant (p, 4, 0x00000080, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1,
@@ -2980,13 +2843,6 @@ orc_subc_convert_s16_u8 (gint16 * d1, const orc_uint8 * s1, int n)
orc_program_add_destination (p, 2, "d1");
orc_program_add_source (p, 1, "s1");
orc_program_add_constant (p, 4, 0x00000080, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
@@ -3076,14 +2932,6 @@ orc_splat_u8_ns (orc_uint8 * d1, int p1, int n)
orc_program_set_name (p, "orc_splat_u8_ns");
orc_program_set_backup_function (p, _backup_orc_splat_u8_ns);
orc_program_add_destination (p, 1, "d1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 1, "p1");
orc_program_append_2 (p, "copyb", 0, ORC_VAR_D1, ORC_VAR_P1, ORC_VAR_D1,
@@ -3171,14 +3019,6 @@ orc_splat_s16_ns (gint16 * d1, int p1, int n)
orc_program_set_name (p, "orc_splat_s16_ns");
orc_program_set_backup_function (p, _backup_orc_splat_s16_ns);
orc_program_add_destination (p, 2, "d1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 2, "p1");
orc_program_append_2 (p, "copyw", 0, ORC_VAR_D1, ORC_VAR_P1, ORC_VAR_D1,
@@ -3345,13 +3185,6 @@ orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1,
orc_program_add_source (p, 1, "s1");
orc_program_add_source (p, 1, "s2");
orc_program_add_constant (p, 4, 0x00000006, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 2, "p1");
orc_program_add_parameter (p, 2, "p2");
orc_program_add_parameter (p, 2, "p3");
@@ -3578,11 +3411,6 @@ orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1,
orc_program_add_constant (p, 4, 0x00000010, "c1");
orc_program_add_constant (p, 4, 0x00000080, "c2");
orc_program_add_constant (p, 4, 0x00000008, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 2, "p1");
orc_program_add_parameter (p, 2, "p2");
orc_program_add_temporary (p, 2, "t1");
@@ -3823,11 +3651,6 @@ orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1,
orc_program_add_constant (p, 4, 0x00000010, "c1");
orc_program_add_constant (p, 4, 0x00000080, "c2");
orc_program_add_constant (p, 4, 0x00000008, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 2, "p1");
orc_program_add_parameter (p, 2, "p2");
orc_program_add_temporary (p, 2, "t1");
@@ -4061,13 +3884,6 @@ orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2,
orc_program_add_source (p, 1, "s2");
orc_program_add_source (p, 1, "s3");
orc_program_add_constant (p, 4, 0x00000006, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 2, "p1");
orc_program_add_parameter (p, 2, "p2");
orc_program_add_parameter (p, 2, "p3");
@@ -4344,11 +4160,6 @@ orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2,
orc_program_add_constant (p, 4, 0x00000010, "c1");
orc_program_add_constant (p, 4, 0x00000080, "c2");
orc_program_add_constant (p, 4, 0x00000008, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 2, "p1");
orc_program_add_parameter (p, 2, "p2");
orc_program_add_parameter (p, 2, "p3");
@@ -4593,14 +4404,6 @@ orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2,
orc_program_add_source (p, 1, "s1");
orc_program_add_source (p, 1, "s2");
orc_program_add_source (p, 1, "s3");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 2, "p1");
orc_program_add_parameter (p, 2, "p2");
orc_program_add_parameter (p, 2, "p3");
@@ -4837,14 +4640,6 @@ orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2,
orc_program_add_source (p, 1, "s1");
orc_program_add_source (p, 1, "s2");
orc_program_add_source (p, 1, "s3");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 2, "p1");
orc_program_add_parameter (p, 2, "p2");
orc_program_add_parameter (p, 2, "p3");
@@ -4933,13 +4728,14 @@ orc_pack_123x (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2,
/* 1: loadb */
var35 = ptr5[i];
/* 2: mergebw */
- var39.i = ((orc_uint8) var34) | ((orc_uint8) var35 << 8);
+ var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8);
/* 3: loadb */
var36 = ptr6[i];
/* 5: mergebw */
- var40.i = ((orc_uint8) var36) | ((orc_uint8) var37 << 8);
+ var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8);
/* 6: mergewl */
- var38.i = ((orc_uint16) var39.i) | ((orc_uint16) var40.i << 16);
+ var38.i =
+ ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var40.i << 16);
/* 7: storel */
ptr0[i] = var38;
}
@@ -4978,13 +4774,14 @@ _backup_orc_pack_123x (OrcExecutor * ex)
/* 1: loadb */
var35 = ptr5[i];
/* 2: mergebw */
- var39.i = ((orc_uint8) var34) | ((orc_uint8) var35 << 8);
+ var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8);
/* 3: loadb */
var36 = ptr6[i];
/* 5: mergebw */
- var40.i = ((orc_uint8) var36) | ((orc_uint8) var37 << 8);
+ var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8);
/* 6: mergewl */
- var38.i = ((orc_uint16) var39.i) | ((orc_uint16) var40.i << 16);
+ var38.i =
+ ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var40.i << 16);
/* 7: storel */
ptr0[i] = var38;
}
@@ -5012,14 +4809,6 @@ orc_pack_123x (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2,
orc_program_add_source (p, 1, "s1");
orc_program_add_source (p, 1, "s2");
orc_program_add_source (p, 1, "s3");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 1, "p1");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
@@ -5082,15 +4871,16 @@ orc_pack_x123 (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2,
/* 1: loadb */
var35 = ptr4[i];
/* 2: mergebw */
- var39.i = ((orc_uint8) var34) | ((orc_uint8) var35 << 8);
+ var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8);
/* 3: loadb */
var36 = ptr5[i];
/* 4: loadb */
var37 = ptr6[i];
/* 5: mergebw */
- var40.i = ((orc_uint8) var36) | ((orc_uint8) var37 << 8);
+ var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8);
/* 6: mergewl */
- var38.i = ((orc_uint16) var39.i) | ((orc_uint16) var40.i << 16);
+ var38.i =
+ ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var40.i << 16);
/* 7: storel */
ptr0[i] = var38;
}
@@ -5127,15 +4917,16 @@ _backup_orc_pack_x123 (OrcExecutor * ex)
/* 1: loadb */
var35 = ptr4[i];
/* 2: mergebw */
- var39.i = ((orc_uint8) var34) | ((orc_uint8) var35 << 8);
+ var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8);
/* 3: loadb */
var36 = ptr5[i];
/* 4: loadb */
var37 = ptr6[i];
/* 5: mergebw */
- var40.i = ((orc_uint8) var36) | ((orc_uint8) var37 << 8);
+ var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8);
/* 6: mergewl */
- var38.i = ((orc_uint16) var39.i) | ((orc_uint16) var40.i << 16);
+ var38.i =
+ ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var40.i << 16);
/* 7: storel */
ptr0[i] = var38;
}
@@ -5163,14 +4954,6 @@ orc_pack_x123 (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2,
orc_program_add_source (p, 1, "s1");
orc_program_add_source (p, 1, "s2");
orc_program_add_source (p, 1, "s3");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 1, "p1");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
@@ -5334,13 +5117,6 @@ cogorc_combine2_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2,
orc_program_add_source (p, 1, "s1");
orc_program_add_source (p, 1, "s2");
orc_program_add_constant (p, 4, 0x00000008, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 2, "p1");
orc_program_add_parameter (p, 2, "p2");
orc_program_add_temporary (p, 2, "t1");
@@ -5598,12 +5374,6 @@ cogorc_combine4_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2,
orc_program_add_source (p, 1, "s4");
orc_program_add_constant (p, 4, 0x00000020, "c1");
orc_program_add_constant (p, 4, 0x00000006, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 2, "p1");
orc_program_add_parameter (p, 2, "p2");
orc_program_add_parameter (p, 2, "p3");
@@ -5740,14 +5510,6 @@ cogorc_unpack_axyz_0 (orc_uint8 * d1, const orc_uint32 * s1, int n)
orc_program_set_backup_function (p, _backup_cogorc_unpack_axyz_0);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "select0lw", 0, ORC_VAR_T1, ORC_VAR_S1,
@@ -5848,14 +5610,6 @@ cogorc_unpack_axyz_1 (orc_uint8 * d1, const orc_uint32 * s1, int n)
orc_program_set_backup_function (p, _backup_cogorc_unpack_axyz_1);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "select0lw", 0, ORC_VAR_T1, ORC_VAR_S1,
@@ -5956,14 +5710,6 @@ cogorc_unpack_axyz_2 (orc_uint8 * d1, const orc_uint32 * s1, int n)
orc_program_set_backup_function (p, _backup_cogorc_unpack_axyz_2);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "select1lw", 0, ORC_VAR_T1, ORC_VAR_S1,
@@ -6064,14 +5810,6 @@ cogorc_unpack_axyz_3 (orc_uint8 * d1, const orc_uint32 * s1, int n)
orc_program_set_backup_function (p, _backup_cogorc_unpack_axyz_3);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "select1lw", 0, ORC_VAR_T1, ORC_VAR_S1,
@@ -6162,14 +5900,6 @@ cogorc_resample_horiz_1tap (orc_uint8 * d1, const orc_uint8 * s1, int p1,
orc_program_set_backup_function (p, _backup_cogorc_resample_horiz_1tap);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 1, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 4, "p1");
orc_program_add_parameter (p, 4, "p2");
@@ -6271,14 +6001,6 @@ cogorc_resample_horiz_2tap (orc_uint8 * d1, const orc_uint8 * s1, int p1,
orc_program_set_backup_function (p, _backup_cogorc_resample_horiz_2tap);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 1, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_parameter (p, 4, "p1");
orc_program_add_parameter (p, 4, "p2");
@@ -6340,19 +6062,23 @@ cogorc_convert_I420_UYVY (orc_uint32 * d1, orc_uint32 * d2,
/* 1: loadb */
var34 = ptr7[i];
/* 2: mergebw */
- var39.i = ((orc_uint8) var33) | ((orc_uint8) var34 << 8);
+ var39.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8);
/* 3: loadw */
var35 = ptr4[i];
/* 4: mergebw */
- var36.x2[0] = ((orc_uint8) var39.x2[0]) | ((orc_uint8) var35.x2[0] << 8);
- var36.x2[1] = ((orc_uint8) var39.x2[1]) | ((orc_uint8) var35.x2[1] << 8);
+ var36.x2[0] =
+ ((orc_uint8) var39.x2[0] & 0x00ff) | ((orc_uint8) var35.x2[0] << 8);
+ var36.x2[1] =
+ ((orc_uint8) var39.x2[1] & 0x00ff) | ((orc_uint8) var35.x2[1] << 8);
/* 5: storel */
ptr0[i] = var36;
/* 6: loadw */
var37 = ptr5[i];
/* 7: mergebw */
- var38.x2[0] = ((orc_uint8) var39.x2[0]) | ((orc_uint8) var37.x2[0] << 8);
- var38.x2[1] = ((orc_uint8) var39.x2[1]) | ((orc_uint8) var37.x2[1] << 8);
+ var38.x2[0] =
+ ((orc_uint8) var39.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8);
+ var38.x2[1] =
+ ((orc_uint8) var39.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8);
/* 8: storel */
ptr1[i] = var38;
}
@@ -6393,19 +6119,23 @@ _backup_cogorc_convert_I420_UYVY (OrcExecutor * ex)
/* 1: loadb */
var34 = ptr7[i];
/* 2: mergebw */
- var39.i = ((orc_uint8) var33) | ((orc_uint8) var34 << 8);
+ var39.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8);
/* 3: loadw */
var35 = ptr4[i];
/* 4: mergebw */
- var36.x2[0] = ((orc_uint8) var39.x2[0]) | ((orc_uint8) var35.x2[0] << 8);
- var36.x2[1] = ((orc_uint8) var39.x2[1]) | ((orc_uint8) var35.x2[1] << 8);
+ var36.x2[0] =
+ ((orc_uint8) var39.x2[0] & 0x00ff) | ((orc_uint8) var35.x2[0] << 8);
+ var36.x2[1] =
+ ((orc_uint8) var39.x2[1] & 0x00ff) | ((orc_uint8) var35.x2[1] << 8);
/* 5: storel */
ptr0[i] = var36;
/* 6: loadw */
var37 = ptr5[i];
/* 7: mergebw */
- var38.x2[0] = ((orc_uint8) var39.x2[0]) | ((orc_uint8) var37.x2[0] << 8);
- var38.x2[1] = ((orc_uint8) var39.x2[1]) | ((orc_uint8) var37.x2[1] << 8);
+ var38.x2[0] =
+ ((orc_uint8) var39.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8);
+ var38.x2[1] =
+ ((orc_uint8) var39.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8);
/* 8: storel */
ptr1[i] = var38;
}
@@ -6436,14 +6166,6 @@ cogorc_convert_I420_UYVY (orc_uint32 * d1, orc_uint32 * d2,
orc_program_add_source (p, 2, "s2");
orc_program_add_source (p, 1, "s3");
orc_program_add_source (p, 1, "s4");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S3, ORC_VAR_S4,
@@ -6510,19 +6232,23 @@ cogorc_convert_I420_YUY2 (orc_uint32 * d1, orc_uint32 * d2,
/* 1: loadb */
var34 = ptr7[i];
/* 2: mergebw */
- var39.i = ((orc_uint8) var33) | ((orc_uint8) var34 << 8);
+ var39.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8);
/* 3: loadw */
var35 = ptr4[i];
/* 4: mergebw */
- var36.x2[0] = ((orc_uint8) var35.x2[0]) | ((orc_uint8) var39.x2[0] << 8);
- var36.x2[1] = ((orc_uint8) var35.x2[1]) | ((orc_uint8) var39.x2[1] << 8);
+ var36.x2[0] =
+ ((orc_uint8) var35.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8);
+ var36.x2[1] =
+ ((orc_uint8) var35.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8);
/* 5: storel */
ptr0[i] = var36;
/* 6: loadw */
var37 = ptr5[i];
/* 7: mergebw */
- var38.x2[0] = ((orc_uint8) var37.x2[0]) | ((orc_uint8) var39.x2[0] << 8);
- var38.x2[1] = ((orc_uint8) var37.x2[1]) | ((orc_uint8) var39.x2[1] << 8);
+ var38.x2[0] =
+ ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8);
+ var38.x2[1] =
+ ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8);
/* 8: storel */
ptr1[i] = var38;
}
@@ -6563,19 +6289,23 @@ _backup_cogorc_convert_I420_YUY2 (OrcExecutor * ex)
/* 1: loadb */
var34 = ptr7[i];
/* 2: mergebw */
- var39.i = ((orc_uint8) var33) | ((orc_uint8) var34 << 8);
+ var39.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8);
/* 3: loadw */
var35 = ptr4[i];
/* 4: mergebw */
- var36.x2[0] = ((orc_uint8) var35.x2[0]) | ((orc_uint8) var39.x2[0] << 8);
- var36.x2[1] = ((orc_uint8) var35.x2[1]) | ((orc_uint8) var39.x2[1] << 8);
+ var36.x2[0] =
+ ((orc_uint8) var35.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8);
+ var36.x2[1] =
+ ((orc_uint8) var35.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8);
/* 5: storel */
ptr0[i] = var36;
/* 6: loadw */
var37 = ptr5[i];
/* 7: mergebw */
- var38.x2[0] = ((orc_uint8) var37.x2[0]) | ((orc_uint8) var39.x2[0] << 8);
- var38.x2[1] = ((orc_uint8) var37.x2[1]) | ((orc_uint8) var39.x2[1] << 8);
+ var38.x2[0] =
+ ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8);
+ var38.x2[1] =
+ ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8);
/* 8: storel */
ptr1[i] = var38;
}
@@ -6606,14 +6336,6 @@ cogorc_convert_I420_YUY2 (orc_uint32 * d1, orc_uint32 * d2,
orc_program_add_source (p, 2, "s2");
orc_program_add_source (p, 1, "s3");
orc_program_add_source (p, 1, "s4");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S3, ORC_VAR_S4,
@@ -6688,21 +6410,23 @@ cogorc_convert_I420_AYUV (orc_uint32 * d1, orc_uint32 * d2,
/* 1: loadupdb */
var43 = ptr7[i >> 1];
/* 2: mergebw */
- var44.i = ((orc_uint8) var42) | ((orc_uint8) var43 << 8);
+ var44.i = ((orc_uint8) var42 & 0x00ff) | ((orc_uint8) var43 << 8);
/* 4: loadb */
var37 = ptr4[i];
/* 5: mergebw */
- var45.i = ((orc_uint8) var36) | ((orc_uint8) var37 << 8);
+ var45.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8);
/* 6: mergewl */
- var38.i = ((orc_uint16) var45.i) | ((orc_uint16) var44.i << 16);
+ var38.i =
+ ((orc_uint16) var45.i & 0x0000ffff) | ((orc_uint16) var44.i << 16);
/* 7: storel */
ptr0[i] = var38;
/* 9: loadb */
var40 = ptr5[i];
/* 10: mergebw */
- var46.i = ((orc_uint8) var39) | ((orc_uint8) var40 << 8);
+ var46.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var40 << 8);
/* 11: mergewl */
- var41.i = ((orc_uint16) var46.i) | ((orc_uint16) var44.i << 16);
+ var41.i =
+ ((orc_uint16) var46.i & 0x0000ffff) | ((orc_uint16) var44.i << 16);
/* 12: storel */
ptr1[i] = var41;
}
@@ -6751,21 +6475,23 @@ _backup_cogorc_convert_I420_AYUV (OrcExecutor * ex)
/* 1: loadupdb */
var43 = ptr7[i >> 1];
/* 2: mergebw */
- var44.i = ((orc_uint8) var42) | ((orc_uint8) var43 << 8);
+ var44.i = ((orc_uint8) var42 & 0x00ff) | ((orc_uint8) var43 << 8);
/* 4: loadb */
var37 = ptr4[i];
/* 5: mergebw */
- var45.i = ((orc_uint8) var36) | ((orc_uint8) var37 << 8);
+ var45.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8);
/* 6: mergewl */
- var38.i = ((orc_uint16) var45.i) | ((orc_uint16) var44.i << 16);
+ var38.i =
+ ((orc_uint16) var45.i & 0x0000ffff) | ((orc_uint16) var44.i << 16);
/* 7: storel */
ptr0[i] = var38;
/* 9: loadb */
var40 = ptr5[i];
/* 10: mergebw */
- var46.i = ((orc_uint8) var39) | ((orc_uint8) var40 << 8);
+ var46.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var40 << 8);
/* 11: mergewl */
- var41.i = ((orc_uint16) var46.i) | ((orc_uint16) var44.i << 16);
+ var41.i =
+ ((orc_uint16) var46.i & 0x0000ffff) | ((orc_uint16) var44.i << 16);
/* 12: storel */
ptr1[i] = var41;
}
@@ -6797,13 +6523,6 @@ cogorc_convert_I420_AYUV (orc_uint32 * d1, orc_uint32 * d2,
orc_program_add_source (p, 1, "s3");
orc_program_add_source (p, 1, "s4");
orc_program_add_constant (p, 1, 0x000000ff, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 1, "t3");
@@ -6995,14 +6714,6 @@ cogorc_convert_YUY2_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3,
orc_program_add_destination (p, 1, "d4");
orc_program_add_source (p, 4, "s1");
orc_program_add_source (p, 4, "s2");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 2, "t3");
@@ -7123,14 +6834,6 @@ cogorc_convert_UYVY_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1,
orc_program_set_backup_function (p, _backup_cogorc_convert_UYVY_YUY2);
orc_program_add_destination (p, 4, "d1");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_append_2 (p, "swapw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
ORC_VAR_D1);
@@ -7256,14 +6959,6 @@ cogorc_planar_chroma_420_422 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2,
orc_program_add_destination (p, 1, "d1");
orc_program_add_destination (p, 1, "d2");
orc_program_add_source (p, 1, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_append_2 (p, "copyb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
ORC_VAR_D1);
@@ -7381,14 +7076,6 @@ cogorc_planar_chroma_420_444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2,
orc_program_add_destination (p, 2, "d1");
orc_program_add_destination (p, 2, "d2");
orc_program_add_source (p, 1, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
@@ -7500,14 +7187,6 @@ cogorc_planar_chroma_422_444 (orc_uint16 * d1, int d1_stride,
orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_422_444);
orc_program_add_destination (p, 2, "d1");
orc_program_add_source (p, 1, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
@@ -7625,14 +7304,6 @@ cogorc_planar_chroma_444_422 (orc_uint8 * d1, int d1_stride,
orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_444_422);
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 2, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 1, "t1");
orc_program_add_temporary (p, 1, "t2");
@@ -7776,14 +7447,6 @@ cogorc_planar_chroma_444_420 (orc_uint8 * d1, int d1_stride,
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 2, "s1");
orc_program_add_source (p, 2, "s2");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 1, "t2");
orc_program_add_temporary (p, 1, "t3");
@@ -7910,14 +7573,6 @@ cogorc_planar_chroma_422_420 (orc_uint8 * d1, int d1_stride,
orc_program_add_destination (p, 1, "d1");
orc_program_add_source (p, 1, "s1");
orc_program_add_source (p, 1, "s2");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2,
ORC_VAR_D1);
@@ -7979,15 +7634,20 @@ cogorc_convert_YUY2_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1,
var39.x2[1] = (var36.x2[1] >> 8) & 0xff;
var40.x2[1] = var36.x2[1] & 0xff;
/* 3: mergebw */
- var41.x2[0] = ((orc_uint8) var37.x2[0]) | ((orc_uint8) var40.x2[0] << 8);
- var41.x2[1] = ((orc_uint8) var37.x2[1]) | ((orc_uint8) var40.x2[1] << 8);
+ var41.x2[0] =
+ ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var40.x2[0] << 8);
+ var41.x2[1] =
+ ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var40.x2[1] << 8);
/* 4: mergewl */
- var42.i = ((orc_uint16) var39.i) | ((orc_uint16) var39.i << 16);
+ var42.i =
+ ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var39.i << 16);
/* 5: mergewl */
var38.x2[0] =
- ((orc_uint16) var41.x2[0]) | ((orc_uint16) var42.x2[0] << 16);
+ ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42.
+ x2[0] << 16);
var38.x2[1] =
- ((orc_uint16) var41.x2[1]) | ((orc_uint16) var42.x2[1] << 16);
+ ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42.
+ x2[1] << 16);
/* 6: storeq */
ptr0[i] = var38;
}
@@ -8030,15 +7690,20 @@ _backup_cogorc_convert_YUY2_AYUV (OrcExecutor * ex)
var39.x2[1] = (var36.x2[1] >> 8) & 0xff;
var40.x2[1] = var36.x2[1] & 0xff;
/* 3: mergebw */
- var41.x2[0] = ((orc_uint8) var37.x2[0]) | ((orc_uint8) var40.x2[0] << 8);
- var41.x2[1] = ((orc_uint8) var37.x2[1]) | ((orc_uint8) var40.x2[1] << 8);
+ var41.x2[0] =
+ ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var40.x2[0] << 8);
+ var41.x2[1] =
+ ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var40.x2[1] << 8);
/* 4: mergewl */
- var42.i = ((orc_uint16) var39.i) | ((orc_uint16) var39.i << 16);
+ var42.i =
+ ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var39.i << 16);
/* 5: mergewl */
var38.x2[0] =
- ((orc_uint16) var41.x2[0]) | ((orc_uint16) var42.x2[0] << 16);
+ ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42.
+ x2[0] << 16);
var38.x2[1] =
- ((orc_uint16) var41.x2[1]) | ((orc_uint16) var42.x2[1] << 16);
+ ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42.
+ x2[1] << 16);
/* 6: storeq */
ptr0[i] = var38;
}
@@ -8067,13 +7732,6 @@ cogorc_convert_YUY2_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1,
orc_program_add_destination (p, 8, "d1");
orc_program_add_source (p, 4, "s1");
orc_program_add_constant (p, 2, 0x000000ff, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 4, "t3");
@@ -8143,15 +7801,20 @@ cogorc_convert_UYVY_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1,
var39.x2[1] = (var36.x2[1] >> 8) & 0xff;
var40.x2[1] = var36.x2[1] & 0xff;
/* 3: mergebw */
- var41.x2[0] = ((orc_uint8) var37.x2[0]) | ((orc_uint8) var39.x2[0] << 8);
- var41.x2[1] = ((orc_uint8) var37.x2[1]) | ((orc_uint8) var39.x2[1] << 8);
+ var41.x2[0] =
+ ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8);
+ var41.x2[1] =
+ ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8);
/* 4: mergewl */
- var42.i = ((orc_uint16) var40.i) | ((orc_uint16) var40.i << 16);
+ var42.i =
+ ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var40.i << 16);
/* 5: mergewl */
var38.x2[0] =
- ((orc_uint16) var41.x2[0]) | ((orc_uint16) var42.x2[0] << 16);
+ ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42.
+ x2[0] << 16);
var38.x2[1] =
- ((orc_uint16) var41.x2[1]) | ((orc_uint16) var42.x2[1] << 16);
+ ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42.
+ x2[1] << 16);
/* 6: storeq */
ptr0[i] = var38;
}
@@ -8194,15 +7857,20 @@ _backup_cogorc_convert_UYVY_AYUV (OrcExecutor * ex)
var39.x2[1] = (var36.x2[1] >> 8) & 0xff;
var40.x2[1] = var36.x2[1] & 0xff;
/* 3: mergebw */
- var41.x2[0] = ((orc_uint8) var37.x2[0]) | ((orc_uint8) var39.x2[0] << 8);
- var41.x2[1] = ((orc_uint8) var37.x2[1]) | ((orc_uint8) var39.x2[1] << 8);
+ var41.x2[0] =
+ ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8);
+ var41.x2[1] =
+ ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8);
/* 4: mergewl */
- var42.i = ((orc_uint16) var40.i) | ((orc_uint16) var40.i << 16);
+ var42.i =
+ ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var40.i << 16);
/* 5: mergewl */
var38.x2[0] =
- ((orc_uint16) var41.x2[0]) | ((orc_uint16) var42.x2[0] << 16);
+ ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42.
+ x2[0] << 16);
var38.x2[1] =
- ((orc_uint16) var41.x2[1]) | ((orc_uint16) var42.x2[1] << 16);
+ ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42.
+ x2[1] << 16);
/* 6: storeq */
ptr0[i] = var38;
}
@@ -8231,13 +7899,6 @@ cogorc_convert_UYVY_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1,
orc_program_add_destination (p, 8, "d1");
orc_program_add_source (p, 4, "s1");
orc_program_add_constant (p, 2, 0x000000ff, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 4, "t3");
@@ -8390,14 +8051,6 @@ cogorc_convert_YUY2_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2,
orc_program_add_destination (p, 1, "d2");
orc_program_add_destination (p, 1, "d3");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_S1,
@@ -8547,14 +8200,6 @@ cogorc_convert_UYVY_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2,
orc_program_add_destination (p, 1, "d2");
orc_program_add_destination (p, 1, "d3");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "splitwb", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1,
@@ -8716,14 +8361,6 @@ cogorc_convert_YUY2_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2,
orc_program_add_destination (p, 2, "d2");
orc_program_add_destination (p, 2, "d3");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 1, "t2");
orc_program_add_temporary (p, 1, "t3");
@@ -8891,14 +8528,6 @@ cogorc_convert_UYVY_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2,
orc_program_add_destination (p, 2, "d2");
orc_program_add_destination (p, 2, "d3");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 1, "t2");
orc_program_add_temporary (p, 1, "t3");
@@ -9086,14 +8715,6 @@ cogorc_convert_UYVY_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3,
orc_program_add_destination (p, 1, "d4");
orc_program_add_source (p, 4, "s1");
orc_program_add_source (p, 4, "s2");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 2, "t3");
@@ -9358,14 +8979,6 @@ cogorc_convert_AYUV_I420 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2,
orc_program_add_destination (p, 1, "d4");
orc_program_add_source (p, 8, "s1");
orc_program_add_source (p, 8, "s2");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 4, "t1");
orc_program_add_temporary (p, 4, "t2");
orc_program_add_temporary (p, 4, "t3");
@@ -9468,8 +9081,10 @@ cogorc_convert_AYUV_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1,
var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff;
var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff;
/* 5: mergebw */
- var38.x2[0] = ((orc_uint8) var44.x2[0]) | ((orc_uint8) var43.x2[0] << 8);
- var38.x2[1] = ((orc_uint8) var44.x2[1]) | ((orc_uint8) var43.x2[1] << 8);
+ var38.x2[0] =
+ ((orc_uint8) var44.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8);
+ var38.x2[1] =
+ ((orc_uint8) var44.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8);
/* 6: storel */
ptr0[i] = var38;
}
@@ -9521,8 +9136,10 @@ _backup_cogorc_convert_AYUV_YUY2 (OrcExecutor * ex)
var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff;
var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff;
/* 5: mergebw */
- var38.x2[0] = ((orc_uint8) var44.x2[0]) | ((orc_uint8) var43.x2[0] << 8);
- var38.x2[1] = ((orc_uint8) var44.x2[1]) | ((orc_uint8) var43.x2[1] << 8);
+ var38.x2[0] =
+ ((orc_uint8) var44.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8);
+ var38.x2[1] =
+ ((orc_uint8) var44.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8);
/* 6: storel */
ptr0[i] = var38;
}
@@ -9550,14 +9167,6 @@ cogorc_convert_AYUV_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1,
orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_YUY2);
orc_program_add_destination (p, 4, "d1");
orc_program_add_source (p, 8, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 2, "t3");
@@ -9639,8 +9248,10 @@ cogorc_convert_AYUV_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1,
var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff;
var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff;
/* 5: mergebw */
- var38.x2[0] = ((orc_uint8) var43.x2[0]) | ((orc_uint8) var44.x2[0] << 8);
- var38.x2[1] = ((orc_uint8) var43.x2[1]) | ((orc_uint8) var44.x2[1] << 8);
+ var38.x2[0] =
+ ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var44.x2[0] << 8);
+ var38.x2[1] =
+ ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var44.x2[1] << 8);
/* 6: storel */
ptr0[i] = var38;
}
@@ -9692,8 +9303,10 @@ _backup_cogorc_convert_AYUV_UYVY (OrcExecutor * ex)
var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff;
var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff;
/* 5: mergebw */
- var38.x2[0] = ((orc_uint8) var43.x2[0]) | ((orc_uint8) var44.x2[0] << 8);
- var38.x2[1] = ((orc_uint8) var43.x2[1]) | ((orc_uint8) var44.x2[1] << 8);
+ var38.x2[0] =
+ ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var44.x2[0] << 8);
+ var38.x2[1] =
+ ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var44.x2[1] << 8);
/* 6: storel */
ptr0[i] = var38;
}
@@ -9721,14 +9334,6 @@ cogorc_convert_AYUV_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1,
orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_UYVY);
orc_program_add_destination (p, 4, "d1");
orc_program_add_source (p, 8, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 2, "t3");
@@ -9914,14 +9519,6 @@ cogorc_convert_AYUV_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2,
orc_program_add_destination (p, 1, "d2");
orc_program_add_destination (p, 1, "d3");
orc_program_add_source (p, 8, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 4, "t1");
orc_program_add_temporary (p, 4, "t2");
orc_program_add_temporary (p, 2, "t3");
@@ -10082,14 +9679,6 @@ cogorc_convert_AYUV_Y444 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2,
orc_program_add_destination (p, 1, "d2");
orc_program_add_destination (p, 1, "d3");
orc_program_add_source (p, 4, "s1");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
@@ -10156,12 +9745,14 @@ cogorc_convert_Y42B_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1,
/* 1: loadb */
var34 = ptr6[i];
/* 2: mergebw */
- var37.i = ((orc_uint8) var33) | ((orc_uint8) var34 << 8);
+ var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8);
/* 3: loadw */
var35 = ptr4[i];
/* 4: mergebw */
- var36.x2[0] = ((orc_uint8) var35.x2[0]) | ((orc_uint8) var37.x2[0] << 8);
- var36.x2[1] = ((orc_uint8) var35.x2[1]) | ((orc_uint8) var37.x2[1] << 8);
+ var36.x2[0] =
+ ((orc_uint8) var35.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8);
+ var36.x2[1] =
+ ((orc_uint8) var35.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8);
/* 5: storel */
ptr0[i] = var36;
}
@@ -10200,12 +9791,14 @@ _backup_cogorc_convert_Y42B_YUY2 (OrcExecutor * ex)
/* 1: loadb */
var34 = ptr6[i];
/* 2: mergebw */
- var37.i = ((orc_uint8) var33) | ((orc_uint8) var34 << 8);
+ var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8);
/* 3: loadw */
var35 = ptr4[i];
/* 4: mergebw */
- var36.x2[0] = ((orc_uint8) var35.x2[0]) | ((orc_uint8) var37.x2[0] << 8);
- var36.x2[1] = ((orc_uint8) var35.x2[1]) | ((orc_uint8) var37.x2[1] << 8);
+ var36.x2[0] =
+ ((orc_uint8) var35.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8);
+ var36.x2[1] =
+ ((orc_uint8) var35.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8);
/* 5: storel */
ptr0[i] = var36;
}
@@ -10236,14 +9829,6 @@ cogorc_convert_Y42B_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1,
orc_program_add_source (p, 2, "s1");
orc_program_add_source (p, 1, "s2");
orc_program_add_source (p, 1, "s3");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_S3,
@@ -10307,12 +9892,14 @@ cogorc_convert_Y42B_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1,
/* 1: loadb */
var34 = ptr6[i];
/* 2: mergebw */
- var37.i = ((orc_uint8) var33) | ((orc_uint8) var34 << 8);
+ var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8);
/* 3: loadw */
var35 = ptr4[i];
/* 4: mergebw */
- var36.x2[0] = ((orc_uint8) var37.x2[0]) | ((orc_uint8) var35.x2[0] << 8);
- var36.x2[1] = ((orc_uint8) var37.x2[1]) | ((orc_uint8) var35.x2[1] << 8);
+ var36.x2[0] =
+ ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var35.x2[0] << 8);
+ var36.x2[1] =
+ ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var35.x2[1] << 8);
/* 5: storel */
ptr0[i] = var36;
}
@@ -10351,12 +9938,14 @@ _backup_cogorc_convert_Y42B_UYVY (OrcExecutor * ex)
/* 1: loadb */
var34 = ptr6[i];
/* 2: mergebw */
- var37.i = ((orc_uint8) var33) | ((orc_uint8) var34 << 8);
+ var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8);
/* 3: loadw */
var35 = ptr4[i];
/* 4: mergebw */
- var36.x2[0] = ((orc_uint8) var37.x2[0]) | ((orc_uint8) var35.x2[0] << 8);
- var36.x2[1] = ((orc_uint8) var37.x2[1]) | ((orc_uint8) var35.x2[1] << 8);
+ var36.x2[0] =
+ ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var35.x2[0] << 8);
+ var36.x2[1] =
+ ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var35.x2[1] << 8);
/* 5: storel */
ptr0[i] = var36;
}
@@ -10387,14 +9976,6 @@ cogorc_convert_Y42B_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1,
orc_program_add_source (p, 2, "s1");
orc_program_add_source (p, 1, "s2");
orc_program_add_source (p, 1, "s3");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_S3,
@@ -10464,19 +10045,24 @@ cogorc_convert_Y42B_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint16 * s1,
/* 1: loadb */
var37 = ptr6[i];
/* 2: mergebw */
- var41.i = ((orc_uint8) var36) | ((orc_uint8) var37 << 8);
+ var41.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8);
/* 4: loadw */
var39 = ptr4[i];
/* 5: mergebw */
- var42.x2[0] = ((orc_uint8) var38.x2[0]) | ((orc_uint8) var39.x2[0] << 8);
- var42.x2[1] = ((orc_uint8) var38.x2[1]) | ((orc_uint8) var39.x2[1] << 8);
+ var42.x2[0] =
+ ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8);
+ var42.x2[1] =
+ ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8);
/* 6: mergewl */
- var43.i = ((orc_uint16) var41.i) | ((orc_uint16) var41.i << 16);
+ var43.i =
+ ((orc_uint16) var41.i & 0x0000ffff) | ((orc_uint16) var41.i << 16);
/* 7: mergewl */
var40.x2[0] =
- ((orc_uint16) var42.x2[0]) | ((orc_uint16) var43.x2[0] << 16);
+ ((orc_uint16) var42.x2[0] & 0x0000ffff) | ((orc_uint16) var43.
+ x2[0] << 16);
var40.x2[1] =
- ((orc_uint16) var42.x2[1]) | ((orc_uint16) var43.x2[1] << 16);
+ ((orc_uint16) var42.x2[1] & 0x0000ffff) | ((orc_uint16) var43.
+ x2[1] << 16);
/* 8: storeq */
ptr0[i] = var40;
}
@@ -10521,19 +10107,24 @@ _backup_cogorc_convert_Y42B_AYUV (OrcExecutor * ex)
/* 1: loadb */
var37 = ptr6[i];
/* 2: mergebw */
- var41.i = ((orc_uint8) var36) | ((orc_uint8) var37 << 8);
+ var41.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8);
/* 4: loadw */
var39 = ptr4[i];
/* 5: mergebw */
- var42.x2[0] = ((orc_uint8) var38.x2[0]) | ((orc_uint8) var39.x2[0] << 8);
- var42.x2[1] = ((orc_uint8) var38.x2[1]) | ((orc_uint8) var39.x2[1] << 8);
+ var42.x2[0] =
+ ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8);
+ var42.x2[1] =
+ ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8);
/* 6: mergewl */
- var43.i = ((orc_uint16) var41.i) | ((orc_uint16) var41.i << 16);
+ var43.i =
+ ((orc_uint16) var41.i & 0x0000ffff) | ((orc_uint16) var41.i << 16);
/* 7: mergewl */
var40.x2[0] =
- ((orc_uint16) var42.x2[0]) | ((orc_uint16) var43.x2[0] << 16);
+ ((orc_uint16) var42.x2[0] & 0x0000ffff) | ((orc_uint16) var43.
+ x2[0] << 16);
var40.x2[1] =
- ((orc_uint16) var42.x2[1]) | ((orc_uint16) var43.x2[1] << 16);
+ ((orc_uint16) var42.x2[1] & 0x0000ffff) | ((orc_uint16) var43.
+ x2[1] << 16);
/* 8: storeq */
ptr0[i] = var40;
}
@@ -10565,13 +10156,6 @@ cogorc_convert_Y42B_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint16 * s1,
orc_program_add_source (p, 1, "s2");
orc_program_add_source (p, 1, "s3");
orc_program_add_constant (p, 1, 0x000000ff, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 4, "t3");
@@ -10645,8 +10229,10 @@ cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1,
/* 1: loadw */
var37 = ptr6[i];
/* 2: mergebw */
- var40.x2[0] = ((orc_uint8) var36.x2[0]) | ((orc_uint8) var37.x2[0] << 8);
- var40.x2[1] = ((orc_uint8) var36.x2[1]) | ((orc_uint8) var37.x2[1] << 8);
+ var40.x2[0] =
+ ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8);
+ var40.x2[1] =
+ ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8);
/* 3: splitlw */
var41.i = (var40.i >> 16) & 0xffff;
var42.i = var40.i & 0xffff;
@@ -10658,8 +10244,10 @@ cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1,
/* 5: loadw */
var38 = ptr4[i];
/* 6: mergebw */
- var39.x2[0] = ((orc_uint8) var38.x2[0]) | ((orc_uint8) var43.x2[0] << 8);
- var39.x2[1] = ((orc_uint8) var38.x2[1]) | ((orc_uint8) var43.x2[1] << 8);
+ var39.x2[0] =
+ ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8);
+ var39.x2[1] =
+ ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8);
/* 7: storel */
ptr0[i] = var39;
}
@@ -10701,8 +10289,10 @@ _backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ex)
/* 1: loadw */
var37 = ptr6[i];
/* 2: mergebw */
- var40.x2[0] = ((orc_uint8) var36.x2[0]) | ((orc_uint8) var37.x2[0] << 8);
- var40.x2[1] = ((orc_uint8) var36.x2[1]) | ((orc_uint8) var37.x2[1] << 8);
+ var40.x2[0] =
+ ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8);
+ var40.x2[1] =
+ ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8);
/* 3: splitlw */
var41.i = (var40.i >> 16) & 0xffff;
var42.i = var40.i & 0xffff;
@@ -10714,8 +10304,10 @@ _backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ex)
/* 5: loadw */
var38 = ptr4[i];
/* 6: mergebw */
- var39.x2[0] = ((orc_uint8) var38.x2[0]) | ((orc_uint8) var43.x2[0] << 8);
- var39.x2[1] = ((orc_uint8) var38.x2[1]) | ((orc_uint8) var43.x2[1] << 8);
+ var39.x2[0] =
+ ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8);
+ var39.x2[1] =
+ ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8);
/* 7: storel */
ptr0[i] = var39;
}
@@ -10746,14 +10338,6 @@ cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1,
orc_program_add_source (p, 2, "s1");
orc_program_add_source (p, 2, "s2");
orc_program_add_source (p, 2, "s3");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 4, "t2");
orc_program_add_temporary (p, 2, "t3");
@@ -10827,8 +10411,10 @@ cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1,
/* 1: loadw */
var37 = ptr6[i];
/* 2: mergebw */
- var40.x2[0] = ((orc_uint8) var36.x2[0]) | ((orc_uint8) var37.x2[0] << 8);
- var40.x2[1] = ((orc_uint8) var36.x2[1]) | ((orc_uint8) var37.x2[1] << 8);
+ var40.x2[0] =
+ ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8);
+ var40.x2[1] =
+ ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8);
/* 3: splitlw */
var41.i = (var40.i >> 16) & 0xffff;
var42.i = var40.i & 0xffff;
@@ -10840,8 +10426,10 @@ cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1,
/* 5: loadw */
var38 = ptr4[i];
/* 6: mergebw */
- var39.x2[0] = ((orc_uint8) var43.x2[0]) | ((orc_uint8) var38.x2[0] << 8);
- var39.x2[1] = ((orc_uint8) var43.x2[1]) | ((orc_uint8) var38.x2[1] << 8);
+ var39.x2[0] =
+ ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var38.x2[0] << 8);
+ var39.x2[1] =
+ ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var38.x2[1] << 8);
/* 7: storel */
ptr0[i] = var39;
}
@@ -10883,8 +10471,10 @@ _backup_cogorc_convert_Y444_UYVY (OrcExecutor * ex)
/* 1: loadw */
var37 = ptr6[i];
/* 2: mergebw */
- var40.x2[0] = ((orc_uint8) var36.x2[0]) | ((orc_uint8) var37.x2[0] << 8);
- var40.x2[1] = ((orc_uint8) var36.x2[1]) | ((orc_uint8) var37.x2[1] << 8);
+ var40.x2[0] =
+ ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8);
+ var40.x2[1] =
+ ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8);
/* 3: splitlw */
var41.i = (var40.i >> 16) & 0xffff;
var42.i = var40.i & 0xffff;
@@ -10896,8 +10486,10 @@ _backup_cogorc_convert_Y444_UYVY (OrcExecutor * ex)
/* 5: loadw */
var38 = ptr4[i];
/* 6: mergebw */
- var39.x2[0] = ((orc_uint8) var43.x2[0]) | ((orc_uint8) var38.x2[0] << 8);
- var39.x2[1] = ((orc_uint8) var43.x2[1]) | ((orc_uint8) var38.x2[1] << 8);
+ var39.x2[0] =
+ ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var38.x2[0] << 8);
+ var39.x2[1] =
+ ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var38.x2[1] << 8);
/* 7: storel */
ptr0[i] = var39;
}
@@ -10928,14 +10520,6 @@ cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1,
orc_program_add_source (p, 2, "s1");
orc_program_add_source (p, 2, "s2");
orc_program_add_source (p, 2, "s3");
- orc_program_add_constant (p, 0, 0x00000000, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 4, "t2");
orc_program_add_temporary (p, 2, "t3");
@@ -11010,13 +10594,14 @@ cogorc_convert_Y444_AYUV (orc_uint32 * d1, int d1_stride, const orc_uint8 * s1,
/* 1: loadb */
var35 = ptr6[i];
/* 2: mergebw */
- var39.i = ((orc_uint8) var34) | ((orc_uint8) var35 << 8);
+ var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8);
/* 4: loadb */
var37 = ptr4[i];
/* 5: mergebw */
- var40.i = ((orc_uint8) var36) | ((orc_uint8) var37 << 8);
+ var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8);
/* 6: mergewl */
- var38.i = ((orc_uint16) var40.i) | ((orc_uint16) var39.i << 16);
+ var38.i =
+ ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var39.i << 16);
/* 7: storel */
ptr0[i] = var38;
}
@@ -11059,13 +10644,14 @@ _backup_cogorc_convert_Y444_AYUV (OrcExecutor * ex)
/* 1: loadb */
var35 = ptr6[i];
/* 2: mergebw */
- var39.i = ((orc_uint8) var34) | ((orc_uint8) var35 << 8);
+ var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8);
/* 4: loadb */
var37 = ptr4[i];
/* 5: mergebw */
- var40.i = ((orc_uint8) var36) | ((orc_uint8) var37 << 8);
+ var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8);
/* 6: mergewl */
- var38.i = ((orc_uint16) var40.i) | ((orc_uint16) var39.i << 16);
+ var38.i =
+ ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var39.i << 16);
/* 7: storel */
ptr0[i] = var38;
}
@@ -11097,13 +10683,6 @@ cogorc_convert_Y444_AYUV (orc_uint32 * d1, int d1_stride, const orc_uint8 * s1,
orc_program_add_source (p, 1, "s2");
orc_program_add_source (p, 1, "s3");
orc_program_add_constant (p, 1, 0x000000ff, "c1");
- orc_program_add_constant (p, 0, 0x00000000, "c2");
- orc_program_add_constant (p, 0, 0x00000000, "c3");
- orc_program_add_constant (p, 0, 0x00000000, "c4");
- orc_program_add_constant (p, 0, 0x00000000, "c5");
- orc_program_add_constant (p, 0, 0x00000000, "c6");
- orc_program_add_constant (p, 0, 0x00000000, "c7");
- orc_program_add_constant (p, 0, 0x00000000, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
@@ -11289,11 +10868,12 @@ cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1,
/* 36: convssswb */
var89 = ORC_CLAMP_SB (var79.i);
/* 37: mergebw */
- var90.i = ((orc_uint8) var61) | ((orc_uint8) var87 << 8);
+ var90.i = ((orc_uint8) var61 & 0x00ff) | ((orc_uint8) var87 << 8);
/* 38: mergebw */
- var91.i = ((orc_uint8) var88) | ((orc_uint8) var89 << 8);
+ var91.i = ((orc_uint8) var88 & 0x00ff) | ((orc_uint8) var89 << 8);
/* 39: mergewl */
- var92.i = ((orc_uint16) var90.i) | ((orc_uint16) var91.i << 16);
+ var92.i =
+ ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16);
/* 41: addb */
var56.x4[0] = var92.x4[0] + var55.x4[0];
var56.x4[1] = var92.x4[1] + var55.x4[1];
@@ -11457,11 +11037,12 @@ _backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ex)
/* 36: convssswb */
var89 = ORC_CLAMP_SB (var79.i);
/* 37: mergebw */
- var90.i = ((orc_uint8) var61) | ((orc_uint8) var87 << 8);
+ var90.i = ((orc_uint8) var61 & 0x00ff) | ((orc_uint8) var87 << 8);
/* 38: mergebw */
- var91.i = ((orc_uint8) var88) | ((orc_uint8) var89 << 8);
+ var91.i = ((orc_uint8) var88 & 0x00ff) | ((orc_uint8) var89 << 8);
/* 39: mergewl */
- var92.i = ((orc_uint16) var90.i) | ((orc_uint16) var91.i << 16);
+ var92.i =
+ ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16);
/* 41: addb */
var56.x4[0] = var92.x4[0] + var55.x4[0];
var56.x4[1] = var92.x4[1] + var55.x4[1];
@@ -11501,7 +11082,6 @@ cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1,
orc_program_add_constant (p, 4, 0x00000004, "c5");
orc_program_add_constant (p, 4, 0x00000064, "c6");
orc_program_add_constant (p, 4, 0x00000068, "c7");
- orc_program_add_constant (p, 0, 0x00000080, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 1, "t3");
@@ -11759,11 +11339,12 @@ cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1,
/* 36: convssswb */
var89 = ORC_CLAMP_SB (var79.i);
/* 37: mergebw */
- var90.i = ((orc_uint8) var89) | ((orc_uint8) var88 << 8);
+ var90.i = ((orc_uint8) var89 & 0x00ff) | ((orc_uint8) var88 << 8);
/* 38: mergebw */
- var91.i = ((orc_uint8) var87) | ((orc_uint8) var61 << 8);
+ var91.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var61 << 8);
/* 39: mergewl */
- var92.i = ((orc_uint16) var90.i) | ((orc_uint16) var91.i << 16);
+ var92.i =
+ ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16);
/* 41: addb */
var56.x4[0] = var92.x4[0] + var55.x4[0];
var56.x4[1] = var92.x4[1] + var55.x4[1];
@@ -11927,11 +11508,12 @@ _backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ex)
/* 36: convssswb */
var89 = ORC_CLAMP_SB (var79.i);
/* 37: mergebw */
- var90.i = ((orc_uint8) var89) | ((orc_uint8) var88 << 8);
+ var90.i = ((orc_uint8) var89 & 0x00ff) | ((orc_uint8) var88 << 8);
/* 38: mergebw */
- var91.i = ((orc_uint8) var87) | ((orc_uint8) var61 << 8);
+ var91.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var61 << 8);
/* 39: mergewl */
- var92.i = ((orc_uint16) var90.i) | ((orc_uint16) var91.i << 16);
+ var92.i =
+ ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16);
/* 41: addb */
var56.x4[0] = var92.x4[0] + var55.x4[0];
var56.x4[1] = var92.x4[1] + var55.x4[1];
@@ -11971,7 +11553,6 @@ cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1,
orc_program_add_constant (p, 4, 0x00000004, "c5");
orc_program_add_constant (p, 4, 0x00000064, "c6");
orc_program_add_constant (p, 4, 0x00000068, "c7");
- orc_program_add_constant (p, 0, 0x00000080, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 1, "t3");
@@ -12229,11 +11810,12 @@ cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1,
/* 36: convssswb */
var89 = ORC_CLAMP_SB (var79.i);
/* 37: mergebw */
- var90.i = ((orc_uint8) var61) | ((orc_uint8) var89 << 8);
+ var90.i = ((orc_uint8) var61 & 0x00ff) | ((orc_uint8) var89 << 8);
/* 38: mergebw */
- var91.i = ((orc_uint8) var88) | ((orc_uint8) var87 << 8);
+ var91.i = ((orc_uint8) var88 & 0x00ff) | ((orc_uint8) var87 << 8);
/* 39: mergewl */
- var92.i = ((orc_uint16) var90.i) | ((orc_uint16) var91.i << 16);
+ var92.i =
+ ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16);
/* 41: addb */
var56.x4[0] = var92.x4[0] + var55.x4[0];
var56.x4[1] = var92.x4[1] + var55.x4[1];
@@ -12397,11 +11979,12 @@ _backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ex)
/* 36: convssswb */
var89 = ORC_CLAMP_SB (var79.i);
/* 37: mergebw */
- var90.i = ((orc_uint8) var61) | ((orc_uint8) var89 << 8);
+ var90.i = ((orc_uint8) var61 & 0x00ff) | ((orc_uint8) var89 << 8);
/* 38: mergebw */
- var91.i = ((orc_uint8) var88) | ((orc_uint8) var87 << 8);
+ var91.i = ((orc_uint8) var88 & 0x00ff) | ((orc_uint8) var87 << 8);
/* 39: mergewl */
- var92.i = ((orc_uint16) var90.i) | ((orc_uint16) var91.i << 16);
+ var92.i =
+ ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16);
/* 41: addb */
var56.x4[0] = var92.x4[0] + var55.x4[0];
var56.x4[1] = var92.x4[1] + var55.x4[1];
@@ -12441,7 +12024,6 @@ cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1,
orc_program_add_constant (p, 4, 0x00000004, "c5");
orc_program_add_constant (p, 4, 0x00000064, "c6");
orc_program_add_constant (p, 4, 0x00000068, "c7");
- orc_program_add_constant (p, 0, 0x00000080, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 1, "t3");
@@ -12699,11 +12281,12 @@ cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1,
/* 36: convssswb */
var89 = ORC_CLAMP_SB (var79.i);
/* 37: mergebw */
- var90.i = ((orc_uint8) var87) | ((orc_uint8) var88 << 8);
+ var90.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var88 << 8);
/* 38: mergebw */
- var91.i = ((orc_uint8) var89) | ((orc_uint8) var61 << 8);
+ var91.i = ((orc_uint8) var89 & 0x00ff) | ((orc_uint8) var61 << 8);
/* 39: mergewl */
- var92.i = ((orc_uint16) var90.i) | ((orc_uint16) var91.i << 16);
+ var92.i =
+ ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16);
/* 41: addb */
var56.x4[0] = var92.x4[0] + var55.x4[0];
var56.x4[1] = var92.x4[1] + var55.x4[1];
@@ -12867,11 +12450,12 @@ _backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ex)
/* 36: convssswb */
var89 = ORC_CLAMP_SB (var79.i);
/* 37: mergebw */
- var90.i = ((orc_uint8) var87) | ((orc_uint8) var88 << 8);
+ var90.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var88 << 8);
/* 38: mergebw */
- var91.i = ((orc_uint8) var89) | ((orc_uint8) var61 << 8);
+ var91.i = ((orc_uint8) var89 & 0x00ff) | ((orc_uint8) var61 << 8);
/* 39: mergewl */
- var92.i = ((orc_uint16) var90.i) | ((orc_uint16) var91.i << 16);
+ var92.i =
+ ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16);
/* 41: addb */
var56.x4[0] = var92.x4[0] + var55.x4[0];
var56.x4[1] = var92.x4[1] + var55.x4[1];
@@ -12911,7 +12495,6 @@ cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1,
orc_program_add_constant (p, 4, 0x00000004, "c5");
orc_program_add_constant (p, 4, 0x00000064, "c6");
orc_program_add_constant (p, 4, 0x00000068, "c7");
- orc_program_add_constant (p, 0, 0x00000080, "c8");
orc_program_add_temporary (p, 2, "t1");
orc_program_add_temporary (p, 2, "t2");
orc_program_add_temporary (p, 1, "t3");
@@ -13175,11 +12758,12 @@ cogorc_convert_I420_BGRA (orc_uint32 * d1, const orc_uint8 * s1,
/* 39: convssswb */
var87 = ORC_CLAMP_SB (var77.i);
/* 40: mergebw */
- var88.i = ((orc_uint8) var87) | ((orc_uint8) var86 << 8);
+ var88.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var86 << 8);
/* 42: mergebw */
- var89.i = ((orc_uint8) var85) | ((orc_uint8) var54 << 8);
+ var89.i = ((orc_uint8) var85 & 0x00ff) | ((orc_uint8) var54 << 8);
/* 43: mergewl */
- var90.i = ((orc_uint16) var88.i) | ((orc_uint16) var89.i << 16);
+ var90.i =
+ ((orc_uint16) var88.i & 0x0000ffff) | ((orc_uint16) var89.i << 16);
/* 45: addb */
var56.x4[0] = var90.x4[0] + var55.x4[0];
var56.x4[1] = var90.x4[1] + var55.x4[1];
@@ -13347,11 +12931,12 @@ _backup_cogorc_convert_I420_BGRA (OrcExecutor * ex)
/* 39: convssswb */
var87 = ORC_CLAMP_SB (var77.i);
/* 40: mergebw */
- var88.i = ((orc_uint8) var87) | ((orc_uint8) var86 << 8);
+ var88.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var86 << 8);
/* 42: mergebw */
- var89.i = ((orc_uint8) var85) | ((orc_uint8) var54 << 8);
+ var89.i = ((orc_uint8) var85 & 0x00ff) | ((orc_uint8) var54 << 8);
/* 43: mergewl */
- var90.i = ((orc_uint16) var88.i) | ((orc_uint16) var89.i << 16);
+ var90.i =
+ ((orc_uint16) var88.i & 0x0000ffff) | ((orc_uint16) var89.i << 16);
/* 45: addb */
var56.x4[0] = var90.x4[0] + var55.x4[0];
var56.x4[1] = var90.x4[1] + var55.x4[1];
@@ -13674,11 +13259,12 @@ cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1,
/* 43: convssswb */
var92 = ORC_CLAMP_SB (var82.i);
/* 44: mergebw */
- var93.i = ((orc_uint8) var92) | ((orc_uint8) var91 << 8);
+ var93.i = ((orc_uint8) var92 & 0x00ff) | ((orc_uint8) var91 << 8);
/* 46: mergebw */
- var94.i = ((orc_uint8) var90) | ((orc_uint8) var55 << 8);
+ var94.i = ((orc_uint8) var90 & 0x00ff) | ((orc_uint8) var55 << 8);
/* 47: mergewl */
- var95.i = ((orc_uint16) var93.i) | ((orc_uint16) var94.i << 16);
+ var95.i =
+ ((orc_uint16) var93.i & 0x0000ffff) | ((orc_uint16) var94.i << 16);
/* 49: addb */
var57.x4[0] = var95.x4[0] + var56.x4[0];
var57.x4[1] = var95.x4[1] + var56.x4[1];
@@ -13866,11 +13452,12 @@ _backup_cogorc_convert_I420_BGRA_avg (OrcExecutor * ex)
/* 43: convssswb */
var92 = ORC_CLAMP_SB (var82.i);
/* 44: mergebw */
- var93.i = ((orc_uint8) var92) | ((orc_uint8) var91 << 8);
+ var93.i = ((orc_uint8) var92 & 0x00ff) | ((orc_uint8) var91 << 8);
/* 46: mergebw */
- var94.i = ((orc_uint8) var90) | ((orc_uint8) var55 << 8);
+ var94.i = ((orc_uint8) var90 & 0x00ff) | ((orc_uint8) var55 << 8);
/* 47: mergewl */
- var95.i = ((orc_uint16) var93.i) | ((orc_uint16) var94.i << 16);
+ var95.i =
+ ((orc_uint16) var93.i & 0x0000ffff) | ((orc_uint16) var94.i << 16);
/* 49: addb */
var57.x4[0] = var95.x4[0] + var56.x4[0];
var57.x4[1] = var95.x4[1] + var56.x4[1];
diff --git a/ext/cog/gstcogorc-dist.h b/ext/cog/gstcogorc-dist.h
index a33587594..4f1dbd204 100644
--- a/ext/cog/gstcogorc-dist.h
+++ b/ext/cog/gstcogorc-dist.h
@@ -24,6 +24,7 @@ typedef uint8_t orc_uint8;
typedef uint16_t orc_uint16;
typedef uint32_t orc_uint32;
typedef uint64_t orc_uint64;
+#define ORC_UINT64_C(x) UINT64_C(x)
#elif defined(_MSC_VER)
typedef signed __int8 orc_int8;
typedef signed __int16 orc_int16;
@@ -33,6 +34,7 @@ typedef unsigned __int8 orc_uint8;
typedef unsigned __int16 orc_uint16;
typedef unsigned __int32 orc_uint32;
typedef unsigned __int64 orc_uint64;
+#define ORC_UINT64_C(x) (x##Ui64)
#else
#include <limits.h>
typedef signed char orc_int8;
@@ -44,14 +46,16 @@ typedef unsigned int orc_uint32;
#if INT_MAX == LONG_MAX
typedef long long orc_int64;
typedef unsigned long long orc_uint64;
+#define ORC_UINT64_C(x) (x##ULL)
#else
typedef long orc_int64;
typedef unsigned long orc_uint64;
+#define ORC_UINT64_C(x) (x##UL)
#endif
#endif
typedef union { orc_int16 i; orc_int8 x2[2]; } orc_union16;
typedef union { orc_int32 i; float f; orc_int16 x2[2]; orc_int8 x4[4]; } orc_union32;
-typedef union { orc_int64 i; double f; orc_int32 x2[2]; orc_int16 x4[4]; } orc_union64;
+typedef union { orc_int64 i; double f; orc_int32 x2[2]; float x2f[2]; orc_int16 x4[4]; } orc_union64;
#endif
void cogorc_memcpy_2d (orc_uint8 * d1, int d1_stride, const orc_uint8 * s1, int s1_stride, int n, int m);
void cogorc_downsample_horiz_cosite_1tap (orc_uint8 * d1, const orc_uint16 * s1, int n);
diff --git a/ext/cog/gstcogutils.c b/ext/cog/gstcogutils.c
index 4d7c8b99f..ff23862f8 100644
--- a/ext/cog/gstcogutils.c
+++ b/ext/cog/gstcogutils.c
@@ -126,6 +126,7 @@ gst_cog_buffer_wrap (GstBuffer * buf, GstVideoFormat format, int width,
break;
default:
g_assert_not_reached ();
+ return NULL;
}
cog_frame_set_free_callback (frame, gst_cog_frame_free, buf);
diff --git a/ext/cog/gstcolorconvert.c b/ext/cog/gstcolorconvert.c
index 6f5d9c85f..560ca68c9 100644
--- a/ext/cog/gstcolorconvert.c
+++ b/ext/cog/gstcolorconvert.c
@@ -27,7 +27,7 @@
#include <string.h>
#include <cog/cog.h>
#include <cog/cogvirtframe.h>
-#include <math.h>
+#include <gst/math-compat.h>
#include "gstcogutils.h"
diff --git a/ext/directfb/dfb-example.c b/ext/directfb/dfb-example.c
index 17dbce3b1..59bbd4a6f 100644
--- a/ext/directfb/dfb-example.c
+++ b/ext/directfb/dfb-example.c
@@ -57,7 +57,8 @@ main (int argc, char *argv[])
/* Adding elements to the pipeline */
gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
- g_assert (gst_element_link (src, sink));
+ if (!gst_element_link (src, sink))
+ g_error ("Couldn't link videotestsrc and dfbvideosink");
/* Let's play ! */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c
index d26da1043..f3086036f 100644
--- a/ext/faac/gstfaac.c
+++ b/ext/faac/gstfaac.c
@@ -764,7 +764,6 @@ gst_faac_push_buffers (GstFaac * faac, gboolean force)
encode_failed:
{
GST_ELEMENT_ERROR (faac, LIBRARY, ENCODE, (NULL), (NULL));
- gst_buffer_unref (outbuf);
return GST_FLOW_ERROR;
}
}
diff --git a/ext/jack/.gitignore b/ext/jack/.gitignore
deleted file mode 100644
index 916f265c7..000000000
--- a/ext/jack/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.loT
diff --git a/ext/jack/Makefile.am b/ext/jack/Makefile.am
deleted file mode 100644
index ede70594b..000000000
--- a/ext/jack/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-
-plugin_LTLIBRARIES = libgstjack.la
-
-libgstjack_la_SOURCES = gstjackutil.c gstjack.c gstjackaudiosrc.c gstjackaudiosink.c gstjackaudioclient.c
-libgstjack_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(JACK_CFLAGS)
-libgstjack_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(JACK_LIBS)
-libgstjack_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstjack_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = gstjackutil.h gstjackaudiosrc.h gstjackaudiosink.h gstjackaudioclient.h gstjack.h gstjackringbuffer.h
-
-EXTRA_DIST = README
diff --git a/ext/jack/README b/ext/jack/README
deleted file mode 100644
index 2bb97beba..000000000
--- a/ext/jack/README
+++ /dev/null
@@ -1,4 +0,0 @@
-to be written, la dee da
-
-jackit.sf.net
-
diff --git a/ext/jack/gstjack.c b/ext/jack/gstjack.c
deleted file mode 100644
index 371a9e934..000000000
--- a/ext/jack/gstjack.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* GStreamer Jack plugins
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstjackaudiosrc.h"
-#include "gstjackaudiosink.h"
-
-GType
-gst_jack_connect_get_type (void)
-{
- static GType jack_connect_type = 0;
- static const GEnumValue jack_connect[] = {
- {GST_JACK_CONNECT_NONE,
- "Don't automatically connect ports to physical ports", "none"},
- {GST_JACK_CONNECT_AUTO,
- "Automatically connect ports to physical ports", "auto"},
- {GST_JACK_CONNECT_AUTO_FORCED,
- "Automatically connect ports to as many physical ports as possible",
- "auto-forced"},
- {0, NULL, NULL},
- };
-
- if (!jack_connect_type) {
- jack_connect_type = g_enum_register_static ("GstJackConnect", jack_connect);
- }
- return jack_connect_type;
-}
-
-
-static gpointer
-gst_jack_client_copy (gpointer jclient)
-{
- return jclient;
-}
-
-
-static void
-gst_jack_client_free (gpointer jclient)
-{
- return;
-}
-
-
-GType
-gst_jack_client_get_type (void)
-{
- static GType type; /* 0 */
-
- if (type == 0) {
- /* hackish, but makes it show up nicely in gst-inspect */
- type = g_boxed_type_register_static ("JackClient",
- (GBoxedCopyFunc) gst_jack_client_copy,
- (GBoxedFreeFunc) gst_jack_client_free);
- }
-
- return type;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "jackaudiosrc", GST_RANK_PRIMARY,
- GST_TYPE_JACK_AUDIO_SRC))
- return FALSE;
- if (!gst_element_register (plugin, "jackaudiosink", GST_RANK_PRIMARY,
- GST_TYPE_JACK_AUDIO_SINK))
- return FALSE;
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "jack",
- "Jack elements",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/jack/gstjack.h b/ext/jack/gstjack.h
deleted file mode 100644
index d923866df..000000000
--- a/ext/jack/gstjack.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * gstjack.h:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _GST_JACK_H_
-#define _GST_JACK_H_
-
-
-/**
- * GstJackConnect:
- * @GST_JACK_CONNECT_NONE: Don't automatically connect to physical ports.
- * In this mode, the element will accept any number of input channels and will
- * create (but not connect) an output port for each channel.
- * @GST_JACK_CONNECT_AUTO: In this mode, the element will try to connect each
- * output port to a random physical jack input pin. The sink will
- * expose the number of physical channels on its pad caps.
- * @GST_JACK_CONNECT_AUTO_FORCED: In this mode, the element will try to connect each
- * output port to a random physical jack input pin. The element will accept any number
- * of input channels.
- *
- * Specify how the output ports will be connected.
- */
-
-typedef enum {
- GST_JACK_CONNECT_NONE,
- GST_JACK_CONNECT_AUTO,
- GST_JACK_CONNECT_AUTO_FORCED
-} GstJackConnect;
-
-typedef jack_default_audio_sample_t sample_t;
-
-#define GST_TYPE_JACK_CONNECT (gst_jack_connect_get_type())
-#define GST_TYPE_JACK_CLIENT (gst_jack_client_get_type ())
-
-GType gst_jack_client_get_type(void);
-GType gst_jack_connect_get_type(void);
-
-#endif // _GST_JACK_H_
diff --git a/ext/jack/gstjackaudioclient.c b/ext/jack/gstjackaudioclient.c
deleted file mode 100644
index 1789edb60..000000000
--- a/ext/jack/gstjackaudioclient.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * gstjackaudioclient.c: jack audio client implementation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-
-#include "gstjackaudioclient.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_jack_audio_client_debug);
-#define GST_CAT_DEFAULT gst_jack_audio_client_debug
-
-void
-gst_jack_audio_client_init (void)
-{
- GST_DEBUG_CATEGORY_INIT (gst_jack_audio_client_debug, "jackclient", 0,
- "jackclient helpers");
-}
-
-/* a list of global connections indexed by id and server. */
-G_LOCK_DEFINE_STATIC (connections_lock);
-static GList *connections;
-
-/* the connection to a server */
-typedef struct
-{
- gint refcount;
- GMutex *lock;
- GCond *flush_cond;
-
- /* id/server pair and the connection */
- gchar *id;
- gchar *server;
- jack_client_t *client;
-
- /* lists of GstJackAudioClients */
- gint n_clients;
- GList *src_clients;
- GList *sink_clients;
-} GstJackAudioConnection;
-
-/* an object sharing a jack_client_t connection. */
-struct _GstJackAudioClient
-{
- GstJackAudioConnection *conn;
-
- GstJackClientType type;
- gboolean active;
- gboolean deactivate;
-
- void (*shutdown) (void *arg);
- JackProcessCallback process;
- JackBufferSizeCallback buffer_size;
- JackSampleRateCallback sample_rate;
- gpointer user_data;
-};
-
-typedef jack_default_audio_sample_t sample_t;
-
-typedef struct
-{
- jack_nframes_t nframes;
- gpointer user_data;
-} JackCB;
-
-static int
-jack_process_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioConnection *conn = (GstJackAudioConnection *) arg;
- GList *walk;
- int res = 0;
-
- g_mutex_lock (conn->lock);
- /* call sources first, then sinks. Sources will either push data into the
- * ringbuffer of the sinks, which will then pull the data out of it, or
- * sinks will pull the data from the sources. */
- for (walk = conn->src_clients; walk; walk = g_list_next (walk)) {
- GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
-
- /* only call active clients */
- if ((client->active || client->deactivate) && client->process) {
- res = client->process (nframes, client->user_data);
- if (client->deactivate) {
- client->deactivate = FALSE;
- g_cond_signal (conn->flush_cond);
- }
- }
- }
- for (walk = conn->sink_clients; walk; walk = g_list_next (walk)) {
- GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
-
- /* only call active clients */
- if ((client->active || client->deactivate) && client->process) {
- res = client->process (nframes, client->user_data);
- if (client->deactivate) {
- client->deactivate = FALSE;
- g_cond_signal (conn->flush_cond);
- }
- }
- }
- g_mutex_unlock (conn->lock);
-
- return res;
-}
-
-/* we error out */
-static int
-jack_sample_rate_cb (jack_nframes_t nframes, void *arg)
-{
- return 0;
-}
-
-/* we error out */
-static int
-jack_buffer_size_cb (jack_nframes_t nframes, void *arg)
-{
- return 0;
-}
-
-static void
-jack_shutdown_cb (void *arg)
-{
- GstJackAudioConnection *conn = (GstJackAudioConnection *) arg;
- GList *walk;
-
- GST_DEBUG ("disconnect client %s from server %s", conn->id,
- GST_STR_NULL (conn->server));
-
- g_mutex_lock (conn->lock);
- for (walk = conn->src_clients; walk; walk = g_list_next (walk)) {
- GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
-
- if (client->shutdown)
- client->shutdown (client->user_data);
- }
- for (walk = conn->sink_clients; walk; walk = g_list_next (walk)) {
- GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
-
- if (client->shutdown)
- client->shutdown (client->user_data);
- }
- g_mutex_unlock (conn->lock);
-}
-
-typedef struct
-{
- const gchar *id;
- const gchar *server;
-} FindData;
-
-static gint
-connection_find (GstJackAudioConnection * conn, FindData * data)
-{
- /* id's must match */
- if (strcmp (conn->id, data->id))
- return 1;
-
- /* both the same or NULL */
- if (conn->server == data->server)
- return 0;
-
- /* we cannot compare NULL */
- if (conn->server == NULL || data->server == NULL)
- return 1;
-
- if (strcmp (conn->server, data->server))
- return 1;
-
- return 0;
-}
-
-/* make a connection with @id and @server. Returns NULL on failure with the
- * status set. */
-static GstJackAudioConnection *
-gst_jack_audio_make_connection (const gchar * id, const gchar * server,
- jack_client_t * jclient, jack_status_t * status)
-{
- GstJackAudioConnection *conn;
- jack_options_t options;
- gint res;
-
- *status = 0;
-
- GST_DEBUG ("new client %s, connecting to server %s", id,
- GST_STR_NULL (server));
-
- /* never start a server */
- options = JackNoStartServer;
- /* if we have a servername, use it */
- if (server != NULL)
- options |= JackServerName;
- /* open the client */
- if (jclient == NULL)
- jclient = jack_client_open (id, options, status, server);
- if (jclient == NULL)
- goto could_not_open;
-
- /* now create object */
- conn = g_new (GstJackAudioConnection, 1);
- conn->refcount = 1;
- conn->lock = g_mutex_new ();
- conn->flush_cond = g_cond_new ();
- conn->id = g_strdup (id);
- conn->server = g_strdup (server);
- conn->client = jclient;
- conn->n_clients = 0;
- conn->src_clients = NULL;
- conn->sink_clients = NULL;
-
- /* set our callbacks */
- jack_set_process_callback (jclient, jack_process_cb, conn);
- /* these callbacks cause us to error */
- jack_set_buffer_size_callback (jclient, jack_buffer_size_cb, conn);
- jack_set_sample_rate_callback (jclient, jack_sample_rate_cb, conn);
- jack_on_shutdown (jclient, jack_shutdown_cb, conn);
-
- /* all callbacks are set, activate the client */
- if ((res = jack_activate (jclient)))
- goto could_not_activate;
-
- GST_DEBUG ("opened connection %p", conn);
-
- return conn;
-
- /* ERRORS */
-could_not_open:
- {
- GST_DEBUG ("failed to open jack client, %d", *status);
- return NULL;
- }
-could_not_activate:
- {
- GST_ERROR ("Could not activate client (%d)", res);
- *status = JackFailure;
- g_mutex_free (conn->lock);
- g_free (conn->id);
- g_free (conn->server);
- g_free (conn);
- return NULL;
- }
-}
-
-static GstJackAudioConnection *
-gst_jack_audio_get_connection (const gchar * id, const gchar * server,
- jack_client_t * jclient, jack_status_t * status)
-{
- GstJackAudioConnection *conn;
- GList *found;
- FindData data;
-
- GST_DEBUG ("getting connection for id %s, server %s", id,
- GST_STR_NULL (server));
-
- data.id = id;
- data.server = server;
-
- G_LOCK (connections_lock);
- found =
- g_list_find_custom (connections, &data, (GCompareFunc) connection_find);
- if (found != NULL && jclient != NULL) {
- /* we found it, increase refcount and return it */
- conn = (GstJackAudioConnection *) found->data;
- conn->refcount++;
-
- GST_DEBUG ("found connection %p", conn);
- } else {
- /* make new connection */
- conn = gst_jack_audio_make_connection (id, server, jclient, status);
- if (conn != NULL) {
- GST_DEBUG ("created connection %p", conn);
- /* add to list on success */
- connections = g_list_prepend (connections, conn);
- } else {
- GST_WARNING ("could not create connection");
- }
- }
- G_UNLOCK (connections_lock);
-
- return conn;
-}
-
-static void
-gst_jack_audio_unref_connection (GstJackAudioConnection * conn)
-{
- gint res;
- gboolean zero;
-
- GST_DEBUG ("unref connection %p refcnt %d", conn, conn->refcount);
-
- G_LOCK (connections_lock);
- conn->refcount--;
- if ((zero = (conn->refcount == 0))) {
- GST_DEBUG ("closing connection %p", conn);
- /* remove from list, we can release the mutex after removing the connection
- * from the list because after that, nobody can access the connection anymore. */
- connections = g_list_remove (connections, conn);
- }
- G_UNLOCK (connections_lock);
-
- /* if we are zero, close and cleanup the connection */
- if (zero) {
- /* don't use conn->lock here. two reasons:
- *
- * 1) its not necessary: jack_deactivate() will not return until the JACK thread
- * associated with this connection is cleaned up by a thread join, hence
- * no more callbacks can occur or be in progress.
- *
- * 2) it would deadlock anyway, because jack_deactivate() will sleep
- * waiting for the JACK thread, and can thus cause deadlock in
- * jack_process_cb()
- */
- if ((res = jack_deactivate (conn->client))) {
- /* we only warn, this means the server is probably shut down and the client
- * is gone anyway. */
- GST_WARNING ("Could not deactivate Jack client (%d)", res);
- }
- /* close connection */
- if ((res = jack_client_close (conn->client))) {
- /* we assume the client is gone. */
- GST_WARNING ("close failed (%d)", res);
- }
-
- /* free resources */
- g_mutex_free (conn->lock);
- g_cond_free (conn->flush_cond);
- g_free (conn->id);
- g_free (conn->server);
- g_free (conn);
- }
-}
-
-static void
-gst_jack_audio_connection_add_client (GstJackAudioConnection * conn,
- GstJackAudioClient * client)
-{
- g_mutex_lock (conn->lock);
- switch (client->type) {
- case GST_JACK_CLIENT_SOURCE:
- conn->src_clients = g_list_append (conn->src_clients, client);
- conn->n_clients++;
- break;
- case GST_JACK_CLIENT_SINK:
- conn->sink_clients = g_list_append (conn->sink_clients, client);
- conn->n_clients++;
- break;
- default:
- g_warning ("trying to add unknown client type");
- break;
- }
- g_mutex_unlock (conn->lock);
-}
-
-static void
-gst_jack_audio_connection_remove_client (GstJackAudioConnection * conn,
- GstJackAudioClient * client)
-{
- g_mutex_lock (conn->lock);
- switch (client->type) {
- case GST_JACK_CLIENT_SOURCE:
- conn->src_clients = g_list_remove (conn->src_clients, client);
- conn->n_clients--;
- break;
- case GST_JACK_CLIENT_SINK:
- conn->sink_clients = g_list_remove (conn->sink_clients, client);
- conn->n_clients--;
- break;
- default:
- g_warning ("trying to remove unknown client type");
- break;
- }
- g_mutex_unlock (conn->lock);
-}
-
-/**
- * gst_jack_audio_client_get:
- * @id: the client id
- * @server: the server to connect to or NULL for the default server
- * @type: the client type
- * @shutdown: a callback when the jack server shuts down
- * @process: a callback when samples are available
- * @buffer_size: a callback when the buffer_size changes
- * @sample_rate: a callback when the sample_rate changes
- * @user_data: user data passed to the callbacks
- * @status: pointer to hold the jack status code in case of errors
- *
- * Get the jack client connection for @id and @server. Connections to the same
- * @id and @server will receive the same physical Jack client connection and
- * will therefore be scheduled in the same process callback.
- *
- * Returns: a #GstJackAudioClient.
- */
-GstJackAudioClient *
-gst_jack_audio_client_new (const gchar * id, const gchar * server,
- jack_client_t * jclient, GstJackClientType type,
- void (*shutdown) (void *arg), JackProcessCallback process,
- JackBufferSizeCallback buffer_size, JackSampleRateCallback sample_rate,
- gpointer user_data, jack_status_t * status)
-{
- GstJackAudioClient *client;
- GstJackAudioConnection *conn;
-
- g_return_val_if_fail (id != NULL, NULL);
- g_return_val_if_fail (status != NULL, NULL);
-
- /* first get a connection for the id/server pair */
- conn = gst_jack_audio_get_connection (id, server, jclient, status);
- if (conn == NULL)
- goto no_connection;
-
- GST_INFO ("new client %s", id);
-
- /* make new client using the connection */
- client = g_new (GstJackAudioClient, 1);
- client->active = client->deactivate = FALSE;
- client->conn = conn;
- client->type = type;
- client->shutdown = shutdown;
- client->process = process;
- client->buffer_size = buffer_size;
- client->sample_rate = sample_rate;
- client->user_data = user_data;
-
- /* add the client to the connection */
- gst_jack_audio_connection_add_client (conn, client);
-
- return client;
-
- /* ERRORS */
-no_connection:
- {
- GST_DEBUG ("Could not get server connection (%d)", *status);
- return NULL;
- }
-}
-
-/**
- * gst_jack_audio_client_free:
- * @client: a #GstJackAudioClient
- *
- * Free the resources used by @client.
- */
-void
-gst_jack_audio_client_free (GstJackAudioClient * client)
-{
- GstJackAudioConnection *conn;
-
- g_return_if_fail (client != NULL);
-
- GST_INFO ("free client");
-
- conn = client->conn;
-
- /* remove from connection first so that it's not scheduled anymore after this
- * call */
- gst_jack_audio_connection_remove_client (conn, client);
- gst_jack_audio_unref_connection (conn);
-
- g_free (client);
-}
-
-/**
- * gst_jack_audio_client_get_client:
- * @client: a #GstJackAudioClient
- *
- * Get the jack audio client for @client. This function is used to perform
- * operations on the jack server from this client.
- *
- * Returns: The jack audio client.
- */
-jack_client_t *
-gst_jack_audio_client_get_client (GstJackAudioClient * client)
-{
- g_return_val_if_fail (client != NULL, NULL);
-
- /* no lock needed, the connection and the client does not change
- * once the client is created. */
- return client->conn->client;
-}
-
-/**
- * gst_jack_audio_client_set_active:
- * @client: a #GstJackAudioClient
- * @active: new mode for the client
- *
- * Activate or deactive @client. When a client is activated it will receive
- * callbacks when data should be processed.
- *
- * Returns: 0 if all ok.
- */
-gint
-gst_jack_audio_client_set_active (GstJackAudioClient * client, gboolean active)
-{
- g_return_val_if_fail (client != NULL, -1);
-
- /* make sure that we are not dispatching the client */
- g_mutex_lock (client->conn->lock);
- if (client->active && !active) {
- /* we need to process once more to flush the port */
- client->deactivate = TRUE;
-
- /* need to wait for process_cb run once more */
- while (client->deactivate)
- g_cond_wait (client->conn->flush_cond, client->conn->lock);
- }
- client->active = active;
- g_mutex_unlock (client->conn->lock);
-
- return 0;
-}
diff --git a/ext/jack/gstjackaudioclient.h b/ext/jack/gstjackaudioclient.h
deleted file mode 100644
index 5fb7e3544..000000000
--- a/ext/jack/gstjackaudioclient.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * gstjackaudioclient.h:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_JACK_AUDIO_CLIENT_H__
-#define __GST_JACK_AUDIO_CLIENT_H__
-
-#include <jack/jack.h>
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-typedef enum
-{
- GST_JACK_CLIENT_SOURCE,
- GST_JACK_CLIENT_SINK
-} GstJackClientType;
-
-typedef struct _GstJackAudioClient GstJackAudioClient;
-
-void gst_jack_audio_client_init (void);
-
-
-GstJackAudioClient * gst_jack_audio_client_new (const gchar *id, const gchar *server,
- jack_client_t *jclient,
- GstJackClientType type,
- void (*shutdown) (void *arg),
- JackProcessCallback process,
- JackBufferSizeCallback buffer_size,
- JackSampleRateCallback sample_rate,
- gpointer user_data,
- jack_status_t *status);
-void gst_jack_audio_client_free (GstJackAudioClient *client);
-
-jack_client_t * gst_jack_audio_client_get_client (GstJackAudioClient *client);
-
-gboolean gst_jack_audio_client_set_active (GstJackAudioClient *client, gboolean active);
-
-G_END_DECLS
-
-#endif /* __GST_JACK_AUDIO_CLIENT_H__ */
diff --git a/ext/jack/gstjackaudiosink.c b/ext/jack/gstjackaudiosink.c
deleted file mode 100644
index 32bf1af3e..000000000
--- a/ext/jack/gstjackaudiosink.c
+++ /dev/null
@@ -1,852 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * gstjackaudiosink.c: jack audio sink implementation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-jackaudiosink
- * @see_also: #GstBaseAudioSink, #GstRingBuffer
- *
- * A Sink that outputs data to Jack ports.
- *
- * It will create N Jack ports named out_&lt;name&gt;_&lt;num&gt; where
- * &lt;name&gt; is the element name and &lt;num&gt; is starting from 1.
- * Each port corresponds to a gstreamer channel.
- *
- * The samplerate as exposed on the caps is always the same as the samplerate of
- * the jack server.
- *
- * When the #GstJackAudioSink:connect property is set to auto, this element
- * will try to connect each output port to a random physical jack input pin. In
- * this mode, the sink will expose the number of physical channels on its pad
- * caps.
- *
- * When the #GstJackAudioSink:connect property is set to none, the element will
- * accept any number of input channels and will create (but not connect) an
- * output port for each channel.
- *
- * The element will generate an error when the Jack server is shut down when it
- * was PAUSED or PLAYING. This element does not support dynamic rate and buffer
- * size changes at runtime.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch audiotestsrc ! jackaudiosink
- * ]| Play a sine wave to using jack.
- * </refsect2>
- *
- * Last reviewed on 2006-11-30 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst-i18n-plugin.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "gstjackaudiosink.h"
-#include "gstjackringbuffer.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_jack_audio_sink_debug);
-#define GST_CAT_DEFAULT gst_jack_audio_sink_debug
-
-static gboolean
-gst_jack_audio_sink_allocate_channels (GstJackAudioSink * sink, gint channels)
-{
- jack_client_t *client;
-
- client = gst_jack_audio_client_get_client (sink->client);
-
- /* remove ports we don't need */
- while (sink->port_count > channels) {
- jack_port_unregister (client, sink->ports[--sink->port_count]);
- }
-
- /* alloc enough output ports */
- sink->ports = g_realloc (sink->ports, sizeof (jack_port_t *) * channels);
-
- /* create an output port for each channel */
- while (sink->port_count < channels) {
- gchar *name;
-
- /* port names start from 1 and are local to the element */
- name =
- g_strdup_printf ("out_%s_%d", GST_ELEMENT_NAME (sink),
- sink->port_count + 1);
- sink->ports[sink->port_count] =
- jack_port_register (client, name, JACK_DEFAULT_AUDIO_TYPE,
- JackPortIsOutput, 0);
- if (sink->ports[sink->port_count] == NULL)
- return FALSE;
-
- sink->port_count++;
-
- g_free (name);
- }
- return TRUE;
-}
-
-static void
-gst_jack_audio_sink_free_channels (GstJackAudioSink * sink)
-{
- gint res, i = 0;
- jack_client_t *client;
-
- client = gst_jack_audio_client_get_client (sink->client);
-
- /* get rid of all ports */
- while (sink->port_count) {
- GST_LOG_OBJECT (sink, "unregister port %d", i);
- if ((res = jack_port_unregister (client, sink->ports[i++]))) {
- GST_DEBUG_OBJECT (sink, "unregister of port failed (%d)", res);
- }
- sink->port_count--;
- }
- g_free (sink->ports);
- sink->ports = NULL;
-}
-
-/* ringbuffer abstract base class */
-static GType
-gst_jack_ring_buffer_get_type (void)
-{
- static GType ringbuffer_type = 0;
-
- if (!ringbuffer_type) {
- static const GTypeInfo ringbuffer_info = {
- sizeof (GstJackRingBufferClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_jack_ring_buffer_class_init,
- NULL,
- NULL,
- sizeof (GstJackRingBuffer),
- 0,
- (GInstanceInitFunc) gst_jack_ring_buffer_init,
- NULL
- };
-
- ringbuffer_type =
- g_type_register_static (GST_TYPE_RING_BUFFER,
- "GstJackAudioSinkRingBuffer", &ringbuffer_info, 0);
- }
- return ringbuffer_type;
-}
-
-static void
-gst_jack_ring_buffer_class_init (GstJackRingBufferClass * klass)
-{
- GObjectClass *gobject_class;
- GstObjectClass *gstobject_class;
- GstRingBufferClass *gstringbuffer_class;
-
- gobject_class = (GObjectClass *) klass;
- gstobject_class = (GstObjectClass *) klass;
- gstringbuffer_class = (GstRingBufferClass *) klass;
-
- ring_parent_class = g_type_class_peek_parent (klass);
-
- gstringbuffer_class->open_device =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_open_device);
- gstringbuffer_class->close_device =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_close_device);
- gstringbuffer_class->acquire =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_acquire);
- gstringbuffer_class->release =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_release);
- gstringbuffer_class->start = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_start);
- gstringbuffer_class->pause = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_pause);
- gstringbuffer_class->resume = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_start);
- gstringbuffer_class->stop = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_stop);
-
- gstringbuffer_class->delay = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_delay);
-}
-
-/* this is the callback of jack. This should RT-safe.
- */
-static int
-jack_process_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioSink *sink;
- GstRingBuffer *buf;
- GstJackRingBuffer *abuf;
- gint readseg, len;
- guint8 *readptr;
- gint i, j, flen, channels;
- sample_t **buffers, *data;
-
- buf = GST_RING_BUFFER_CAST (arg);
- abuf = GST_JACK_RING_BUFFER_CAST (arg);
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- channels = buf->spec.channels;
-
- /* alloc pointers to samples */
- buffers = g_alloca (sizeof (sample_t *) * channels);
-
- /* get target buffers */
- for (i = 0; i < channels; i++) {
- buffers[i] = (sample_t *) jack_port_get_buffer (sink->ports[i], nframes);
- }
-
- if (gst_ring_buffer_prepare_read (buf, &readseg, &readptr, &len)) {
- flen = len / channels;
-
- /* the number of samples must be exactly the segment size */
- if (nframes * sizeof (sample_t) != flen)
- goto wrong_size;
-
- GST_DEBUG_OBJECT (sink, "copy %d frames: %p, %d bytes, %d channels",
- nframes, readptr, flen, channels);
- data = (sample_t *) readptr;
-
- /* the samples in the ringbuffer have the channels interleaved, we need to
- * deinterleave into the jack target buffers */
- for (i = 0; i < nframes; i++) {
- for (j = 0; j < channels; j++) {
- buffers[j][i] = *data++;
- }
- }
-
- /* clear written samples in the ringbuffer */
- gst_ring_buffer_clear (buf, readseg);
-
- /* we wrote one segment */
- gst_ring_buffer_advance (buf, 1);
- } else {
- GST_DEBUG_OBJECT (sink, "write %d frames silence", nframes);
- /* We are not allowed to read from the ringbuffer, write silence to all
- * jack output buffers */
- for (i = 0; i < channels; i++) {
- memset (buffers[i], 0, nframes * sizeof (sample_t));
- }
- }
- return 0;
-
- /* ERRORS */
-wrong_size:
- {
- GST_ERROR_OBJECT (sink, "nbytes (%d) != flen (%d)",
- (gint) (nframes * sizeof (sample_t)), flen);
- return 1;
- }
-}
-
-/* we error out */
-static int
-jack_sample_rate_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioSink *sink;
- GstJackRingBuffer *abuf;
-
- abuf = GST_JACK_RING_BUFFER_CAST (arg);
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (arg));
-
- if (abuf->sample_rate != -1 && abuf->sample_rate != nframes)
- goto not_supported;
-
- return 0;
-
- /* ERRORS */
-not_supported:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
- (NULL), ("Jack changed the sample rate, which is not supported"));
- return 1;
- }
-}
-
-/* we error out */
-static int
-jack_buffer_size_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioSink *sink;
- GstJackRingBuffer *abuf;
-
- abuf = GST_JACK_RING_BUFFER_CAST (arg);
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (arg));
-
- if (abuf->buffer_size != -1 && abuf->buffer_size != nframes)
- goto not_supported;
-
- return 0;
-
- /* ERRORS */
-not_supported:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
- (NULL), ("Jack changed the buffer size, which is not supported"));
- return 1;
- }
-}
-
-static void
-jack_shutdown_cb (void *arg)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (arg));
-
- GST_DEBUG_OBJECT (sink, "shutdown");
-
- GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND,
- (NULL), ("Jack server shutdown"));
-}
-
-static void
-gst_jack_ring_buffer_init (GstJackRingBuffer * buf,
- GstJackRingBufferClass * g_class)
-{
- buf->channels = -1;
- buf->buffer_size = -1;
- buf->sample_rate = -1;
-}
-
-/* the _open_device method should make a connection with the server
- */
-static gboolean
-gst_jack_ring_buffer_open_device (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
- jack_status_t status = 0;
- const gchar *name;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "open");
-
- name = g_get_application_name ();
- if (!name)
- name = "GStreamer";
-
- sink->client = gst_jack_audio_client_new (name, sink->server,
- sink->jclient,
- GST_JACK_CLIENT_SINK,
- jack_shutdown_cb,
- jack_process_cb, jack_buffer_size_cb, jack_sample_rate_cb, buf, &status);
- if (sink->client == NULL)
- goto could_not_open;
-
- GST_DEBUG_OBJECT (sink, "opened");
-
- return TRUE;
-
- /* ERRORS */
-could_not_open:
- {
- if (status & JackServerFailed) {
- GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND,
- (_("Jack server not found")),
- ("Cannot connect to the Jack server (status %d)", status));
- } else {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (NULL), ("Jack client open error (status %d)", status));
- }
- return FALSE;
- }
-}
-
-/* close the connection with the server
- */
-static gboolean
-gst_jack_ring_buffer_close_device (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "close");
-
- gst_jack_audio_sink_free_channels (sink);
- gst_jack_audio_client_free (sink->client);
- sink->client = NULL;
-
- return TRUE;
-}
-
-/* allocate a buffer and setup resources to process the audio samples of
- * the format as specified in @spec.
- *
- * We allocate N jack ports, one for each channel. If we are asked to
- * automatically make a connection with physical ports, we connect as many
- * ports as there are physical ports, leaving leftover ports unconnected.
- *
- * It is assumed that samplerate and number of channels are acceptable since our
- * getcaps method will always provide correct values. If unacceptable caps are
- * received for some reason, we fail here.
- */
-static gboolean
-gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
-{
- GstJackAudioSink *sink;
- GstJackRingBuffer *abuf;
- const char **ports;
- gint sample_rate, buffer_size;
- gint i, channels, res;
- jack_client_t *client;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- abuf = GST_JACK_RING_BUFFER_CAST (buf);
-
- GST_DEBUG_OBJECT (sink, "acquire");
-
- client = gst_jack_audio_client_get_client (sink->client);
-
- /* sample rate must be that of the server */
- sample_rate = jack_get_sample_rate (client);
- if (sample_rate != spec->rate)
- goto wrong_samplerate;
-
- channels = spec->channels;
-
- if (!gst_jack_audio_sink_allocate_channels (sink, channels))
- goto out_of_ports;
-
- buffer_size = jack_get_buffer_size (client);
-
- /* the segment size in bytes, this is large enough to hold a buffer of 32bit floats
- * for all channels */
- spec->segsize = buffer_size * sizeof (gfloat) * channels;
- spec->latency_time = gst_util_uint64_scale (spec->segsize,
- (GST_SECOND / GST_USECOND), spec->rate * spec->bytes_per_sample);
- /* segtotal based on buffer-time latency */
- spec->segtotal = spec->buffer_time / spec->latency_time;
- if (spec->segtotal < 2) {
- spec->segtotal = 2;
- spec->buffer_time = spec->latency_time * spec->segtotal;
- }
-
- GST_DEBUG_OBJECT (sink, "buffer time: %" G_GINT64_FORMAT " usec",
- spec->buffer_time);
- GST_DEBUG_OBJECT (sink, "latency time: %" G_GINT64_FORMAT " usec",
- spec->latency_time);
- GST_DEBUG_OBJECT (sink, "buffer_size %d, segsize %d, segtotal %d",
- buffer_size, spec->segsize, spec->segtotal);
-
- /* allocate the ringbuffer memory now */
- buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
- memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
-
- if ((res = gst_jack_audio_client_set_active (sink->client, TRUE)))
- goto could_not_activate;
-
- /* if we need to automatically connect the ports, do so now. We must do this
- * after activating the client. */
- if (sink->connect == GST_JACK_CONNECT_AUTO
- || sink->connect == GST_JACK_CONNECT_AUTO_FORCED) {
- /* find all the physical input ports. A physical input port is a port
- * associated with a hardware device. Someone needs connect to a physical
- * port in order to hear something. */
- ports = jack_get_ports (client, NULL, NULL,
- JackPortIsPhysical | JackPortIsInput);
- if (ports == NULL) {
- /* no ports? fine then we don't do anything except for posting a warning
- * message. */
- GST_ELEMENT_WARNING (sink, RESOURCE, NOT_FOUND, (NULL),
- ("No physical input ports found, leaving ports unconnected"));
- goto done;
- }
-
- for (i = 0; i < channels; i++) {
- /* stop when all input ports are exhausted */
- if (ports[i] == NULL) {
- /* post a warning that we could not connect all ports */
- GST_ELEMENT_WARNING (sink, RESOURCE, NOT_FOUND, (NULL),
- ("No more physical ports, leaving some ports unconnected"));
- break;
- }
- GST_DEBUG_OBJECT (sink, "try connecting to %s",
- jack_port_name (sink->ports[i]));
- /* connect the port to a physical port */
- res = jack_connect (client, jack_port_name (sink->ports[i]), ports[i]);
- if (res != 0 && res != EEXIST)
- goto cannot_connect;
- }
- free (ports);
- }
-done:
-
- abuf->sample_rate = sample_rate;
- abuf->buffer_size = buffer_size;
- abuf->channels = spec->channels;
-
- return TRUE;
-
- /* ERRORS */
-wrong_samplerate:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, (NULL),
- ("Wrong samplerate, server is running at %d and we received %d",
- sample_rate, spec->rate));
- return FALSE;
- }
-out_of_ports:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, (NULL),
- ("Cannot allocate more Jack ports"));
- return FALSE;
- }
-could_not_activate:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, (NULL),
- ("Could not activate client (%d:%s)", res, g_strerror (res)));
- return FALSE;
- }
-cannot_connect:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, (NULL),
- ("Could not connect output ports to physical ports (%d:%s)",
- res, g_strerror (res)));
- free (ports);
- return FALSE;
- }
-}
-
-/* function is called with LOCK */
-static gboolean
-gst_jack_ring_buffer_release (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
- GstJackRingBuffer *abuf;
- gint res;
-
- abuf = GST_JACK_RING_BUFFER_CAST (buf);
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "release");
-
- if ((res = gst_jack_audio_client_set_active (sink->client, FALSE))) {
- /* we only warn, this means the server is probably shut down and the client
- * is gone anyway. */
- GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL),
- ("Could not deactivate Jack client (%d)", res));
- }
-
- abuf->channels = -1;
- abuf->buffer_size = -1;
- abuf->sample_rate = -1;
-
- /* free the buffer */
- gst_buffer_unref (buf->data);
- buf->data = NULL;
-
- return TRUE;
-}
-
-static gboolean
-gst_jack_ring_buffer_start (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "start");
-
- return TRUE;
-}
-
-static gboolean
-gst_jack_ring_buffer_pause (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "pause");
-
- return TRUE;
-}
-
-static gboolean
-gst_jack_ring_buffer_stop (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "stop");
-
- return TRUE;
-}
-
-static guint
-gst_jack_ring_buffer_delay (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
- guint i, res = 0, latency;
- jack_client_t *client;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- client = gst_jack_audio_client_get_client (sink->client);
-
- for (i = 0; i < sink->port_count; i++) {
- latency = jack_port_get_total_latency (client, sink->ports[i]);
- if (latency > res)
- res = latency;
- }
-
- GST_LOG_OBJECT (sink, "delay %u", res);
-
- return res;
-}
-
-static GstStaticPadTemplate jackaudiosink_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-float, "
- "endianness = (int) { " G_STRINGIFY (G_BYTE_ORDER) " }, "
- "width = (int) 32, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]")
- );
-
-/* AudioSink signals and args */
-enum
-{
- /* FILL ME */
- SIGNAL_LAST
-};
-
-#define DEFAULT_PROP_CONNECT GST_JACK_CONNECT_AUTO
-#define DEFAULT_PROP_SERVER NULL
-
-enum
-{
- PROP_0,
- PROP_CONNECT,
- PROP_SERVER,
- PROP_CLIENT,
- PROP_LAST
-};
-
-#define _do_init(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_jack_audio_sink_debug, "jacksink", 0, "jacksink element");
-
-GST_BOILERPLATE_FULL (GstJackAudioSink, gst_jack_audio_sink, GstBaseAudioSink,
- GST_TYPE_BASE_AUDIO_SINK, _do_init);
-
-static void gst_jack_audio_sink_dispose (GObject * object);
-static void gst_jack_audio_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_jack_audio_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstCaps *gst_jack_audio_sink_getcaps (GstBaseSink * bsink);
-static GstRingBuffer *gst_jack_audio_sink_create_ringbuffer (GstBaseAudioSink *
- sink);
-
-static void
-gst_jack_audio_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details_simple (element_class, "Audio Sink (Jack)",
- "Sink/Audio", "Output to Jack", "Wim Taymans <wim@fluendo.com>");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&jackaudiosink_sink_factory));
-}
-
-static void
-gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSinkClass *gstbasesink_class;
- GstBaseAudioSinkClass *gstbaseaudiosink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
- gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass;
-
- gobject_class->dispose = gst_jack_audio_sink_dispose;
- gobject_class->get_property = gst_jack_audio_sink_get_property;
- gobject_class->set_property = gst_jack_audio_sink_set_property;
-
- g_object_class_install_property (gobject_class, PROP_CONNECT,
- g_param_spec_enum ("connect", "Connect",
- "Specify how the output ports will be connected",
- GST_TYPE_JACK_CONNECT, DEFAULT_PROP_CONNECT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SERVER,
- g_param_spec_string ("server", "Server",
- "The Jack server to connect to (NULL = default)",
- DEFAULT_PROP_SERVER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CLIENT,
- g_param_spec_boxed ("client", "JackClient", "Handle for jack client",
- GST_TYPE_JACK_CLIENT,
- GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_jack_audio_sink_getcaps);
-
- gstbaseaudiosink_class->create_ringbuffer =
- GST_DEBUG_FUNCPTR (gst_jack_audio_sink_create_ringbuffer);
-
- /* ref class from a thread-safe context to work around missing bit of
- * thread-safety in GObject */
- g_type_class_ref (GST_TYPE_JACK_RING_BUFFER);
-
- gst_jack_audio_client_init ();
-}
-
-static void
-gst_jack_audio_sink_init (GstJackAudioSink * sink,
- GstJackAudioSinkClass * g_class)
-{
- sink->connect = DEFAULT_PROP_CONNECT;
- sink->server = g_strdup (DEFAULT_PROP_SERVER);
- sink->jclient = NULL;
- sink->ports = NULL;
- sink->port_count = 0;
-}
-
-static void
-gst_jack_audio_sink_dispose (GObject * object)
-{
- GstJackAudioSink *sink = GST_JACK_AUDIO_SINK (object);
-
- gst_caps_replace (&sink->caps, NULL);
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_jack_audio_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (object);
-
- switch (prop_id) {
- case PROP_CONNECT:
- sink->connect = g_value_get_enum (value);
- break;
- case PROP_SERVER:
- g_free (sink->server);
- sink->server = g_value_dup_string (value);
- break;
- case PROP_CLIENT:
- if (GST_STATE (sink) == GST_STATE_NULL ||
- GST_STATE (sink) == GST_STATE_READY) {
- sink->jclient = g_value_get_boxed (value);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_jack_audio_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (object);
-
- switch (prop_id) {
- case PROP_CONNECT:
- g_value_set_enum (value, sink->connect);
- break;
- case PROP_SERVER:
- g_value_set_string (value, sink->server);
- break;
- case PROP_CLIENT:
- g_value_set_boxed (value, sink->jclient);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstCaps *
-gst_jack_audio_sink_getcaps (GstBaseSink * bsink)
-{
- GstJackAudioSink *sink = GST_JACK_AUDIO_SINK (bsink);
- const char **ports;
- gint min, max;
- gint rate;
- jack_client_t *client;
-
- if (sink->client == NULL)
- goto no_client;
-
- client = gst_jack_audio_client_get_client (sink->client);
-
- if (sink->connect == GST_JACK_CONNECT_AUTO) {
- /* get a port count, this is the number of channels we can automatically
- * connect. */
- ports = jack_get_ports (client, NULL, NULL,
- JackPortIsPhysical | JackPortIsInput);
- max = 0;
- if (ports != NULL) {
- for (; ports[max]; max++);
- free (ports);
- } else
- max = 0;
- } else {
- /* we allow any number of pads, something else is going to connect the
- * pads. */
- max = G_MAXINT;
- }
- min = MIN (1, max);
-
- rate = jack_get_sample_rate (client);
-
- GST_DEBUG_OBJECT (sink, "got %d-%d ports, samplerate: %d", min, max, rate);
-
- if (!sink->caps) {
- sink->caps = gst_caps_new_simple ("audio/x-raw-float",
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "width", G_TYPE_INT, 32,
- "rate", G_TYPE_INT, rate,
- "channels", GST_TYPE_INT_RANGE, min, max, NULL);
- }
- GST_INFO_OBJECT (sink, "returning caps %" GST_PTR_FORMAT, sink->caps);
-
- return gst_caps_ref (sink->caps);
-
- /* ERRORS */
-no_client:
- {
- GST_DEBUG_OBJECT (sink, "device not open, using template caps");
- /* base class will get template caps for us when we return NULL */
- return NULL;
- }
-}
-
-static GstRingBuffer *
-gst_jack_audio_sink_create_ringbuffer (GstBaseAudioSink * sink)
-{
- GstRingBuffer *buffer;
-
- buffer = g_object_new (GST_TYPE_JACK_RING_BUFFER, NULL);
- GST_DEBUG_OBJECT (sink, "created ringbuffer @%p", buffer);
-
- return buffer;
-}
diff --git a/ext/jack/gstjackaudiosink.h b/ext/jack/gstjackaudiosink.h
deleted file mode 100644
index def423329..000000000
--- a/ext/jack/gstjackaudiosink.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * gstjacksink.h:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_JACK_AUDIO_SINK_H__
-#define __GST_JACK_AUDIO_SINK_H__
-
-#include <jack/jack.h>
-
-#include <gst/gst.h>
-#include <gst/audio/gstbaseaudiosink.h>
-
-#include "gstjack.h"
-#include "gstjackaudioclient.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_JACK_AUDIO_SINK (gst_jack_audio_sink_get_type())
-#define GST_JACK_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JACK_AUDIO_SINK,GstJackAudioSink))
-#define GST_JACK_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JACK_AUDIO_SINK,GstJackAudioSinkClass))
-#define GST_JACK_AUDIO_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_JACK_AUDIO_SINK,GstJackAudioSinkClass))
-#define GST_IS_JACK_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JACK_AUDIO_SINK))
-#define GST_IS_JACK_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JACK_AUDIO_SINK))
-
-typedef struct _GstJackAudioSink GstJackAudioSink;
-typedef struct _GstJackAudioSinkClass GstJackAudioSinkClass;
-
-/**
- * GstJackAudioSink:
- *
- * Opaque #GstJackAudioSink.
- */
-struct _GstJackAudioSink {
- GstBaseAudioSink element;
-
- /*< private >*/
- /* cached caps */
- GstCaps *caps;
-
- /* properties */
- GstJackConnect connect;
- gchar *server;
- jack_client_t *jclient;
-
- /* our client */
- GstJackAudioClient *client;
-
- /* our ports */
- jack_port_t **ports;
- int port_count;
-};
-
-struct _GstJackAudioSinkClass {
- GstBaseAudioSinkClass parent_class;
-};
-
-GType gst_jack_audio_sink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_JACK_AUDIO_SINK_H__ */
diff --git a/ext/jack/gstjackaudiosrc.c b/ext/jack/gstjackaudiosrc.c
deleted file mode 100644
index 0ffdb2398..000000000
--- a/ext/jack/gstjackaudiosrc.c
+++ /dev/null
@@ -1,874 +0,0 @@
-/* GStreamer
- * Copyright (C) 2008 Tristan Matthews <tristan@sat.qc.ca>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-jackaudiosrc
- * @see_also: #GstBaseAudioSrc, #GstRingBuffer
- *
- * A Src that inputs data from Jack ports.
- *
- * It will create N Jack ports named in_&lt;name&gt;_&lt;num&gt; where
- * &lt;name&gt; is the element name and &lt;num&gt; is starting from 1.
- * Each port corresponds to a gstreamer channel.
- *
- * The samplerate as exposed on the caps is always the same as the samplerate of
- * the jack server.
- *
- * When the #GstJackAudioSrc:connect property is set to auto, this element
- * will try to connect each input port to a random physical jack output pin.
- *
- * When the #GstJackAudioSrc:connect property is set to none, the element will
- * accept any number of output channels and will create (but not connect) an
- * input port for each channel.
- *
- * The element will generate an error when the Jack server is shut down when it
- * was PAUSED or PLAYING. This element does not support dynamic rate and buffer
- * size changes at runtime.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch jackaudiosrc connect=0 ! jackaudiosink connect=0
- * ]| Get audio input into gstreamer from jack.
- * </refsect2>
- *
- * Last reviewed on 2008-07-22 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst-i18n-plugin.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "gstjackaudiosrc.h"
-#include "gstjackringbuffer.h"
-#include "gstjackutil.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_jack_audio_src_debug);
-#define GST_CAT_DEFAULT gst_jack_audio_src_debug
-
-static gboolean
-gst_jack_audio_src_allocate_channels (GstJackAudioSrc * src, gint channels)
-{
- jack_client_t *client;
-
- client = gst_jack_audio_client_get_client (src->client);
-
- /* remove ports we don't need */
- while (src->port_count > channels)
- jack_port_unregister (client, src->ports[--src->port_count]);
-
- /* alloc enough input ports */
- src->ports = g_realloc (src->ports, sizeof (jack_port_t *) * channels);
- src->buffers = g_realloc (src->buffers, sizeof (sample_t *) * channels);
-
- /* create an input port for each channel */
- while (src->port_count < channels) {
- gchar *name;
-
- /* port names start from 1 and are local to the element */
- name =
- g_strdup_printf ("in_%s_%d", GST_ELEMENT_NAME (src),
- src->port_count + 1);
- src->ports[src->port_count] =
- jack_port_register (client, name, JACK_DEFAULT_AUDIO_TYPE,
- JackPortIsInput, 0);
- if (src->ports[src->port_count] == NULL)
- return FALSE;
-
- src->port_count++;
-
- g_free (name);
- }
- return TRUE;
-}
-
-static void
-gst_jack_audio_src_free_channels (GstJackAudioSrc * src)
-{
- gint res, i = 0;
- jack_client_t *client;
-
- client = gst_jack_audio_client_get_client (src->client);
-
- /* get rid of all ports */
- while (src->port_count) {
- GST_LOG_OBJECT (src, "unregister port %d", i);
- if ((res = jack_port_unregister (client, src->ports[i++])))
- GST_DEBUG_OBJECT (src, "unregister of port failed (%d)", res);
-
- src->port_count--;
- }
- g_free (src->ports);
- src->ports = NULL;
- g_free (src->buffers);
- src->buffers = NULL;
-}
-
-/* ringbuffer abstract base class */
-static GType
-gst_jack_ring_buffer_get_type (void)
-{
- static GType ringbuffer_type = 0;
-
- if (!ringbuffer_type) {
- static const GTypeInfo ringbuffer_info = { sizeof (GstJackRingBufferClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_jack_ring_buffer_class_init,
- NULL,
- NULL,
- sizeof (GstJackRingBuffer),
- 0,
- (GInstanceInitFunc) gst_jack_ring_buffer_init,
- NULL
- };
-
- ringbuffer_type =
- g_type_register_static (GST_TYPE_RING_BUFFER,
- "GstJackAudioSrcRingBuffer", &ringbuffer_info, 0);
- }
- return ringbuffer_type;
-}
-
-static void
-gst_jack_ring_buffer_class_init (GstJackRingBufferClass * klass)
-{
- GObjectClass *gobject_class;
- GstObjectClass *gstobject_class;
- GstRingBufferClass *gstringbuffer_class;
-
- gobject_class = (GObjectClass *) klass;
- gstobject_class = (GstObjectClass *) klass;
- gstringbuffer_class = (GstRingBufferClass *) klass;
-
- ring_parent_class = g_type_class_peek_parent (klass);
-
- gstringbuffer_class->open_device =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_open_device);
- gstringbuffer_class->close_device =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_close_device);
- gstringbuffer_class->acquire =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_acquire);
- gstringbuffer_class->release =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_release);
- gstringbuffer_class->start = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_start);
- gstringbuffer_class->pause = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_pause);
- gstringbuffer_class->resume = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_start);
- gstringbuffer_class->stop = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_stop);
-
- gstringbuffer_class->delay = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_delay);
-}
-
-/* this is the callback of jack. This should be RT-safe.
- * Writes samples from the jack input port's buffer to the gst ring buffer.
- */
-static int
-jack_process_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioSrc *src;
- GstRingBuffer *buf;
- gint len;
- guint8 *writeptr;
- gint writeseg;
- gint channels, i, j, flen;
- sample_t *data;
-
- buf = GST_RING_BUFFER_CAST (arg);
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- channels = buf->spec.channels;
-
- /* get input buffers */
- for (i = 0; i < channels; i++)
- src->buffers[i] =
- (sample_t *) jack_port_get_buffer (src->ports[i], nframes);
-
- if (gst_ring_buffer_prepare_read (buf, &writeseg, &writeptr, &len)) {
- flen = len / channels;
-
- /* the number of samples must be exactly the segment size */
- if (nframes * sizeof (sample_t) != flen)
- goto wrong_size;
-
- /* the samples in the jack input buffers have to be interleaved into the
- * ringbuffer */
- data = (sample_t *) writeptr;
- for (i = 0; i < nframes; ++i)
- for (j = 0; j < channels; ++j)
- *data++ = src->buffers[j][i];
-
- GST_DEBUG ("copy %d frames: %p, %d bytes, %d channels", nframes, writeptr,
- len / channels, channels);
-
- /* we wrote one segment */
- gst_ring_buffer_advance (buf, 1);
- }
- return 0;
-
- /* ERRORS */
-wrong_size:
- {
- GST_ERROR_OBJECT (src, "nbytes (%d) != flen (%d)",
- (gint) (nframes * sizeof (sample_t)), flen);
- return 1;
- }
-}
-
-/* we error out */
-static int
-jack_sample_rate_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioSrc *src;
- GstJackRingBuffer *abuf;
-
- abuf = GST_JACK_RING_BUFFER_CAST (arg);
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (arg));
-
- if (abuf->sample_rate != -1 && abuf->sample_rate != nframes)
- goto not_supported;
-
- return 0;
-
- /* ERRORS */
-not_supported:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS,
- (NULL), ("Jack changed the sample rate, which is not supported"));
- return 1;
- }
-}
-
-/* we error out */
-static int
-jack_buffer_size_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioSrc *src;
- GstJackRingBuffer *abuf;
-
- abuf = GST_JACK_RING_BUFFER_CAST (arg);
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (arg));
-
- if (abuf->buffer_size != -1 && abuf->buffer_size != nframes)
- goto not_supported;
-
- return 0;
-
- /* ERRORS */
-not_supported:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS,
- (NULL), ("Jack changed the buffer size, which is not supported"));
- return 1;
- }
-}
-
-static void
-jack_shutdown_cb (void *arg)
-{
- GstJackAudioSrc *src;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (arg));
-
- GST_DEBUG_OBJECT (src, "shutdown");
-
- GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
- (NULL), ("Jack server shutdown"));
-}
-
-static void
-gst_jack_ring_buffer_init (GstJackRingBuffer * buf,
- GstJackRingBufferClass * g_class)
-{
- buf->channels = -1;
- buf->buffer_size = -1;
- buf->sample_rate = -1;
-}
-
-/* the _open_device method should make a connection with the server
-*/
-static gboolean
-gst_jack_ring_buffer_open_device (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
- jack_status_t status = 0;
- const gchar *name;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (src, "open");
-
- name = g_get_application_name ();
- if (!name)
- name = "GStreamer";
-
- src->client = gst_jack_audio_client_new (name, src->server,
- src->jclient,
- GST_JACK_CLIENT_SOURCE,
- jack_shutdown_cb,
- jack_process_cb, jack_buffer_size_cb, jack_sample_rate_cb, buf, &status);
- if (src->client == NULL)
- goto could_not_open;
-
- GST_DEBUG_OBJECT (src, "opened");
-
- return TRUE;
-
- /* ERRORS */
-could_not_open:
- {
- if (status & JackServerFailed) {
- GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
- (_("Jack server not found")),
- ("Cannot connect to the Jack server (status %d)", status));
- } else {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_WRITE,
- (NULL), ("Jack client open error (status %d)", status));
- }
- return FALSE;
- }
-}
-
-/* close the connection with the server
-*/
-static gboolean
-gst_jack_ring_buffer_close_device (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (src, "close");
-
- gst_jack_audio_src_free_channels (src);
- gst_jack_audio_client_free (src->client);
- src->client = NULL;
-
- return TRUE;
-}
-
-
-/* allocate a buffer and setup resources to process the audio samples of
- * the format as specified in @spec.
- *
- * We allocate N jack ports, one for each channel. If we are asked to
- * automatically make a connection with physical ports, we connect as many
- * ports as there are physical ports, leaving leftover ports unconnected.
- *
- * It is assumed that samplerate and number of channels are acceptable since our
- * getcaps method will always provide correct values. If unacceptable caps are
- * received for some reason, we fail here.
- */
-static gboolean
-gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
-{
- GstJackAudioSrc *src;
- GstJackRingBuffer *abuf;
- const char **ports;
- gint sample_rate, buffer_size;
- gint i, channels, res;
- jack_client_t *client;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
- abuf = GST_JACK_RING_BUFFER_CAST (buf);
-
- GST_DEBUG_OBJECT (src, "acquire");
-
- client = gst_jack_audio_client_get_client (src->client);
-
- /* sample rate must be that of the server */
- sample_rate = jack_get_sample_rate (client);
- if (sample_rate != spec->rate)
- goto wrong_samplerate;
-
- channels = spec->channels;
-
- if (!gst_jack_audio_src_allocate_channels (src, channels))
- goto out_of_ports;
-
- gst_jack_set_layout_on_caps (&spec->caps, channels);
-
- buffer_size = jack_get_buffer_size (client);
-
- /* the segment size in bytes, this is large enough to hold a buffer of 32bit floats
- * for all channels */
- spec->segsize = buffer_size * sizeof (gfloat) * channels;
- spec->latency_time = gst_util_uint64_scale (spec->segsize,
- (GST_SECOND / GST_USECOND), spec->rate * spec->bytes_per_sample);
- /* segtotal based on buffer-time latency */
- spec->segtotal = spec->buffer_time / spec->latency_time;
- if (spec->segtotal < 2) {
- spec->segtotal = 2;
- spec->buffer_time = spec->latency_time * spec->segtotal;
- }
-
- GST_DEBUG_OBJECT (src, "buffer time: %" G_GINT64_FORMAT " usec",
- spec->buffer_time);
- GST_DEBUG_OBJECT (src, "latency time: %" G_GINT64_FORMAT " usec",
- spec->latency_time);
- GST_DEBUG_OBJECT (src, "buffer_size %d, segsize %d, segtotal %d",
- buffer_size, spec->segsize, spec->segtotal);
-
- /* allocate the ringbuffer memory now */
- buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
- memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
-
- if ((res = gst_jack_audio_client_set_active (src->client, TRUE)))
- goto could_not_activate;
-
- /* if we need to automatically connect the ports, do so now. We must do this
- * after activating the client. */
- if (src->connect == GST_JACK_CONNECT_AUTO
- || src->connect == GST_JACK_CONNECT_AUTO_FORCED) {
- /* find all the physical output ports. A physical output port is a port
- * associated with a hardware device. Someone needs connect to a physical
- * port in order to capture something. */
- ports =
- jack_get_ports (client, NULL, NULL,
- JackPortIsPhysical | JackPortIsOutput);
- if (ports == NULL) {
- /* no ports? fine then we don't do anything except for posting a warning
- * message. */
- GST_ELEMENT_WARNING (src, RESOURCE, NOT_FOUND, (NULL),
- ("No physical output ports found, leaving ports unconnected"));
- goto done;
- }
-
- for (i = 0; i < channels; i++) {
- /* stop when all output ports are exhausted */
- if (ports[i] == NULL) {
- /* post a warning that we could not connect all ports */
- GST_ELEMENT_WARNING (src, RESOURCE, NOT_FOUND, (NULL),
- ("No more physical ports, leaving some ports unconnected"));
- break;
- }
- GST_DEBUG_OBJECT (src, "try connecting to %s",
- jack_port_name (src->ports[i]));
-
- /* connect the physical port to a port */
- res = jack_connect (client, ports[i], jack_port_name (src->ports[i]));
- if (res != 0 && res != EEXIST)
- goto cannot_connect;
- }
- free (ports);
- }
-done:
-
- abuf->sample_rate = sample_rate;
- abuf->buffer_size = buffer_size;
- abuf->channels = spec->channels;
-
- return TRUE;
-
- /* ERRORS */
-wrong_samplerate:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
- ("Wrong samplerate, server is running at %d and we received %d",
- sample_rate, spec->rate));
- return FALSE;
- }
-out_of_ports:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
- ("Cannot allocate more Jack ports"));
- return FALSE;
- }
-could_not_activate:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
- ("Could not activate client (%d:%s)", res, g_strerror (res)));
- return FALSE;
- }
-cannot_connect:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
- ("Could not connect input ports to physical ports (%d:%s)",
- res, g_strerror (res)));
- free (ports);
- return FALSE;
- }
-}
-
-/* function is called with LOCK */
-static gboolean
-gst_jack_ring_buffer_release (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
- GstJackRingBuffer *abuf;
- gint res;
-
- abuf = GST_JACK_RING_BUFFER_CAST (buf);
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (src, "release");
-
- if ((res = gst_jack_audio_client_set_active (src->client, FALSE))) {
- /* we only warn, this means the server is probably shut down and the client
- * is gone anyway. */
- GST_ELEMENT_WARNING (src, RESOURCE, CLOSE, (NULL),
- ("Could not deactivate Jack client (%d)", res));
- }
-
- abuf->channels = -1;
- abuf->buffer_size = -1;
- abuf->sample_rate = -1;
-
- /* free the buffer */
- gst_buffer_unref (buf->data);
- buf->data = NULL;
-
- return TRUE;
-}
-
-static gboolean
-gst_jack_ring_buffer_start (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (src, "start");
-
- return TRUE;
-}
-
-static gboolean
-gst_jack_ring_buffer_pause (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (src, "pause");
-
- return TRUE;
-}
-
-static gboolean
-gst_jack_ring_buffer_stop (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (src, "stop");
-
- return TRUE;
-}
-
-static guint
-gst_jack_ring_buffer_delay (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
- guint i, res = 0, latency;
- jack_client_t *client;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
- client = gst_jack_audio_client_get_client (src->client);
-
- for (i = 0; i < src->port_count; i++) {
- latency = jack_port_get_total_latency (client, src->ports[i]);
- if (latency > res)
- res = latency;
- }
-
- GST_DEBUG_OBJECT (src, "delay %u", res);
-
- return res;
-}
-
-/* Audiosrc signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-#define DEFAULT_PROP_CONNECT GST_JACK_CONNECT_AUTO
-#define DEFAULT_PROP_SERVER NULL
-
-enum
-{
- PROP_0,
- PROP_CONNECT,
- PROP_SERVER,
- PROP_CLIENT,
- PROP_LAST
-};
-
-
-/* the capabilities of the inputs and outputs.
- *
- * describe the real formats here.
- */
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-float, "
- "endianness = (int) { " G_STRINGIFY (G_BYTE_ORDER) " }, "
- "width = (int) 32, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]")
- );
-
-#define _do_init(bla) \
- GST_DEBUG_CATEGORY_INIT(gst_jack_audio_src_debug, "jacksrc", 0, "jacksrc element");
-
-GST_BOILERPLATE_FULL (GstJackAudioSrc, gst_jack_audio_src, GstBaseAudioSrc,
- GST_TYPE_BASE_AUDIO_SRC, _do_init);
-
-static void gst_jack_audio_src_dispose (GObject * object);
-static void gst_jack_audio_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_jack_audio_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstCaps *gst_jack_audio_src_getcaps (GstBaseSrc * bsrc);
-static GstRingBuffer *gst_jack_audio_src_create_ringbuffer (GstBaseAudioSrc *
- src);
-
-/* GObject vmethod implementations */
-
-static void
-gst_jack_audio_src_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
- gst_element_class_set_details_simple (element_class, "Audio Source (Jack)",
- "Source/Audio",
- "Input from Jack", "Tristan Matthews <tristan@sat.qc.ca>");
-}
-
-/* initialize the jack_audio_src's class */
-static void
-gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSrcClass *gstbasesrc_class;
- GstBaseAudioSrcClass *gstbaseaudiosrc_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- gstbasesrc_class = (GstBaseSrcClass *) klass;
- gstbaseaudiosrc_class = (GstBaseAudioSrcClass *) klass;
-
- gobject_class->dispose = gst_jack_audio_src_dispose;
- gobject_class->set_property = gst_jack_audio_src_set_property;
- gobject_class->get_property = gst_jack_audio_src_get_property;
-
- g_object_class_install_property (gobject_class, PROP_CONNECT,
- g_param_spec_enum ("connect", "Connect",
- "Specify how the input ports will be connected",
- GST_TYPE_JACK_CONNECT, DEFAULT_PROP_CONNECT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SERVER,
- g_param_spec_string ("server", "Server",
- "The Jack server to connect to (NULL = default)",
- DEFAULT_PROP_SERVER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CLIENT,
- g_param_spec_boxed ("client", "JackClient", "Handle for jack client",
- GST_TYPE_JACK_CLIENT,
- GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_jack_audio_src_getcaps);
- gstbaseaudiosrc_class->create_ringbuffer =
- GST_DEBUG_FUNCPTR (gst_jack_audio_src_create_ringbuffer);
-
- /* ref class from a thread-safe context to work around missing bit of
- * thread-safety in GObject */
- g_type_class_ref (GST_TYPE_JACK_RING_BUFFER);
-
- gst_jack_audio_client_init ();
-}
-
-/* initialize the new element
- * instantiate pads and add them to element
- * set pad calback functions
- * initialize instance structure
- */
-static void
-gst_jack_audio_src_init (GstJackAudioSrc * src, GstJackAudioSrcClass * gclass)
-{
- //gst_base_src_set_live(GST_BASE_SRC (src), TRUE);
- src->connect = DEFAULT_PROP_CONNECT;
- src->server = g_strdup (DEFAULT_PROP_SERVER);
- src->jclient = NULL;
- src->ports = NULL;
- src->port_count = 0;
- src->buffers = NULL;
-}
-
-static void
-gst_jack_audio_src_dispose (GObject * object)
-{
- GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object);
-
- gst_caps_replace (&src->caps, NULL);
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_jack_audio_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object);
-
- switch (prop_id) {
- case PROP_CONNECT:
- src->connect = g_value_get_enum (value);
- break;
- case PROP_SERVER:
- g_free (src->server);
- src->server = g_value_dup_string (value);
- break;
- case PROP_CLIENT:
- if (GST_STATE (src) == GST_STATE_NULL ||
- GST_STATE (src) == GST_STATE_READY) {
- src->jclient = g_value_get_boxed (value);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_jack_audio_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object);
-
- switch (prop_id) {
- case PROP_CONNECT:
- g_value_set_enum (value, src->connect);
- break;
- case PROP_SERVER:
- g_value_set_string (value, src->server);
- break;
- case PROP_CLIENT:
- g_value_set_boxed (value, src->jclient);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstCaps *
-gst_jack_audio_src_getcaps (GstBaseSrc * bsrc)
-{
- GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (bsrc);
- const char **ports;
- gint min, max;
- gint rate;
- jack_client_t *client;
-
- if (src->client == NULL)
- goto no_client;
-
- client = gst_jack_audio_client_get_client (src->client);
-
- if (src->connect == GST_JACK_CONNECT_AUTO) {
- /* get a port count, this is the number of channels we can automatically
- * connect. */
- ports = jack_get_ports (client, NULL, NULL,
- JackPortIsPhysical | JackPortIsOutput);
- max = 0;
- if (ports != NULL) {
- for (; ports[max]; max++);
-
- free (ports);
- } else
- max = 0;
- } else {
- /* we allow any number of pads, something else is going to connect the
- * pads. */
- max = G_MAXINT;
- }
- min = MIN (1, max);
-
- rate = jack_get_sample_rate (client);
-
- GST_DEBUG_OBJECT (src, "got %d-%d ports, samplerate: %d", min, max, rate);
-
- if (!src->caps) {
- src->caps = gst_caps_new_simple ("audio/x-raw-float",
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "width", G_TYPE_INT, 32,
- "rate", G_TYPE_INT, rate,
- "channels", GST_TYPE_INT_RANGE, min, max, NULL);
- }
- GST_INFO_OBJECT (src, "returning caps %" GST_PTR_FORMAT, src->caps);
-
- return gst_caps_ref (src->caps);
-
- /* ERRORS */
-no_client:
- {
- GST_DEBUG_OBJECT (src, "device not open, using template caps");
- /* base class will get template caps for us when we return NULL */
- return NULL;
- }
-}
-
-static GstRingBuffer *
-gst_jack_audio_src_create_ringbuffer (GstBaseAudioSrc * src)
-{
- GstRingBuffer *buffer;
-
- buffer = g_object_new (GST_TYPE_JACK_RING_BUFFER, NULL);
- GST_DEBUG_OBJECT (src, "created ringbuffer @%p", buffer);
-
- return buffer;
-}
diff --git a/ext/jack/gstjackaudiosrc.h b/ext/jack/gstjackaudiosrc.h
deleted file mode 100644
index 7e99b69df..000000000
--- a/ext/jack/gstjackaudiosrc.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* GStreamer
- * Copyright (C) 2008 Tristan Matthews <tristan@sat.qc.ca>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_JACK_AUDIO_SRC_H__
-#define __GST_JACK_AUDIO_SRC_H__
-
-#include <jack/jack.h>
-
-#include <gst/gst.h>
-#include <gst/audio/gstaudiosrc.h>
-
-#include "gstjackaudioclient.h"
-#include "gstjack.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_JACK_AUDIO_SRC (gst_jack_audio_src_get_type())
-#define GST_JACK_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JACK_AUDIO_SRC,GstJackAudioSrc))
-#define GST_JACK_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JACK_AUDIO_SRC,GstJackAudioSrcClass))
-#define GST_JACK_AUDIO_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_JACK_AUDIO_SRC,GstJackAudioSrcClass))
-#define GST_IS_JACK_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JACK_AUDIO_SRC))
-#define GST_IS_JACK_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JACK_AUDIO_SRC))
-
-typedef struct _GstJackAudioSrc GstJackAudioSrc;
-typedef struct _GstJackAudioSrcClass GstJackAudioSrcClass;
-
-struct _GstJackAudioSrc
-{
- GstBaseAudioSrc src;
-
- /*< private >*/
- /* cached caps */
- GstCaps *caps;
-
- /* properties */
- GstJackConnect connect;
- gchar *server;
- jack_client_t *jclient;
-
- /* our client */
- GstJackAudioClient *client;
-
- /* our ports */
- jack_port_t **ports;
- int port_count;
- sample_t **buffers;
-};
-
-struct _GstJackAudioSrcClass
-{
- GstBaseAudioSrcClass parent_class;
-};
-
-GType gst_jack_audio_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_JACK_AUDIO_SRC_H__ */
diff --git a/ext/jack/gstjackringbuffer.h b/ext/jack/gstjackringbuffer.h
deleted file mode 100644
index 266fdfa31..000000000
--- a/ext/jack/gstjackringbuffer.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- * Copyright (C) 2008 Tristan Matthews <tristan@sat.qc.ca>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_JACK_RING_BUFFER_H__
-#define __GST_JACK_RING_BUFFER_H__
-
-#define GST_TYPE_JACK_RING_BUFFER (gst_jack_ring_buffer_get_type())
-#define GST_JACK_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JACK_RING_BUFFER,GstJackRingBuffer))
-#define GST_JACK_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JACK_RING_BUFFER,GstJackRingBufferClass))
-#define GST_JACK_RING_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_JACK_RING_BUFFER,GstJackRingBufferClass))
-#define GST_JACK_RING_BUFFER_CAST(obj) ((GstJackRingBuffer *)obj)
-#define GST_IS_JACK_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JACK_RING_BUFFER))
-#define GST_IS_JACK_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JACK_RING_BUFFER))
-
-typedef struct _GstJackRingBuffer GstJackRingBuffer;
-typedef struct _GstJackRingBufferClass GstJackRingBufferClass;
-
-struct _GstJackRingBuffer
-{
- GstRingBuffer object;
-
- gint sample_rate;
- gint buffer_size;
- gint channels;
-};
-
-struct _GstJackRingBufferClass
-{
- GstRingBufferClass parent_class;
-};
-
-static void gst_jack_ring_buffer_class_init(GstJackRingBufferClass * klass);
-static void gst_jack_ring_buffer_init(GstJackRingBuffer * ringbuffer,
- GstJackRingBufferClass * klass);
-
-static GstRingBufferClass *ring_parent_class = NULL;
-
-static gboolean gst_jack_ring_buffer_open_device(GstRingBuffer * buf);
-static gboolean gst_jack_ring_buffer_close_device(GstRingBuffer * buf);
-static gboolean gst_jack_ring_buffer_acquire(GstRingBuffer * buf,GstRingBufferSpec * spec);
-static gboolean gst_jack_ring_buffer_release(GstRingBuffer * buf);
-static gboolean gst_jack_ring_buffer_start(GstRingBuffer * buf);
-static gboolean gst_jack_ring_buffer_pause(GstRingBuffer * buf);
-static gboolean gst_jack_ring_buffer_stop(GstRingBuffer * buf);
-static guint gst_jack_ring_buffer_delay(GstRingBuffer * buf);
-
-#endif
diff --git a/ext/jack/gstjackutil.c b/ext/jack/gstjackutil.c
deleted file mode 100644
index cde84d8e8..000000000
--- a/ext/jack/gstjackutil.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* GStreamer Jack utility functions
- * Copyright (C) 2010 Tristan Matthews <tristan@sat.qc.ca>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "gstjackutil.h"
-#include <gst/audio/multichannel.h>
-
-static const GstAudioChannelPosition default_positions[8][8] = {
- /* 1 channel */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
- },
- /* 2 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- },
- /* 3 channels (2.1) */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_LFE, /* or FRONT_CENTER for 3.0? */
- },
- /* 4 channels (4.0 or 3.1?) */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- },
- /* 5 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- },
- /* 6 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- },
- /* 7 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
- },
- /* 8 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
- }
-};
-
-
-/* if channels are less than or equal to 8, we set a default layout,
- * otherwise set layout to an array of GST_AUDIO_CHANNEL_POSITION_NONE */
-void
-gst_jack_set_layout_on_caps (GstCaps ** caps, gint channels)
-{
- int c;
- GValue pos = { 0 };
- GValue chanpos = { 0 };
- gst_caps_unref (*caps);
-
- if (channels <= 8) {
- g_assert (channels >= 1);
- gst_audio_set_channel_positions (gst_caps_get_structure (*caps, 0),
- default_positions[channels - 1]);
- } else {
- g_value_init (&chanpos, GST_TYPE_ARRAY);
- g_value_init (&pos, GST_TYPE_AUDIO_CHANNEL_POSITION);
- for (c = 0; c < channels; c++) {
- g_value_set_enum (&pos, GST_AUDIO_CHANNEL_POSITION_NONE);
- gst_value_array_append_value (&chanpos, &pos);
- }
- g_value_unset (&pos);
- gst_structure_set_value (gst_caps_get_structure (*caps, 0),
- "channel-positions", &chanpos);
- g_value_unset (&chanpos);
- }
- gst_caps_ref (*caps);
-}
diff --git a/ext/jack/gstjackutil.h b/ext/jack/gstjackutil.h
deleted file mode 100644
index e330afd5e..000000000
--- a/ext/jack/gstjackutil.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 Tristan Matthews <tristan@sat.qc.ca>
- *
- * gstjackutil.h:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _GST_JACK_UTIL_H_
-#define _GST_JACK_UTIL_H_
-
-#include <gst/gst.h>
-
-void
-gst_jack_set_layout_on_caps (GstCaps **caps, gint channels);
-
-#endif // _GST_JACK_UTIL_H_
diff --git a/ext/jp2k/gstjasperdec.c b/ext/jp2k/gstjasperdec.c
index 05c1963ac..595134c46 100644
--- a/ext/jp2k/gstjasperdec.c
+++ b/ext/jp2k/gstjasperdec.c
@@ -65,7 +65,7 @@ static GstStaticPadTemplate gst_jasper_dec_src_template =
GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB "; " GST_VIDEO_CAPS_BGR "; "
GST_VIDEO_CAPS_RGBx "; " GST_VIDEO_CAPS_xRGB "; "
GST_VIDEO_CAPS_BGRx "; " GST_VIDEO_CAPS_xBGR "; "
- GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, UYVY, Y41B, Y42B }"))
+ GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, UYVY, Y41B, Y42B, v308 }"))
);
static void gst_jasper_dec_set_property (GObject * object, guint prop_id,
@@ -535,8 +535,8 @@ fail:
if (*outbuf)
gst_buffer_unref (*outbuf);
*outbuf = NULL;
- GST_ELEMENT_ERROR (dec, STREAM, DECODE, (NULL), (NULL));
- ret = GST_FLOW_ERROR;
+ GST_ELEMENT_WARNING (dec, STREAM, DECODE, (NULL), (NULL));
+ ret = GST_FLOW_OK;
goto done;
}
no_buffer:
diff --git a/ext/jp2k/gstjasperenc.c b/ext/jp2k/gstjasperenc.c
index a372be2ab..27073e22a 100644
--- a/ext/jp2k/gstjasperenc.c
+++ b/ext/jp2k/gstjasperenc.c
@@ -49,7 +49,7 @@ static GstStaticPadTemplate gst_jasper_enc_sink_template =
GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB "; " GST_VIDEO_CAPS_BGR "; "
GST_VIDEO_CAPS_RGBx "; " GST_VIDEO_CAPS_xRGB "; "
GST_VIDEO_CAPS_BGRx "; " GST_VIDEO_CAPS_xBGR "; "
- GST_VIDEO_CAPS_YUV ("{ I420, YV12 }"))
+ GST_VIDEO_CAPS_YUV ("{ I420, YV12, v308 }"))
);
static GstStaticPadTemplate gst_jasper_enc_src_template =
diff --git a/ext/kate/Makefile.am b/ext/kate/Makefile.am
index 6a2152d13..fd7d6ced4 100644
--- a/ext/kate/Makefile.am
+++ b/ext/kate/Makefile.am
@@ -10,7 +10,7 @@ endif
# flags used to compile this plugin
libgstkate_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(TIGER_CFLAGS) $(KATE_CFLAGS)
-libgstkate_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgsttag-$(GST_MAJORMINOR) $(GST_LIBS) $(TIGER_LIBS) $(KATE_LIBS)
+libgstkate_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) -lgsttag-$(GST_MAJORMINOR) $(GST_LIBS) $(TIGER_LIBS) $(KATE_LIBS)
libgstkate_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstkate_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/ext/kate/gstkate.c b/ext/kate/gstkate.c
index 08adfea8d..c7858e495 100644
--- a/ext/kate/gstkate.c
+++ b/ext/kate/gstkate.c
@@ -64,6 +64,7 @@ GST_DEBUG_CATEGORY (gst_katedec_debug);
GST_DEBUG_CATEGORY (gst_kateenc_debug);
GST_DEBUG_CATEGORY (gst_kateparse_debug);
GST_DEBUG_CATEGORY (gst_katetag_debug);
+GST_DEBUG_CATEGORY (gst_kateutil_debug);
#ifdef HAVE_TIGER
GST_DEBUG_CATEGORY (gst_katetiger_debug);
#endif
@@ -75,6 +76,8 @@ plugin_init (GstPlugin * plugin)
GST_DEBUG_CATEGORY_INIT (gst_kateenc_debug, "kateenc", 0, "Kate encoder");
GST_DEBUG_CATEGORY_INIT (gst_kateparse_debug, "kateparse", 0, "Kate parser");
GST_DEBUG_CATEGORY_INIT (gst_katetag_debug, "katetag", 0, "Kate tagger");
+ GST_DEBUG_CATEGORY_INIT (gst_kateutil_debug, "kateutil", 0,
+ "Kate utility functions");
#ifdef HAVE_TIGER
GST_DEBUG_CATEGORY_INIT (gst_katetiger_debug, "tiger", 0,
"Kate Tiger renderer");
@@ -97,7 +100,7 @@ plugin_init (GstPlugin * plugin)
return FALSE;
#ifdef HAVE_TIGER
- if (!gst_element_register (plugin, "tiger", GST_RANK_NONE,
+ if (!gst_element_register (plugin, "tiger", GST_RANK_PRIMARY,
GST_TYPE_KATE_TIGER))
return FALSE;
#endif
diff --git a/ext/kate/gstkatedec.c b/ext/kate/gstkatedec.c
index 322363d81..df3607024 100644
--- a/ext/kate/gstkatedec.c
+++ b/ext/kate/gstkatedec.c
@@ -128,6 +128,9 @@ static GstFlowReturn gst_kate_dec_chain (GstPad * pad, GstBuffer * buf);
static GstStateChangeReturn gst_kate_dec_change_state (GstElement * element,
GstStateChange transition);
static gboolean gst_kate_dec_sink_query (GstPad * pad, GstQuery * query);
+static gboolean gst_kate_dec_sink_event (GstPad * pad, GstEvent * event);
+static gboolean gst_kate_dec_sink_handle_event (GstPad * pad, GstEvent * event);
+static GstCaps *gst_kate_dec_src_get_caps (GstPad * pad);
static void
gst_kate_dec_base_init (gpointer gclass)
@@ -155,8 +158,8 @@ gst_kate_dec_class_init (GstKateDecClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
- gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_kate_dec_set_property);
- gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_kate_dec_get_property);
+ gobject_class->set_property = gst_kate_dec_set_property;
+ gobject_class->get_property = gst_kate_dec_get_property;
gst_kate_util_install_decoder_base_properties (gobject_class);
@@ -184,16 +187,21 @@ gst_kate_dec_init (GstKateDec * dec, GstKateDecClass * gclass)
GST_DEBUG_FUNCPTR (gst_kate_dec_chain));
gst_pad_set_query_function (dec->sinkpad,
GST_DEBUG_FUNCPTR (gst_kate_dec_sink_query));
+ gst_pad_set_event_function (dec->sinkpad,
+ GST_DEBUG_FUNCPTR (gst_kate_dec_sink_event));
gst_pad_use_fixed_caps (dec->sinkpad);
gst_pad_set_caps (dec->sinkpad,
gst_static_pad_template_get_caps (&sink_factory));
gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
dec->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
+ gst_pad_set_getcaps_function (dec->srcpad,
+ GST_DEBUG_FUNCPTR (gst_kate_dec_src_get_caps));
gst_element_add_pad (GST_ELEMENT (dec), dec->srcpad);
- gst_kate_util_decode_base_init (&dec->decoder);
+ gst_kate_util_decode_base_init (&dec->decoder, TRUE);
+ dec->src_caps = NULL;
dec->remove_markup = FALSE;
}
@@ -240,9 +248,16 @@ gst_kate_dec_chain (GstPad * pad, GstBuffer * buf)
const kate_event *ev = NULL;
GstFlowReturn rflow = GST_FLOW_OK;
+ if (!gst_kate_util_decoder_base_update_segment (&kd->decoder,
+ GST_ELEMENT_CAST (kd), buf)) {
+ GST_WARNING_OBJECT (kd, "Out of segment!");
+ goto not_in_seg;
+ }
+
rflow =
gst_kate_util_decoder_base_chain_kate_packet (&kd->decoder,
- GST_ELEMENT_CAST (kd), pad, buf, kd->srcpad, &ev);
+ GST_ELEMENT_CAST (kd), pad, buf, kd->srcpad, kd->srcpad, &kd->src_caps,
+ &ev);
if (G_UNLIKELY (rflow != GST_FLOW_OK)) {
gst_object_unref (kd);
gst_buffer_unref (buf);
@@ -336,6 +351,7 @@ gst_kate_dec_chain (GstPad * pad, GstBuffer * buf)
}
}
+not_in_seg:
gst_object_unref (kd);
gst_buffer_unref (buf);
return rflow;
@@ -344,9 +360,17 @@ gst_kate_dec_chain (GstPad * pad, GstBuffer * buf)
static GstStateChangeReturn
gst_kate_dec_change_state (GstElement * element, GstStateChange transition)
{
+ GstStateChangeReturn ret;
GstKateDec *kd = GST_KATE_DEC (element);
- return gst_kate_decoder_base_change_state (&kd->decoder, element,
+
+ ret = gst_kate_decoder_base_change_state (&kd->decoder, element,
parent_class, transition);
+
+ if (transition == GST_STATE_CHANGE_PAUSED_TO_READY) {
+ gst_caps_replace (&kd->src_caps, NULL);
+ }
+
+ return ret;
}
gboolean
@@ -359,3 +383,80 @@ gst_kate_dec_sink_query (GstPad * pad, GstQuery * query)
gst_object_unref (kd);
return res;
}
+
+static gboolean
+gst_kate_dec_sink_event (GstPad * pad, GstEvent * event)
+{
+ GstKateDec *kd = (GstKateDec *) (gst_object_get_parent (GST_OBJECT (pad)));
+ gboolean res = TRUE;
+
+ GST_LOG_OBJECT (pad, "Event on sink pad: %s", GST_EVENT_TYPE_NAME (event));
+
+ /* Delay events till we've set caps */
+ if (gst_kate_util_decoder_base_queue_event (&kd->decoder, event,
+ &gst_kate_dec_sink_handle_event, pad)) {
+ gst_object_unref (kd);
+ return TRUE;
+ }
+
+ res = gst_kate_dec_sink_handle_event (pad, event);
+
+ gst_object_unref (kd);
+
+ return res;
+}
+
+static gboolean
+gst_kate_dec_sink_handle_event (GstPad * pad, GstEvent * event)
+{
+ GstKateDec *kd = (GstKateDec *) (gst_object_get_parent (GST_OBJECT (pad)));
+ gboolean res = TRUE;
+
+ GST_LOG_OBJECT (pad, "Handling event on sink pad: %s",
+ GST_EVENT_TYPE_NAME (event));
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_NEWSEGMENT:
+ gst_kate_util_decoder_base_new_segment_event (&kd->decoder, event);
+ res = gst_pad_event_default (pad, event);
+ break;
+
+ case GST_EVENT_FLUSH_START:
+ gst_kate_util_decoder_base_set_flushing (&kd->decoder, TRUE);
+ res = gst_pad_event_default (pad, event);
+ break;
+
+ case GST_EVENT_FLUSH_STOP:
+ gst_kate_util_decoder_base_set_flushing (&kd->decoder, FALSE);
+ res = gst_pad_event_default (pad, event);
+ break;
+
+ default:
+ res = gst_pad_event_default (pad, event);
+ break;
+ }
+
+ gst_object_unref (kd);
+
+ return res;
+}
+
+static GstCaps *
+gst_kate_dec_src_get_caps (GstPad * pad)
+{
+ GstKateDec *kd = (GstKateDec *) (gst_object_get_parent (GST_OBJECT (pad)));
+ GstCaps *caps;
+
+ if (kd->src_caps) {
+ GST_DEBUG_OBJECT (kd, "We have src caps %" GST_PTR_FORMAT, kd->src_caps);
+ caps = kd->src_caps;
+ } else {
+ GST_DEBUG_OBJECT (kd, "We have no src caps, using template caps");
+ caps = gst_static_pad_template_get_caps (&src_factory);
+ }
+
+ caps = gst_caps_copy (caps);
+
+ gst_object_unref (kd);
+ return caps;
+}
diff --git a/ext/kate/gstkatedec.h b/ext/kate/gstkatedec.h
index a7011ecbc..b4d99059a 100644
--- a/ext/kate/gstkatedec.h
+++ b/ext/kate/gstkatedec.h
@@ -67,12 +67,12 @@ typedef struct _GstKateDecClass GstKateDecClass;
struct _GstKateDec
{
- GstElement element;
+ GstKateDecoderBase decoder;
GstPad *sinkpad;
GstPad *srcpad;
- GstKateDecoderBase decoder;
+ GstCaps *src_caps;
gboolean remove_markup;
};
diff --git a/ext/kate/gstkateparse.c b/ext/kate/gstkateparse.c
index c41066645..6a72edec9 100644
--- a/ext/kate/gstkateparse.c
+++ b/ext/kate/gstkateparse.c
@@ -255,11 +255,6 @@ gst_kate_parse_push_buffer (GstKateParse * parse, GstBuffer * buf,
GST_BUFFER_OFFSET_END (buf) = granulepos;
GST_BUFFER_TIMESTAMP (buf) = GST_BUFFER_OFFSET (buf);
- /* Hack to flush each packet on its own page - taken off the CMML encoder element */
- /* TODO: this is shite and needs to go once I find a way to tell Ogg to flush
- as it messes up Matroska's track duration */
- GST_BUFFER_DURATION (buf) = G_MAXINT64;
-
gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
return gst_pad_push (parse->srcpad, buf);
diff --git a/ext/kate/gstkatespu.c b/ext/kate/gstkatespu.c
index 778288ecf..13f561941 100644
--- a/ext/kate/gstkatespu.c
+++ b/ext/kate/gstkatespu.c
@@ -804,14 +804,6 @@ gst_kate_spu_encode_spu (GstKateDec * kd, const kate_event * ev)
bytes[nbytes++] =
((kp->colors[palette[1]].a / 17) << 4) | (kp->colors[palette[0]].a / 17);
-#if 0
- // move to top left - avoids a crash in dvdspu when overlaying on a small video :/
- right -= left;
- bottom -= top;
- left = 0;
- top = 0;
-#endif
-
CHKBUFSPC (7 * 2);
bytes[nbytes++] = SPU_CMD_SET_DAREA;
bytes[nbytes++] = left >> 4;
diff --git a/ext/kate/gstkatetiger.c b/ext/kate/gstkatetiger.c
index 93d98e73a..81ac6f755 100644
--- a/ext/kate/gstkatetiger.c
+++ b/ext/kate/gstkatetiger.c
@@ -88,6 +88,19 @@
GST_DEBUG_CATEGORY_EXTERN (gst_katetiger_debug);
#define GST_CAT_DEFAULT gst_katetiger_debug
+#define GST_KATE_TIGER_MUTEX_LOCK(element) \
+ do { \
+ /*GST_LOG_OBJECT ((element), "locking from %s:%d\n",__FILE__,__LINE__);*/ \
+ g_mutex_lock ((element)->mutex); \
+ /*GST_LOG_OBJECT ((element), "ready from %s:%d\n",__FILE__,__LINE__);*/ \
+ } while(0)
+
+#define GST_KATE_TIGER_MUTEX_UNLOCK(element) \
+ do { \
+ /*GST_LOG_OBJECT ((element), "unlocking from %s:%d\n",__FILE__,__LINE__);*/ \
+ g_mutex_unlock ((element)->mutex); \
+ } while(0)
+
/* Filter signals and args */
enum
{
@@ -118,18 +131,26 @@ static GstStaticPadTemplate kate_sink_factory =
GST_STATIC_CAPS ("subtitle/x-kate; application/x-kate")
);
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define TIGER_VIDEO_CAPS \
+ GST_VIDEO_CAPS_xRGB ", endianness = (int)1234; " \
+ GST_VIDEO_CAPS_BGRx ", endianness = (int)4321"
+#else
+#define TIGER_VIDEO_CAPS \
+ GST_VIDEO_CAPS_BGRx ", endianness = (int)4321; " \
+ GST_VIDEO_CAPS_xRGB ", endianness = (int)1234"
+#endif
+
static GstStaticPadTemplate video_sink_factory =
GST_STATIC_PAD_TEMPLATE ("video_sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-rgb, bpp=(int)32, depth=(int)24")
- );
+ GST_STATIC_CAPS (TIGER_VIDEO_CAPS));
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-rgb, bpp=(int)32, depth=(int)24")
- );
+ GST_STATIC_CAPS (TIGER_VIDEO_CAPS));
GST_BOILERPLATE (GstKateTiger, gst_kate_tiger, GstElement, GST_TYPE_ELEMENT);
@@ -163,6 +184,7 @@ static GstStateChangeReturn gst_kate_tiger_change_state (GstElement * element,
GstStateChange transition);
static gboolean gst_kate_tiger_kate_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_kate_tiger_kate_event (GstPad * pad, GstEvent * event);
+static gboolean gst_kate_tiger_video_event (GstPad * pad, GstEvent * event);
static gboolean gst_kate_tiger_video_set_caps (GstPad * pad, GstCaps * caps);
static gboolean gst_kate_tiger_source_event (GstPad * pad, GstEvent * event);
@@ -214,7 +236,7 @@ gst_kate_tiger_class_init (GstKateTigerClass * klass)
g_param_spec_enum ("default-font-effect", "Default font effect",
"Whether to apply an effect to text by default, for increased readability",
gst_kate_tiger_font_effect_get_type (),
- tiger_font_plain,
+ tiger_font_outline,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
@@ -287,6 +309,7 @@ gst_kate_tiger_init (GstKateTiger * tiger, GstKateTigerClass * gclass)
GST_DEBUG_OBJECT (tiger, "gst_kate_tiger_init");
tiger->mutex = g_mutex_new ();
+ tiger->cond = g_cond_new ();
tiger->katesinkpad =
gst_pad_new_from_static_template (&kate_sink_factory, "subtitle_sink");
@@ -302,25 +325,25 @@ gst_kate_tiger_init (GstKateTiger * tiger, GstKateTigerClass * gclass)
gst_pad_new_from_static_template (&video_sink_factory, "video_sink");
gst_pad_set_chain_function (tiger->videosinkpad,
GST_DEBUG_FUNCPTR (gst_kate_tiger_video_chain));
- //gst_pad_set_query_function (tiger->videosinkpad, GST_DEBUG_FUNCPTR (gst_kate_tiger_video_sink_query));
gst_pad_use_fixed_caps (tiger->videosinkpad);
- gst_pad_set_caps (tiger->videosinkpad,
- gst_static_pad_template_get_caps (&video_sink_factory));
gst_pad_set_setcaps_function (tiger->videosinkpad,
GST_DEBUG_FUNCPTR (gst_kate_tiger_video_set_caps));
+ gst_pad_set_event_function (tiger->videosinkpad,
+ GST_DEBUG_FUNCPTR (gst_kate_tiger_video_event));
gst_element_add_pad (GST_ELEMENT (tiger), tiger->videosinkpad);
tiger->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
gst_pad_set_event_function (tiger->srcpad, gst_kate_tiger_source_event);
+ gst_pad_use_fixed_caps (tiger->srcpad);
gst_element_add_pad (GST_ELEMENT (tiger), tiger->srcpad);
- gst_kate_util_decode_base_init (&tiger->decoder);
+ gst_kate_util_decode_base_init (&tiger->decoder, FALSE);
tiger->tr = NULL;
tiger->default_font_desc = NULL;
tiger->quality = -1.0;
- tiger->default_font_effect = tiger_font_plain;
+ tiger->default_font_effect = tiger_font_outline;
tiger->default_font_effect_strength = 0.5;
tiger->default_font_r = 255;
tiger->default_font_g = 255;
@@ -333,6 +356,8 @@ gst_kate_tiger_init (GstKateTiger * tiger, GstKateTigerClass * gclass)
tiger->video_width = 0;
tiger->video_height = 0;
+
+ tiger->seen_header = FALSE;
}
static void
@@ -347,6 +372,9 @@ gst_kate_tiger_dispose (GObject * object)
tiger->default_font_desc = NULL;
}
+ g_cond_free (tiger->cond);
+ tiger->cond = NULL;
+
g_mutex_free (tiger->mutex);
tiger->mutex = NULL;
@@ -400,7 +428,7 @@ gst_kate_tiger_set_property (GObject * object, guint prop_id,
GstKateTiger *tiger = GST_KATE_TIGER (object);
const char *str;
- g_mutex_lock (tiger->mutex);
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
switch (prop_id) {
case ARG_DEFAULT_FONT_DESC:
@@ -465,7 +493,7 @@ gst_kate_tiger_set_property (GObject * object, guint prop_id,
break;
}
- g_mutex_unlock (tiger->mutex);
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
}
static void
@@ -474,7 +502,7 @@ gst_kate_tiger_get_property (GObject * object, guint prop_id,
{
GstKateTiger *tiger = GST_KATE_TIGER (object);
- g_mutex_lock (tiger->mutex);
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
switch (prop_id) {
case ARG_DEFAULT_FONT_DESC:
@@ -522,7 +550,7 @@ gst_kate_tiger_get_property (GObject * object, guint prop_id,
break;
}
- g_mutex_unlock (tiger->mutex);
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
}
/* GstElement vmethod implementations */
@@ -538,30 +566,108 @@ gst_kate_tiger_kate_chain (GstPad * pad, GstBuffer * buf)
const kate_event *ev = NULL;
GstFlowReturn rflow = GST_FLOW_OK;
- g_mutex_lock (tiger->mutex);
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
+
+ GST_LOG_OBJECT (tiger, "Got kate buffer, caps %" GST_PTR_FORMAT,
+ GST_BUFFER_CAPS (buf));
+
+ /* Unfortunately, it can happen that the start of the stream is not sent,
+ for instance if there's a stream selector upstream, which is switched
+ from another Kate stream. If this happens, then we can fallback on the
+ headers stored in the caps (if any). */
+ if (!tiger->seen_header) {
+ if (GST_BUFFER_SIZE (buf) == 0 || (GST_BUFFER_DATA (buf)[0] & 0x80) == 0) {
+ /* Not a header, try to fall back on caps */
+ GstStructure *s;
+ const GValue *streamheader;
+
+ GST_INFO_OBJECT (tiger, "Headers not seen, start of stream is cut off");
+ s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
+ streamheader = gst_structure_get_value (s, "streamheader");
+ if (streamheader && G_VALUE_TYPE (streamheader) == GST_TYPE_ARRAY) {
+ GstPad *tagpad = gst_pad_get_peer (pad);
+ GArray *array;
+ gint i;
+
+ GST_INFO_OBJECT (tiger, "Falling back on caps to initialize decoder");
+ array = g_value_peek_pointer (streamheader);
+ for (i = 0; i < array->len; i++) {
+ GValue *value = &g_array_index (array, GValue, i);
+ if (G_VALUE_TYPE (value) == GST_TYPE_BUFFER) {
+ GstBuffer *hbuf = g_value_peek_pointer (value);
+ gst_buffer_ref (hbuf);
+ rflow =
+ gst_kate_util_decoder_base_chain_kate_packet (&tiger->decoder,
+ GST_ELEMENT_CAST (tiger), pad, hbuf, tiger->srcpad, tagpad,
+ NULL, NULL);
+ } else {
+ GST_WARNING_OBJECT (tiger,
+ "Streamheader index %d does not hold a buffer", i);
+ }
+ }
+ gst_object_unref (tagpad);
+ tiger->seen_header = TRUE;
+ } else {
+ GST_WARNING_OBJECT (tiger, "No headers seen, and no headers on caps");
+ }
+ } else {
+ tiger->seen_header = TRUE;
+ }
+ }
- GST_LOG_OBJECT (tiger, "Got kate buffer");
+ if (gst_kate_util_decoder_base_update_segment (&tiger->decoder,
+ GST_ELEMENT_CAST (tiger), buf)) {
+ GstPad *tagpad = gst_pad_get_peer (pad);
+ rflow =
+ gst_kate_util_decoder_base_chain_kate_packet (&tiger->decoder,
+ GST_ELEMENT_CAST (tiger), pad, buf, tiger->srcpad, tagpad, NULL, &ev);
+ if (G_LIKELY (rflow == GST_FLOW_OK)) {
+ if (ev) {
+ int ret = tiger_renderer_add_event (tiger->tr, ev->ki, ev);
+ GST_INFO_OBJECT (tiger, "adding event for %p from %f to %f: %p, \"%s\"",
+ ev->ki, ev->start_time, ev->end_time, ev->bitmap, ev->text);
+ if (G_UNLIKELY (ret < 0)) {
+ GST_WARNING_OBJECT (tiger,
+ "failed to add Kate event to Tiger renderer: %d", ret);
+ }
+ }
+ }
+ gst_object_unref (tagpad);
+ }
- rflow =
- gst_kate_util_decoder_base_chain_kate_packet (&tiger->decoder,
- GST_ELEMENT_CAST (tiger), pad, buf, tiger->srcpad, &ev);
- if (G_LIKELY (rflow == GST_FLOW_OK)) {
- if (ev) {
- int ret = tiger_renderer_add_event (tiger->tr, ev->ki, ev);
- GST_INFO_OBJECT (tiger, "adding event for %p from %f to %f: %p, \"%s\"",
- ev->ki, ev->start_time, ev->end_time, ev->bitmap, ev->text);
- if (G_UNLIKELY (ret < 0)) {
- GST_WARNING_OBJECT (tiger,
- "failed to add Kate event to Tiger renderer: %d", ret);
+ /* we want to avoid shooting ahead of the video stream, or we will
+ get segment updates which will place us ahead of it, and we won't
+ be able to convert a video timestamp back into a kate timestamp */
+ if (G_LIKELY (GST_BUFFER_TIMESTAMP_IS_VALID (buf))) {
+ while (1) {
+ gint64 kate_time, video_time;
+ kate_time =
+ gst_segment_to_running_time (&tiger->decoder.kate_segment,
+ GST_FORMAT_TIME, GST_BUFFER_TIMESTAMP (buf));
+ video_time =
+ gst_segment_to_running_time (&tiger->video_segment, GST_FORMAT_TIME,
+ tiger->video_segment.last_stop);
+ GST_DEBUG_OBJECT (tiger, "Kate time %.2f, video time %.2f (kts %ld)",
+ kate_time / (float) GST_SECOND, video_time / (float) GST_SECOND,
+ (long) GST_BUFFER_TIMESTAMP (buf));
+ if (kate_time <= video_time) {
+ break;
+ }
+ GST_LOG_OBJECT (tiger, "Waiting to return from chain function");
+ g_cond_wait (tiger->cond, tiger->mutex);
+ if (tiger->decoder.kate_flushing) {
+ GST_DEBUG_OBJECT (tiger, "Flushing while waiting");
+ break;
}
+ GST_LOG_OBJECT (tiger, "Woken up, checking time again");
}
}
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
+
gst_object_unref (tiger);
gst_buffer_unref (buf);
- g_mutex_unlock (tiger->mutex);
-
return rflow;
}
@@ -569,28 +675,41 @@ static gboolean
gst_kate_tiger_video_set_caps (GstPad * pad, GstCaps * caps)
{
GstKateTiger *tiger = GST_KATE_TIGER (gst_pad_get_parent (pad));
- GstStructure *s;
+ GstVideoFormat format;
gint w, h;
- gboolean res = FALSE;
- g_mutex_lock (tiger->mutex);
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
- s = gst_caps_get_structure (caps, 0);
+ /* Cairo expects ARGB in native endianness, and that's what we get
+ as we've forced it in the caps. We might allow swapped red/blue
+ at some point, and get tiger to swap, to make some cases faster */
+ tiger->swap_rgb = FALSE;
- if (G_LIKELY (gst_structure_get_int (s, "width", &w))
- && G_LIKELY (gst_structure_get_int (s, "height", &h))) {
- GST_INFO_OBJECT (tiger, "video sink: %d %d", w, h);
+ if (gst_video_format_parse_caps (caps, &format, &w, &h)) {
tiger->video_width = w;
tiger->video_height = h;
- res = TRUE;
}
- g_mutex_unlock (tiger->mutex);
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
+
+ gst_pad_set_caps (tiger->srcpad, caps);
gst_object_unref (tiger);
return TRUE;
}
+static gdouble
+gst_kate_tiger_get_time (GstKateTiger * tiger)
+{
+ gint64 rt =
+ gst_segment_to_running_time (&tiger->video_segment, GST_FORMAT_TIME,
+ tiger->video_segment.last_stop);
+ gint64 pos =
+ gst_segment_to_position (&tiger->decoder.kate_segment, GST_FORMAT_TIME,
+ rt);
+ return pos / (gdouble) GST_SECOND;
+}
+
static GstFlowReturn
gst_kate_tiger_video_chain (GstPad * pad, GstBuffer * buf)
{
@@ -599,10 +718,23 @@ gst_kate_tiger_video_chain (GstPad * pad, GstBuffer * buf)
unsigned char *ptr;
int ret;
- g_mutex_lock (tiger->mutex);
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
GST_LOG_OBJECT (tiger, "got video frame, %u bytes", GST_BUFFER_SIZE (buf));
+ if (G_UNLIKELY (tiger->video_flushing)) {
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
+ gst_object_unref (tiger);
+ gst_buffer_unref (buf);
+ return GST_FLOW_WRONG_STATE;
+ }
+
+ if (G_LIKELY (GST_BUFFER_TIMESTAMP_IS_VALID (buf))) {
+ gst_segment_set_last_stop (&tiger->video_segment, GST_FORMAT_TIME,
+ GST_BUFFER_TIMESTAMP (buf));
+ g_cond_broadcast (tiger->cond);
+ }
+
/* draw on it */
buf = gst_buffer_make_writable (buf);
if (G_UNLIKELY (!buf)) {
@@ -613,12 +745,17 @@ gst_kate_tiger_video_chain (GstPad * pad, GstBuffer * buf)
GST_WARNING_OBJECT (tiger,
"Failed to get a pointer to video buffer data");
} else {
- ret = tiger_renderer_set_buffer (tiger->tr, ptr, tiger->video_width, tiger->video_height, tiger->video_width * 4, 0); // TODO: stride ?
+ ret =
+ tiger_renderer_set_buffer (tiger->tr, ptr, tiger->video_width,
+ tiger->video_height, tiger->video_width * 4, tiger->swap_rgb);
if (G_UNLIKELY (ret < 0)) {
GST_WARNING_OBJECT (tiger,
"Tiger renderer failed to set buffer to video frame: %d", ret);
} else {
- kate_float t = GST_BUFFER_TIMESTAMP (buf) / (gdouble) GST_SECOND;
+ kate_float t = gst_kate_tiger_get_time (tiger);
+ GST_LOG_OBJECT (tiger, "Video segment calc: last stop %ld, time %.3f",
+ (long) tiger->video_segment.last_stop, t);
+
ret = tiger_renderer_update (tiger->tr, t, 1);
if (G_UNLIKELY (ret < 0)) {
GST_WARNING_OBJECT (tiger, "Tiger renderer failed to update: %d",
@@ -636,12 +773,13 @@ gst_kate_tiger_video_chain (GstPad * pad, GstBuffer * buf)
}
}
}
+
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
+
rflow = gst_pad_push (tiger->srcpad, buf);
gst_object_unref (tiger);
- g_mutex_unlock (tiger->mutex);
-
return rflow;
}
@@ -654,12 +792,16 @@ gst_kate_tiger_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_DEBUG_OBJECT (tiger, "PAUSED -> READY, clearing kate state");
- g_mutex_lock (tiger->mutex);
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
+ gst_kate_util_decoder_base_set_flushing (&tiger->decoder, TRUE);
+ g_cond_broadcast (tiger->cond);
if (tiger->tr) {
tiger_renderer_destroy (tiger->tr);
tiger->tr = NULL;
}
- g_mutex_unlock (tiger->mutex);
+ gst_segment_init (&tiger->video_segment, GST_FORMAT_UNDEFINED);
+ tiger->video_flushing = TRUE;
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
break;
default:
break;
@@ -672,7 +814,7 @@ gst_kate_tiger_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_DEBUG_OBJECT (tiger, "READY -> PAUSED, initializing kate state");
- g_mutex_lock (tiger->mutex);
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
if (tiger->decoder.initialized) {
int ret = tiger_renderer_create (&tiger->tr);
if (ret < 0) {
@@ -692,7 +834,10 @@ gst_kate_tiger_change_state (GstElement * element, GstStateChange transition)
gst_kate_tiger_update_quality (tiger);
}
}
- g_mutex_unlock (tiger->mutex);
+ gst_segment_init (&tiger->video_segment, GST_FORMAT_UNDEFINED);
+ tiger->video_flushing = FALSE;
+ tiger->seen_header = FALSE;
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
break;
default:
break;
@@ -713,18 +858,44 @@ gst_kate_tiger_seek (GstKateTiger * tiger, GstPad * pad, GstEvent * event)
gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
&stop_type, &stop);
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
+ tiger->video_flushing = TRUE;
+ gst_kate_util_decoder_base_set_flushing (&tiger->decoder, TRUE);
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
+
+ if (format == GST_FORMAT_TIME) {
+ /* if seeking in time, we can update tiger to remove any appropriate events */
+ kate_float target;
+ switch (cur_type) {
+ case GST_SEEK_TYPE_SET:
+ target = cur / (float) GST_SECOND;
+ break;
+ case GST_SEEK_TYPE_CUR:
+ GST_WARNING_OBJECT (tiger,
+ "Seeking from the current segment, cannot work out target so flushing everything");
+ target = (kate_float) 0;
+ break;
+ case GST_SEEK_TYPE_END:
+ GST_WARNING_OBJECT (tiger,
+ "Seeking from the end, cannot work out target so flushing everything");
+ target = (kate_float) 0;
+ break;
+ default:
+ GST_WARNING_OBJECT (tiger, "Unexpected seek type");
+ target = (kate_float) 0;
+ break;
+ }
+ GST_INFO_OBJECT (tiger, "Seeking in time to %f", target);
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
+ tiger_renderer_seek (tiger->tr, target);
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
+ }
+
/* forward to both sinks */
gst_event_ref (event);
if (gst_pad_push_event (tiger->videosinkpad, event)) {
- if (gst_pad_push_event (tiger->katesinkpad, event)) {
- if (format == GST_FORMAT_TIME) {
- /* if seeking in time, we can update tiger to remove any appropriate events */
- kate_float target = cur / (gdouble) GST_SECOND;
- GST_INFO_OBJECT (tiger, "Seeking in time to %f", target);
- g_mutex_lock (tiger->mutex);
- tiger_renderer_seek (tiger->tr, target);
- g_mutex_unlock (tiger->mutex);
- }
+ int ret = gst_pad_push_event (tiger->katesinkpad, event);
+ if (ret) {
return TRUE;
} else {
return FALSE;
@@ -744,6 +915,9 @@ gst_kate_tiger_source_event (GstPad * pad, GstEvent * event)
g_return_val_if_fail (tiger != NULL, FALSE);
+ GST_LOG_OBJECT (tiger, "Event on source pad: %s",
+ GST_EVENT_TYPE_NAME (event));
+
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:
GST_INFO_OBJECT (tiger, "Seek on source pad");
@@ -760,23 +934,41 @@ gst_kate_tiger_source_event (GstPad * pad, GstEvent * event)
}
static gboolean
-gst_kate_tiger_kate_event (GstPad * pad, GstEvent * event)
+gst_kate_tiger_handle_kate_event (GstPad * pad, GstEvent * event)
{
GstKateTiger *tiger =
(GstKateTiger *) (gst_object_get_parent (GST_OBJECT (pad)));
gboolean res = TRUE;
- g_return_val_if_fail (tiger != NULL, FALSE);
-
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NEWSEGMENT:
GST_INFO_OBJECT (tiger, "New segment on Kate pad");
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
+ g_cond_broadcast (tiger->cond);
+ gst_kate_util_decoder_base_new_segment_event (&tiger->decoder, event);
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
+ gst_event_unref (event);
+ break;
+ case GST_EVENT_FLUSH_START:
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
+ gst_kate_util_decoder_base_set_flushing (&tiger->decoder, TRUE);
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
+ g_cond_broadcast (tiger->cond);
+ gst_event_unref (event);
+ break;
+ case GST_EVENT_FLUSH_STOP:
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
+ gst_kate_util_decoder_base_set_flushing (&tiger->decoder, FALSE);
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
gst_event_unref (event);
break;
case GST_EVENT_EOS:
/* we ignore this, it just means we don't have anymore Kate packets, but
the Tiger renderer will still draw (if appropriate) on incoming video */
GST_INFO_OBJECT (tiger, "EOS on Kate pad");
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
+ g_cond_broadcast (tiger->cond);
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
gst_event_unref (event);
break;
default:
@@ -789,12 +981,116 @@ gst_kate_tiger_kate_event (GstPad * pad, GstEvent * event)
return res;
}
+static gboolean
+gst_kate_tiger_kate_event (GstPad * pad, GstEvent * event)
+{
+ GstKateTiger *tiger =
+ (GstKateTiger *) (gst_object_get_parent (GST_OBJECT (pad)));
+ gboolean res = TRUE;
+
+ g_return_val_if_fail (tiger != NULL, FALSE);
+
+ GST_LOG_OBJECT (tiger, "Event on Kate pad: %s", GST_EVENT_TYPE_NAME (event));
+
+ /* Delay events till we've set caps */
+ if (gst_kate_util_decoder_base_queue_event (&tiger->decoder, event,
+ &gst_kate_tiger_handle_kate_event, pad)) {
+ gst_object_unref (tiger);
+ return TRUE;
+ }
+
+ res = gst_kate_tiger_handle_kate_event (pad, event);
+
+ gst_object_unref (tiger);
+
+ return res;
+}
+
+static gboolean
+gst_kate_tiger_handle_video_event (GstPad * pad, GstEvent * event)
+{
+ GstKateTiger *tiger =
+ (GstKateTiger *) (gst_object_get_parent (GST_OBJECT (pad)));
+ gboolean res = TRUE;
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_NEWSEGMENT:
+ {
+ gboolean update;
+ gdouble rate, arate;
+ GstFormat format;
+ gint64 start, stop, time;
+
+ gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
+ &start, &stop, &time);
+
+ if (format == GST_FORMAT_TIME) {
+ GST_DEBUG_OBJECT (tiger, "video pad segment:"
+ " Update %d, rate %g arate %g format %d start %" GST_TIME_FORMAT
+ " %" GST_TIME_FORMAT " position %" GST_TIME_FORMAT,
+ update, rate, arate, format, GST_TIME_ARGS (start),
+ GST_TIME_ARGS (stop), GST_TIME_ARGS (time));
+
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
+ gst_segment_set_newsegment_full (&tiger->video_segment, update, rate,
+ arate, format, start, stop, time);
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
+ }
+
+ res = gst_pad_event_default (pad, event);
+ break;
+ }
+ case GST_EVENT_FLUSH_START:
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
+ gst_segment_init (&tiger->video_segment, GST_FORMAT_UNDEFINED);
+ tiger->video_flushing = TRUE;
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
+ g_cond_broadcast (tiger->cond);
+ res = gst_pad_event_default (pad, event);
+ break;
+ case GST_EVENT_FLUSH_STOP:
+ GST_KATE_TIGER_MUTEX_LOCK (tiger);
+ gst_segment_init (&tiger->video_segment, GST_FORMAT_UNDEFINED);
+ tiger->video_flushing = FALSE;
+ GST_KATE_TIGER_MUTEX_UNLOCK (tiger);
+ res = gst_pad_event_default (pad, event);
+ break;
+ default:
+ res = gst_pad_event_default (pad, event);
+ break;
+ }
+
+ gst_object_unref (tiger);
+
+ return res;
+}
+
+static gboolean
+gst_kate_tiger_video_event (GstPad * pad, GstEvent * event)
+{
+ GstKateTiger *tiger =
+ (GstKateTiger *) (gst_object_get_parent (GST_OBJECT (pad)));
+ gboolean res = TRUE;
+
+ g_return_val_if_fail (tiger != NULL, FALSE);
+
+ GST_INFO_OBJECT (tiger, "Event on video pad: %s",
+ GST_EVENT_TYPE_NAME (event));
+
+ res = gst_kate_tiger_handle_video_event (pad, event);
+
+ gst_object_unref (tiger);
+
+ return res;
+}
+
gboolean
gst_kate_tiger_kate_sink_query (GstPad * pad, GstQuery * query)
{
GstKateTiger *tiger = GST_KATE_TIGER (gst_pad_get_parent (pad));
gboolean res = gst_kate_decoder_base_sink_query (&tiger->decoder,
GST_ELEMENT_CAST (tiger), pad, query);
+ GST_INFO_OBJECT (tiger, "Query on Kate pad");
gst_object_unref (tiger);
return res;
}
diff --git a/ext/kate/gstkatetiger.h b/ext/kate/gstkatetiger.h
index 0ab7dc136..d3880b32b 100644
--- a/ext/kate/gstkatetiger.h
+++ b/ext/kate/gstkatetiger.h
@@ -68,14 +68,12 @@ typedef struct _GstKateTigerClass GstKateTigerClass;
struct _GstKateTiger
{
- GstElement element;
+ GstKateDecoderBase decoder;
GstPad *katesinkpad;
GstPad *videosinkpad;
GstPad *srcpad;
- GstKateDecoderBase decoder;
-
tiger_renderer *tr;
gdouble quality;
@@ -93,8 +91,14 @@ struct _GstKateTiger
gint video_width;
gint video_height;
+ gboolean swap_rgb;
GMutex *mutex;
+ GCond *cond;
+
+ GstSegment video_segment;
+ gboolean video_flushing;
+ gboolean seen_header;
};
struct _GstKateTigerClass
diff --git a/ext/kate/gstkateutil.c b/ext/kate/gstkateutil.c
index 5b71b94a3..46ae19b9d 100644
--- a/ext/kate/gstkateutil.c
+++ b/ext/kate/gstkateutil.c
@@ -23,10 +23,17 @@
# include "config.h"
#endif
+#include <string.h>
#include <gst/tag/tag.h>
#include "gstkate.h"
#include "gstkateutil.h"
+GST_DEBUG_CATEGORY_EXTERN (gst_kateutil_debug);
+#define GST_CAT_DEFAULT gst_kateutil_debug
+
+static void gst_kate_util_decoder_base_free_event_queue (GstKateDecoderBase *
+ decoder);
+
GstCaps *
gst_kate_util_set_header_on_caps (GstElement * element, GstCaps * caps,
GList * headers)
@@ -95,7 +102,8 @@ gst_kate_util_install_decoder_base_properties (GObjectClass * gobject_class)
}
void
-gst_kate_util_decode_base_init (GstKateDecoderBase * decoder)
+gst_kate_util_decode_base_init (GstKateDecoderBase * decoder,
+ gboolean delay_events)
{
if (G_UNLIKELY (!decoder))
return;
@@ -106,6 +114,8 @@ gst_kate_util_decode_base_init (GstKateDecoderBase * decoder)
decoder->original_canvas_height = 0;
decoder->tags = NULL;
decoder->initialized = FALSE;
+ decoder->delay_events = delay_events;
+ decoder->event_queue = NULL;
}
static void
@@ -121,10 +131,77 @@ gst_kate_util_decode_base_reset (GstKateDecoderBase * decoder)
}
decoder->original_canvas_width = 0;
decoder->original_canvas_height = 0;
+ if (decoder->event_queue) {
+ gst_kate_util_decoder_base_free_event_queue (decoder);
+ }
decoder->initialized = FALSE;
}
gboolean
+gst_kate_util_decoder_base_queue_event (GstKateDecoderBase * decoder,
+ GstEvent * event, gboolean (*handler) (GstPad *, GstEvent *), GstPad * pad)
+{
+ gboolean can_be_queued;
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_FLUSH_START:
+ case GST_EVENT_FLUSH_STOP:
+ case GST_EVENT_EOS:
+ can_be_queued = FALSE;
+ break;
+ default:
+ can_be_queued = TRUE;
+ break;
+ }
+
+ if (decoder->delay_events && can_be_queued) {
+ GstKateDecoderBaseQueuedEvent *item;
+ GST_DEBUG_OBJECT (decoder, "We have to delay the event");
+ item = g_slice_new (GstKateDecoderBaseQueuedEvent);
+ if (item) {
+ item->event = event;
+ item->pad = pad;
+ item->handler = handler;
+ g_queue_push_tail (decoder->event_queue, item);
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ } else {
+ return FALSE;
+ }
+}
+
+static void
+gst_kate_util_decoder_base_free_event_queue (GstKateDecoderBase * decoder)
+{
+ while (decoder->event_queue->length) {
+ GstKateDecoderBaseQueuedEvent *item = (GstKateDecoderBaseQueuedEvent *)
+ g_queue_pop_head (decoder->event_queue);
+ g_slice_free (GstKateDecoderBaseQueuedEvent, item);
+ }
+ g_queue_free (decoder->event_queue);
+ decoder->event_queue = NULL;
+}
+
+static void
+gst_kate_util_decoder_base_drain_event_queue (GstKateDecoderBase * decoder)
+{
+ decoder->delay_events = FALSE;
+
+ if (decoder->event_queue->length == 0)
+ return;
+
+ GST_DEBUG_OBJECT (decoder, "We can now drain all events!");
+ while (decoder->event_queue->length) {
+ GstKateDecoderBaseQueuedEvent *item = (GstKateDecoderBaseQueuedEvent *)
+ g_queue_pop_head (decoder->event_queue);
+ (*item->handler) (item->pad, item->event);
+ g_slice_free (GstKateDecoderBaseQueuedEvent, item);
+ }
+}
+
+gboolean
gst_kate_util_decoder_base_get_property (GstKateDecoderBase * decoder,
GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
{
@@ -152,38 +229,65 @@ gst_kate_util_decoder_base_get_property (GstKateDecoderBase * decoder,
GstFlowReturn
gst_kate_util_decoder_base_chain_kate_packet (GstKateDecoderBase * decoder,
GstElement * element, GstPad * pad, GstBuffer * buf, GstPad * srcpad,
- const kate_event ** ev)
+ GstPad * tagpad, GstCaps ** src_caps, const kate_event ** ev)
{
kate_packet kp;
int ret;
GstFlowReturn rflow = GST_FLOW_OK;
+ gboolean is_header;
GST_DEBUG_OBJECT (element, "got kate packet, %u bytes, type %02x",
GST_BUFFER_SIZE (buf),
GST_BUFFER_SIZE (buf) == 0 ? -1 : GST_BUFFER_DATA (buf)[0]);
+
+ is_header = GST_BUFFER_SIZE (buf) > 0 && (GST_BUFFER_DATA (buf)[0] & 0x80);
+
+ if (!is_header && decoder->tags) {
+ /* after we've processed headers, send any tags before processing the data packet */
+ GST_DEBUG_OBJECT (element, "Not a header, sending tags for pad %s:%s",
+ GST_DEBUG_PAD_NAME (tagpad));
+ gst_element_found_tags_for_pad (element, tagpad, decoder->tags);
+ decoder->tags = NULL;
+ }
+
kate_packet_wrap (&kp, GST_BUFFER_SIZE (buf), GST_BUFFER_DATA (buf));
ret = kate_high_decode_packetin (&decoder->k, &kp, ev);
if (G_UNLIKELY (ret < 0)) {
GST_ELEMENT_ERROR (element, STREAM, DECODE, (NULL),
("Failed to decode Kate packet: %d", ret));
return GST_FLOW_ERROR;
- } else if (G_UNLIKELY (ret > 0)) {
+ }
+
+ if (G_UNLIKELY (ret > 0)) {
GST_DEBUG_OBJECT (element,
"kate_high_decode_packetin has received EOS packet");
- return GST_FLOW_OK;
}
/* headers may be interesting to retrieve information from */
- if (G_LIKELY (GST_BUFFER_SIZE (buf) > 0))
+ if (G_UNLIKELY (is_header)) {
switch (GST_BUFFER_DATA (buf)[0]) {
- GstCaps *caps;
-
case 0x80: /* ID header */
GST_INFO_OBJECT (element, "Parsed ID header: language %s, category %s",
decoder->k.ki->language, decoder->k.ki->category);
- caps = gst_caps_new_simple ("text/x-pango-markup", NULL);
- gst_pad_set_caps (srcpad, caps);
- gst_caps_unref (caps);
+ if (src_caps) {
+ if (*src_caps) {
+ gst_caps_unref (*src_caps);
+ *src_caps = NULL;
+ }
+ if (strcmp (decoder->k.ki->category, "K-SPU") == 0 ||
+ strcmp (decoder->k.ki->category, "spu-subtitles") == 0) {
+ *src_caps = gst_caps_new_simple ("video/x-dvd-subpicture", NULL);
+ } else if (decoder->k.ki->text_markup_type == kate_markup_none) {
+ *src_caps = gst_caps_new_simple ("text/plain", NULL);
+ } else {
+ *src_caps = gst_caps_new_simple ("text/x-pango-markup", NULL);
+ }
+ GST_INFO_OBJECT (srcpad, "Setting caps: %" GST_PTR_FORMAT, *src_caps);
+ if (!gst_pad_set_caps (srcpad, *src_caps)) {
+ GST_ERROR_OBJECT (srcpad, "Failed to set caps %" GST_PTR_FORMAT,
+ *src_caps);
+ }
+ }
if (decoder->k.ki->language && *decoder->k.ki->language) {
GstTagList *old = decoder->tags, *tags = gst_tag_list_new ();
if (tags) {
@@ -214,6 +318,9 @@ gst_kate_util_decoder_base_chain_kate_packet (GstKateDecoderBase * decoder,
decoder->original_canvas_width = decoder->k.ki->original_canvas_width;
decoder->original_canvas_height = decoder->k.ki->original_canvas_height;
+ /* we can now send away any event we've delayed, as the src pad now has caps */
+ gst_kate_util_decoder_base_drain_event_queue (decoder);
+
break;
case 0x81: /* Vorbis comments header */
@@ -248,7 +355,7 @@ gst_kate_util_decoder_base_chain_kate_packet (GstKateDecoderBase * decoder,
gst_tag_list_free (old);
if (decoder->initialized) {
- gst_element_found_tags_for_pad (element, srcpad, decoder->tags);
+ gst_element_found_tags_for_pad (element, tagpad, decoder->tags);
decoder->tags = NULL;
} else {
/* Only push them as messages for the time being. *
@@ -263,6 +370,7 @@ gst_kate_util_decoder_base_chain_kate_packet (GstKateDecoderBase * decoder,
default:
break;
}
+ }
return rflow;
}
@@ -285,7 +393,10 @@ gst_kate_decoder_base_change_state (GstKateDecoderBase * decoder,
GST_WARNING_OBJECT (element, "failed to initialize kate state: %d",
ret);
}
+ gst_segment_init (&decoder->kate_segment, GST_FORMAT_UNDEFINED);
+ decoder->kate_flushing = FALSE;
decoder->initialized = TRUE;
+ decoder->event_queue = g_queue_new ();
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
@@ -304,6 +415,8 @@ gst_kate_decoder_base_change_state (GstKateDecoderBase * decoder,
kate_high_decode_clear (&decoder->k);
decoder->initialized = FALSE;
}
+ gst_segment_init (&decoder->kate_segment, GST_FORMAT_UNDEFINED);
+ decoder->kate_flushing = TRUE;
gst_kate_util_decode_base_reset (decoder);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
@@ -316,6 +429,79 @@ gst_kate_decoder_base_change_state (GstKateDecoderBase * decoder,
return res;
}
+void
+gst_kate_util_decoder_base_set_flushing (GstKateDecoderBase * decoder,
+ gboolean flushing)
+{
+ decoder->kate_flushing = flushing;
+ gst_segment_init (&decoder->kate_segment, GST_FORMAT_UNDEFINED);
+}
+
+void
+gst_kate_util_decoder_base_new_segment_event (GstKateDecoderBase * decoder,
+ GstEvent * event)
+{
+ gboolean update;
+ gdouble rate;
+ GstFormat format;
+ gint64 start, stop, time;
+ gdouble arate;
+
+ gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
+ &start, &stop, &time);
+ GST_DEBUG_OBJECT (decoder, "kate pad segment:"
+ " Update %d, rate %g arate %g format %d start %" GST_TIME_FORMAT
+ " %" GST_TIME_FORMAT " position %" GST_TIME_FORMAT,
+ update, rate, arate, format, GST_TIME_ARGS (start),
+ GST_TIME_ARGS (stop), GST_TIME_ARGS (time));
+ if (!update) {
+ /* Tiger uses this segment is used to remap the video running time to the
+ Kate running time. The sending of segment updates to keep streams in sync
+ does kinda rain on our parade though, and since we don't need these,
+ we just ignore those here */
+ gst_segment_set_newsegment_full (&decoder->kate_segment, update, rate,
+ arate, format, start, stop, time);
+ }
+}
+
+gboolean
+gst_kate_util_decoder_base_update_segment (GstKateDecoderBase * decoder,
+ GstElement * element, GstBuffer * buf)
+{
+ gint64 clip_start = 0, clip_stop = 0;
+ gboolean in_seg;
+
+ if (decoder->kate_flushing) {
+ GST_LOG_OBJECT (element, "Kate pad flushing, buffer ignored");
+ return FALSE;
+ }
+
+ if (G_LIKELY (GST_BUFFER_TIMESTAMP_IS_VALID (buf))) {
+ GstClockTime stop;
+
+ if (G_LIKELY (GST_BUFFER_DURATION_IS_VALID (buf)))
+ stop = GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf);
+ else
+ stop = GST_CLOCK_TIME_NONE;
+
+ in_seg = gst_segment_clip (&decoder->kate_segment, GST_FORMAT_TIME,
+ GST_BUFFER_TIMESTAMP (buf), stop, &clip_start, &clip_stop);
+ } else {
+ in_seg = TRUE;
+ }
+
+ if (in_seg) {
+ if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
+ gst_segment_set_last_stop (&decoder->kate_segment, GST_FORMAT_TIME,
+ clip_start);
+ }
+ } else {
+ GST_INFO_OBJECT (element, "Kate buffer not in segment, ignored");
+ }
+
+ return in_seg;
+}
+
static GstClockTime
gst_kate_util_granule_time (kate_state * k, gint64 granulepos)
{
diff --git a/ext/kate/gstkateutil.h b/ext/kate/gstkateutil.h
index 6e8ea2e01..27b6f70f3 100644
--- a/ext/kate/gstkateutil.h
+++ b/ext/kate/gstkateutil.h
@@ -37,6 +37,15 @@ G_BEGIN_DECLS enum
typedef struct
{
+ GstEvent * event;
+ gboolean (*handler)(GstPad *, GstEvent *);
+ GstPad *pad;
+} GstKateDecoderBaseQueuedEvent;
+
+typedef struct
+{
+ GstElement element;
+
kate_state k;
gboolean initialized;
@@ -49,11 +58,17 @@ typedef struct
gint original_canvas_width;
gint original_canvas_height;
+ GstSegment kate_segment;
+ gboolean kate_flushing;
+
+ gboolean delay_events;
+ GQueue *event_queue;
} GstKateDecoderBase;
extern GstCaps *gst_kate_util_set_header_on_caps (GstElement * element,
GstCaps * caps, GList * headers);
-extern void gst_kate_util_decode_base_init (GstKateDecoderBase * decoder);
+extern void gst_kate_util_decode_base_init (GstKateDecoderBase * decoder,
+ gboolean delay_events);
extern void gst_kate_util_install_decoder_base_properties (GObjectClass *
gobject_class);
extern gboolean gst_kate_util_decoder_base_get_property (GstKateDecoderBase *
@@ -62,7 +77,16 @@ extern gboolean gst_kate_util_decoder_base_get_property (GstKateDecoderBase *
extern GstFlowReturn
gst_kate_util_decoder_base_chain_kate_packet (GstKateDecoderBase * decoder,
GstElement * element, GstPad * pad, GstBuffer * buffer, GstPad * srcpad,
- const kate_event ** ev);
+ GstPad * tagpad, GstCaps **src_caps, const kate_event ** ev);
+extern void
+gst_kate_util_decoder_base_set_flushing (GstKateDecoderBase * decoder,
+ gboolean flushing);
+extern void
+gst_kate_util_decoder_base_new_segment_event (GstKateDecoderBase * decoder,
+ GstEvent * event);
+extern gboolean
+gst_kate_util_decoder_base_update_segment (GstKateDecoderBase * decoder,
+ GstElement * element, GstBuffer * buf);
extern GstStateChangeReturn
gst_kate_decoder_base_change_state (GstKateDecoderBase * decoder,
GstElement * element, GstElementClass * parent_class,
@@ -72,6 +96,8 @@ extern gboolean gst_kate_decoder_base_convert (GstKateDecoderBase * decoder,
GstFormat * dest_fmt, gint64 * dest_val);
extern gboolean gst_kate_decoder_base_sink_query (GstKateDecoderBase * decoder,
GstElement * element, GstPad * pad, GstQuery * query);
+extern gboolean
+gst_kate_util_decoder_base_queue_event (GstKateDecoderBase * decoder, GstEvent * event, gboolean (*handler)(GstPad *, GstEvent *), GstPad * pad);
G_END_DECLS
#endif /* __GST_KATE_UTIL_H__ */
diff --git a/ext/resindvd/resindvdsrc.c b/ext/resindvd/resindvdsrc.c
index 72c8d2544..e4bdd7eec 100644
--- a/ext/resindvd/resindvdsrc.c
+++ b/ext/resindvd/resindvdsrc.c
@@ -36,6 +36,7 @@ GST_DEBUG_CATEGORY_STATIC (rsndvdsrc_debug);
#define DEFAULT_DEVICE "/dev/dvd"
#define DEFAULT_FASTSTART TRUE
+#define DEFAULT_LANG "en"
#define GST_FLOW_WOULD_BLOCK GST_FLOW_CUSTOM_SUCCESS
@@ -61,7 +62,7 @@ typedef enum
RSN_BTN_LEFT = 0x01,
RSN_BTN_RIGHT = 0x02,
RSN_BTN_UP = 0x04,
- RSN_BTN_DOWN = 0x04
+ RSN_BTN_DOWN = 0x08
} RsnBtnMask;
enum
@@ -354,6 +355,8 @@ static gboolean
rsn_dvdsrc_start (GstBaseSrc * bsrc)
{
resinDvdSrc *src = RESINDVDSRC (bsrc);
+ const gchar *const *langs, *const *cur;
+ gchar lang[8];
g_mutex_lock (src->dvd_lock);
if (!read_vts_info (src)) {
@@ -374,6 +377,21 @@ rsn_dvdsrc_start (GstBaseSrc * bsrc)
goto fail;
}
+ /* Attempt to set DVD menu, audio and spu languages */
+ langs = g_get_language_names ();
+ strncpy (lang, DEFAULT_LANG, 8);
+ for (cur = langs; *cur != NULL; cur++) {
+ /* Look for a 2 char iso-639 lang */
+ if (strlen (*cur) == 2) {
+ strncpy (lang, *cur, 8);
+ break;
+ }
+ }
+ /* Set the user's preferred language */
+ dvdnav_menu_language_select (src->dvdnav, lang);
+ dvdnav_audio_language_select (src->dvdnav, lang);
+ dvdnav_spu_language_select (src->dvdnav, lang);
+
if (src->faststart) {
if (dvdnav_title_play (src->dvdnav, 1) != DVDNAV_STATUS_OK ||
(dvdnav_menu_call (src->dvdnav, DVD_MENU_Title) != DVDNAV_STATUS_OK &&
@@ -391,6 +409,7 @@ rsn_dvdsrc_start (GstBaseSrc * bsrc)
src->branching = FALSE;
src->discont = TRUE;
src->need_segment = TRUE;
+ src->need_tag_update = TRUE;
src->cur_position = GST_CLOCK_TIME_NONE;
src->pgc_duration = GST_CLOCK_TIME_NONE;
@@ -792,8 +811,8 @@ get_current_pgc (resinDvdSrc * src)
return pgc;
}
-static void
-update_title_info (resinDvdSrc * src)
+static GstTagList *
+update_title_info (resinDvdSrc * src, gboolean force)
{
gint n_angles, cur_agl;
gint title_n, part_n;
@@ -807,14 +826,14 @@ update_title_info (resinDvdSrc * src)
if (dvdnav_current_title_info (src->dvdnav, &title_n,
&part_n) != DVDNAV_STATUS_OK) {
if (!src->in_menu)
- return; /* Can't update now */
+ return NULL; /* Can't update now */
/* Must be in the first play sequence */
title_n = -1;
part_n = 0;
}
if (title_n != src->title_n || part_n != src->part_n ||
- src->n_angles != n_angles || src->cur_angle != cur_agl) {
+ src->n_angles != n_angles || src->cur_angle != cur_agl || force) {
gchar *title_str = NULL;
src->title_n = title_n;
@@ -852,9 +871,11 @@ update_title_info (resinDvdSrc * src)
gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_TITLE,
title_str, NULL);
g_free (title_str);
- gst_element_found_tags (GST_ELEMENT_CAST (src), tags);
+ return tags;
}
}
+
+ return NULL;
}
/* we don't cache the result on purpose */
@@ -1028,8 +1049,7 @@ rsn_dvdsrc_step (resinDvdSrc * src, gboolean have_dvd_lock)
GST_TIME_ARGS (src->cur_position));
rsn_dvdsrc_prepare_streamsinfo_event (src);
-
- update_title_info (src);
+ src->need_tag_update = TRUE;
break;
}
@@ -1058,11 +1078,11 @@ rsn_dvdsrc_step (resinDvdSrc * src, gboolean have_dvd_lock)
dvdnav_audio_stream_change_event_t *event =
(dvdnav_audio_stream_change_event_t *) data;
+ rsn_dvdsrc_prepare_audio_stream_event (src,
+ event->logical, event->physical);
GST_DEBUG_OBJECT (src, " physical: %d", event->physical);
GST_DEBUG_OBJECT (src, " logical: %d", event->logical);
- rsn_dvdsrc_prepare_audio_stream_event (src,
- event->logical, event->physical);
break;
}
case DVDNAV_SPU_STREAM_CHANGE:{
@@ -1276,6 +1296,7 @@ rsn_dvdsrc_create (GstBaseSrc * bsrc, guint64 offset,
GstEvent *audio_select_event = NULL;
GstEvent *highlight_event = NULL;
GstMessage *angles_msg = NULL;
+ GstTagList *tags = NULL;
gboolean cmds_changed = FALSE;
*outbuf = NULL;
@@ -1313,6 +1334,11 @@ rsn_dvdsrc_create (GstBaseSrc * bsrc, guint64 offset,
cmds_changed = src->commands_changed;
src->commands_changed = FALSE;
+ if (src->need_tag_update) {
+ tags = update_title_info (src, FALSE);
+ src->need_tag_update = FALSE;
+ }
+
g_mutex_unlock (src->dvd_lock);
/* Push in-band events now that we've dropped the dvd_lock, before
@@ -1359,6 +1385,11 @@ rsn_dvdsrc_create (GstBaseSrc * bsrc, guint64 offset,
if (src->cur_end_ts != GST_CLOCK_TIME_NONE)
gst_segment_set_last_stop (segment, GST_FORMAT_TIME, src->cur_end_ts);
+ if (tags) {
+ gst_element_found_tags_for_pad (GST_ELEMENT_CAST (src),
+ GST_BASE_SRC_PAD (src), tags);
+ tags = NULL;
+ }
g_mutex_lock (src->dvd_lock);
if (src->next_buf != NULL) {
@@ -1766,7 +1797,7 @@ rsn_dvdsrc_handle_navigation_event (resinDvdSrc * src, GstEvent * event)
}
src->angles_changed = FALSE;
- update_title_info (src);
+ src->need_tag_update = TRUE;
}
cmds_changed = src->commands_changed;
@@ -2369,7 +2400,7 @@ rsn_dvdsrc_src_event (GstBaseSrc * basesrc, GstEvent * event)
GST_LOG_OBJECT (src, "handling seek event");
gst_event_parse_seek (event, NULL, NULL, &flags, NULL, NULL, NULL, NULL);
- src->flushing_seek = ! !(flags & GST_SEEK_FLAG_FLUSH);
+ src->flushing_seek = !!(flags & GST_SEEK_FLAG_FLUSH);
GST_DEBUG_OBJECT (src, "%s seek event",
src->flushing_seek ? "flushing" : "non-flushing");
diff --git a/ext/resindvd/resindvdsrc.h b/ext/resindvd/resindvdsrc.h
index c3985b6cf..5e6e3c7a0 100644
--- a/ext/resindvd/resindvdsrc.h
+++ b/ext/resindvd/resindvdsrc.h
@@ -84,6 +84,7 @@ struct _resinDvdSrc
gboolean first_seek;
gboolean flushing_seek;
gboolean need_segment;
+ gboolean need_tag_update;
gboolean active_highlight;
gboolean in_still_state;
gboolean in_playing;
diff --git a/ext/rsvg/gstrsvgdec.c b/ext/rsvg/gstrsvgdec.c
index b885d15b8..c0a636216 100644
--- a/ext/rsvg/gstrsvgdec.c
+++ b/ext/rsvg/gstrsvgdec.c
@@ -16,6 +16,18 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
+/**
+ * SECTION:element-rsvgdec
+ *
+ * This elements renders SVG graphics.
+ *
+ * <refsect2>
+ * <title>Example launch lines</title>
+ * |[
+ * gst-launch filesrc location=image.svg ! rsvgdec ! imagefreeze ! ffmpegcolorspace ! autovideosink
+ * ]| render and show a svg image.
+ * </refsect2>
+ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/rsvg/gstrsvgoverlay.c b/ext/rsvg/gstrsvgoverlay.c
index d5c707824..1cbd0990c 100644
--- a/ext/rsvg/gstrsvgoverlay.c
+++ b/ext/rsvg/gstrsvgoverlay.c
@@ -24,19 +24,34 @@
* either be specified through properties, or fed through the
* data-sink pad.
*
- * Note: setting the x or y parameter to a non-zero value will implicitly disable the fit-to-frame behaviour.
+ * Position and dimension of the SVG graphics can be achieved by
+ * specifying appropriate dimensions in the SVG file itself, but
+ * shortcuts are provided by the element to specify x/y position and
+ * width/height dimension, both in absolute form (pixels) and in
+ * relative form (percentage of video dimension).
+ *
+ * For any measure (x/y/width/height), the absolute value (in pixels)
+ * takes precedence over the relative one if both are
+ * specified. Absolute values must be set to 0 to disable them.
+ *
+ * If all parameters are 0, the image is displayed without rescaling
+ * at (0, 0) position.
+ *
+ * The fit-to-frame property is a shortcut for displaying the SVG
+ * overlay at (0, 0) position filling the whole screen. It modifies
+ * the values of the x/y/width/height attributes, by setting
+ * height-/width-relative to 1.0. and all other attributes to 0.
*
* <refsect2>
- *
* <title>Example launch lines</title>
* |[
* gst-launch -v videotestsrc ! ffmpegcolorspace ! rsvgoverlay location=foo.svg ! ffmpegcolorspace ! autovideosink
- * ]| specifies the SVG location through the filename property.
+ * ]| specifies the SVG location through the filename property.
* |[
* gst-launch -v videotestsrc ! ffmpegcolorspace ! rsvgoverlay name=overlay ! ffmpegcolorspace ! autovideosink filesrc location=foo.svg ! image/svg ! overlay.data_sink
* ]| does the same by feeding data through the data_sink pad. You can also specify the SVG data itself as parameter:
* |[
- * gst-launch -v videotestsrc ! ffmpegcolorspace ! rsvgoverlay data='<svg viewBox="0 0 800 600"><image x="80%" y="80%" width="10%" height="10%" xlink:href="foo.jpg" /></svg>' ! ffmpegcolorspace ! autovideosink
+ * gst-launch -v videotestsrc ! ffmpegcolorspace ! rsvgoverlay data='&lt;svg viewBox="0 0 800 600"&gt;&lt;image x="80%" y="80%" width="10%" height="10%" xlink:href="foo.jpg" /&gt;&lt;/svg&gt;' ! ffmpegcolorspace ! autovideosink
* ]|
* </refsect2>
*/
@@ -61,6 +76,12 @@ enum
PROP_FIT_TO_FRAME,
PROP_X,
PROP_Y,
+ PROP_X_RELATIVE,
+ PROP_Y_RELATIVE,
+ PROP_WIDTH,
+ PROP_HEIGHT,
+ PROP_WIDTH_RELATIVE,
+ PROP_HEIGHT_RELATIVE
};
#define GST_RSVG_LOCK(overlay) G_STMT_START { \
@@ -126,16 +147,20 @@ gst_rsvg_overlay_set_svg_data (GstRsvgOverlay * overlay, const gchar * data,
else
overlay->handle =
rsvg_handle_new_from_data ((guint8 *) data, size, &error);
- if (error) {
- GST_ERROR_OBJECT (overlay, "Cannot read SVG data: %s\n%s",
- error->message, data);
- g_error_free (error);
+ if (error || overlay->handle == NULL) {
+ if (error) {
+ GST_ERROR_OBJECT (overlay, "Cannot read SVG data: %s\n%s",
+ error->message, data);
+ g_error_free (error);
+ } else {
+ GST_ERROR_OBJECT (overlay, "Cannot read SVG data: %s", data);
+ }
} else {
/* Get SVG dimension. */
RsvgDimensionData svg_dimension;
rsvg_handle_get_dimensions (overlay->handle, &svg_dimension);
- overlay->width = svg_dimension.width;
- overlay->height = svg_dimension.height;
+ overlay->svg_width = svg_dimension.width;
+ overlay->svg_height = svg_dimension.height;
gst_base_transform_set_passthrough (btrans, FALSE);
}
}
@@ -164,7 +189,19 @@ gst_rsvg_overlay_set_property (GObject * object, guint prop_id,
}
case PROP_FIT_TO_FRAME:
{
- overlay->fit_to_frame = g_value_get_boolean (value);
+ if (g_value_get_boolean (value)) {
+ overlay->x_offset = 0;
+ overlay->y_offset = 0;
+ overlay->x_relative = 0.0;
+ overlay->y_relative = 0.0;
+ overlay->width = 0;
+ overlay->height = 0;
+ overlay->width_relative = 1.0;
+ overlay->height_relative = 1.0;
+ } else {
+ overlay->width_relative = 0;
+ overlay->height_relative = 0;
+ }
break;
}
case PROP_X:
@@ -177,6 +214,37 @@ gst_rsvg_overlay_set_property (GObject * object, guint prop_id,
overlay->y_offset = g_value_get_int (value);
break;
}
+ case PROP_X_RELATIVE:
+ {
+ overlay->x_relative = g_value_get_float (value);
+ break;
+ }
+ case PROP_Y_RELATIVE:
+ {
+ overlay->y_relative = g_value_get_float (value);
+ break;
+ }
+
+ case PROP_WIDTH:
+ {
+ overlay->width = g_value_get_int (value);
+ break;
+ }
+ case PROP_HEIGHT:
+ {
+ overlay->height = g_value_get_int (value);
+ break;
+ }
+ case PROP_WIDTH_RELATIVE:
+ {
+ overlay->width_relative = g_value_get_float (value);
+ break;
+ }
+ case PROP_HEIGHT_RELATIVE:
+ {
+ overlay->height_relative = g_value_get_float (value);
+ break;
+ }
default:
{
@@ -196,13 +264,34 @@ gst_rsvg_overlay_get_property (GObject * object, guint prop_id, GValue * value,
switch (prop_id) {
case PROP_X:
- g_value_set_uint (value, overlay->x_offset);
+ g_value_set_int (value, overlay->x_offset);
break;
case PROP_Y:
- g_value_set_uint (value, overlay->y_offset);
+ g_value_set_int (value, overlay->y_offset);
+ break;
+ case PROP_X_RELATIVE:
+ g_value_set_float (value, overlay->x_relative);
+ break;
+ case PROP_Y_RELATIVE:
+ g_value_set_float (value, overlay->y_relative);
+ break;
+
+ case PROP_WIDTH:
+ g_value_set_int (value, overlay->width);
break;
+ case PROP_HEIGHT:
+ g_value_set_int (value, overlay->height);
+ break;
+ case PROP_WIDTH_RELATIVE:
+ g_value_set_float (value, overlay->width_relative);
+ break;
+ case PROP_HEIGHT_RELATIVE:
+ g_value_set_float (value, overlay->height_relative);
+ break;
+
case PROP_FIT_TO_FRAME:
- g_value_set_boolean (value, overlay->fit_to_frame);
+ g_value_set_boolean (value, (overlay->width_relative == 1.0
+ && overlay->height_relative == 1.0));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -274,6 +363,10 @@ gst_rsvg_overlay_transform_ip (GstBaseTransform * btrans, GstBuffer * buf)
GstRsvgOverlay *overlay = GST_RSVG_OVERLAY (btrans);
cairo_surface_t *surface;
cairo_t *cr;
+ double applied_x_offset = (double) overlay->x_offset;
+ double applied_y_offset = (double) overlay->y_offset;
+ int applied_width = overlay->width;
+ int applied_height = overlay->height;
GST_RSVG_LOCK (overlay);
if (!overlay->handle) {
@@ -294,14 +387,37 @@ gst_rsvg_overlay_transform_ip (GstBaseTransform * btrans, GstBuffer * buf)
return GST_FLOW_ERROR;
}
- /* If x or y offset is specified, do not fit-to-frame. */
- if (overlay->x_offset || overlay->y_offset)
- cairo_translate (cr, (double) overlay->x_offset,
- (double) overlay->y_offset);
- else if (overlay->fit_to_frame && overlay->width && overlay->height)
- cairo_scale (cr, (float) overlay->caps_width / overlay->width,
- (float) overlay->caps_height / overlay->height);
+ /* Compute relative dimensions if absolute dimensions are not set */
+ if (!applied_x_offset && overlay->x_relative) {
+ applied_x_offset = overlay->x_relative * overlay->caps_width;
+ }
+ if (!applied_y_offset && overlay->y_relative) {
+ applied_y_offset = overlay->y_relative * overlay->caps_height;
+ }
+ if (!applied_width && overlay->width_relative) {
+ applied_width = (int) (overlay->width_relative * overlay->caps_width);
+ }
+ if (!applied_height && overlay->height_relative) {
+ applied_height = (int) (overlay->height_relative * overlay->caps_height);
+ }
+
+ if (applied_x_offset || applied_y_offset) {
+ cairo_translate (cr, applied_x_offset, applied_y_offset);
+ }
+ /* Scale when necessary, i.e. an absolute or relative dimension has been specified. */
+ if ((applied_width || applied_height) && overlay->svg_width
+ && overlay->svg_height) {
+ /* If may happen that only one of the dimension is specified. Use
+ the original SVG size for the other dimension. */
+ if (!applied_width)
+ applied_width = overlay->svg_width;
+ if (!applied_height)
+ applied_height = overlay->svg_height;
+
+ cairo_scale (cr, (double) applied_width / overlay->svg_width,
+ (double) applied_height / overlay->svg_height);
+ }
rsvg_handle_render_cairo (overlay->handle, cr);
GST_RSVG_UNLOCK (overlay);
@@ -362,14 +478,40 @@ gst_rsvg_overlay_class_init (GstRsvgOverlayClass * klass)
g_param_spec_boolean ("fit-to-frame", "fit to frame",
"Fit the SVG to fill the whole frame.", TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_X,
g_param_spec_int ("x", "x offset",
- "Specify an x offset.", 0, G_MAXINT, 0,
+ "Specify an x offset.", -G_MAXINT, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_Y,
g_param_spec_int ("y", "y offset",
- "Specify a y offset.", 0, G_MAXINT, 0,
+ "Specify a y offset.", -G_MAXINT, G_MAXINT, 0,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_X_RELATIVE,
+ g_param_spec_float ("x-relative", "x relative offset",
+ "Specify an x offset relative to the display size.", -G_MAXFLOAT,
+ G_MAXFLOAT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_Y_RELATIVE,
+ g_param_spec_float ("y-relative", "y relative offset",
+ "Specify a y offset relative to the display size.", -G_MAXFLOAT,
+ G_MAXFLOAT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_WIDTH,
+ g_param_spec_int ("width", "width",
+ "Specify a width in pixels.", -G_MAXINT, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HEIGHT,
+ g_param_spec_int ("height", "height",
+ "Specify a height in pixels.", -G_MAXINT, G_MAXINT, 0,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_WIDTH_RELATIVE,
+ g_param_spec_float ("width-relative", "relative width",
+ "Specify a width relative to the display size.", -G_MAXFLOAT,
+ G_MAXFLOAT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HEIGHT_RELATIVE,
+ g_param_spec_float ("height-relative", "relative height",
+ "Specify a height relative to the display size.", -G_MAXFLOAT,
+ G_MAXFLOAT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
basetransform_class->set_caps = gst_rsvg_overlay_set_caps;
basetransform_class->transform_ip = gst_rsvg_overlay_transform_ip;
@@ -380,7 +522,15 @@ gst_rsvg_overlay_class_init (GstRsvgOverlayClass * klass)
static void
gst_rsvg_overlay_init (GstRsvgOverlay * overlay, GstRsvgOverlayClass * klass)
{
- overlay->fit_to_frame = 1;
+ overlay->x_offset = 0;
+ overlay->y_offset = 0;
+ overlay->x_relative = 0.0;
+ overlay->y_relative = 0.0;
+ overlay->width = 0;
+ overlay->height = 0;
+ overlay->width_relative = 0.0;
+ overlay->height_relative = 0.0;
+
overlay->adapter = gst_adapter_new ();
/* data sink */
diff --git a/ext/rsvg/gstrsvgoverlay.h b/ext/rsvg/gstrsvgoverlay.h
index a0125444c..371bc35be 100644
--- a/ext/rsvg/gstrsvgoverlay.h
+++ b/ext/rsvg/gstrsvgoverlay.h
@@ -50,13 +50,18 @@ struct _GstRsvgOverlay
RsvgHandle *handle;
/* width and height of the SVG data */
- int width;
- int height;
- /* Should we fit the SVG to the dimension ? */
- gboolean fit_to_frame;
+ int svg_width;
+ int svg_height;
int x_offset;
int y_offset;
+ float x_relative;
+ float y_relative;
+
+ int width;
+ int height;
+ float width_relative;
+ float height_relative;
GstVideoFormat caps_format;
int caps_width;
diff --git a/ext/schroedinger/Makefile.am b/ext/schroedinger/Makefile.am
index fdedd67f0..66b2e1e2f 100644
--- a/ext/schroedinger/Makefile.am
+++ b/ext/schroedinger/Makefile.am
@@ -8,7 +8,6 @@ libgstschro_la_SOURCES = \
gstschro.c \
gstschrodec.c \
gstschroenc.c \
- gstschroparse.c \
gstschroutils.c
libgstschro_la_CFLAGS = \
$(GST_PLUGINS_BAD_CFLAGS) \
diff --git a/ext/schroedinger/gstschro.c b/ext/schroedinger/gstschro.c
index 44d9226e6..c486473f9 100644
--- a/ext/schroedinger/gstschro.c
+++ b/ext/schroedinger/gstschro.c
@@ -26,7 +26,6 @@
GType gst_schro_enc_get_type (void);
GType gst_schro_dec_get_type (void);
-GType gst_schro_parse_get_type (void);
GST_DEBUG_CATEGORY (schro_debug);
#define GST_CAT_DEFAULT schro_debug
@@ -39,8 +38,6 @@ plugin_init (GstPlugin * plugin)
GST_DEBUG_CATEGORY_INIT (schro_debug, "schro", 0, "Schroedinger");
gst_element_register (plugin, "schrodec", GST_RANK_PRIMARY,
gst_schro_dec_get_type ());
- gst_element_register (plugin, "schroparse", GST_RANK_NONE,
- gst_schro_parse_get_type ());
gst_element_register (plugin, "schroenc", GST_RANK_PRIMARY,
gst_schro_enc_get_type ());
diff --git a/ext/schroedinger/gstschroenc.c b/ext/schroedinger/gstschroenc.c
index b4e50a922..7af28eac2 100644
--- a/ext/schroedinger/gstschroenc.c
+++ b/ext/schroedinger/gstschroenc.c
@@ -600,6 +600,7 @@ gst_schro_enc_get_caps (GstBaseVideoEncoder * base_video_encoder)
state->par_d, NULL);
} else {
g_assert_not_reached ();
+ caps = NULL;
}
return caps;
diff --git a/ext/schroedinger/gstschroparse.c b/ext/schroedinger/gstschroparse.c
deleted file mode 100644
index 25711c8d1..000000000
--- a/ext/schroedinger/gstschroparse.c
+++ /dev/null
@@ -1,585 +0,0 @@
-/* Schrodinger
- * Copyright (C) 2006 David Schleef <ds@schleef.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstadapter.h>
-#include <gst/video/video.h>
-#include <gst/video/gstbasevideoparse.h>
-#include <string.h>
-#include <schroedinger/schro.h>
-#include <math.h>
-
-#include <schroedinger/schroparse.h>
-
-
-GST_DEBUG_CATEGORY_EXTERN (schro_debug);
-#define GST_CAT_DEFAULT schro_debug
-
-#define GST_TYPE_SCHRO_PARSE \
- (gst_schro_parse_get_type())
-#define GST_SCHRO_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SCHRO_PARSE,GstSchroParse))
-#define GST_SCHRO_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SCHRO_PARSE,GstSchroParseClass))
-#define GST_IS_SCHRO_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SCHRO_PARSE))
-#define GST_IS_SCHRO_PARSE_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SCHRO_PARSE))
-
-typedef struct _GstSchroParse GstSchroParse;
-typedef struct _GstSchroParseClass GstSchroParseClass;
-
-typedef enum
-{
- GST_SCHRO_PARSE_OUTPUT_OGG,
- GST_SCHRO_PARSE_OUTPUT_QUICKTIME,
- GST_SCHRO_PARSE_OUTPUT_AVI,
- GST_SCHRO_PARSE_OUTPUT_MPEG_TS,
- GST_SCHRO_PARSE_OUTPUT_MP4
-} GstSchroParseOutputType;
-
-struct _GstSchroParse
-{
- GstBaseVideoParse base_video_parse;
-
- GstPad *sinkpad, *srcpad;
-
- GstSchroParseOutputType output_format;
-
- GstBuffer *seq_header_buffer;
-
- /* state */
-
-
- gboolean have_picture;
- int buf_picture_number;
- int seq_hdr_picture_number;
- int picture_number;
-
- guint64 last_granulepos;
-
- int bytes_per_picture;
-};
-
-struct _GstSchroParseClass
-{
- GstBaseVideoParseClass base_video_parse_class;
-};
-
-GType gst_schro_parse_get_type (void);
-
-
-/* GstSchroParse signals and args */
-enum
-{
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0
-};
-
-static gboolean gst_schro_parse_start (GstBaseVideoParse * base_video_parse);
-static gboolean gst_schro_parse_stop (GstBaseVideoParse * base_video_parse);
-static gboolean gst_schro_parse_reset (GstBaseVideoParse * base_video_parse);
-static int gst_schro_parse_scan_for_sync (GstAdapter * adapter,
- gboolean at_eos, int offset, int n);
-static gboolean gst_schro_parse_parse_data (GstBaseVideoParse *
- base_video_parse, gboolean at_eos);
-static gboolean gst_schro_parse_shape_output (GstBaseVideoParse *
- base_video_parse, GstVideoFrame * frame);
-static GstCaps *gst_schro_parse_get_caps (GstBaseVideoParse * base_video_parse);
-
-
-
-static GstStaticPadTemplate gst_schro_parse_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-dirac")
- );
-
-static GstStaticPadTemplate gst_schro_parse_src_template =
- GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS
- ("video/x-dirac;video/x-qt-part;video/x-avi-part;video/x-mp4-part")
- );
-
-GST_BOILERPLATE (GstSchroParse, gst_schro_parse, GstBaseVideoParse,
- GST_TYPE_BASE_VIDEO_PARSE);
-
-static void
-gst_schro_parse_base_init (gpointer g_class)
-{
-
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_schro_parse_src_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_schro_parse_sink_template));
-
- gst_element_class_set_details_simple (element_class, "Dirac Parser",
- "Codec/Parser/Video",
- "Parse Dirac streams", "David Schleef <ds@schleef.org>");
-}
-
-static void
-gst_schro_parse_class_init (GstSchroParseClass * klass)
-{
- GstBaseVideoParseClass *base_video_parse_class;
-
- base_video_parse_class = GST_BASE_VIDEO_PARSE_CLASS (klass);
-
- base_video_parse_class->start = GST_DEBUG_FUNCPTR (gst_schro_parse_start);
- base_video_parse_class->stop = GST_DEBUG_FUNCPTR (gst_schro_parse_stop);
- base_video_parse_class->reset = GST_DEBUG_FUNCPTR (gst_schro_parse_reset);
- base_video_parse_class->parse_data =
- GST_DEBUG_FUNCPTR (gst_schro_parse_parse_data);
- base_video_parse_class->shape_output =
- GST_DEBUG_FUNCPTR (gst_schro_parse_shape_output);
- base_video_parse_class->scan_for_sync =
- GST_DEBUG_FUNCPTR (gst_schro_parse_scan_for_sync);
- base_video_parse_class->get_caps =
- GST_DEBUG_FUNCPTR (gst_schro_parse_get_caps);
-
-}
-
-static void
-gst_schro_parse_init (GstSchroParse * schro_parse, GstSchroParseClass * klass)
-{
- GstBaseVideoParse *base_video_parse = GST_BASE_VIDEO_PARSE (schro_parse);
-
- GST_DEBUG ("gst_schro_parse_init");
-
- schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_OGG;
-
- base_video_parse->reorder_depth = 2;
-}
-
-static gboolean
-gst_schro_parse_reset (GstBaseVideoParse * base_video_parse)
-{
- GST_DEBUG ("reset");
-
- return TRUE;
-}
-
-static gboolean
-gst_schro_parse_start (GstBaseVideoParse * base_video_parse)
-{
- GstSchroParse *schro_parse = GST_SCHRO_PARSE (base_video_parse);
- GstCaps *caps;
- GstStructure *structure;
-
- GST_DEBUG ("start");
- caps =
- gst_pad_get_allowed_caps (GST_BASE_VIDEO_CODEC_SRC_PAD
- (base_video_parse));
-
- if (gst_caps_is_empty (caps)) {
- gst_caps_unref (caps);
- return FALSE;
- }
-
- structure = gst_caps_get_structure (caps, 0);
-
- if (gst_structure_has_name (structure, "video/x-dirac")) {
- schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_OGG;
- } else if (gst_structure_has_name (structure, "video/x-qt-part")) {
- schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_QUICKTIME;
- } else if (gst_structure_has_name (structure, "video/x-avi-part")) {
- schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_AVI;
- } else if (gst_structure_has_name (structure, "video/x-mpegts-part")) {
- schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_MPEG_TS;
- } else if (gst_structure_has_name (structure, "video/x-mp4-part")) {
- schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_MP4;
- } else {
- return FALSE;
- }
-
- gst_caps_unref (caps);
- return TRUE;
-}
-
-static gboolean
-gst_schro_parse_stop (GstBaseVideoParse * base_video_parse)
-{
- return TRUE;
-}
-
-static void
-parse_sequence_header (GstSchroParse * schro_parse, guint8 * data, int size)
-{
- SchroVideoFormat video_format;
- int ret;
- GstVideoState *state;
-
- GST_DEBUG ("parse_sequence_header size=%d", size);
-
- state = gst_base_video_parse_get_state (GST_BASE_VIDEO_PARSE (schro_parse));
-
- schro_parse->seq_header_buffer = gst_buffer_new_and_alloc (size);
- memcpy (GST_BUFFER_DATA (schro_parse->seq_header_buffer), data, size);
-
- ret = schro_parse_decode_sequence_header (data + 13, size - 13,
- &video_format);
- if (ret) {
- state->fps_n = video_format.frame_rate_numerator;
- state->fps_d = video_format.frame_rate_denominator;
- GST_DEBUG ("Frame rate is %d/%d", state->fps_n, state->fps_d);
-
- state->width = video_format.width;
- state->height = video_format.height;
- GST_DEBUG ("Frame dimensions are %d x %d\n", state->width, state->height);
-
- state->clean_width = video_format.clean_width;
- state->clean_height = video_format.clean_height;
- state->clean_offset_left = video_format.left_offset;
- state->clean_offset_top = video_format.top_offset;
-
- state->par_n = video_format.aspect_ratio_numerator;
- state->par_d = video_format.aspect_ratio_denominator;
- GST_DEBUG ("Pixel aspect ratio is %d/%d", state->par_n, state->par_d);
-
- gst_base_video_parse_set_state (GST_BASE_VIDEO_PARSE (schro_parse), state);
- } else {
- GST_WARNING ("Failed to get frame rate from sequence header");
- }
-
-}
-
-static int
-gst_schro_parse_scan_for_sync (GstAdapter * adapter, gboolean at_eos,
- int offset, int n)
-{
- int n_available = gst_adapter_available (adapter) - offset;
-
- if (n_available < 4) {
- if (at_eos) {
- return n_available;
- } else {
- return 0;
- }
- }
-
- n_available -= 3;
-
- return gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x42424344,
- offset, MIN (n, n_available - 3));
-}
-
-static GstFlowReturn
-gst_schro_parse_parse_data (GstBaseVideoParse * base_video_parse,
- gboolean at_eos)
-{
- GstSchroParse *schro_parse;
- unsigned char header[SCHRO_PARSE_HEADER_SIZE];
- int next;
- int prev;
- int parse_code;
-
- GST_DEBUG ("parse_data");
-
- schro_parse = GST_SCHRO_PARSE (base_video_parse);
-
- if (gst_adapter_available (base_video_parse->input_adapter) <
- SCHRO_PARSE_HEADER_SIZE) {
- return GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA;
- }
-
- GST_DEBUG ("available %d",
- gst_adapter_available (base_video_parse->input_adapter));
-
- gst_adapter_copy (base_video_parse->input_adapter, header, 0,
- SCHRO_PARSE_HEADER_SIZE);
-
- parse_code = header[4];
- next = GST_READ_UINT32_BE (header + 5);
- prev = GST_READ_UINT32_BE (header + 9);
-
- GST_DEBUG ("%08x %02x %08x %08x",
- GST_READ_UINT32_BE (header), parse_code, next, prev);
-
- if (memcmp (header, "BBCD", 4) != 0 ||
- (next & 0xf0000000) || (prev & 0xf0000000)) {
- gst_base_video_parse_lost_sync (base_video_parse);
- return GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA;
- }
-
- if (SCHRO_PARSE_CODE_IS_END_OF_SEQUENCE (parse_code)) {
- GstVideoFrame *frame;
-
- if (next != 0 && next != SCHRO_PARSE_HEADER_SIZE) {
- GST_WARNING ("next is not 0 or 13 in EOS packet (%d)", next);
- }
-
- gst_base_video_parse_add_to_frame (base_video_parse,
- SCHRO_PARSE_HEADER_SIZE);
-
- frame = gst_base_video_parse_get_frame (base_video_parse);
- frame->is_eos = TRUE;
-
- SCHRO_DEBUG ("eos");
-
- return gst_base_video_parse_finish_frame (base_video_parse);
- }
-
- if (gst_adapter_available (base_video_parse->input_adapter) < next) {
- return GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA;
- }
-
- if (SCHRO_PARSE_CODE_IS_SEQ_HEADER (parse_code)) {
- guint8 *data;
-
- data = g_malloc (next);
-
- gst_adapter_copy (base_video_parse->input_adapter, data, 0, next);
- parse_sequence_header (schro_parse, data, next);
-
- base_video_parse->current_frame->is_sync_point = TRUE;
-
- g_free (data);
- }
-
- if (schro_parse->seq_header_buffer == NULL) {
- gst_adapter_flush (base_video_parse->input_adapter, next);
- return GST_FLOW_OK;
- }
-
- if (SCHRO_PARSE_CODE_IS_PICTURE (parse_code)) {
- GstVideoFrame *frame;
- guint8 tmp[4];
-
- frame = gst_base_video_parse_get_frame (base_video_parse);
-
-#if 0
- if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf))) {
- frame->presentation_timestamp = GST_BUFFER_TIMESTAMP (buf);
- }
-#endif
-
- gst_adapter_copy (base_video_parse->input_adapter, tmp,
- SCHRO_PARSE_HEADER_SIZE, 4);
-
- frame->presentation_frame_number = GST_READ_UINT32_BE (tmp);
-
- gst_base_video_parse_add_to_frame (base_video_parse, next);
-
- return gst_base_video_parse_finish_frame (base_video_parse);
- } else {
- gst_base_video_parse_add_to_frame (base_video_parse, next);
- }
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_schro_parse_shape_output_ogg (GstBaseVideoParse * base_video_parse,
- GstVideoFrame * frame)
-{
- GstSchroParse *schro_parse;
- int dpn;
- int delay;
- int dist;
- int pt;
- int dt;
- guint64 granulepos_hi;
- guint64 granulepos_low;
- GstBuffer *buf = frame->src_buffer;
-
- schro_parse = GST_SCHRO_PARSE (base_video_parse);
-
- dpn = frame->decode_frame_number;
-
- pt = frame->presentation_frame_number * 2;
- dt = frame->decode_frame_number * 2;
- delay = pt - dt;
- dist = frame->distance_from_sync;
-
- GST_DEBUG ("sys %d dpn %d pt %d dt %d delay %d dist %d",
- (int) frame->system_frame_number,
- (int) frame->decode_frame_number, pt, dt, delay, dist);
-
- granulepos_hi = (((guint64) pt - delay) << 9) | ((dist >> 8));
- granulepos_low = (delay << 9) | (dist & 0xff);
- GST_DEBUG ("granulepos %" G_GINT64_FORMAT ":%" G_GINT64_FORMAT, granulepos_hi,
- granulepos_low);
-
- if (frame->is_eos) {
- GST_BUFFER_OFFSET_END (buf) = schro_parse->last_granulepos;
- } else {
- schro_parse->last_granulepos = (granulepos_hi << 22) | (granulepos_low);
- GST_BUFFER_OFFSET_END (buf) = schro_parse->last_granulepos;
- }
-
- return gst_base_video_parse_push (base_video_parse, buf);
-}
-
-static GstFlowReturn
-gst_schro_parse_shape_output_quicktime (GstBaseVideoParse * base_video_parse,
- GstVideoFrame * frame)
-{
- GstBuffer *buf = frame->src_buffer;
- const GstVideoState *state;
-
- state = gst_base_video_parse_get_state (base_video_parse);
-
- GST_BUFFER_OFFSET_END (buf) = gst_video_state_get_timestamp (state,
- &base_video_parse->segment, frame->system_frame_number);
-
- if (frame->is_sync_point &&
- frame->presentation_frame_number == frame->system_frame_number) {
- GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
- GST_DEBUG ("sync point");
- } else {
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
- }
-
- return gst_base_video_parse_push (base_video_parse, buf);
-}
-
-static GstFlowReturn
-gst_schro_parse_shape_output_mpeg_ts (GstBaseVideoParse * base_video_parse,
- GstVideoFrame * frame)
-{
- GstBuffer *buf = frame->src_buffer;
-
- return gst_base_video_parse_push (base_video_parse, buf);
-}
-
-static GstFlowReturn
-gst_schro_parse_shape_output (GstBaseVideoParse * base_video_parse,
- GstVideoFrame * frame)
-{
- GstSchroParse *schro_parse;
-
- schro_parse = GST_SCHRO_PARSE (base_video_parse);
-
- switch (schro_parse->output_format) {
- case GST_SCHRO_PARSE_OUTPUT_OGG:
- return gst_schro_parse_shape_output_ogg (base_video_parse, frame);
- case GST_SCHRO_PARSE_OUTPUT_QUICKTIME:
- return gst_schro_parse_shape_output_quicktime (base_video_parse, frame);
- case GST_SCHRO_PARSE_OUTPUT_MPEG_TS:
- return gst_schro_parse_shape_output_mpeg_ts (base_video_parse, frame);
- default:
- break;
- }
-
- return GST_FLOW_ERROR;
-}
-
-static GstCaps *
-gst_schro_parse_get_caps (GstBaseVideoParse * base_video_parse)
-{
- GstCaps *caps;
- GstVideoState *state;
- GstSchroParse *schro_parse;
-
- schro_parse = GST_SCHRO_PARSE (base_video_parse);
-
- state = gst_base_video_parse_get_state (base_video_parse);
-
- if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_OGG) {
- caps = gst_caps_new_simple ("video/x-dirac",
- "width", G_TYPE_INT, state->width,
- "height", G_TYPE_INT, state->height,
- "framerate", GST_TYPE_FRACTION, state->fps_n,
- state->fps_d,
- "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n,
- state->par_d, NULL);
-
- GST_BUFFER_FLAG_SET (schro_parse->seq_header_buffer,
- GST_BUFFER_FLAG_IN_CAPS);
-
- {
- GValue array = { 0 };
- GValue value = { 0 };
- GstBuffer *buf;
- int size;
-
- g_value_init (&array, GST_TYPE_ARRAY);
- g_value_init (&value, GST_TYPE_BUFFER);
- size = GST_BUFFER_SIZE (schro_parse->seq_header_buffer);
- buf = gst_buffer_new_and_alloc (size + SCHRO_PARSE_HEADER_SIZE);
- memcpy (GST_BUFFER_DATA (buf),
- GST_BUFFER_DATA (schro_parse->seq_header_buffer), size);
- GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 0, 0x42424344);
- GST_WRITE_UINT8 (GST_BUFFER_DATA (buf) + size + 4,
- SCHRO_PARSE_CODE_END_OF_SEQUENCE);
- GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 5, 0);
- GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 9, size);
- gst_value_set_buffer (&value, buf);
- gst_buffer_unref (buf);
- gst_value_array_append_value (&array, &value);
- gst_structure_set_value (gst_caps_get_structure (caps, 0),
- "streamheader", &array);
- g_value_unset (&value);
- g_value_unset (&array);
- }
- } else if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_QUICKTIME) {
- caps = gst_caps_new_simple ("video/x-qt-part",
- "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'),
- "width", G_TYPE_INT, state->width,
- "height", G_TYPE_INT, state->height,
- "framerate", GST_TYPE_FRACTION, state->fps_n,
- state->fps_d,
- "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n,
- state->par_d, NULL);
- } else if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_AVI) {
- caps = gst_caps_new_simple ("video/x-avi-part",
- "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'),
- "width", G_TYPE_INT, state->width,
- "height", G_TYPE_INT, state->height,
- "framerate", GST_TYPE_FRACTION, state->fps_n,
- state->fps_d,
- "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n,
- state->par_d, NULL);
- } else if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_MPEG_TS) {
- caps = gst_caps_new_simple ("video/x-mpegts-part",
- "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'),
- "width", G_TYPE_INT, state->width,
- "height", G_TYPE_INT, state->height,
- "framerate", GST_TYPE_FRACTION, state->fps_n,
- state->fps_d,
- "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n,
- state->par_d, NULL);
- } else if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_MP4) {
- caps = gst_caps_new_simple ("video/x-mp4-part",
- "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'),
- "width", G_TYPE_INT, state->width,
- "height", G_TYPE_INT, state->height,
- "framerate", GST_TYPE_FRACTION, state->fps_n,
- state->fps_d,
- "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n,
- state->par_d, NULL);
- } else {
- g_assert_not_reached ();
- }
-
- return caps;
-}
diff --git a/ext/schroedinger/gstschroutils.c b/ext/schroedinger/gstschroutils.c
index bb1f1bcd6..66514a3d5 100644
--- a/ext/schroedinger/gstschroutils.c
+++ b/ext/schroedinger/gstschroutils.c
@@ -95,6 +95,7 @@ gst_schro_buffer_wrap (GstBuffer * buf, GstVideoFormat format, int width,
#endif
default:
g_assert_not_reached ();
+ return NULL;
}
schro_frame_set_free_callback (frame, gst_schro_frame_free, buf);
diff --git a/ext/vp8/gstvp8enc.c b/ext/vp8/gstvp8enc.c
index b70510243..17b316a5b 100644
--- a/ext/vp8/gstvp8enc.c
+++ b/ext/vp8/gstvp8enc.c
@@ -229,7 +229,7 @@ gst_vp8_enc_class_init (GstVP8EncClass * klass)
g_object_class_install_property (gobject_class, PROP_BITRATE,
g_param_spec_int ("bitrate", "Bit rate",
- "Bit rate",
+ "Bit rate (in bits/sec)",
0, 1000000000, DEFAULT_BITRATE,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
diff --git a/ext/xvid/gstxviddec.c b/ext/xvid/gstxviddec.c
index 84a0eaad9..67e33c03e 100644
--- a/ext/xvid/gstxviddec.c
+++ b/ext/xvid/gstxviddec.c
@@ -310,7 +310,7 @@ gst_xviddec_chain (GstPad * pad, GstBuffer * buf)
xvid_dec_frame_t xframe;
xvid_dec_stats_t xstats;
gint ret;
- guint8 *data;
+ guint8 *data, *dupe = NULL;
guint size;
GstFlowReturn fret;
@@ -333,6 +333,16 @@ gst_xviddec_chain (GstPad * pad, GstBuffer * buf)
data = GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (buf);
+ /* xvidcore overreads the input buffer, we need to alloc some extra padding
+ * to make things work reliably */
+#define EXTRA_PADDING 16
+ if (EXTRA_PADDING > 0) {
+ dupe = g_malloc (size + EXTRA_PADDING);
+ memcpy (dupe, data, size);
+ memset (dupe + size, 0, EXTRA_PADDING);
+ data = dupe;
+ }
+
do { /* loop needed because xvidcore may return vol information */
/* decode and so ... */
gst_xvid_init_struct (xframe);
@@ -412,6 +422,7 @@ gst_xviddec_chain (GstPad * pad, GstBuffer * buf)
}
done:
+ g_free (dupe);
gst_buffer_unref (buf);
return fret;
diff --git a/ext/xvid/gstxvidenc.c b/ext/xvid/gstxvidenc.c
index 1194ecbbc..6d16e87bd 100644
--- a/ext/xvid/gstxvidenc.c
+++ b/ext/xvid/gstxvidenc.c
@@ -714,11 +714,17 @@ gst_xvidenc_setcaps (GstPad * pad, GstCaps * vscaps)
structure = gst_caps_get_structure (vscaps, 0);
- g_return_val_if_fail (gst_structure_get_int (structure, "width", &w), FALSE);
- g_return_val_if_fail (gst_structure_get_int (structure, "height", &h), FALSE);
+ if (!gst_structure_get_int (structure, "width", &w) ||
+ !gst_structure_get_int (structure, "height", &h)) {
+ return FALSE;
+ }
+
fps = gst_structure_get_value (structure, "framerate");
- g_return_val_if_fail (w > 0 && h > 0
- && fps != NULL && GST_VALUE_HOLDS_FRACTION (fps), FALSE);
+ if (fps == NULL || !GST_VALUE_HOLDS_FRACTION (fps)) {
+ GST_WARNING_OBJECT (pad, "no framerate specified, or not a GstFraction");
+ return FALSE;
+ }
+
/* optional par info */
par = gst_structure_get_value (structure, "pixel-aspect-ratio");
@@ -1039,7 +1045,6 @@ gst_xvidenc_set_property (GObject * object,
GstXvidEnc *xvidenc;
guint offset;
- g_return_if_fail (GST_IS_XVIDENC (object));
xvidenc = GST_XVIDENC (object);
if (prop_id > xvidenc_prop_count) {
@@ -1050,7 +1055,9 @@ gst_xvidenc_set_property (GObject * object,
/* our param specs should have such qdata */
offset =
GPOINTER_TO_UINT (g_param_spec_get_qdata (pspec, xvidenc_pspec_quark));
- g_return_if_fail (offset != 0);
+
+ if (offset == 0)
+ return;
switch (G_PARAM_SPEC_VALUE_TYPE (pspec)) {
case G_TYPE_BOOLEAN:
@@ -1080,7 +1087,6 @@ gst_xvidenc_get_property (GObject * object,
GstXvidEnc *xvidenc;
guint offset;
- g_return_if_fail (GST_IS_XVIDENC (object));
xvidenc = GST_XVIDENC (object);
if (prop_id > xvidenc_prop_count) {
@@ -1091,7 +1097,9 @@ gst_xvidenc_get_property (GObject * object,
/* our param specs should have such qdata */
offset =
GPOINTER_TO_UINT (g_param_spec_get_qdata (pspec, xvidenc_pspec_quark));
- g_return_if_fail (offset != 0);
+
+ if (offset == 0)
+ return;
switch (G_PARAM_SPEC_VALUE_TYPE (pspec)) {
case G_TYPE_BOOLEAN: