1 |
commit: 647538681781463bd2259945b9aa7746e3041347 |
2 |
Author: Daniel Diaz <ddiaz <AT> ti <DOT> com> |
3 |
AuthorDate: Fri Jan 14 23:54:22 2011 +0000 |
4 |
Commit: Raúl Porcel <armin76 <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 22 23:14:19 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pandaboard.git;a=commit;h=64753868 |
7 |
|
8 |
Add ebuild for gst-plugins-base. |
9 |
|
10 |
This includes TI patches required for GstOpenMAX and V4L2. |
11 |
|
12 |
Signed-off-by: Daniel Diaz <ddiaz <AT> ti.com> |
13 |
|
14 |
--- |
15 |
media-libs/gst-plugins-base/Manifest | 26 + |
16 |
...stride-support-to-video-utility-functions.patch | 536 +++++++++ |
17 |
...form-skeletal-implementation-of-stridetra.patch | 368 +++++++ |
18 |
...form-implement-caps-negotiation-and-relat.patch | 379 +++++++ |
19 |
...idetransform-implement-transform-function.patch | 215 ++++ |
20 |
...5-add-gst_stride_transform_transform_size.patch | 143 +++ |
21 |
...-typo.-need-to-use-the-smaller-of-new_wid.patch | 36 + |
22 |
...-0007-Add-NV12-support-in-stridetransform.patch | 77 ++ |
23 |
...upport-for-I420-NV12-colorspace-conversio.patch | 186 ++++ |
24 |
...-fix-to-avoid-parsing-caps-on-every-frame.patch | 35 + |
25 |
...ridetransform-to-make-it-easier-to-add-ne.patch | 759 +++++++++++++ |
26 |
.../files/gst-0.10.32-0011-add-some-neon.patch | 293 +++++ |
27 |
...port-to-convert-to-YUY2-YUYV-color-format.patch | 197 ++++ |
28 |
...Add-support-for-RGB565-to-stridetransform.patch | 336 ++++++ |
29 |
...form-updates-for-new-extra-anal-compiler-.patch | 61 ++ |
30 |
...form-fix-problem-transforming-caps-with-l.patch | 544 ++++++++++ |
31 |
...016-modify-playbin-to-use-stridetransform.patch | 62 ++ |
32 |
...2-0017-playbin-disable-interlaced-support.patch | 33 + |
33 |
...10.32-0018-textoverlay-add-stride-support.patch | 132 +++ |
34 |
...19-video-more-flexible-video-caps-utility.patch | 228 ++++ |
35 |
...fix-endianess-issue-for-16bit-RGB-formats.patch | 41 + |
36 |
...ide-more-flexible-stride-color-conversion.patch | 1131 ++++++++++++++++++++ |
37 |
...0022-stride-support-for-32bit-RGB-formats.patch | 54 + |
38 |
...23-ffmpegcolorspace-support-for-rowstride.patch | 410 +++++++ |
39 |
...0.10.32-0024-discoverer-rowstride-support.patch | 45 + |
40 |
.../gst-plugins-base-0.10.32_p20110127.ebuild | 78 ++ |
41 |
26 files changed, 6405 insertions(+), 0 deletions(-) |
42 |
|
43 |
diff --git a/media-libs/gst-plugins-base/Manifest b/media-libs/gst-plugins-base/Manifest |
44 |
new file mode 100644 |
45 |
index 0000000..0cba68e |
46 |
--- /dev/null |
47 |
+++ b/media-libs/gst-plugins-base/Manifest |
48 |
@@ -0,0 +1,26 @@ |
49 |
+AUX gst-0.10.32-0001-add-rowstride-support-to-video-utility-functions.patch 19478 RMD160 3314aa44215803242a9cd1b2f33987066b2d9255 SHA1 960ce8f2c0c12c1d79cac4ba667236ab5dc9c4a9 SHA256 453f54b8b2a00df3038b96096f65720ad09f78a83db356bbd3018a6dae519c56 |
50 |
+AUX gst-0.10.32-0002-stridetransform-skeletal-implementation-of-stridetra.patch 12038 RMD160 ae601020715b8049423418dd51c97ffd4cd84da6 SHA1 b0210b381c97a94b7542b3e103a0071bbce14cf6 SHA256 a8cbdef59063369c4bae3c87dc9d197fc950c9fb588ad9a3dcfcbca7f1ea02c9 |
51 |
+AUX gst-0.10.32-0003-stridetransform-implement-caps-negotiation-and-relat.patch 13666 RMD160 cd97b88ec464c8e8055c93a443ff7a0d31aa0d41 SHA1 500b157dca39a60751fd89edd29d23224b287fd9 SHA256 a2685bd2928796756e5217d10bee09679b99458e5c33ea90498725b379c060a6 |
52 |
+AUX gst-0.10.32-0004-stridetransform-implement-transform-function.patch 7985 RMD160 f246b2f9a27a6d94a7d21f2594bbb65f9dba08be SHA1 62174bf74b1b1086a3585df0178db703c8ddb108 SHA256 efcf08ac81ce74fedab80318db7e20eef0abda36ef9e03aed6c823426199bad8 |
53 |
+AUX gst-0.10.32-0005-add-gst_stride_transform_transform_size.patch 5629 RMD160 01a147ca359509d478aa69c40697735f3b339d4d SHA1 1e7a520e85b9364797764be5a755478e4becbb3b SHA256 3ca3bfac1d14ce43c2c1211038275a22b41b370bbfcadd06224bd68b6f79608b |
54 |
+AUX gst-0.10.32-0006-fix-a-small-typo.-need-to-use-the-smaller-of-new_wid.patch 1398 RMD160 fff110733e415d3a62b887ac5155d3200f821daa SHA1 0e331030afdf5be917c71f7b2d0a3961450159ef SHA256 e4ffd2ceefcb6bdf851d897ca63f57f5b33bc80210fcd2e70e8337738857a823 |
55 |
+AUX gst-0.10.32-0007-Add-NV12-support-in-stridetransform.patch 2909 RMD160 f77e0f781af75021ba4dbbc19fc181c38f5e7a7d SHA1 8eebe554050a4e7239e2d3c886f2d71e92c481ad SHA256 ee77cd62a3af64ab453d14e563ac142e1cc9a78422158d548fa412c3e6a5c6e1 |
56 |
+AUX gst-0.10.32-0008-add-basic-support-for-I420-NV12-colorspace-conversio.patch 6976 RMD160 e8c645b0a55e39cc70547eeb6eaed361b93f7770 SHA1 2fb572546b90b9e1566f8dd38854d307ea5fa897 SHA256 55c669534771130dbaf5bdd94a4a08031faf27900fb3d7981d4b5934510c5f11 |
57 |
+AUX gst-0.10.32-0009-fix-to-avoid-parsing-caps-on-every-frame.patch 1087 RMD160 ee3a3bbf77ad5c5726a30115caeb373c430553f9 SHA1 cfb3b914b88a278131d91e2dd48865765302d947 SHA256 52f163890b09cc2133739adb18788441329c71c10359a0a1a2e5bcee918bff1c |
58 |
+AUX gst-0.10.32-0010-refactor-stridetransform-to-make-it-easier-to-add-ne.patch 26534 RMD160 ccc77aef354ecc2f506dfe73d485a1edd5910e2a SHA1 837fdc52c72c09105356c12b361480b1ff03eb54 SHA256 1abf8e19bdbd7d4b404cc8803dce83da77be4fd98e1c940d6842f2ae3c6e29fd |
59 |
+AUX gst-0.10.32-0011-add-some-neon.patch 9024 RMD160 48388eea9e42f4a156cae6090f34c1732eec717f SHA1 dfe6de8382322ccab6889c3afb228fc3512f9816 SHA256 d9f3e1fbb8cfbcda0fa49cf976e7b318c55780a3f4216c030e4a6b1e1ec207c1 |
60 |
+AUX gst-0.10.32-0012-add-support-to-convert-to-YUY2-YUYV-color-format.patch 6307 RMD160 37c8cfdc0850f8b163747b029ce6ef7125a92bcf SHA1 5385dfa1622cc4b8639e03adc99dbb91d6de8b49 SHA256 f26b61b6c92bd064c423eadcc7b35dcd3573c7e313b0ecc142473124f37240ec |
61 |
+AUX gst-0.10.32-0013-Add-support-for-RGB565-to-stridetransform.patch 13641 RMD160 51386f4ebb999d90eff5ef786e27d07fa37e159a SHA1 1b0f6ee44a24c32247e165f357100d9a6a0cac6b SHA256 f8013cdb9943559fa14491c8e253f7c51a7a061e16c76acabe10f057f9066b6a |
62 |
+AUX gst-0.10.32-0014-stridetransform-updates-for-new-extra-anal-compiler-.patch 2398 RMD160 2fc97ee99088fb484f728d9d0c6ea0ae2509c32d SHA1 0b5aed4e09b7dad068d7048e9960ca980e46fd18 SHA256 749859c06913a633ead030f69d9cc5076d9425a95e720111876c8abf464a3d57 |
63 |
+AUX gst-0.10.32-0015-stridetransform-fix-problem-transforming-caps-with-l.patch 20488 RMD160 f5d8a82c2313dcde45b2220ead8bd2f1c356a2dd SHA1 c02b4ee4468134fd9eb27a755a031a0e113a509e SHA256 6313ea19aa2496f2e14e91c2d3812d6f9d9c82035635d4a978a8e7b963a8be6a |
64 |
+AUX gst-0.10.32-0016-modify-playbin-to-use-stridetransform.patch 2485 RMD160 cb93726b58319d71c95abc8195d1535785fbde85 SHA1 afcc848f8ab059452a68b1eea13735c5c431de89 SHA256 9e55a7d20b269d947875aba1e3ed66579a866696afda99e754093ff74b5d4fe5 |
65 |
+AUX gst-0.10.32-0017-playbin-disable-interlaced-support.patch 1108 RMD160 9d759f6f3028811150df8aa01ccb114e73b3f2df SHA1 63802de92a41aec3a210615f9c7750621c9cd20c SHA256 31d306b25a4edf00b65146a92c74f8f1f6bf6aaf001b81b8df70affdddd2b5ab |
66 |
+AUX gst-0.10.32-0018-textoverlay-add-stride-support.patch 5213 RMD160 f1a10c218e9cc25b232f48e1cf890cf6a108dce4 SHA1 3d79d8b3f2037c807d61c427943e3a2cb1a0cf1d SHA256 cf0facafdf762e114c5ea56a5ad6420dd6a6269c674eb2f06af0eec17a4a0d9d |
67 |
+AUX gst-0.10.32-0019-video-more-flexible-video-caps-utility.patch 8691 RMD160 5b22d8a8f74bcf46e08671a160b6bce314f50b82 SHA1 862be817be2a3a6fdac3073efa2d6e53b161aa00 SHA256 a6b85a91555daf21c4228ea708be91de875997158b393b8e99422bc02c05f835 |
68 |
+AUX gst-0.10.32-0020-video-fix-endianess-issue-for-16bit-RGB-formats.patch 1343 RMD160 4fa95c02bfaf97dadf504f3aee2a7397afd4ac41 SHA1 bdc1d37a88cd3ce562a411474474608d7d1b9084 SHA256 3f8a7bf670e54af9bd3fdf8d56b22f5c9e6ff00616472e1c0b0b2493f6a561c8 |
69 |
+AUX gst-0.10.32-0021-stride-more-flexible-stride-color-conversion.patch 40158 RMD160 1d45d8b1e3084ac125b733e57bece2b1de01b096 SHA1 621a2f39835043114e08b4420c1d6e3731b568b9 SHA256 a38d4f60b3e38d45c38044133fe2ad1e799dc966e53c1dd292e63ad897101037 |
70 |
+AUX gst-0.10.32-0022-stride-support-for-32bit-RGB-formats.patch 1818 RMD160 d5a3ade8595272586ab934cc10ba7658fbc9121a SHA1 42f14b868bc68e2554e96d4ff8d94faa79863fbf SHA256 a74ac22cb796fc175fa2362fe48b7d2554f41e39228a993197a09e5002fc4fe1 |
71 |
+AUX gst-0.10.32-0023-ffmpegcolorspace-support-for-rowstride.patch 15546 RMD160 c389743544f5881bf7be1ce8df5682a0a8556285 SHA1 975b92fa352e3210b1013f5c6e98f6994b5737e7 SHA256 3843c61f9d49ba75dc6a20c9b7d57bcdc3bfbdf784ea93619ee68dd8bab72c6c |
72 |
+AUX gst-0.10.32-0024-discoverer-rowstride-support.patch 1552 RMD160 4e662a66b724a19dcb71e614a71198edd9d5fe5b SHA1 153a14d26dc2f90e0d060d78244e10ab54d7912d SHA256 434643810dde2d6afc8d712563afbcd588d49cdb6bec7edec9545d2c7e375ee8 |
73 |
+DIST gst-plugins-base-0.10.32.tar.bz2 2720103 RMD160 b267e3138e40e3646efed0baa662d40775eca1ea SHA1 c1c149272b7ab6cbe5f648532f74525c6541eea5 SHA256 e9aabfac83f6480896da0686e9c911989f896fbad634821b7771ed84a446172b |
74 |
+EBUILD gst-plugins-base-0.10.32_p20110127.ebuild 3386 RMD160 366819facffe23ed35617ff106ac81411824103c SHA1 2efdfad7c81709078ff142410917d092b34ad112 SHA256 8fa605d70e03f9f52680a5d46334a9ad9cc055e84578fb440ddc74174670fa64 |
75 |
|
76 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0001-add-rowstride-support-to-video-utility-functions.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0001-add-rowstride-support-to-video-utility-functions.patch |
77 |
new file mode 100644 |
78 |
index 0000000..6f25b71 |
79 |
--- /dev/null |
80 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0001-add-rowstride-support-to-video-utility-functions.patch |
81 |
@@ -0,0 +1,536 @@ |
82 |
+From 481cda8686336999ccccbdbf239bcbd520bcdfc7 Mon Sep 17 00:00:00 2001 |
83 |
+From: Rob Clark <rob@××.com> |
84 |
+Date: Thu, 30 Jul 2009 14:50:05 -0500 |
85 |
+Subject: [PATCH 01/24] add rowstride support to video utility functions |
86 |
+ |
87 |
+--- |
88 |
+ gst-libs/gst/video/gstvideofilter.c | 8 +- |
89 |
+ gst-libs/gst/video/video.c | 244 ++++++++++++++++++++++++++++------- |
90 |
+ gst-libs/gst/video/video.h | 27 +++-- |
91 |
+ 3 files changed, 220 insertions(+), 59 deletions(-) |
92 |
+ |
93 |
+diff --git a/gst-libs/gst/video/gstvideofilter.c b/gst-libs/gst/video/gstvideofilter.c |
94 |
+index 2d08a60..6b2d7b7 100644 |
95 |
+--- a/gst-libs/gst/video/gstvideofilter.c |
96 |
++++ b/gst-libs/gst/video/gstvideofilter.c |
97 |
+@@ -21,7 +21,7 @@ |
98 |
+ /** |
99 |
+ * SECTION:gstvideofilter |
100 |
+ * @short_description: Base class for video filters |
101 |
+- * |
102 |
++ * |
103 |
+ * <refsect2> |
104 |
+ * <para> |
105 |
+ * Provides useful functions and a base class for video filters. |
106 |
+@@ -78,14 +78,14 @@ gst_video_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, |
107 |
+ guint * size) |
108 |
+ { |
109 |
+ GstVideoFormat fmt; |
110 |
+- gint width, height; |
111 |
++ gint width, height, rowstride; |
112 |
+ |
113 |
+- if (!gst_video_format_parse_caps (caps, &fmt, &width, &height)) { |
114 |
++ if (!gst_video_format_parse_caps_strided (caps, &fmt, &width, &height, &rowstride)) { |
115 |
+ GST_WARNING_OBJECT (btrans, "Failed to parse caps %" GST_PTR_FORMAT, caps); |
116 |
+ return FALSE; |
117 |
+ } |
118 |
+ |
119 |
+- *size = gst_video_format_get_size (fmt, width, height); |
120 |
++ *size = gst_video_format_get_size_strided (fmt, width, height, rowstride); |
121 |
+ |
122 |
+ GST_DEBUG_OBJECT (btrans, "Returning size %u bytes for caps %" |
123 |
+ GST_PTR_FORMAT, *size, caps); |
124 |
+diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c |
125 |
+index d9fa50b..24f1ac8 100644 |
126 |
+--- a/gst-libs/gst/video/video.c |
127 |
++++ b/gst-libs/gst/video/video.c |
128 |
+@@ -31,7 +31,7 @@ |
129 |
+ * |
130 |
+ * <refsect2> |
131 |
+ * <para> |
132 |
+- * This library contains some helper functions and includes the |
133 |
++ * This library contains some helper functions and includes the |
134 |
+ * videosink and videofilter base classes. |
135 |
+ * </para> |
136 |
+ * </refsect2> |
137 |
+@@ -53,7 +53,7 @@ static GstVideoFormat gst_video_format_from_rgb16_masks (int red_mask, |
138 |
+ * |
139 |
+ * A convenience function to retrieve a GValue holding the framerate |
140 |
+ * from the caps on a pad. |
141 |
+- * |
142 |
++ * |
143 |
+ * The pad needs to have negotiated caps containing a framerate property. |
144 |
+ * |
145 |
+ * Returns: NULL if the pad has no configured caps or the configured caps |
146 |
+@@ -106,7 +106,7 @@ gst_video_frame_rate (GstPad * pad) |
147 |
+ * |
148 |
+ * Inspect the caps of the provided pad and retrieve the width and height of |
149 |
+ * the video frames it is configured for. |
150 |
+- * |
151 |
++ * |
152 |
+ * The pad needs to have negotiated caps containing width and height properties. |
153 |
+ * |
154 |
+ * Returns: TRUE if the width and height could be retrieved. |
155 |
+@@ -158,13 +158,13 @@ gst_video_get_size (GstPad * pad, gint * width, gint * height) |
156 |
+ * @display_par_n: Numerator of the pixel aspect ratio of the display device |
157 |
+ * @display_par_d: Denominator of the pixel aspect ratio of the display device |
158 |
+ * |
159 |
+- * Given the Pixel Aspect Ratio and size of an input video frame, and the |
160 |
+- * pixel aspect ratio of the intended display device, calculates the actual |
161 |
++ * Given the Pixel Aspect Ratio and size of an input video frame, and the |
162 |
++ * pixel aspect ratio of the intended display device, calculates the actual |
163 |
+ * display ratio the video will be rendered with. |
164 |
+ * |
165 |
+- * Returns: A boolean indicating success and a calculated Display Ratio in the |
166 |
+- * dar_n and dar_d parameters. |
167 |
+- * The return value is FALSE in the case of integer overflow or other error. |
168 |
++ * Returns: A boolean indicating success and a calculated Display Ratio in the |
169 |
++ * dar_n and dar_d parameters. |
170 |
++ * The return value is FALSE in the case of integer overflow or other error. |
171 |
+ * |
172 |
+ * Since: 0.10.7 |
173 |
+ */ |
174 |
+@@ -308,28 +308,15 @@ gst_video_parse_caps_chroma_site (GstCaps * caps) |
175 |
+ } |
176 |
+ |
177 |
+ /** |
178 |
+- * gst_video_format_parse_caps: |
179 |
+- * @caps: the #GstCaps to parse |
180 |
+- * @format: the #GstVideoFormat of the video represented by @caps (output) |
181 |
+- * @width: the width of the video represented by @caps, may be NULL (output) |
182 |
+- * @height: the height of the video represented by @caps, may be NULL (output) |
183 |
+- * |
184 |
+- * Determines the #GstVideoFormat of @caps and places it in the location |
185 |
+- * pointed to by @format. Extracts the size of the video and places it |
186 |
+- * in the location pointed to by @width and @height. If @caps does not |
187 |
+- * represent one of the raw video formats listed in #GstVideoFormat, the |
188 |
+- * function will fail and return FALSE. |
189 |
+- * |
190 |
+- * Since: 0.10.16 |
191 |
+- * |
192 |
+- * Returns: TRUE if @caps was parsed correctly. |
193 |
++ * see gst_video_format_parse_caps_strided and gst_video_format_parse_caps |
194 |
+ */ |
195 |
+-gboolean |
196 |
+-gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format, |
197 |
+- int *width, int *height) |
198 |
++static gboolean |
199 |
++parse_caps (GstCaps * caps, GstVideoFormat * format, gint *width, gint *height, |
200 |
++ gboolean stride_ok, gint *rowstride) |
201 |
+ { |
202 |
+ GstStructure *structure; |
203 |
+ gboolean ok = TRUE; |
204 |
++ gboolean strided = FALSE; |
205 |
+ |
206 |
+ if (!gst_caps_is_fixed (caps)) |
207 |
+ return FALSE; |
208 |
+@@ -337,7 +324,10 @@ gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format, |
209 |
+ structure = gst_caps_get_structure (caps, 0); |
210 |
+ |
211 |
+ if (format) { |
212 |
+- if (gst_structure_has_name (structure, "video/x-raw-yuv")) { |
213 |
++ if (gst_structure_has_name (structure, "video/x-raw-yuv") || |
214 |
++ (stride_ok && |
215 |
++ gst_structure_has_name (structure, "video/x-raw-yuv-strided") && |
216 |
++ (strided=TRUE) /* single '=' intentional */)) { |
217 |
+ guint32 fourcc; |
218 |
+ |
219 |
+ ok &= gst_structure_get_fourcc (structure, "format", &fourcc); |
220 |
+@@ -346,7 +336,10 @@ gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format, |
221 |
+ if (*format == GST_VIDEO_FORMAT_UNKNOWN) { |
222 |
+ ok = FALSE; |
223 |
+ } |
224 |
+- } else if (gst_structure_has_name (structure, "video/x-raw-rgb")) { |
225 |
++ } else if (gst_structure_has_name (structure, "video/x-raw-rgb") || |
226 |
++ (stride_ok && |
227 |
++ gst_structure_has_name (structure, "video/x-raw-rgb-strided") && |
228 |
++ (strided=TRUE) /* single '=' intentional */)) { |
229 |
+ int depth; |
230 |
+ int bpp; |
231 |
+ int endianness = 0; |
232 |
+@@ -423,6 +416,10 @@ gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format, |
233 |
+ } |
234 |
+ } |
235 |
+ |
236 |
++ /* note: should we require that the caps have these fields, even if |
237 |
++ * the caller does not particularly request them?? |
238 |
++ */ |
239 |
++ |
240 |
+ if (width) { |
241 |
+ ok &= gst_structure_get_int (structure, "width", width); |
242 |
+ } |
243 |
+@@ -431,11 +428,70 @@ gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format, |
244 |
+ ok &= gst_structure_get_int (structure, "height", height); |
245 |
+ } |
246 |
+ |
247 |
++ if (rowstride) { |
248 |
++ if (strided) { |
249 |
++ ok &= gst_structure_get_int (structure, "rowstride", rowstride); |
250 |
++ } else { |
251 |
++ *rowstride = 0; /* not a strided format */ |
252 |
++ } |
253 |
++ } |
254 |
++ |
255 |
+ return ok; |
256 |
+ } |
257 |
+ |
258 |
+ |
259 |
+ /** |
260 |
++ * gst_video_format_parse_caps_strided: |
261 |
++ * @caps: the #GstCaps to parse |
262 |
++ * @format: the #GstVideoFormat of the video represented by @caps (output) |
263 |
++ * @width: the width of the video represented by @caps, may be NULL (output) |
264 |
++ * @height: the height of the video represented by @caps, may be NULL (output) |
265 |
++ * @rowstride: the rowstride (in bytes) represented by @caps, or 0 if there |
266 |
++ * is no rowstride, may be NULL (output) |
267 |
++ * |
268 |
++ * Determines the #GstVideoFormat of @caps and places it in the location |
269 |
++ * pointed to by @format. Extracts the size of the video and places it |
270 |
++ * in the location pointed to by @width and @height. Extracts the row- |
271 |
++ * stride and places it in the location pointed to by @rowstride. If |
272 |
++ * @caps does not represent one of the raw video formats listed in |
273 |
++ * #GstVideoFormat, the function will fail and return FALSE. |
274 |
++ * |
275 |
++ * Since: ??? |
276 |
++ * |
277 |
++ * Returns: TRUE if @caps was parsed correctly. |
278 |
++ */ |
279 |
++gboolean |
280 |
++gst_video_format_parse_caps_strided (GstCaps * caps, GstVideoFormat * format, |
281 |
++ int *width, int *height, int *rowstride) |
282 |
++{ |
283 |
++ return parse_caps (caps, format, width, height, TRUE, rowstride); |
284 |
++} |
285 |
++ |
286 |
++/** |
287 |
++ * gst_video_format_parse_caps: |
288 |
++ * @caps: the #GstCaps to parse |
289 |
++ * @format: the #GstVideoFormat of the video represented by @caps (output) |
290 |
++ * @width: the width of the video represented by @caps, may be NULL (output) |
291 |
++ * @height: the height of the video represented by @caps, may be NULL (output) |
292 |
++ * |
293 |
++ * Determines the #GstVideoFormat of @caps and places it in the location |
294 |
++ * pointed to by @format. Extracts the size of the video and places it |
295 |
++ * in the location pointed to by @width and @height. If @caps does not |
296 |
++ * represent one of the raw video formats listed in #GstVideoFormat, the |
297 |
++ * function will fail and return FALSE. |
298 |
++ * |
299 |
++ * Since: 0.10.16 |
300 |
++ * |
301 |
++ * Returns: TRUE if @caps was parsed correctly. |
302 |
++ */ |
303 |
++gboolean |
304 |
++gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format, |
305 |
++ int *width, int *height) |
306 |
++{ |
307 |
++ return parse_caps (caps, format, width, height, FALSE, NULL); |
308 |
++} |
309 |
++ |
310 |
++/** |
311 |
+ * gst_video_parse_caps_framerate: |
312 |
+ * @caps: pointer to a #GstCaps instance |
313 |
+ * @fps_n: pointer to integer to hold numerator of frame rate (output) |
314 |
+@@ -534,10 +590,11 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, |
315 |
+ } |
316 |
+ |
317 |
+ /** |
318 |
+- * gst_video_format_new_caps: |
319 |
++ * gst_video_format_new_caps_strided: |
320 |
+ * @format: the #GstVideoFormat describing the raw video format |
321 |
+ * @width: width of video |
322 |
+ * @height: height of video |
323 |
++ * @rowstride: the rowstride (in bytes), or 0 if no rowstride |
324 |
+ * @framerate_n: numerator of frame rate |
325 |
+ * @framerate_d: denominator of frame rate |
326 |
+ * @par_n: numerator of pixel aspect ratio |
327 |
+@@ -545,26 +602,29 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, |
328 |
+ * |
329 |
+ * Creates a new #GstCaps object based on the parameters provided. |
330 |
+ * |
331 |
+- * Since: 0.10.16 |
332 |
++ * Since: ??? |
333 |
+ * |
334 |
+ * Returns: a new #GstCaps object, or NULL if there was an error |
335 |
+ */ |
336 |
+ GstCaps * |
337 |
+-gst_video_format_new_caps (GstVideoFormat format, int width, |
338 |
+- int height, int framerate_n, int framerate_d, int par_n, int par_d) |
339 |
++gst_video_format_new_caps_strided (GstVideoFormat format, |
340 |
++ int width, int height, int rowstride, |
341 |
++ int framerate_n, int framerate_d, int par_n, int par_d) |
342 |
+ { |
343 |
++ GstCaps *caps = NULL; |
344 |
++ |
345 |
+ g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL); |
346 |
+ g_return_val_if_fail (width > 0 && height > 0, NULL); |
347 |
+ |
348 |
+ if (gst_video_format_is_yuv (format)) { |
349 |
+- return gst_caps_new_simple ("video/x-raw-yuv", |
350 |
++ caps = gst_caps_new_simple ( |
351 |
++ rowstride ? "video/x-raw-yuv-strided" : "video/x-raw-yuv", |
352 |
+ "format", GST_TYPE_FOURCC, gst_video_format_to_fourcc (format), |
353 |
+ "width", G_TYPE_INT, width, |
354 |
+ "height", G_TYPE_INT, height, |
355 |
+ "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, |
356 |
+ "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); |
357 |
+- } |
358 |
+- if (gst_video_format_is_rgb (format)) { |
359 |
++ } else if (gst_video_format_is_rgb (format)) { |
360 |
+ GstCaps *caps; |
361 |
+ int red_mask = 0; |
362 |
+ int blue_mask = 0; |
363 |
+@@ -663,7 +723,8 @@ gst_video_format_new_caps (GstVideoFormat format, int width, |
364 |
+ return NULL; |
365 |
+ } |
366 |
+ |
367 |
+- caps = gst_caps_new_simple ("video/x-raw-rgb", |
368 |
++ caps = gst_caps_new_simple ( |
369 |
++ rowstride ? "video/x-raw-rgb-strided" : "video/x-raw-rgb", |
370 |
+ "bpp", G_TYPE_INT, bpp, |
371 |
+ "depth", G_TYPE_INT, depth, |
372 |
+ "width", G_TYPE_INT, width, |
373 |
+@@ -685,11 +746,7 @@ gst_video_format_new_caps (GstVideoFormat format, int width, |
374 |
+ width, height)); |
375 |
+ gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, alpha_mask, NULL); |
376 |
+ } |
377 |
+- return caps; |
378 |
+- } |
379 |
+- |
380 |
+- if (gst_video_format_is_gray (format)) { |
381 |
+- GstCaps *caps; |
382 |
++ } else if (gst_video_format_is_gray (format)) { |
383 |
+ int bpp; |
384 |
+ int depth; |
385 |
+ int endianness; |
386 |
+@@ -730,11 +787,39 @@ gst_video_format_new_caps (GstVideoFormat format, int width, |
387 |
+ "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, |
388 |
+ "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); |
389 |
+ } |
390 |
++ } else { |
391 |
++ return NULL; |
392 |
++ } |
393 |
+ |
394 |
+- return caps; |
395 |
++ if (rowstride) { |
396 |
++ gst_caps_set_simple (caps, "rowstride", G_TYPE_INT, rowstride, NULL); |
397 |
+ } |
398 |
+ |
399 |
+- return NULL; |
400 |
++ return caps; |
401 |
++} |
402 |
++ |
403 |
++/** |
404 |
++ * gst_video_format_new_caps: |
405 |
++ * @format: the #GstVideoFormat describing the raw video format |
406 |
++ * @width: width of video |
407 |
++ * @height: height of video |
408 |
++ * @framerate_n: numerator of frame rate |
409 |
++ * @framerate_d: denominator of frame rate |
410 |
++ * @par_n: numerator of pixel aspect ratio |
411 |
++ * @par_d: denominator of pixel aspect ratio |
412 |
++ * |
413 |
++ * Creates a new #GstCaps object based on the parameters provided. |
414 |
++ * |
415 |
++ * Since: 0.10.16 |
416 |
++ * |
417 |
++ * Returns: a new #GstCaps object, or NULL if there was an error |
418 |
++ */ |
419 |
++GstCaps * |
420 |
++gst_video_format_new_caps (GstVideoFormat format, int width, int height, |
421 |
++ int framerate_n, int framerate_d, int par_n, int par_d) |
422 |
++{ |
423 |
++ return gst_video_format_new_caps_strided (format, width, height, 0, |
424 |
++ framerate_n, framerate_d, par_n, par_d); |
425 |
+ } |
426 |
+ |
427 |
+ /** |
428 |
+@@ -874,7 +959,7 @@ gst_video_format_to_fourcc (GstVideoFormat format) |
429 |
+ * @blue_mask: blue bit mask |
430 |
+ * |
431 |
+ * Converts red, green, blue bit masks into the corresponding |
432 |
+- * #GstVideoFormat. |
433 |
++ * #GstVideoFormat. |
434 |
+ * |
435 |
+ * Since: 0.10.16 |
436 |
+ * |
437 |
+@@ -1107,7 +1192,7 @@ gst_video_format_is_gray (GstVideoFormat format) |
438 |
+ /** |
439 |
+ * gst_video_format_has_alpha: |
440 |
+ * @format: a #GstVideoFormat |
441 |
+- * |
442 |
++ * |
443 |
+ * Returns TRUE or FALSE depending on if the video format provides an |
444 |
+ * alpha channel. |
445 |
+ * |
446 |
+@@ -1877,6 +1962,75 @@ gst_video_format_get_size (GstVideoFormat format, int width, int height) |
447 |
+ } |
448 |
+ |
449 |
+ /** |
450 |
++ * gst_video_format_get_size_strided: |
451 |
++ * @format: a #GstVideoFormat |
452 |
++ * @width: the width of video (in pixels) |
453 |
++ * @height: the height of video (in pixels) |
454 |
++ * @rowstride: the rowstride (in bytes), or 0 if no rowstride (in which |
455 |
++ * case the returned value is same as #gst_video_format_get_size()) |
456 |
++ * |
457 |
++ * Calculates the total number of bytes in the raw video format, for a buffer |
458 |
++ * which may have a rowstride in bytes |
459 |
++ * |
460 |
++ * Since: ??? |
461 |
++ * |
462 |
++ * Returns: size (in bytes) of raw video format |
463 |
++ */ |
464 |
++int |
465 |
++gst_video_format_get_size_strided (GstVideoFormat format, |
466 |
++ int width, int height, int rowstride) |
467 |
++{ |
468 |
++ if(!rowstride) |
469 |
++ return gst_video_format_get_size (format, width, height); |
470 |
++ |
471 |
++ g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0); |
472 |
++ g_return_val_if_fail (width > 0 && height > 0, 0); |
473 |
++ |
474 |
++ switch (format) { |
475 |
++ /* all packed formats have the same calculation, ie. rowstride * height |
476 |
++ */ |
477 |
++ case GST_VIDEO_FORMAT_RGBx: |
478 |
++ case GST_VIDEO_FORMAT_BGRx: |
479 |
++ case GST_VIDEO_FORMAT_xRGB: |
480 |
++ case GST_VIDEO_FORMAT_xBGR: |
481 |
++ case GST_VIDEO_FORMAT_RGBA: |
482 |
++ case GST_VIDEO_FORMAT_BGRA: |
483 |
++ case GST_VIDEO_FORMAT_ARGB: |
484 |
++ case GST_VIDEO_FORMAT_ABGR: |
485 |
++ case GST_VIDEO_FORMAT_RGB16: |
486 |
++ case GST_VIDEO_FORMAT_BGR16: |
487 |
++ case GST_VIDEO_FORMAT_RGB15: |
488 |
++ case GST_VIDEO_FORMAT_BGR15: |
489 |
++ case GST_VIDEO_FORMAT_RGB: |
490 |
++ case GST_VIDEO_FORMAT_BGR: |
491 |
++ case GST_VIDEO_FORMAT_YUY2: |
492 |
++ case GST_VIDEO_FORMAT_YVYU: |
493 |
++ case GST_VIDEO_FORMAT_UYVY: |
494 |
++ case GST_VIDEO_FORMAT_AYUV: |
495 |
++ case GST_VIDEO_FORMAT_v210: |
496 |
++ case GST_VIDEO_FORMAT_v216: |
497 |
++ return GST_ROUND_UP_4 (rowstride * height); |
498 |
++ |
499 |
++ /* these planar formats have 2x sub-sampling in the vertical direction, |
500 |
++ * so U/V have half as many rows as Y: |
501 |
++ */ |
502 |
++ case GST_VIDEO_FORMAT_I420: |
503 |
++ case GST_VIDEO_FORMAT_YV12: |
504 |
++ return GST_ROUND_UP_4 (2 * rowstride * height); |
505 |
++ |
506 |
++ /* these planar formats have no sub-sampling in the vertical direction, |
507 |
++ * so each plane has 'height' number of rows |
508 |
++ */ |
509 |
++ case GST_VIDEO_FORMAT_Y41B: |
510 |
++ case GST_VIDEO_FORMAT_Y42B: |
511 |
++ case GST_VIDEO_FORMAT_Y444: |
512 |
++ return GST_ROUND_UP_4 (3 * rowstride * height); |
513 |
++ default: |
514 |
++ return 0; |
515 |
++ } |
516 |
++} |
517 |
++ |
518 |
++/** |
519 |
+ * gst_video_format_convert: |
520 |
+ * @format: a #GstVideoFormat |
521 |
+ * @width: the width of video |
522 |
+diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h |
523 |
+index 96c5a85..a6a2293 100644 |
524 |
+--- a/gst-libs/gst/video/video.h |
525 |
++++ b/gst-libs/gst/video/video.h |
526 |
+@@ -33,7 +33,7 @@ G_BEGIN_DECLS |
527 |
+ * @GST_VIDEO_FORMAT_I420: planar 4:2:0 YUV |
528 |
+ * @GST_VIDEO_FORMAT_YV12: planar 4:2:0 YVU (like I420 but UV planes swapped) |
529 |
+ * @GST_VIDEO_FORMAT_YUY2: packed 4:2:2 YUV (Y0-U0-Y1-V0 Y2-U2-Y3-V2 Y4 ...) |
530 |
+- * @GST_VIDEO_FORMAT_UYVY: packed 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...) |
531 |
++ * @GST_VIDEO_FORMAT_UYVY: packed 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...) |
532 |
+ * @GST_VIDEO_FORMAT_AYUV: packed 4:4:4 YUV with alpha channel (A0-Y0-U0-V0 ...) |
533 |
+ * @GST_VIDEO_FORMAT_RGBx: sparse rgb packed into 32 bit, space last |
534 |
+ * @GST_VIDEO_FORMAT_BGRx: sparse reverse rgb packed into 32 bit, space last |
535 |
+@@ -245,13 +245,13 @@ typedef enum { |
536 |
+ |
537 |
+ #define GST_VIDEO_CAPS_RGBx \ |
538 |
+ __GST_VIDEO_CAPS_MAKE_32 (1, 2, 3) |
539 |
+- |
540 |
++ |
541 |
+ #define GST_VIDEO_CAPS_xRGB \ |
542 |
+ __GST_VIDEO_CAPS_MAKE_32 (2, 3, 4) |
543 |
+- |
544 |
++ |
545 |
+ #define GST_VIDEO_CAPS_BGRx \ |
546 |
+ __GST_VIDEO_CAPS_MAKE_32 (3, 2, 1) |
547 |
+- |
548 |
++ |
549 |
+ #define GST_VIDEO_CAPS_xBGR \ |
550 |
+ __GST_VIDEO_CAPS_MAKE_32 (4, 3, 2) |
551 |
+ |
552 |
+@@ -259,13 +259,13 @@ typedef enum { |
553 |
+ |
554 |
+ #define GST_VIDEO_CAPS_RGBA \ |
555 |
+ __GST_VIDEO_CAPS_MAKE_32A (1, 2, 3, 4) |
556 |
+- |
557 |
++ |
558 |
+ #define GST_VIDEO_CAPS_ARGB \ |
559 |
+ __GST_VIDEO_CAPS_MAKE_32A (2, 3, 4, 1) |
560 |
+- |
561 |
++ |
562 |
+ #define GST_VIDEO_CAPS_BGRA \ |
563 |
+ __GST_VIDEO_CAPS_MAKE_32A (3, 2, 1, 4) |
564 |
+- |
565 |
++ |
566 |
+ #define GST_VIDEO_CAPS_ABGR \ |
567 |
+ __GST_VIDEO_CAPS_MAKE_32A (4, 3, 2, 1) |
568 |
+ |
569 |
+@@ -281,7 +281,7 @@ typedef enum { |
570 |
+ #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \ |
571 |
+ GST_VIDEO_CAPS_xRGB |
572 |
+ #endif |
573 |
+- |
574 |
++ |
575 |
+ /* 15/16 bit */ |
576 |
+ |
577 |
+ #define GST_VIDEO_CAPS_RGB_16 \ |
578 |
+@@ -395,13 +395,15 @@ gboolean gst_video_get_size (GstPad *pad, |
579 |
+ gint *height); |
580 |
+ |
581 |
+ gboolean gst_video_calculate_display_ratio (guint *dar_n, guint *dar_d, |
582 |
+- guint video_width, guint video_height, |
583 |
+- guint video_par_n, guint video_par_d, |
584 |
++ guint video_width, guint video_height, |
585 |
++ guint video_par_n, guint video_par_d, |
586 |
+ guint display_par_n, guint display_par_d); |
587 |
+ |
588 |
+ gboolean gst_video_format_parse_caps (GstCaps *caps, GstVideoFormat *format, |
589 |
+ int *width, int *height); |
590 |
+ gboolean gst_video_format_parse_caps_interlaced (GstCaps *caps, gboolean *interlaced); |
591 |
++gboolean gst_video_format_parse_caps_strided (GstCaps * caps, GstVideoFormat * format, |
592 |
++ int *width, int *height, int *rowstride); |
593 |
+ gboolean gst_video_parse_caps_framerate (GstCaps *caps, |
594 |
+ int *fps_n, int *fps_d); |
595 |
+ gboolean gst_video_parse_caps_pixel_aspect_ratio (GstCaps *caps, |
596 |
+@@ -415,6 +417,9 @@ GstCaps * gst_video_format_new_caps (GstVideoFormat format, |
597 |
+ GstCaps * gst_video_format_new_caps_interlaced (GstVideoFormat format, |
598 |
+ int width, int height, int framerate_n, int framerate_d, |
599 |
+ int par_n, int par_d, gboolean interlaced); |
600 |
++GstCaps * gst_video_format_new_caps_strided (GstVideoFormat format, |
601 |
++ int width, int height, int rowstride, |
602 |
++ int framerate_n, int framerate_d, int par_n, int par_d); |
603 |
+ GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc); |
604 |
+ guint32 gst_video_format_to_fourcc (GstVideoFormat format); |
605 |
+ gboolean gst_video_format_is_rgb (GstVideoFormat format); |
606 |
+@@ -431,6 +436,8 @@ int gst_video_format_get_component_height (GstVideoFormat format, int component, |
607 |
+ int gst_video_format_get_component_offset (GstVideoFormat format, int component, |
608 |
+ int width, int height); |
609 |
+ int gst_video_format_get_size (GstVideoFormat format, int width, int height); |
610 |
++int gst_video_format_get_size_strided (GstVideoFormat format, |
611 |
++ int width, int height, int rowstride); |
612 |
+ gboolean gst_video_format_convert (GstVideoFormat format, int width, int height, |
613 |
+ int fps_n, int fps_d, |
614 |
+ GstFormat src_format, gint64 src_value, |
615 |
+-- |
616 |
+1.7.1 |
617 |
+ |
618 |
|
619 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0002-stridetransform-skeletal-implementation-of-stridetra.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0002-stridetransform-skeletal-implementation-of-stridetra.patch |
620 |
new file mode 100644 |
621 |
index 0000000..6e88172 |
622 |
--- /dev/null |
623 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0002-stridetransform-skeletal-implementation-of-stridetra.patch |
624 |
@@ -0,0 +1,368 @@ |
625 |
+From 9820616aad713a23aa9d0e2afe44835d9e9278e5 Mon Sep 17 00:00:00 2001 |
626 |
+From: Rob Clark <rob@××.com> |
627 |
+Date: Thu, 30 Jul 2009 20:41:18 -0500 |
628 |
+Subject: [PATCH 02/24] stridetransform: skeletal implementation of stridetransform element |
629 |
+ |
630 |
+--- |
631 |
+ configure.ac | 2 + |
632 |
+ gst/stride/Makefile.am | 15 ++++ |
633 |
+ gst/stride/gststridetransform.c | 178 +++++++++++++++++++++++++++++++++++++++ |
634 |
+ gst/stride/gststridetransform.h | 66 ++++++++++++++ |
635 |
+ gst/stride/plugin.c | 45 ++++++++++ |
636 |
+ 5 files changed, 306 insertions(+), 0 deletions(-) |
637 |
+ create mode 100644 gst/stride/Makefile.am |
638 |
+ create mode 100644 gst/stride/gststridetransform.c |
639 |
+ create mode 100644 gst/stride/gststridetransform.h |
640 |
+ create mode 100644 gst/stride/plugin.c |
641 |
+ |
642 |
+diff --git a/configure.ac b/configure.ac |
643 |
+index 3325abc..af6cd52 100644 |
644 |
+--- a/configure.ac |
645 |
++++ b/configure.ac |
646 |
+@@ -427,6 +427,7 @@ AG_GST_CHECK_PLUGIN(ffmpegcolorspace) |
647 |
+ AG_GST_CHECK_PLUGIN(gdp) |
648 |
+ AG_GST_CHECK_PLUGIN(playback) |
649 |
+ AG_GST_CHECK_PLUGIN(audioresample) |
650 |
++AG_GST_CHECK_PLUGIN(stride) |
651 |
+ AG_GST_CHECK_PLUGIN(subparse) |
652 |
+ AG_GST_CHECK_PLUGIN(tcp) |
653 |
+ AG_GST_CHECK_PLUGIN(typefind) |
654 |
+@@ -925,6 +926,7 @@ gst/ffmpegcolorspace/Makefile |
655 |
+ gst/gdp/Makefile |
656 |
+ gst/playback/Makefile |
657 |
+ gst/audioresample/Makefile |
658 |
++gst/stride/Makefile |
659 |
+ gst/subparse/Makefile |
660 |
+ gst/tcp/Makefile |
661 |
+ gst/typefind/Makefile |
662 |
+diff --git a/gst/stride/Makefile.am b/gst/stride/Makefile.am |
663 |
+new file mode 100644 |
664 |
+index 0000000..1adc197 |
665 |
+--- /dev/null |
666 |
++++ b/gst/stride/Makefile.am |
667 |
+@@ -0,0 +1,15 @@ |
668 |
++plugin_LTLIBRARIES = libgststridetransform.la |
669 |
++ |
670 |
++libgststridetransform_la_SOURCES = \ |
671 |
++ gststridetransform.c \ |
672 |
++ plugin.c |
673 |
++ |
674 |
++libgststridetransform_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) |
675 |
++libgststridetransform_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) |
676 |
++libgststridetransform_la_LIBADD = \ |
677 |
++ $(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \ |
678 |
++ $(GST_BASE_LIBS) $(GST_LIBS) $(LIBM) |
679 |
++libgststridetransform_la_LIBTOOLFLAGS = --tag=disable-static |
680 |
++ |
681 |
++noinst_HEADERS = \ |
682 |
++ gststridetransform.h |
683 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
684 |
+new file mode 100644 |
685 |
+index 0000000..21f2d6e |
686 |
+--- /dev/null |
687 |
++++ b/gst/stride/gststridetransform.c |
688 |
+@@ -0,0 +1,178 @@ |
689 |
++/* GStreamer |
690 |
++ * |
691 |
++ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ |
692 |
++ * |
693 |
++ * Description: V4L2 sink element |
694 |
++ * Created on: Jul 30, 2009 |
695 |
++ * Author: Rob Clark <rob@××.com> |
696 |
++ * |
697 |
++ * This library is free software; you can redistribute it and/or |
698 |
++ * modify it under the terms of the GNU Library General Public |
699 |
++ * License as published by the Free Software Foundation; either |
700 |
++ * version 2 of the License, or (at your option) any later version. |
701 |
++ * |
702 |
++ * This library is distributed in the hope that it will be useful, |
703 |
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
704 |
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
705 |
++ * Library General Public License for more details. |
706 |
++ * |
707 |
++ * You should have received a copy of the GNU Library General Public |
708 |
++ * License along with this library; if not, write to the |
709 |
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
710 |
++ * Boston, MA 02111-1307, USA. |
711 |
++ */ |
712 |
++ |
713 |
++ |
714 |
++/** |
715 |
++ * SECTION:element-stridetransform |
716 |
++ * |
717 |
++ * stridetransform can be used to convert between video buffers |
718 |
++ * with and without stride, or between buffers with differing |
719 |
++ * stride |
720 |
++ * |
721 |
++ * <refsect2> |
722 |
++ * <title>Example launch lines</title> |
723 |
++ * |[ |
724 |
++ * gst-launch ???? TODO |
725 |
++ * ]| This pipeline ???? TODO |
726 |
++ * </refsect2> |
727 |
++ */ |
728 |
++ |
729 |
++ |
730 |
++#ifdef HAVE_CONFIG_H |
731 |
++#include <config.h> |
732 |
++#endif |
733 |
++ |
734 |
++#include "gststridetransform.h" |
735 |
++#include "gst/gst-i18n-plugin.h" |
736 |
++ |
737 |
++ |
738 |
++static const GstElementDetails stridetransform_details = |
739 |
++GST_ELEMENT_DETAILS ("Stride transform", |
740 |
++ "Filter/Converter/Video", |
741 |
++ "Convert between video buffers with and without stride, or with differing stride", |
742 |
++ "Rob Clark <rob@××.com>,"); |
743 |
++ |
744 |
++GST_DEBUG_CATEGORY (stridetransform_debug); |
745 |
++#define GST_CAT_DEFAULT stridetransform_debug |
746 |
++ |
747 |
++/* type functions */ |
748 |
++static void gst_stride_transform_dispose (GObject * obj); |
749 |
++ |
750 |
++/* GstBaseTransform functions */ |
751 |
++static gboolean gst_stride_transform_get_unit_size (GstBaseTransform * base, |
752 |
++ GstCaps * caps, guint * size); |
753 |
++static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform * base, |
754 |
++ GstPadDirection direction, GstCaps * caps); |
755 |
++static void gst_stride_transform_fixate_caps (GstBaseTransform * base, |
756 |
++ GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); |
757 |
++static gboolean gst_stride_transform_set_caps (GstBaseTransform * base, |
758 |
++ GstCaps * incaps, GstCaps * outcaps); |
759 |
++static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, |
760 |
++ GstBuffer * inbuf, GstBuffer * outbuf); |
761 |
++static GstFlowReturn gst_stride_transform_transform_ip (GstBaseTransform * base, |
762 |
++ GstBuffer * buf); |
763 |
++ |
764 |
++GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, GST_TYPE_VIDEO_FILTER); |
765 |
++ |
766 |
++ |
767 |
++static void |
768 |
++gst_stride_transform_base_init (gpointer g_class) |
769 |
++{ |
770 |
++ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); |
771 |
++ |
772 |
++ GST_DEBUG_CATEGORY_INIT (stridetransform_debug, "stride", 0, "stride transform element"); |
773 |
++ |
774 |
++ gst_element_class_set_details (gstelement_class, &stridetransform_details); |
775 |
++} |
776 |
++ |
777 |
++static void |
778 |
++gst_stride_transform_class_init (GstStrideTransformClass * klass) |
779 |
++{ |
780 |
++ GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
781 |
++ GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass); |
782 |
++ |
783 |
++ gobject_class->dispose = gst_stride_transform_dispose; |
784 |
++ |
785 |
++ basetransform_class->get_unit_size = |
786 |
++ GST_DEBUG_FUNCPTR (gst_stride_transform_get_unit_size); |
787 |
++ basetransform_class->transform_caps = |
788 |
++ GST_DEBUG_FUNCPTR (gst_stride_transform_transform_caps); |
789 |
++ basetransform_class->fixate_caps = |
790 |
++ GST_DEBUG_FUNCPTR (gst_stride_transform_fixate_caps); |
791 |
++ basetransform_class->set_caps = |
792 |
++ GST_DEBUG_FUNCPTR (gst_stride_transform_set_caps); |
793 |
++ basetransform_class->transform_ip = |
794 |
++ GST_DEBUG_FUNCPTR (gst_stride_transform_transform_ip); |
795 |
++ basetransform_class->transform = |
796 |
++ GST_DEBUG_FUNCPTR (gst_stride_transform_transform); |
797 |
++ |
798 |
++ basetransform_class->passthrough_on_same_caps = TRUE; |
799 |
++} |
800 |
++ |
801 |
++static void |
802 |
++gst_stride_transform_init (GstStrideTransform * self, GstStrideTransformClass * klass) |
803 |
++{ |
804 |
++ GST_DEBUG_OBJECT (self, "not implemented"); |
805 |
++} |
806 |
++ |
807 |
++ |
808 |
++static void |
809 |
++gst_stride_transform_dispose (GObject * object) |
810 |
++{ |
811 |
++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (object); |
812 |
++ GST_DEBUG_OBJECT (self, "not implemented"); |
813 |
++ G_OBJECT_CLASS (parent_class)->dispose (object); |
814 |
++} |
815 |
++ |
816 |
++static gboolean |
817 |
++gst_stride_transform_get_unit_size (GstBaseTransform * base, |
818 |
++ GstCaps * caps, guint * size) |
819 |
++{ |
820 |
++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
821 |
++ GST_DEBUG_OBJECT (self, "not implemented"); |
822 |
++ return FALSE; |
823 |
++} |
824 |
++ |
825 |
++static GstCaps * |
826 |
++gst_stride_transform_transform_caps (GstBaseTransform * base, |
827 |
++ GstPadDirection direction, GstCaps * caps) |
828 |
++{ |
829 |
++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
830 |
++ GST_DEBUG_OBJECT (self, "not implemented"); |
831 |
++ return NULL; |
832 |
++} |
833 |
++ |
834 |
++static void |
835 |
++gst_stride_transform_fixate_caps (GstBaseTransform * base, |
836 |
++ GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) |
837 |
++{ |
838 |
++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
839 |
++ GST_DEBUG_OBJECT (self, "not implemented"); |
840 |
++} |
841 |
++ |
842 |
++static gboolean |
843 |
++gst_stride_transform_set_caps (GstBaseTransform * base, |
844 |
++ GstCaps * incaps, GstCaps * outcaps) |
845 |
++{ |
846 |
++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
847 |
++ GST_DEBUG_OBJECT (self, "not implemented"); |
848 |
++ return FALSE; |
849 |
++} |
850 |
++ |
851 |
++static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, |
852 |
++ GstBuffer * inbuf, GstBuffer * outbuf) |
853 |
++{ |
854 |
++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
855 |
++ GST_DEBUG_OBJECT (self, "not implemented"); |
856 |
++ return GST_FLOW_ERROR; |
857 |
++} |
858 |
++ |
859 |
++static GstFlowReturn |
860 |
++gst_stride_transform_transform_ip (GstBaseTransform * base, |
861 |
++ GstBuffer * buf) |
862 |
++{ |
863 |
++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
864 |
++ GST_DEBUG_OBJECT (self, "not implemented"); |
865 |
++ return GST_FLOW_ERROR; |
866 |
++} |
867 |
+diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h |
868 |
+new file mode 100644 |
869 |
+index 0000000..b4f7d59 |
870 |
+--- /dev/null |
871 |
++++ b/gst/stride/gststridetransform.h |
872 |
+@@ -0,0 +1,66 @@ |
873 |
++/* GStreamer |
874 |
++ * |
875 |
++ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ |
876 |
++ * |
877 |
++ * Description: V4L2 sink element |
878 |
++ * Created on: Jul 2, 2009 |
879 |
++ * Author: Rob Clark <rob@××.com> |
880 |
++ * |
881 |
++ * This library is free software; you can redistribute it and/or |
882 |
++ * modify it under the terms of the GNU Library General Public |
883 |
++ * License as published by the Free Software Foundation; either |
884 |
++ * version 2 of the License, or (at your option) any later version. |
885 |
++ * |
886 |
++ * This library is distributed in the hope that it will be useful, |
887 |
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
888 |
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
889 |
++ * Library General Public License for more details. |
890 |
++ * |
891 |
++ * You should have received a copy of the GNU Library General Public |
892 |
++ * License along with this library; if not, write to the |
893 |
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
894 |
++ * Boston, MA 02111-1307, USA. |
895 |
++ */ |
896 |
++ |
897 |
++#ifndef __GSTSTRIDETRANSFORM_H__ |
898 |
++#define __GSTSTRIDETRANSFORM_H__ |
899 |
++ |
900 |
++ |
901 |
++#include <gst/video/gstvideofilter.h> |
902 |
++ |
903 |
++G_BEGIN_DECLS |
904 |
++ |
905 |
++#define GST_TYPE_STRIDE_TRANSFORM \ |
906 |
++ (gst_stride_transform_get_type()) |
907 |
++#define GST_STRIDE_TRANSFORM(obj) \ |
908 |
++ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_STRIDE_TRANSFORM,GstStrideTransform)) |
909 |
++#define GST_STRIDE_TRANSFORM_CLASS(klass) \ |
910 |
++ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_STRIDE_TRANSFORM,GstStrideTransformClass)) |
911 |
++#define GST_IS_STRIDE_TRANSFORM(obj) \ |
912 |
++ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_STRIDE_TRANSFORM)) |
913 |
++#define GST_IS_STRIDE_TRANSFORM_CLASS(klass) \ |
914 |
++ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_STRIDE_TRANSFORM)) |
915 |
++ |
916 |
++typedef struct _GstStrideTransform GstStrideTransform; |
917 |
++typedef struct _GstStrideTransformClass GstStrideTransformClass; |
918 |
++ |
919 |
++/** |
920 |
++ * GstStrideTransform: |
921 |
++ * |
922 |
++ * Opaque datastructure. |
923 |
++ */ |
924 |
++struct _GstStrideTransform { |
925 |
++ GstVideoFilter videofilter; |
926 |
++ |
927 |
++}; |
928 |
++ |
929 |
++struct _GstStrideTransformClass { |
930 |
++ GstVideoFilterClass parent_class; |
931 |
++}; |
932 |
++ |
933 |
++GType gst_stride_transform_get_type (void); |
934 |
++ |
935 |
++G_END_DECLS |
936 |
++ |
937 |
++ |
938 |
++#endif /* __GSTSTRIDETRANSFORM_H__ */ |
939 |
+diff --git a/gst/stride/plugin.c b/gst/stride/plugin.c |
940 |
+new file mode 100644 |
941 |
+index 0000000..7672bdc |
942 |
+--- /dev/null |
943 |
++++ b/gst/stride/plugin.c |
944 |
+@@ -0,0 +1,45 @@ |
945 |
++/* GStreamer |
946 |
++ * |
947 |
++ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ |
948 |
++ * |
949 |
++ * Description: V4L2 sink element |
950 |
++ * Created on: Jul 30, 2009 |
951 |
++ * Author: Rob Clark <rob@××.com> |
952 |
++ * |
953 |
++ * This library is free software; you can redistribute it and/or |
954 |
++ * modify it under the terms of the GNU Library General Public |
955 |
++ * License as published by the Free Software Foundation; either |
956 |
++ * version 2 of the License, or (at your option) any later version. |
957 |
++ * |
958 |
++ * This library is distributed in the hope that it will be useful, |
959 |
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
960 |
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
961 |
++ * Library General Public License for more details. |
962 |
++ * |
963 |
++ * You should have received a copy of the GNU Library General Public |
964 |
++ * License along with this library; if not, write to the |
965 |
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
966 |
++ * Boston, MA 02111-1307, USA. |
967 |
++ */ |
968 |
++ |
969 |
++#ifdef HAVE_CONFIG_H |
970 |
++#include "config.h" |
971 |
++#endif |
972 |
++ |
973 |
++#include "gststridetransform.h" |
974 |
++ |
975 |
++static gboolean |
976 |
++plugin_init (GstPlugin * plugin) |
977 |
++{ |
978 |
++ if (!gst_element_register (plugin, "stridetransform", |
979 |
++ GST_RANK_PRIMARY, gst_stride_transform_get_type ())) |
980 |
++ return FALSE; |
981 |
++ |
982 |
++ return TRUE; |
983 |
++} |
984 |
++ |
985 |
++GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, |
986 |
++ GST_VERSION_MINOR, |
987 |
++ "stridetransform", |
988 |
++ "Convert video from strided to non-strided, or between different row-strides", |
989 |
++ plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) |
990 |
+-- |
991 |
+1.7.1 |
992 |
+ |
993 |
|
994 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0003-stridetransform-implement-caps-negotiation-and-relat.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0003-stridetransform-implement-caps-negotiation-and-relat.patch |
995 |
new file mode 100644 |
996 |
index 0000000..faf97a1 |
997 |
--- /dev/null |
998 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0003-stridetransform-implement-caps-negotiation-and-relat.patch |
999 |
@@ -0,0 +1,379 @@ |
1000 |
+From c235770f9e1c73dc75d6873166bc1ef69770a6c1 Mon Sep 17 00:00:00 2001 |
1001 |
+From: Rob Clark <rob@××.com> |
1002 |
+Date: Fri, 31 Jul 2009 16:31:42 -0500 |
1003 |
+Subject: [PATCH 03/24] stridetransform: implement caps negotiation and related parts |
1004 |
+ |
1005 |
+now all that is left is to implement the actual transform functions |
1006 |
+--- |
1007 |
+ gst-libs/gst/video/video.h | 10 ++ |
1008 |
+ gst/stride/gststridetransform.c | 190 ++++++++++++++++++++++++++++++--------- |
1009 |
+ gst/stride/gststridetransform.h | 38 ++++++++ |
1010 |
+ 3 files changed, 196 insertions(+), 42 deletions(-) |
1011 |
+ |
1012 |
+diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h |
1013 |
+index a6a2293..5bac21f 100644 |
1014 |
+--- a/gst-libs/gst/video/video.h |
1015 |
++++ b/gst-libs/gst/video/video.h |
1016 |
+@@ -356,6 +356,16 @@ typedef enum { |
1017 |
+ "height = " GST_VIDEO_SIZE_RANGE ", " \ |
1018 |
+ "framerate = " GST_VIDEO_FPS_RANGE |
1019 |
+ |
1020 |
++ |
1021 |
++#define GST_VIDEO_CAPS_YUV_STRIDED(fourcc, rowstride) \ |
1022 |
++ GST_VIDEO_CAPS_YUV(fourcc) "; " \ |
1023 |
++ "video/x-raw-yuv-strided, " \ |
1024 |
++ "format = (fourcc) " fourcc ", " \ |
1025 |
++ "rowstride = (int) " rowstride ", " \ |
1026 |
++ "width = " GST_VIDEO_SIZE_RANGE ", " \ |
1027 |
++ "height = " GST_VIDEO_SIZE_RANGE ", " \ |
1028 |
++ "framerate = " GST_VIDEO_FPS_RANGE |
1029 |
++ |
1030 |
+ /* buffer flags */ |
1031 |
+ |
1032 |
+ /** |
1033 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
1034 |
+index 21f2d6e..e31bf11 100644 |
1035 |
+--- a/gst/stride/gststridetransform.c |
1036 |
++++ b/gst/stride/gststridetransform.c |
1037 |
+@@ -33,7 +33,10 @@ |
1038 |
+ * <refsect2> |
1039 |
+ * <title>Example launch lines</title> |
1040 |
+ * |[ |
1041 |
+- * gst-launch ???? TODO |
1042 |
++ * gst-launch videotestsrc ! video/x-raw-yuv,format=(fourcc)YUY2,width=320,height=240,framerate=30/1 ! |
1043 |
++ * stridetransform ! video/x-raw-yuv-strided,format=(fourcc)YUY2,width=320,height=240,rowstride=700,framerate=30/1 ! |
1044 |
++ * stridetransform ! video/x-raw-yuv,format=(fourcc)YUY2,width=320,height=240,framerate=30/1 ! |
1045 |
++ * v4l2sink |
1046 |
+ * ]| This pipeline ???? TODO |
1047 |
+ * </refsect2> |
1048 |
+ */ |
1049 |
+@@ -43,8 +46,11 @@ |
1050 |
+ #include <config.h> |
1051 |
+ #endif |
1052 |
+ |
1053 |
+-#include "gststridetransform.h" |
1054 |
++#include <string.h> |
1055 |
++#include <gst/video/video.h> |
1056 |
++ |
1057 |
+ #include "gst/gst-i18n-plugin.h" |
1058 |
++#include "gststridetransform.h" |
1059 |
+ |
1060 |
+ |
1061 |
+ static const GstElementDetails stridetransform_details = |
1062 |
+@@ -53,25 +59,44 @@ GST_ELEMENT_DETAILS ("Stride transform", |
1063 |
+ "Convert between video buffers with and without stride, or with differing stride", |
1064 |
+ "Rob Clark <rob@××.com>,"); |
1065 |
+ |
1066 |
++ |
1067 |
++/* TODO: add rgb formats too! */ |
1068 |
++#define SUPPORTED_CAPS \ |
1069 |
++ GST_VIDEO_CAPS_YUV_STRIDED ("{ I420, YV12, YUY2 }", "[ 0, max ]") |
1070 |
++ |
1071 |
++ |
1072 |
++static GstStaticPadTemplate src_template = |
1073 |
++GST_STATIC_PAD_TEMPLATE ("src", |
1074 |
++ GST_PAD_SRC, |
1075 |
++ GST_PAD_ALWAYS, |
1076 |
++ GST_STATIC_CAPS (SUPPORTED_CAPS) |
1077 |
++ ); |
1078 |
++ |
1079 |
++static GstStaticPadTemplate sink_template = |
1080 |
++GST_STATIC_PAD_TEMPLATE ("sink", |
1081 |
++ GST_PAD_SINK, |
1082 |
++ GST_PAD_ALWAYS, |
1083 |
++ GST_STATIC_CAPS (SUPPORTED_CAPS) |
1084 |
++ ); |
1085 |
++ |
1086 |
++ |
1087 |
+ GST_DEBUG_CATEGORY (stridetransform_debug); |
1088 |
+ #define GST_CAT_DEFAULT stridetransform_debug |
1089 |
+ |
1090 |
+ /* type functions */ |
1091 |
+-static void gst_stride_transform_dispose (GObject * obj); |
1092 |
++static void gst_stride_transform_dispose (GObject *obj); |
1093 |
+ |
1094 |
+ /* GstBaseTransform functions */ |
1095 |
+-static gboolean gst_stride_transform_get_unit_size (GstBaseTransform * base, |
1096 |
+- GstCaps * caps, guint * size); |
1097 |
+-static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform * base, |
1098 |
+- GstPadDirection direction, GstCaps * caps); |
1099 |
+-static void gst_stride_transform_fixate_caps (GstBaseTransform * base, |
1100 |
+- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); |
1101 |
+-static gboolean gst_stride_transform_set_caps (GstBaseTransform * base, |
1102 |
+- GstCaps * incaps, GstCaps * outcaps); |
1103 |
+-static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, |
1104 |
+- GstBuffer * inbuf, GstBuffer * outbuf); |
1105 |
+-static GstFlowReturn gst_stride_transform_transform_ip (GstBaseTransform * base, |
1106 |
+- GstBuffer * buf); |
1107 |
++static gboolean gst_stride_transform_get_unit_size (GstBaseTransform *base, |
1108 |
++ GstCaps *caps, guint *size); |
1109 |
++static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform *base, |
1110 |
++ GstPadDirection direction, GstCaps *caps); |
1111 |
++static gboolean gst_stride_transform_set_caps (GstBaseTransform *base, |
1112 |
++ GstCaps *incaps, GstCaps *outcaps); |
1113 |
++static GstFlowReturn gst_stride_transform_transform (GstBaseTransform *base, |
1114 |
++ GstBuffer *inbuf, GstBuffer *outbuf); |
1115 |
++static GstFlowReturn gst_stride_transform_transform_ip (GstBaseTransform *base, |
1116 |
++ GstBuffer *buf); |
1117 |
+ |
1118 |
+ GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, GST_TYPE_VIDEO_FILTER); |
1119 |
+ |
1120 |
+@@ -84,10 +109,15 @@ gst_stride_transform_base_init (gpointer g_class) |
1121 |
+ GST_DEBUG_CATEGORY_INIT (stridetransform_debug, "stride", 0, "stride transform element"); |
1122 |
+ |
1123 |
+ gst_element_class_set_details (gstelement_class, &stridetransform_details); |
1124 |
++ |
1125 |
++ gst_element_class_add_pad_template (gstelement_class, |
1126 |
++ gst_static_pad_template_get (&sink_template)); |
1127 |
++ gst_element_class_add_pad_template (gstelement_class, |
1128 |
++ gst_static_pad_template_get (&src_template)); |
1129 |
+ } |
1130 |
+ |
1131 |
+ static void |
1132 |
+-gst_stride_transform_class_init (GstStrideTransformClass * klass) |
1133 |
++gst_stride_transform_class_init (GstStrideTransformClass *klass) |
1134 |
+ { |
1135 |
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
1136 |
+ GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass); |
1137 |
+@@ -98,8 +128,6 @@ gst_stride_transform_class_init (GstStrideTransformClass * klass) |
1138 |
+ GST_DEBUG_FUNCPTR (gst_stride_transform_get_unit_size); |
1139 |
+ basetransform_class->transform_caps = |
1140 |
+ GST_DEBUG_FUNCPTR (gst_stride_transform_transform_caps); |
1141 |
+- basetransform_class->fixate_caps = |
1142 |
+- GST_DEBUG_FUNCPTR (gst_stride_transform_fixate_caps); |
1143 |
+ basetransform_class->set_caps = |
1144 |
+ GST_DEBUG_FUNCPTR (gst_stride_transform_set_caps); |
1145 |
+ basetransform_class->transform_ip = |
1146 |
+@@ -111,57 +139,135 @@ gst_stride_transform_class_init (GstStrideTransformClass * klass) |
1147 |
+ } |
1148 |
+ |
1149 |
+ static void |
1150 |
+-gst_stride_transform_init (GstStrideTransform * self, GstStrideTransformClass * klass) |
1151 |
++gst_stride_transform_init (GstStrideTransform *self, GstStrideTransformClass *klass) |
1152 |
+ { |
1153 |
+ GST_DEBUG_OBJECT (self, "not implemented"); |
1154 |
+ } |
1155 |
+ |
1156 |
+ |
1157 |
+ static void |
1158 |
+-gst_stride_transform_dispose (GObject * object) |
1159 |
++gst_stride_transform_dispose (GObject *object) |
1160 |
+ { |
1161 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (object); |
1162 |
+ GST_DEBUG_OBJECT (self, "not implemented"); |
1163 |
+ G_OBJECT_CLASS (parent_class)->dispose (object); |
1164 |
+ } |
1165 |
+ |
1166 |
++/** |
1167 |
++ * figure out the required buffer size based on @caps |
1168 |
++ */ |
1169 |
+ static gboolean |
1170 |
+-gst_stride_transform_get_unit_size (GstBaseTransform * base, |
1171 |
+- GstCaps * caps, guint * size) |
1172 |
++gst_stride_transform_get_unit_size (GstBaseTransform *base, |
1173 |
++ GstCaps *caps, guint *size) |
1174 |
+ { |
1175 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
1176 |
+- GST_DEBUG_OBJECT (self, "not implemented"); |
1177 |
+- return FALSE; |
1178 |
++ GstVideoFormat format; |
1179 |
++ gint width, height, rowstride; |
1180 |
++ |
1181 |
++ g_return_val_if_fail (gst_video_format_parse_caps_strided ( |
1182 |
++ caps, &format, &width, &height, &rowstride), FALSE); |
1183 |
++ |
1184 |
++ *size = gst_video_format_get_size_strided (format, width, height, rowstride); |
1185 |
++ |
1186 |
++ GST_DEBUG_OBJECT (self, |
1187 |
++ "format=%d, width=%d, height=%d, rowstride=%d -> size=%d", |
1188 |
++ format, width, height, rowstride, *size); |
1189 |
++ |
1190 |
++ return TRUE; |
1191 |
+ } |
1192 |
+ |
1193 |
+-static GstCaps * |
1194 |
+-gst_stride_transform_transform_caps (GstBaseTransform * base, |
1195 |
+- GstPadDirection direction, GstCaps * caps) |
1196 |
++ |
1197 |
++/** |
1198 |
++ * helper to add all fields, other than rowstride to @caps, copied from @s. |
1199 |
++ */ |
1200 |
++static void |
1201 |
++add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rowstride) |
1202 |
+ { |
1203 |
+- GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
1204 |
+- GST_DEBUG_OBJECT (self, "not implemented"); |
1205 |
+- return NULL; |
1206 |
++ gint idx; |
1207 |
++ GstStructure *new_s = gst_structure_new (name, NULL); |
1208 |
++ |
1209 |
++ if (rowstride) { |
1210 |
++ gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, 1000, NULL); // XXX |
1211 |
++ } |
1212 |
++ |
1213 |
++ idx = gst_structure_n_fields (s) - 1; |
1214 |
++ while (idx >= 0) { |
1215 |
++ const gchar *name = gst_structure_nth_field_name (s, idx); |
1216 |
++ if (strcmp ("rowstride", name)) { |
1217 |
++ const GValue *val = gst_structure_get_value (s, name); |
1218 |
++ gst_structure_set_value (new_s, name, val); |
1219 |
++ } |
1220 |
++ idx--; |
1221 |
++ } |
1222 |
++ |
1223 |
++ gst_caps_merge_structure (caps, new_s); |
1224 |
+ } |
1225 |
+ |
1226 |
+-static void |
1227 |
+-gst_stride_transform_fixate_caps (GstBaseTransform * base, |
1228 |
+- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) |
1229 |
++ |
1230 |
++/** |
1231 |
++ * we can transform @caps to strided or non-strided caps with otherwise |
1232 |
++ * identical parameters |
1233 |
++ */ |
1234 |
++static GstCaps * |
1235 |
++gst_stride_transform_transform_caps (GstBaseTransform *base, |
1236 |
++ GstPadDirection direction, GstCaps *caps) |
1237 |
+ { |
1238 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
1239 |
+- GST_DEBUG_OBJECT (self, "not implemented"); |
1240 |
++ GstCaps *ret; |
1241 |
++ GstStructure *s; |
1242 |
++ |
1243 |
++ g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL); |
1244 |
++ |
1245 |
++ GST_DEBUG_OBJECT (self, "direction=%d, caps=%p", direction, caps); |
1246 |
++ LOG_CAPS (self, caps); |
1247 |
++ |
1248 |
++ ret = gst_caps_new_empty (); |
1249 |
++ s = gst_caps_get_structure (caps, 0); |
1250 |
++ |
1251 |
++ if (gst_structure_has_name (s, "video/x-raw-yuv") || |
1252 |
++ gst_structure_has_name (s, "video/x-raw-yuv-strided")) { |
1253 |
++ |
1254 |
++ add_all_fields (ret, "video/x-raw-yuv", s, FALSE); |
1255 |
++ add_all_fields (ret, "video/x-raw-yuv-strided", s, TRUE); |
1256 |
++ |
1257 |
++ } else if (gst_structure_has_name (s, "video/x-raw-rgb") || |
1258 |
++ gst_structure_has_name (s, "video/x-raw-rgb-strided")) { |
1259 |
++ |
1260 |
++ add_all_fields (ret, "video/x-raw-rgb", s, FALSE); |
1261 |
++ add_all_fields (ret, "video/x-raw-rgb-strided", s, TRUE); |
1262 |
++ |
1263 |
++ } |
1264 |
++ |
1265 |
++ LOG_CAPS (self, ret); |
1266 |
++ |
1267 |
++ return ret; |
1268 |
+ } |
1269 |
+ |
1270 |
++/** |
1271 |
++ * at this point, we have identical fourcc, width, and height for @incaps |
1272 |
++ * and @outcaps.. so we need to extract these to use for transforming, |
1273 |
++ * plus the requested rowstride of the @incaps and @outcaps |
1274 |
++ */ |
1275 |
+ static gboolean |
1276 |
+-gst_stride_transform_set_caps (GstBaseTransform * base, |
1277 |
+- GstCaps * incaps, GstCaps * outcaps) |
1278 |
++gst_stride_transform_set_caps (GstBaseTransform *base, |
1279 |
++ GstCaps *incaps, GstCaps *outcaps) |
1280 |
+ { |
1281 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
1282 |
+- GST_DEBUG_OBJECT (self, "not implemented"); |
1283 |
+- return FALSE; |
1284 |
++ |
1285 |
++ LOG_CAPS (self, incaps); |
1286 |
++ LOG_CAPS (self, outcaps); |
1287 |
++ |
1288 |
++ g_return_val_if_fail (gst_video_format_parse_caps_strided (incaps, |
1289 |
++ &self->format, &self->width, &self->height, &self->in_rowstride), FALSE); |
1290 |
++ g_return_val_if_fail (gst_video_format_parse_caps_strided (outcaps, |
1291 |
++ NULL, NULL, NULL, &self->out_rowstride), FALSE); |
1292 |
++ |
1293 |
++ return TRUE; |
1294 |
+ } |
1295 |
+ |
1296 |
+-static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, |
1297 |
+- GstBuffer * inbuf, GstBuffer * outbuf) |
1298 |
++static GstFlowReturn |
1299 |
++gst_stride_transform_transform (GstBaseTransform *base, |
1300 |
++ GstBuffer *inbuf, GstBuffer *outbuf) |
1301 |
+ { |
1302 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
1303 |
+ GST_DEBUG_OBJECT (self, "not implemented"); |
1304 |
+@@ -169,8 +275,8 @@ static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, |
1305 |
+ } |
1306 |
+ |
1307 |
+ static GstFlowReturn |
1308 |
+-gst_stride_transform_transform_ip (GstBaseTransform * base, |
1309 |
+- GstBuffer * buf) |
1310 |
++gst_stride_transform_transform_ip (GstBaseTransform *base, |
1311 |
++ GstBuffer *buf) |
1312 |
+ { |
1313 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
1314 |
+ GST_DEBUG_OBJECT (self, "not implemented"); |
1315 |
+diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h |
1316 |
+index b4f7d59..d80197f 100644 |
1317 |
+--- a/gst/stride/gststridetransform.h |
1318 |
++++ b/gst/stride/gststridetransform.h |
1319 |
+@@ -27,6 +27,8 @@ |
1320 |
+ |
1321 |
+ |
1322 |
+ #include <gst/video/gstvideofilter.h> |
1323 |
++#include <gst/video/video.h> |
1324 |
++ |
1325 |
+ |
1326 |
+ G_BEGIN_DECLS |
1327 |
+ |
1328 |
+@@ -52,6 +54,11 @@ typedef struct _GstStrideTransformClass GstStrideTransformClass; |
1329 |
+ struct _GstStrideTransform { |
1330 |
+ GstVideoFilter videofilter; |
1331 |
+ |
1332 |
++ /*< private >*/ |
1333 |
++ GstVideoFormat format; |
1334 |
++ gint width, height; |
1335 |
++ gint in_rowstride; |
1336 |
++ gint out_rowstride; |
1337 |
+ }; |
1338 |
+ |
1339 |
+ struct _GstStrideTransformClass { |
1340 |
+@@ -63,4 +70,35 @@ GType gst_stride_transform_get_type (void); |
1341 |
+ G_END_DECLS |
1342 |
+ |
1343 |
+ |
1344 |
++ |
1345 |
++ |
1346 |
++/* note: in case this is a build with TTIF logging, we can optimize slightly |
1347 |
++ * and avoid the gst_caps_to_string() in case logging isn't enabled by using |
1348 |
++ * the TTIF_TRACE_ARG_PROCESSOR feature of ttif_trace_fprintf(): |
1349 |
++ */ |
1350 |
++#ifdef GST_LOG_OVER_TTIF |
1351 |
++# define LOG_CAPS(obj, caps) G_STMT_START { \ |
1352 |
++ if (caps) { \ |
1353 |
++ static TTIF_TRACE_ARG_PROCESSOR proc = { \ |
1354 |
++ .convert = (char (*)(void *))gst_caps_to_string, \ |
1355 |
++ .free = (void (*)(char *))g_free \ |
1356 |
++ }; \ |
1357 |
++ GST_DEBUG_OBJECT (obj, "%s: %qs", #caps, &proc, (caps)); \ |
1358 |
++ } else { \ |
1359 |
++ GST_DEBUG_OBJECT (obj, "null"); \ |
1360 |
++ } \ |
1361 |
++ } G_STMT_END |
1362 |
++#else |
1363 |
++# define LOG_CAPS(obj, caps) G_STMT_START { \ |
1364 |
++ if (caps) { \ |
1365 |
++ gchar *capstr = gst_caps_to_string (caps); \ |
1366 |
++ GST_DEBUG_OBJECT (obj, "%s: %s", #caps, capstr); \ |
1367 |
++ g_free (capstr); \ |
1368 |
++ } else { \ |
1369 |
++ GST_DEBUG_OBJECT (obj, "null"); \ |
1370 |
++ } \ |
1371 |
++ } G_STMT_END |
1372 |
++#endif |
1373 |
++ |
1374 |
++ |
1375 |
+ #endif /* __GSTSTRIDETRANSFORM_H__ */ |
1376 |
+-- |
1377 |
+1.7.1 |
1378 |
+ |
1379 |
|
1380 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0004-stridetransform-implement-transform-function.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0004-stridetransform-implement-transform-function.patch |
1381 |
new file mode 100644 |
1382 |
index 0000000..b948c02 |
1383 |
--- /dev/null |
1384 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0004-stridetransform-implement-transform-function.patch |
1385 |
@@ -0,0 +1,215 @@ |
1386 |
+From 44d68a183355bce2dd7b6c890f67420ab300e0b4 Mon Sep 17 00:00:00 2001 |
1387 |
+From: Rob Clark <rob@××.com> |
1388 |
+Date: Fri, 31 Jul 2009 17:39:47 -0500 |
1389 |
+Subject: [PATCH 04/24] stridetransform: implement transform function |
1390 |
+ |
1391 |
+Still needed are a few details, like conversion from one stride to another (instead of just strided->nonstrided or visa versa), and support for RGB and more YUV color formats. |
1392 |
+--- |
1393 |
+ gst/stride/gststridetransform.c | 163 +++++++++++++++++++++++++++++++++++++-- |
1394 |
+ 1 files changed, 157 insertions(+), 6 deletions(-) |
1395 |
+ |
1396 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
1397 |
+index e31bf11..a911cd0 100644 |
1398 |
+--- a/gst/stride/gststridetransform.c |
1399 |
++++ b/gst/stride/gststridetransform.c |
1400 |
+@@ -187,7 +187,7 @@ add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rows |
1401 |
+ GstStructure *new_s = gst_structure_new (name, NULL); |
1402 |
+ |
1403 |
+ if (rowstride) { |
1404 |
+- gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, 1000, NULL); // XXX |
1405 |
++ gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, 1000, NULL); // TODO |
1406 |
+ } |
1407 |
+ |
1408 |
+ idx = gst_structure_n_fields (s) - 1; |
1409 |
+@@ -253,6 +253,8 @@ gst_stride_transform_set_caps (GstBaseTransform *base, |
1410 |
+ GstCaps *incaps, GstCaps *outcaps) |
1411 |
+ { |
1412 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
1413 |
++ GstVideoFormat format; |
1414 |
++ gint width, height; |
1415 |
+ |
1416 |
+ LOG_CAPS (self, incaps); |
1417 |
+ LOG_CAPS (self, outcaps); |
1418 |
+@@ -260,17 +262,166 @@ gst_stride_transform_set_caps (GstBaseTransform *base, |
1419 |
+ g_return_val_if_fail (gst_video_format_parse_caps_strided (incaps, |
1420 |
+ &self->format, &self->width, &self->height, &self->in_rowstride), FALSE); |
1421 |
+ g_return_val_if_fail (gst_video_format_parse_caps_strided (outcaps, |
1422 |
+- NULL, NULL, NULL, &self->out_rowstride), FALSE); |
1423 |
++ &format, &width, &height, &self->out_rowstride), FALSE); |
1424 |
++ |
1425 |
++ g_return_val_if_fail (self->format == format, FALSE); |
1426 |
++ g_return_val_if_fail (self->width == width, FALSE); |
1427 |
++ g_return_val_if_fail (self->height == height, FALSE); |
1428 |
+ |
1429 |
+ return TRUE; |
1430 |
+ } |
1431 |
+ |
1432 |
++/* ************************************************************************* */ |
1433 |
++ |
1434 |
++/** |
1435 |
++ * Convert from one stride to another... like memmove, but can convert stride in |
1436 |
++ * the process. This function is not aware of pixels, only of bytes. So widths |
1437 |
++ * are given in bytes, not pixels. The new_buf and orig_buf can point to the |
1438 |
++ * same buffers to do an in-place conversion, but the buffer should be large |
1439 |
++ * enough. |
1440 |
++ */ |
1441 |
++static void |
1442 |
++stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height) |
1443 |
++{ |
1444 |
++ int row; |
1445 |
++ |
1446 |
++ GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", |
1447 |
++ new_buf, orig_buf, new_width, orig_width, height); |
1448 |
++ /* if increasing the stride, work from bottom-up to avoid overwriting data |
1449 |
++ * that has not been moved yet.. otherwise, work in the opposite order, |
1450 |
++ * for the same reason. |
1451 |
++ */ |
1452 |
++ if (new_width > orig_width) { |
1453 |
++ for (row=height-1; row>=0; row--) { |
1454 |
++ memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); |
1455 |
++ } |
1456 |
++ } else { |
1457 |
++ for (row=0; row<height; row++) { |
1458 |
++ memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); |
1459 |
++ } |
1460 |
++ } |
1461 |
++} |
1462 |
++ |
1463 |
++ |
1464 |
++/** |
1465 |
++ * Convert from a non-strided buffer to strided. The two buffer pointers could |
1466 |
++ * be pointing to the same memory block for in-place transform.. assuming that |
1467 |
++ * the buffer is large enough |
1468 |
++ * |
1469 |
++ * @strided: the pointer to the resulting strided buffer |
1470 |
++ * @unstrided: the pointer to the initial unstrided buffer |
1471 |
++ * @fourcc: the color format |
1472 |
++ * @stride: the stride, in bytes |
1473 |
++ * @width: the width in pixels |
1474 |
++ * @height: the height in pixels |
1475 |
++ */ |
1476 |
++static GstFlowReturn |
1477 |
++stridify (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
1478 |
++{ |
1479 |
++ gint width = self->width; |
1480 |
++ gint height = self->height; |
1481 |
++ gint stride = self->out_rowstride; |
1482 |
++ |
1483 |
++ switch (self->format) { |
1484 |
++#if 0 /* TODO */ |
1485 |
++ case GST_VIDEO_FORMAT_NV12: |
1486 |
++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
1487 |
++ stridemove (strided, unstrided, stride, width, height * 1.5); |
1488 |
++ return GST_FLOW_OK; |
1489 |
++#endif |
1490 |
++ case GST_VIDEO_FORMAT_I420: |
1491 |
++ case GST_VIDEO_FORMAT_YV12: |
1492 |
++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
1493 |
++ stridemove ( |
1494 |
++ strided + (int)(height*stride*1.5), |
1495 |
++ unstrided + (int)(height*width*1.5), |
1496 |
++ stride, width/2, height); /* move U/V */ |
1497 |
++ stridemove ( |
1498 |
++ strided + (height*stride), |
1499 |
++ unstrided + (height*width), |
1500 |
++ stride, width/2, height); /* move V/U */ |
1501 |
++ stridemove (strided, unstrided, stride, width, height); /* move Y */ |
1502 |
++ return GST_FLOW_OK; |
1503 |
++ case GST_VIDEO_FORMAT_YUY2: |
1504 |
++ case GST_VIDEO_FORMAT_UYVY: |
1505 |
++ g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); |
1506 |
++ stridemove (strided, unstrided, stride, width*2, height); |
1507 |
++ return GST_FLOW_OK; |
1508 |
++ default: |
1509 |
++ GST_WARNING ("unknown color format!\n"); |
1510 |
++ return GST_FLOW_ERROR; |
1511 |
++ } |
1512 |
++} |
1513 |
++ |
1514 |
++ |
1515 |
++/** |
1516 |
++ * Convert from a strided buffer to non-strided. The two buffer pointers could |
1517 |
++ * be pointing to the same memory block for in-place transform.. |
1518 |
++ * |
1519 |
++ * @unstrided: the pointer to the resulting unstrided buffer |
1520 |
++ * @strided: the pointer to the initial strided buffer |
1521 |
++ */ |
1522 |
++static GstFlowReturn |
1523 |
++unstridify (GstStrideTransform *self, guchar *unstrided, guchar *strided) |
1524 |
++{ |
1525 |
++ gint width = self->width; |
1526 |
++ gint height = self->height; |
1527 |
++ gint stride = self->in_rowstride; |
1528 |
++ |
1529 |
++ switch (self->format) { |
1530 |
++#if 0 /* TODO */ |
1531 |
++ case GST_VIDEO_FORMAT_NV12: |
1532 |
++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
1533 |
++ stridemove (unstrided, strided, width, stride, height * 1.5); |
1534 |
++ return GST_FLOW_OK; |
1535 |
++#endif |
1536 |
++ case GST_VIDEO_FORMAT_I420: |
1537 |
++ case GST_VIDEO_FORMAT_YV12: |
1538 |
++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
1539 |
++ stridemove (unstrided, strided, width, stride, height); /* move Y */ |
1540 |
++ stridemove ( |
1541 |
++ unstrided + (height*width), |
1542 |
++ strided + (height*stride), |
1543 |
++ width/2, stride, height); /* move V/U */ |
1544 |
++ stridemove ( |
1545 |
++ unstrided + (int)(height*width*1.5), |
1546 |
++ strided + (int)(height*stride*1.5), |
1547 |
++ width/2, stride, height); /* move U/V */ |
1548 |
++ return GST_FLOW_OK; |
1549 |
++ case GST_VIDEO_FORMAT_YUY2: |
1550 |
++ case GST_VIDEO_FORMAT_UYVY: |
1551 |
++ g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); |
1552 |
++ stridemove (unstrided, strided, width*2, stride, height); |
1553 |
++ return GST_FLOW_OK; |
1554 |
++ default: |
1555 |
++ GST_WARNING ("unknown color format!\n"); |
1556 |
++ return GST_FLOW_ERROR; |
1557 |
++ } |
1558 |
++} |
1559 |
++ |
1560 |
++ |
1561 |
+ static GstFlowReturn |
1562 |
+ gst_stride_transform_transform (GstBaseTransform *base, |
1563 |
+ GstBuffer *inbuf, GstBuffer *outbuf) |
1564 |
+ { |
1565 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
1566 |
+- GST_DEBUG_OBJECT (self, "not implemented"); |
1567 |
++ |
1568 |
++ GST_DEBUG_OBJECT (self, "inbuf=%p, outbuf=%p", inbuf, outbuf); |
1569 |
++ |
1570 |
++ if (self->in_rowstride && self->out_rowstride) { |
1571 |
++ GST_DEBUG_OBJECT (self, "not implemented"); // TODO |
1572 |
++ return GST_FLOW_ERROR; |
1573 |
++ } else if (self->in_rowstride) { |
1574 |
++ return unstridify (self, |
1575 |
++ GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); |
1576 |
++ } else if (self->out_rowstride) { |
1577 |
++ return stridify (self, |
1578 |
++ GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); |
1579 |
++ } |
1580 |
++ |
1581 |
++ GST_DEBUG_OBJECT (self, "this shouldn't happen! in_rowstride=%d, out_rowstride=%d", |
1582 |
++ self->in_rowstride, self->out_rowstride); |
1583 |
++ |
1584 |
+ return GST_FLOW_ERROR; |
1585 |
+ } |
1586 |
+ |
1587 |
+@@ -278,7 +429,7 @@ static GstFlowReturn |
1588 |
+ gst_stride_transform_transform_ip (GstBaseTransform *base, |
1589 |
+ GstBuffer *buf) |
1590 |
+ { |
1591 |
+- GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
1592 |
+- GST_DEBUG_OBJECT (self, "not implemented"); |
1593 |
+- return GST_FLOW_ERROR; |
1594 |
++ /* transform function is safe to call with same buffer ptr: |
1595 |
++ */ |
1596 |
++ return gst_stride_transform_transform (base, buf, buf); |
1597 |
+ } |
1598 |
+-- |
1599 |
+1.7.1 |
1600 |
+ |
1601 |
|
1602 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0005-add-gst_stride_transform_transform_size.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0005-add-gst_stride_transform_transform_size.patch |
1603 |
new file mode 100644 |
1604 |
index 0000000..2a791d0 |
1605 |
--- /dev/null |
1606 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0005-add-gst_stride_transform_transform_size.patch |
1607 |
@@ -0,0 +1,143 @@ |
1608 |
+From c1b33e01fa6fa867b950ba0e6f4426e5a878cbe7 Mon Sep 17 00:00:00 2001 |
1609 |
+From: Rob Clark <rob@××.com> |
1610 |
+Date: Sun, 16 Aug 2009 21:04:40 -0500 |
1611 |
+Subject: [PATCH 05/24] add gst_stride_transform_transform_size() |
1612 |
+ |
1613 |
+input buffer size and output buffer size many not be multiples of a common unit size, so the transform_size() method should be used |
1614 |
+--- |
1615 |
+ gst/stride/gststridetransform.c | 38 ++++++++++++++++++++++++++++++++++++-- |
1616 |
+ gst/stride/gststridetransform.h | 34 +++++----------------------------- |
1617 |
+ 2 files changed, 41 insertions(+), 31 deletions(-) |
1618 |
+ |
1619 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
1620 |
+index a911cd0..adc22ce 100644 |
1621 |
+--- a/gst/stride/gststridetransform.c |
1622 |
++++ b/gst/stride/gststridetransform.c |
1623 |
+@@ -62,7 +62,7 @@ GST_ELEMENT_DETAILS ("Stride transform", |
1624 |
+ |
1625 |
+ /* TODO: add rgb formats too! */ |
1626 |
+ #define SUPPORTED_CAPS \ |
1627 |
+- GST_VIDEO_CAPS_YUV_STRIDED ("{ I420, YV12, YUY2 }", "[ 0, max ]") |
1628 |
++ GST_VIDEO_CAPS_YUV_STRIDED ("{ I420, YV12, YUY2, UYVY }", "[ 0, max ]") |
1629 |
+ |
1630 |
+ |
1631 |
+ static GstStaticPadTemplate src_template = |
1632 |
+@@ -89,6 +89,10 @@ static void gst_stride_transform_dispose (GObject *obj); |
1633 |
+ /* GstBaseTransform functions */ |
1634 |
+ static gboolean gst_stride_transform_get_unit_size (GstBaseTransform *base, |
1635 |
+ GstCaps *caps, guint *size); |
1636 |
++static gboolean gst_stride_transform_transform_size (GstBaseTransform *base, |
1637 |
++ GstPadDirection direction, |
1638 |
++ GstCaps *caps, guint size, |
1639 |
++ GstCaps *othercaps, guint *othersize); |
1640 |
+ static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform *base, |
1641 |
+ GstPadDirection direction, GstCaps *caps); |
1642 |
+ static gboolean gst_stride_transform_set_caps (GstBaseTransform *base, |
1643 |
+@@ -126,6 +130,8 @@ gst_stride_transform_class_init (GstStrideTransformClass *klass) |
1644 |
+ |
1645 |
+ basetransform_class->get_unit_size = |
1646 |
+ GST_DEBUG_FUNCPTR (gst_stride_transform_get_unit_size); |
1647 |
++ basetransform_class->transform_size = |
1648 |
++ GST_DEBUG_FUNCPTR (gst_stride_transform_transform_size); |
1649 |
+ basetransform_class->transform_caps = |
1650 |
+ GST_DEBUG_FUNCPTR (gst_stride_transform_transform_caps); |
1651 |
+ basetransform_class->set_caps = |
1652 |
+@@ -176,6 +182,34 @@ gst_stride_transform_get_unit_size (GstBaseTransform *base, |
1653 |
+ return TRUE; |
1654 |
+ } |
1655 |
+ |
1656 |
++/** |
1657 |
++ * Default transform_size function is no good, as it assumes that the output |
1658 |
++ * buffer size is a multiple of the unit size.. which doesn't hold true. |
1659 |
++ */ |
1660 |
++static gboolean |
1661 |
++gst_stride_transform_transform_size (GstBaseTransform *base, |
1662 |
++ GstPadDirection direction, |
1663 |
++ GstCaps *caps, guint size, |
1664 |
++ GstCaps *othercaps, guint *othersize) |
1665 |
++{ |
1666 |
++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
1667 |
++ guint idx = (direction == GST_PAD_SINK) ? 0 : 1; |
1668 |
++ |
1669 |
++ if (self->cached_caps[idx] != othercaps) |
1670 |
++ { |
1671 |
++ if (!gst_stride_transform_get_unit_size (base, othercaps, |
1672 |
++ &(self->cached_size[idx]))) |
1673 |
++ { |
1674 |
++ return FALSE; |
1675 |
++ } |
1676 |
++ } |
1677 |
++ |
1678 |
++ *othersize = self->cached_size[idx]; |
1679 |
++ |
1680 |
++ return TRUE; |
1681 |
++} |
1682 |
++ |
1683 |
++ |
1684 |
+ |
1685 |
+ /** |
1686 |
+ * helper to add all fields, other than rowstride to @caps, copied from @s. |
1687 |
+@@ -187,7 +221,7 @@ add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rows |
1688 |
+ GstStructure *new_s = gst_structure_new (name, NULL); |
1689 |
+ |
1690 |
+ if (rowstride) { |
1691 |
+- gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, 1000, NULL); // TODO |
1692 |
++ gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); |
1693 |
+ } |
1694 |
+ |
1695 |
+ idx = gst_structure_n_fields (s) - 1; |
1696 |
+diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h |
1697 |
+index d80197f..481959e 100644 |
1698 |
+--- a/gst/stride/gststridetransform.h |
1699 |
++++ b/gst/stride/gststridetransform.h |
1700 |
+@@ -59,6 +59,10 @@ struct _GstStrideTransform { |
1701 |
+ gint width, height; |
1702 |
+ gint in_rowstride; |
1703 |
+ gint out_rowstride; |
1704 |
++ |
1705 |
++ /* for caching the tranform_size() results.. */ |
1706 |
++ GstCaps *cached_caps[2]; |
1707 |
++ guint cached_size[2]; |
1708 |
+ }; |
1709 |
+ |
1710 |
+ struct _GstStrideTransformClass { |
1711 |
+@@ -70,35 +74,7 @@ GType gst_stride_transform_get_type (void); |
1712 |
+ G_END_DECLS |
1713 |
+ |
1714 |
+ |
1715 |
+- |
1716 |
+- |
1717 |
+-/* note: in case this is a build with TTIF logging, we can optimize slightly |
1718 |
+- * and avoid the gst_caps_to_string() in case logging isn't enabled by using |
1719 |
+- * the TTIF_TRACE_ARG_PROCESSOR feature of ttif_trace_fprintf(): |
1720 |
+- */ |
1721 |
+-#ifdef GST_LOG_OVER_TTIF |
1722 |
+-# define LOG_CAPS(obj, caps) G_STMT_START { \ |
1723 |
+- if (caps) { \ |
1724 |
+- static TTIF_TRACE_ARG_PROCESSOR proc = { \ |
1725 |
+- .convert = (char (*)(void *))gst_caps_to_string, \ |
1726 |
+- .free = (void (*)(char *))g_free \ |
1727 |
+- }; \ |
1728 |
+- GST_DEBUG_OBJECT (obj, "%s: %qs", #caps, &proc, (caps)); \ |
1729 |
+- } else { \ |
1730 |
+- GST_DEBUG_OBJECT (obj, "null"); \ |
1731 |
+- } \ |
1732 |
+- } G_STMT_END |
1733 |
+-#else |
1734 |
+-# define LOG_CAPS(obj, caps) G_STMT_START { \ |
1735 |
+- if (caps) { \ |
1736 |
+- gchar *capstr = gst_caps_to_string (caps); \ |
1737 |
+- GST_DEBUG_OBJECT (obj, "%s: %s", #caps, capstr); \ |
1738 |
+- g_free (capstr); \ |
1739 |
+- } else { \ |
1740 |
+- GST_DEBUG_OBJECT (obj, "null"); \ |
1741 |
+- } \ |
1742 |
+- } G_STMT_END |
1743 |
+-#endif |
1744 |
++#define LOG_CAPS(obj, caps) GST_DEBUG_OBJECT (obj, "%s: %"GST_PTR_FORMAT, #caps, caps) |
1745 |
+ |
1746 |
+ |
1747 |
+ #endif /* __GSTSTRIDETRANSFORM_H__ */ |
1748 |
+-- |
1749 |
+1.7.1 |
1750 |
+ |
1751 |
|
1752 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0006-fix-a-small-typo.-need-to-use-the-smaller-of-new_wid.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0006-fix-a-small-typo.-need-to-use-the-smaller-of-new_wid.patch |
1753 |
new file mode 100644 |
1754 |
index 0000000..14f7d3f |
1755 |
--- /dev/null |
1756 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0006-fix-a-small-typo.-need-to-use-the-smaller-of-new_wid.patch |
1757 |
@@ -0,0 +1,36 @@ |
1758 |
+From db7698656e71dc4a898fec9e46ae6c9d04352447 Mon Sep 17 00:00:00 2001 |
1759 |
+From: Rob Clark <rob@××.com> |
1760 |
+Date: Wed, 19 Aug 2009 15:33:50 -0500 |
1761 |
+Subject: [PATCH 06/24] fix a small typo.. need to use the smaller of {new_width, orig_width} for the line-by-line copy to avoid overwriting past end of buffer |
1762 |
+ |
1763 |
+--- |
1764 |
+ gst/stride/gststridetransform.c | 6 ++++-- |
1765 |
+ 1 files changed, 4 insertions(+), 2 deletions(-) |
1766 |
+ |
1767 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
1768 |
+index adc22ce..ea52500 100644 |
1769 |
+--- a/gst/stride/gststridetransform.c |
1770 |
++++ b/gst/stride/gststridetransform.c |
1771 |
+@@ -331,7 +331,7 @@ stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, |
1772 |
+ } |
1773 |
+ } else { |
1774 |
+ for (row=0; row<height; row++) { |
1775 |
+- memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); |
1776 |
++ memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width); |
1777 |
+ } |
1778 |
+ } |
1779 |
+ } |
1780 |
+@@ -440,7 +440,9 @@ gst_stride_transform_transform (GstBaseTransform *base, |
1781 |
+ { |
1782 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
1783 |
+ |
1784 |
+- GST_DEBUG_OBJECT (self, "inbuf=%p, outbuf=%p", inbuf, outbuf); |
1785 |
++ GST_DEBUG_OBJECT (self, "inbuf=%p (size=%d), outbuf=%p (size=%d)", |
1786 |
++ inbuf, GST_BUFFER_SIZE (inbuf), |
1787 |
++ outbuf, GST_BUFFER_SIZE (outbuf)); |
1788 |
+ |
1789 |
+ if (self->in_rowstride && self->out_rowstride) { |
1790 |
+ GST_DEBUG_OBJECT (self, "not implemented"); // TODO |
1791 |
+-- |
1792 |
+1.7.1 |
1793 |
+ |
1794 |
|
1795 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0007-Add-NV12-support-in-stridetransform.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0007-Add-NV12-support-in-stridetransform.patch |
1796 |
new file mode 100644 |
1797 |
index 0000000..fae77f7 |
1798 |
--- /dev/null |
1799 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0007-Add-NV12-support-in-stridetransform.patch |
1800 |
@@ -0,0 +1,77 @@ |
1801 |
+From f392c3f35052b57343e814d8f2d52b4f788d5d45 Mon Sep 17 00:00:00 2001 |
1802 |
+From: Rob Clark <rob@××.com> |
1803 |
+Date: Fri, 20 Nov 2009 18:43:12 -0600 |
1804 |
+Subject: [PATCH 07/24] Add NV12 support in stridetransform |
1805 |
+ |
1806 |
+--- |
1807 |
+ gst-libs/gst/video/video.c | 3 +++ |
1808 |
+ gst/stride/gststridetransform.c | 12 ++++-------- |
1809 |
+ 2 files changed, 7 insertions(+), 8 deletions(-) |
1810 |
+ |
1811 |
+diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c |
1812 |
+index 24f1ac8..ff9c4fb 100644 |
1813 |
+--- a/gst-libs/gst/video/video.c |
1814 |
++++ b/gst-libs/gst/video/video.c |
1815 |
+@@ -2025,6 +2025,9 @@ gst_video_format_get_size_strided (GstVideoFormat format, |
1816 |
+ case GST_VIDEO_FORMAT_Y42B: |
1817 |
+ case GST_VIDEO_FORMAT_Y444: |
1818 |
+ return GST_ROUND_UP_4 (3 * rowstride * height); |
1819 |
++ case GST_VIDEO_FORMAT_NV12: |
1820 |
++ case GST_VIDEO_FORMAT_NV21: |
1821 |
++ return GST_ROUND_UP_4 (rowstride) * GST_ROUND_UP_2 (height) * 3 / 2; |
1822 |
+ default: |
1823 |
+ return 0; |
1824 |
+ } |
1825 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
1826 |
+index ea52500..56207d0 100644 |
1827 |
+--- a/gst/stride/gststridetransform.c |
1828 |
++++ b/gst/stride/gststridetransform.c |
1829 |
+@@ -2,7 +2,7 @@ |
1830 |
+ * |
1831 |
+ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ |
1832 |
+ * |
1833 |
+- * Description: V4L2 sink element |
1834 |
++ * Description: stride transform element |
1835 |
+ * Created on: Jul 30, 2009 |
1836 |
+ * Author: Rob Clark <rob@××.com> |
1837 |
+ * |
1838 |
+@@ -62,7 +62,7 @@ GST_ELEMENT_DETAILS ("Stride transform", |
1839 |
+ |
1840 |
+ /* TODO: add rgb formats too! */ |
1841 |
+ #define SUPPORTED_CAPS \ |
1842 |
+- GST_VIDEO_CAPS_YUV_STRIDED ("{ I420, YV12, YUY2, UYVY }", "[ 0, max ]") |
1843 |
++ GST_VIDEO_CAPS_YUV_STRIDED ("{ I420, YV12, YUY2, UYVY, NV12 }", "[ 0, max ]") |
1844 |
+ |
1845 |
+ |
1846 |
+ static GstStaticPadTemplate src_template = |
1847 |
+@@ -357,12 +357,10 @@ stridify (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
1848 |
+ gint stride = self->out_rowstride; |
1849 |
+ |
1850 |
+ switch (self->format) { |
1851 |
+-#if 0 /* TODO */ |
1852 |
+ case GST_VIDEO_FORMAT_NV12: |
1853 |
+ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
1854 |
+- stridemove (strided, unstrided, stride, width, height * 1.5); |
1855 |
++ stridemove (strided, unstrided, stride, width, (GST_ROUND_UP_2 (height) * 3) / 2); |
1856 |
+ return GST_FLOW_OK; |
1857 |
+-#endif |
1858 |
+ case GST_VIDEO_FORMAT_I420: |
1859 |
+ case GST_VIDEO_FORMAT_YV12: |
1860 |
+ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
1861 |
+@@ -403,12 +401,10 @@ unstridify (GstStrideTransform *self, guchar *unstrided, guchar *strided) |
1862 |
+ gint stride = self->in_rowstride; |
1863 |
+ |
1864 |
+ switch (self->format) { |
1865 |
+-#if 0 /* TODO */ |
1866 |
+ case GST_VIDEO_FORMAT_NV12: |
1867 |
+ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
1868 |
+- stridemove (unstrided, strided, width, stride, height * 1.5); |
1869 |
++ stridemove (unstrided, strided, width, stride, (GST_ROUND_UP_2 (height) * 3) / 2); |
1870 |
+ return GST_FLOW_OK; |
1871 |
+-#endif |
1872 |
+ case GST_VIDEO_FORMAT_I420: |
1873 |
+ case GST_VIDEO_FORMAT_YV12: |
1874 |
+ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
1875 |
+-- |
1876 |
+1.7.1 |
1877 |
+ |
1878 |
|
1879 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0008-add-basic-support-for-I420-NV12-colorspace-conversio.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0008-add-basic-support-for-I420-NV12-colorspace-conversio.patch |
1880 |
new file mode 100644 |
1881 |
index 0000000..5898e0a |
1882 |
--- /dev/null |
1883 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0008-add-basic-support-for-I420-NV12-colorspace-conversio.patch |
1884 |
@@ -0,0 +1,186 @@ |
1885 |
+From 4b74d1b679855e8c709fde124fd9f0027ba8d916 Mon Sep 17 00:00:00 2001 |
1886 |
+From: Rob Clark <rob@××.com> |
1887 |
+Date: Fri, 27 Nov 2009 11:13:47 -0600 |
1888 |
+Subject: [PATCH 08/24] add basic support for I420->NV12 colorspace conversion |
1889 |
+ |
1890 |
+--- |
1891 |
+ gst/stride/gststridetransform.c | 109 ++++++++++++++++++++++++++++++++++++--- |
1892 |
+ gst/stride/gststridetransform.h | 2 +- |
1893 |
+ 2 files changed, 103 insertions(+), 8 deletions(-) |
1894 |
+ |
1895 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
1896 |
+index 56207d0..03deeb1 100644 |
1897 |
+--- a/gst/stride/gststridetransform.c |
1898 |
++++ b/gst/stride/gststridetransform.c |
1899 |
+@@ -227,11 +227,43 @@ add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rows |
1900 |
+ idx = gst_structure_n_fields (s) - 1; |
1901 |
+ while (idx >= 0) { |
1902 |
+ const gchar *name = gst_structure_nth_field_name (s, idx); |
1903 |
++ idx--; |
1904 |
++ if (!strcmp ("format", name)) { |
1905 |
++ // we can do simple color format translations, such as converting from one |
1906 |
++ // YUV420 format to another: |
1907 |
++ GValue formats = {0}; |
1908 |
++ GValue fourccval = {0}; |
1909 |
++ guint fourcc; |
1910 |
++ if (gst_structure_get_fourcc (s, name, &fourcc)) { |
1911 |
++ switch (gst_video_format_from_fourcc (fourcc)) { |
1912 |
++ case GST_VIDEO_FORMAT_NV12: |
1913 |
++ case GST_VIDEO_FORMAT_I420: |
1914 |
++GST_DEBUG ("Hmm, let's say I can convert I420<-->NV12.."); |
1915 |
++ g_value_init (&formats, GST_TYPE_LIST); |
1916 |
++ g_value_init (&fourccval, GST_TYPE_FOURCC); |
1917 |
++ gst_value_set_fourcc (&fourccval, |
1918 |
++ GST_MAKE_FOURCC ('I', '4', '2', '0')); |
1919 |
++ gst_value_list_append_value (&formats, &fourccval); |
1920 |
++ gst_value_set_fourcc (&fourccval, |
1921 |
++ GST_MAKE_FOURCC ('N', 'V', '1', '2')); |
1922 |
++ gst_value_list_append_value (&formats, &fourccval); |
1923 |
++ gst_structure_set_value (new_s, "format", &formats); |
1924 |
++ continue; |
1925 |
++/* maybe handle other cases later.. |
1926 |
++ case GST_VIDEO_FORMAT_YV12: |
1927 |
++ case GST_VIDEO_FORMAT_YUY2: |
1928 |
++ case GST_VIDEO_FORMAT_UYVY: |
1929 |
++*/ |
1930 |
++ default: |
1931 |
++ break; |
1932 |
++ } |
1933 |
++ } |
1934 |
++ } |
1935 |
++ |
1936 |
+ if (strcmp ("rowstride", name)) { |
1937 |
+ const GValue *val = gst_structure_get_value (s, name); |
1938 |
+ gst_structure_set_value (new_s, name, val); |
1939 |
+ } |
1940 |
+- idx--; |
1941 |
+ } |
1942 |
+ |
1943 |
+ gst_caps_merge_structure (caps, new_s); |
1944 |
+@@ -287,18 +319,16 @@ gst_stride_transform_set_caps (GstBaseTransform *base, |
1945 |
+ GstCaps *incaps, GstCaps *outcaps) |
1946 |
+ { |
1947 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
1948 |
+- GstVideoFormat format; |
1949 |
+ gint width, height; |
1950 |
+ |
1951 |
+ LOG_CAPS (self, incaps); |
1952 |
+ LOG_CAPS (self, outcaps); |
1953 |
+ |
1954 |
+ g_return_val_if_fail (gst_video_format_parse_caps_strided (incaps, |
1955 |
+- &self->format, &self->width, &self->height, &self->in_rowstride), FALSE); |
1956 |
++ &self->in_format, &self->width, &self->height, &self->in_rowstride), FALSE); |
1957 |
+ g_return_val_if_fail (gst_video_format_parse_caps_strided (outcaps, |
1958 |
+- &format, &width, &height, &self->out_rowstride), FALSE); |
1959 |
++ &self->out_format, &width, &height, &self->out_rowstride), FALSE); |
1960 |
+ |
1961 |
+- g_return_val_if_fail (self->format == format, FALSE); |
1962 |
+ g_return_val_if_fail (self->width == width, FALSE); |
1963 |
+ g_return_val_if_fail (self->height == height, FALSE); |
1964 |
+ |
1965 |
+@@ -307,6 +337,49 @@ gst_stride_transform_set_caps (GstBaseTransform *base, |
1966 |
+ |
1967 |
+ /* ************************************************************************* */ |
1968 |
+ |
1969 |
++static void |
1970 |
++memmove_demux (guchar *new_buf, guchar *orig_buf, gint sz, gint pxstride) |
1971 |
++{ |
1972 |
++ if (new_buf > orig_buf) { |
1973 |
++ /* copy backwards */ |
1974 |
++ new_buf += (sz * pxstride); |
1975 |
++ orig_buf += sz; |
1976 |
++ while(sz--) { |
1977 |
++ *new_buf = *orig_buf; |
1978 |
++ new_buf -= pxstride; |
1979 |
++ orig_buf--; |
1980 |
++ } |
1981 |
++ } else { |
1982 |
++ while(sz--) { |
1983 |
++ *new_buf = *orig_buf; |
1984 |
++ new_buf += pxstride; |
1985 |
++ orig_buf++; |
1986 |
++ } |
1987 |
++ } |
1988 |
++} |
1989 |
++ |
1990 |
++static void |
1991 |
++stridemove_demux (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height, gint pxstride) |
1992 |
++{ |
1993 |
++ int row; |
1994 |
++ |
1995 |
++ GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", |
1996 |
++ new_buf, orig_buf, new_width, orig_width, height); |
1997 |
++ /* if increasing the stride, work from bottom-up to avoid overwriting data |
1998 |
++ * that has not been moved yet.. otherwise, work in the opposite order, |
1999 |
++ * for the same reason. |
2000 |
++ */ |
2001 |
++ if (new_width > orig_width) { |
2002 |
++ for (row=height-1; row>=0; row--) { |
2003 |
++ memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width, pxstride); |
2004 |
++ } |
2005 |
++ } else { |
2006 |
++ for (row=0; row<height; row++) { |
2007 |
++ memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width, pxstride); |
2008 |
++ } |
2009 |
++ } |
2010 |
++} |
2011 |
++ |
2012 |
+ /** |
2013 |
+ * Convert from one stride to another... like memmove, but can convert stride in |
2014 |
+ * the process. This function is not aware of pixels, only of bytes. So widths |
2015 |
+@@ -356,7 +429,29 @@ stridify (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
2016 |
+ gint height = self->height; |
2017 |
+ gint stride = self->out_rowstride; |
2018 |
+ |
2019 |
+- switch (self->format) { |
2020 |
++ if (self->out_format != self->in_format) { |
2021 |
++ |
2022 |
++ if ((self->in_format == GST_VIDEO_FORMAT_I420) && |
2023 |
++ (self->out_format == GST_VIDEO_FORMAT_NV12)) { |
2024 |
++ /* note: if not an in-place conversion, then doing the U&V in one pass |
2025 |
++ * would be more efficient... but if it is an in-place conversion, I'd |
2026 |
++ * need to think about whether it is potential for the new UV plane to |
2027 |
++ * corrupt the V plane before it is done copying.. |
2028 |
++ */ |
2029 |
++ stridemove_demux ( |
2030 |
++ strided + (height*stride) + 1, |
2031 |
++ unstrided + (int)(height*width*1.25), |
2032 |
++ stride, width/2, height/2, 2); /* move V */ |
2033 |
++ stridemove_demux ( |
2034 |
++ strided + (height*stride), |
2035 |
++ unstrided + (height*width), |
2036 |
++ stride, width/2, height/2, 2); /* move U */ |
2037 |
++ stridemove (strided, unstrided, stride, width, height); /* move Y */ |
2038 |
++ return GST_FLOW_OK; |
2039 |
++ } |
2040 |
++ } |
2041 |
++ |
2042 |
++ switch (self->out_format) { |
2043 |
+ case GST_VIDEO_FORMAT_NV12: |
2044 |
+ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
2045 |
+ stridemove (strided, unstrided, stride, width, (GST_ROUND_UP_2 (height) * 3) / 2); |
2046 |
+@@ -400,7 +495,7 @@ unstridify (GstStrideTransform *self, guchar *unstrided, guchar *strided) |
2047 |
+ gint height = self->height; |
2048 |
+ gint stride = self->in_rowstride; |
2049 |
+ |
2050 |
+- switch (self->format) { |
2051 |
++ switch (self->out_format) { |
2052 |
+ case GST_VIDEO_FORMAT_NV12: |
2053 |
+ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
2054 |
+ stridemove (unstrided, strided, width, stride, (GST_ROUND_UP_2 (height) * 3) / 2); |
2055 |
+diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h |
2056 |
+index 481959e..0141571 100644 |
2057 |
+--- a/gst/stride/gststridetransform.h |
2058 |
++++ b/gst/stride/gststridetransform.h |
2059 |
+@@ -55,7 +55,7 @@ struct _GstStrideTransform { |
2060 |
+ GstVideoFilter videofilter; |
2061 |
+ |
2062 |
+ /*< private >*/ |
2063 |
+- GstVideoFormat format; |
2064 |
++ GstVideoFormat in_format, out_format; |
2065 |
+ gint width, height; |
2066 |
+ gint in_rowstride; |
2067 |
+ gint out_rowstride; |
2068 |
+-- |
2069 |
+1.7.1 |
2070 |
+ |
2071 |
|
2072 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0009-fix-to-avoid-parsing-caps-on-every-frame.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0009-fix-to-avoid-parsing-caps-on-every-frame.patch |
2073 |
new file mode 100644 |
2074 |
index 0000000..b67789f |
2075 |
--- /dev/null |
2076 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0009-fix-to-avoid-parsing-caps-on-every-frame.patch |
2077 |
@@ -0,0 +1,35 @@ |
2078 |
+From 8132aecf99071faab59739ebabd7bcd41a2ab581 Mon Sep 17 00:00:00 2001 |
2079 |
+From: Rob Clark <rob@××.com> |
2080 |
+Date: Fri, 27 Nov 2009 11:14:58 -0600 |
2081 |
+Subject: [PATCH 09/24] fix to avoid parsing caps on every frame |
2082 |
+ |
2083 |
+--- |
2084 |
+ gst/stride/gststridetransform.c | 10 +++++++--- |
2085 |
+ 1 files changed, 7 insertions(+), 3 deletions(-) |
2086 |
+ |
2087 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
2088 |
+index 03deeb1..143a9f7 100644 |
2089 |
+--- a/gst/stride/gststridetransform.c |
2090 |
++++ b/gst/stride/gststridetransform.c |
2091 |
+@@ -197,11 +197,15 @@ gst_stride_transform_transform_size (GstBaseTransform *base, |
2092 |
+ |
2093 |
+ if (self->cached_caps[idx] != othercaps) |
2094 |
+ { |
2095 |
+- if (!gst_stride_transform_get_unit_size (base, othercaps, |
2096 |
+- &(self->cached_size[idx]))) |
2097 |
+- { |
2098 |
++ guint sz; |
2099 |
++ if (!gst_stride_transform_get_unit_size (base, othercaps, &sz)) { |
2100 |
+ return FALSE; |
2101 |
+ } |
2102 |
++ if (self->cached_caps[idx]) { |
2103 |
++ gst_caps_unref (self->cached_caps[idx]); |
2104 |
++ } |
2105 |
++ self->cached_size[idx] = sz; |
2106 |
++ self->cached_caps[idx] = gst_caps_ref (othercaps); |
2107 |
+ } |
2108 |
+ |
2109 |
+ *othersize = self->cached_size[idx]; |
2110 |
+-- |
2111 |
+1.7.1 |
2112 |
+ |
2113 |
|
2114 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0010-refactor-stridetransform-to-make-it-easier-to-add-ne.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0010-refactor-stridetransform-to-make-it-easier-to-add-ne.patch |
2115 |
new file mode 100644 |
2116 |
index 0000000..f8c3612 |
2117 |
--- /dev/null |
2118 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0010-refactor-stridetransform-to-make-it-easier-to-add-ne.patch |
2119 |
@@ -0,0 +1,759 @@ |
2120 |
+From c854bfe87a39d640dfd3381bcba83281d9316b50 Mon Sep 17 00:00:00 2001 |
2121 |
+From: Rob Clark <rob@××.com> |
2122 |
+Date: Fri, 27 Nov 2009 15:05:56 -0600 |
2123 |
+Subject: [PATCH 10/24] refactor stridetransform to make it easier to add new transforms (stride and/or colorspace) |
2124 |
+ |
2125 |
+--- |
2126 |
+ gst/stride/Makefile.am | 1 + |
2127 |
+ gst/stride/convert.c | 267 +++++++++++++++++++++++++++++++++++ |
2128 |
+ gst/stride/gststridetransform.c | 295 ++++++++------------------------------- |
2129 |
+ gst/stride/gststridetransform.h | 18 ++- |
2130 |
+ 4 files changed, 340 insertions(+), 241 deletions(-) |
2131 |
+ create mode 100644 gst/stride/convert.c |
2132 |
+ |
2133 |
+diff --git a/gst/stride/Makefile.am b/gst/stride/Makefile.am |
2134 |
+index 1adc197..0b61d55 100644 |
2135 |
+--- a/gst/stride/Makefile.am |
2136 |
++++ b/gst/stride/Makefile.am |
2137 |
+@@ -2,6 +2,7 @@ plugin_LTLIBRARIES = libgststridetransform.la |
2138 |
+ |
2139 |
+ libgststridetransform_la_SOURCES = \ |
2140 |
+ gststridetransform.c \ |
2141 |
++ convert.c \ |
2142 |
+ plugin.c |
2143 |
+ |
2144 |
+ libgststridetransform_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) |
2145 |
+diff --git a/gst/stride/convert.c b/gst/stride/convert.c |
2146 |
+new file mode 100644 |
2147 |
+index 0000000..860f16c |
2148 |
+--- /dev/null |
2149 |
++++ b/gst/stride/convert.c |
2150 |
+@@ -0,0 +1,267 @@ |
2151 |
++/* GStreamer |
2152 |
++ * |
2153 |
++ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ |
2154 |
++ * |
2155 |
++ * Description: stride transform conversion utilities |
2156 |
++ * Created on: Nov 27, 2009 |
2157 |
++ * Author: Rob Clark <rob@××.com> |
2158 |
++ * |
2159 |
++ * This library is free software; you can redistribute it and/or |
2160 |
++ * modify it under the terms of the GNU Library General Public |
2161 |
++ * License as published by the Free Software Foundation; either |
2162 |
++ * version 2 of the License, or (at your option) any later version. |
2163 |
++ * |
2164 |
++ * This library is distributed in the hope that it will be useful, |
2165 |
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2166 |
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2167 |
++ * Library General Public License for more details. |
2168 |
++ * |
2169 |
++ * You should have received a copy of the GNU Library General Public |
2170 |
++ * License along with this library; if not, write to the |
2171 |
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
2172 |
++ * Boston, MA 02111-1307, USA. |
2173 |
++ */ |
2174 |
++ |
2175 |
++ |
2176 |
++#ifdef HAVE_CONFIG_H |
2177 |
++#include <config.h> |
2178 |
++#endif |
2179 |
++ |
2180 |
++#include <string.h> |
2181 |
++#include <gst/video/video.h> |
2182 |
++ |
2183 |
++#include "gststridetransform.h" |
2184 |
++ |
2185 |
++ |
2186 |
++GST_DEBUG_CATEGORY_EXTERN (stridetransform_debug); |
2187 |
++#define GST_CAT_DEFAULT stridetransform_debug |
2188 |
++ |
2189 |
++ |
2190 |
++/* |
2191 |
++ * Conversion utilities: |
2192 |
++ */ |
2193 |
++ |
2194 |
++static void |
2195 |
++memmove_demux (guchar *new_buf, guchar *orig_buf, gint sz, gint pxstride) |
2196 |
++{ |
2197 |
++ if (new_buf > orig_buf) { |
2198 |
++ /* copy backwards */ |
2199 |
++ new_buf += ((sz - 1) * pxstride); |
2200 |
++ orig_buf += sz - 1; |
2201 |
++ while(sz--) { |
2202 |
++ *new_buf = *orig_buf; |
2203 |
++ new_buf -= pxstride; |
2204 |
++ orig_buf--; |
2205 |
++ } |
2206 |
++ } else { |
2207 |
++ while(sz--) { |
2208 |
++ *new_buf = *orig_buf; |
2209 |
++ new_buf += pxstride; |
2210 |
++ orig_buf++; |
2211 |
++ } |
2212 |
++ } |
2213 |
++} |
2214 |
++ |
2215 |
++static void |
2216 |
++stridemove_demux (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height, gint pxstride) |
2217 |
++{ |
2218 |
++ int row; |
2219 |
++ |
2220 |
++ GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", |
2221 |
++ new_buf, orig_buf, new_width, orig_width, height); |
2222 |
++ |
2223 |
++ /* if increasing the stride, work from bottom-up to avoid overwriting data |
2224 |
++ * that has not been moved yet.. otherwise, work in the opposite order, |
2225 |
++ * for the same reason. |
2226 |
++ */ |
2227 |
++ if (new_width > orig_width) { |
2228 |
++ for (row=height-1; row>=0; row--) { |
2229 |
++ memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width, pxstride); |
2230 |
++ } |
2231 |
++ } else { |
2232 |
++ for (row=0; row<height; row++) { |
2233 |
++ memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width, pxstride); |
2234 |
++ } |
2235 |
++ } |
2236 |
++} |
2237 |
++ |
2238 |
++/** |
2239 |
++ * Convert from one stride to another... like memmove, but can convert stride in |
2240 |
++ * the process. This function is not aware of pixels, only of bytes. So widths |
2241 |
++ * are given in bytes, not pixels. The new_buf and orig_buf can point to the |
2242 |
++ * same buffers to do an in-place conversion, but the buffer should be large |
2243 |
++ * enough. |
2244 |
++ */ |
2245 |
++static void |
2246 |
++stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height) |
2247 |
++{ |
2248 |
++ int row; |
2249 |
++ |
2250 |
++ GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", |
2251 |
++ new_buf, orig_buf, new_width, orig_width, height); |
2252 |
++ |
2253 |
++ /* if increasing the stride, work from bottom-up to avoid overwriting data |
2254 |
++ * that has not been moved yet.. otherwise, work in the opposite order, |
2255 |
++ * for the same reason. |
2256 |
++ */ |
2257 |
++ if (new_width > orig_width) { |
2258 |
++ for (row=height-1; row>=0; row--) { |
2259 |
++ memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); |
2260 |
++ } |
2261 |
++ } else { |
2262 |
++ for (row=0; row<height; row++) { |
2263 |
++ memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width); |
2264 |
++ } |
2265 |
++ } |
2266 |
++} |
2267 |
++ |
2268 |
++/* |
2269 |
++ * Conversion Functions: |
2270 |
++ */ |
2271 |
++ |
2272 |
++/** convert 4:2:0 semiplanar to same 4:2:0 semiplanar */ |
2273 |
++static GstFlowReturn |
2274 |
++unstridify_420sp_420sp (GstStrideTransform *self, guchar *unstrided, guchar *strided) |
2275 |
++{ |
2276 |
++ gint width = self->width; |
2277 |
++ gint height = self->height; |
2278 |
++ gint stride = self->in_rowstride; |
2279 |
++ |
2280 |
++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
2281 |
++ |
2282 |
++ stridemove (unstrided, strided, width, stride, |
2283 |
++ (GST_ROUND_UP_2 (height) * 3) / 2); |
2284 |
++ |
2285 |
++ return GST_FLOW_OK; |
2286 |
++} |
2287 |
++static GstFlowReturn |
2288 |
++stridify_420sp_420sp (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
2289 |
++{ |
2290 |
++ gint width = self->width; |
2291 |
++ gint height = self->height; |
2292 |
++ gint stride = self->out_rowstride; |
2293 |
++ |
2294 |
++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
2295 |
++ |
2296 |
++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
2297 |
++ stridemove (strided, unstrided, stride, width, |
2298 |
++ (GST_ROUND_UP_2 (height) * 3) / 2); |
2299 |
++ |
2300 |
++ return GST_FLOW_OK; |
2301 |
++} |
2302 |
++ |
2303 |
++/** convert 4:2:0 planar to same 4:2:0 planar */ |
2304 |
++static GstFlowReturn |
2305 |
++unstridify_420p_420p (GstStrideTransform *self, guchar *unstrided, guchar *strided) |
2306 |
++{ |
2307 |
++ gint width = self->width; |
2308 |
++ gint height = self->height; |
2309 |
++ gint stride = self->in_rowstride; |
2310 |
++ |
2311 |
++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
2312 |
++ |
2313 |
++ stridemove (unstrided, strided, width, stride, height); /* move Y */ |
2314 |
++ stridemove ( |
2315 |
++ unstrided + (height*width), |
2316 |
++ strided + (height*stride), |
2317 |
++ width/2, stride, height); /* move V/U */ |
2318 |
++ /* XXX odd widths/heights/strides: */ |
2319 |
++ stridemove ( |
2320 |
++ unstrided + (int)(height*width*1.5), |
2321 |
++ strided + (int)(height*stride*1.5), |
2322 |
++ width/2, stride, height); /* move U/V */ |
2323 |
++ |
2324 |
++ return GST_FLOW_OK; |
2325 |
++} |
2326 |
++static GstFlowReturn |
2327 |
++stridify_420p_420p (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
2328 |
++{ |
2329 |
++ gint width = self->width; |
2330 |
++ gint height = self->height; |
2331 |
++ gint stride = self->out_rowstride; |
2332 |
++ |
2333 |
++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
2334 |
++ |
2335 |
++ /* XXX odd widths/heights/strides: */ |
2336 |
++ stridemove ( |
2337 |
++ strided + (int)(height*stride*1.5), |
2338 |
++ unstrided + (int)(height*width*1.5), |
2339 |
++ stride, width/2, height); /* move U/V */ |
2340 |
++ stridemove ( |
2341 |
++ strided + (height*stride), |
2342 |
++ unstrided + (height*width), |
2343 |
++ stride, width/2, height); /* move V/U */ |
2344 |
++ stridemove (strided, unstrided, stride, width, height); /* move Y */ |
2345 |
++ |
2346 |
++ return GST_FLOW_OK; |
2347 |
++} |
2348 |
++ |
2349 |
++/** convert 4:2:2 packed to same 4:2:2 packed */ |
2350 |
++static GstFlowReturn |
2351 |
++unstridify_422i_422i (GstStrideTransform *self, guchar *unstrided, guchar *strided) |
2352 |
++{ |
2353 |
++ gint width = self->width; |
2354 |
++ gint height = self->height; |
2355 |
++ gint stride = self->in_rowstride; |
2356 |
++ |
2357 |
++ g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); |
2358 |
++ |
2359 |
++ stridemove (unstrided, strided, width*2, stride, height); |
2360 |
++ |
2361 |
++ return GST_FLOW_OK; |
2362 |
++} |
2363 |
++static GstFlowReturn |
2364 |
++stridify_422i_422i (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
2365 |
++{ |
2366 |
++ gint width = self->width; |
2367 |
++ gint height = self->height; |
2368 |
++ gint stride = self->out_rowstride; |
2369 |
++ |
2370 |
++ g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); |
2371 |
++ |
2372 |
++ stridemove (strided, unstrided, stride, width*2, height); |
2373 |
++ |
2374 |
++ return GST_FLOW_OK; |
2375 |
++} |
2376 |
++ |
2377 |
++/** convert I420 unstrided to NV12 strided */ |
2378 |
++static GstFlowReturn |
2379 |
++stridify_i420_nv12 (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
2380 |
++{ |
2381 |
++ gint width = self->width; |
2382 |
++ gint height = self->height; |
2383 |
++ gint stride = self->out_rowstride; |
2384 |
++ |
2385 |
++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
2386 |
++ |
2387 |
++ /* note: if not an in-place conversion, then doing the U&V in one pass |
2388 |
++ * would be more efficient... but if it is an in-place conversion, I'd |
2389 |
++ * need to think about whether it is potential for the new UV plane to |
2390 |
++ * corrupt the V plane before it is done copying.. |
2391 |
++ */ |
2392 |
++ stridemove_demux ( |
2393 |
++ strided + (height*stride) + 1, |
2394 |
++ unstrided + (int)(height*width*1.25), |
2395 |
++ stride, width/2, height/2, 2); /* move V */ |
2396 |
++ stridemove_demux ( |
2397 |
++ strided + (height*stride), |
2398 |
++ unstrided + (height*width), |
2399 |
++ stride, width/2, height/2, 2); /* move U */ |
2400 |
++ stridemove (strided, unstrided, stride, width, height); /* move Y */ |
2401 |
++ |
2402 |
++ return GST_FLOW_OK; |
2403 |
++} |
2404 |
++ |
2405 |
++/* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ |
2406 |
++Conversion stride_conversions[] = { |
2407 |
++ { { GST_VIDEO_FORMAT_NV12, GST_VIDEO_FORMAT_NV12 }, stridify_420sp_420sp, unstridify_420sp_420sp }, |
2408 |
++ { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_I420 }, stridify_420p_420p, unstridify_420p_420p }, |
2409 |
++ { { GST_VIDEO_FORMAT_YV12, GST_VIDEO_FORMAT_YV12 }, stridify_420p_420p, unstridify_420p_420p }, |
2410 |
++ { { GST_VIDEO_FORMAT_YUY2, GST_VIDEO_FORMAT_YUY2 }, stridify_422i_422i, unstridify_422i_422i }, |
2411 |
++ { { GST_VIDEO_FORMAT_UYVY, GST_VIDEO_FORMAT_UYVY }, stridify_422i_422i, unstridify_422i_422i }, |
2412 |
++ { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_NV12 }, stridify_i420_nv12, NULL }, |
2413 |
++ /* add new entries before here */ |
2414 |
++ { { GST_VIDEO_FORMAT_UNKNOWN } } |
2415 |
++}; |
2416 |
++ |
2417 |
++ |
2418 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
2419 |
+index 143a9f7..6ab0479 100644 |
2420 |
+--- a/gst/stride/gststridetransform.c |
2421 |
++++ b/gst/stride/gststridetransform.c |
2422 |
+@@ -47,12 +47,17 @@ |
2423 |
+ #endif |
2424 |
+ |
2425 |
+ #include <string.h> |
2426 |
++ |
2427 |
+ #include <gst/video/video.h> |
2428 |
+ |
2429 |
+ #include "gst/gst-i18n-plugin.h" |
2430 |
+ #include "gststridetransform.h" |
2431 |
+ |
2432 |
+ |
2433 |
++/* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ |
2434 |
++extern const Conversion stride_conversions[]; |
2435 |
++ |
2436 |
++ |
2437 |
+ static const GstElementDetails stridetransform_details = |
2438 |
+ GST_ELEMENT_DETAILS ("Stride transform", |
2439 |
+ "Filter/Converter/Video", |
2440 |
+@@ -70,14 +75,14 @@ GST_STATIC_PAD_TEMPLATE ("src", |
2441 |
+ GST_PAD_SRC, |
2442 |
+ GST_PAD_ALWAYS, |
2443 |
+ GST_STATIC_CAPS (SUPPORTED_CAPS) |
2444 |
+- ); |
2445 |
++); |
2446 |
+ |
2447 |
+ static GstStaticPadTemplate sink_template = |
2448 |
+ GST_STATIC_PAD_TEMPLATE ("sink", |
2449 |
+ GST_PAD_SINK, |
2450 |
+ GST_PAD_ALWAYS, |
2451 |
+ GST_STATIC_CAPS (SUPPORTED_CAPS) |
2452 |
+- ); |
2453 |
++); |
2454 |
+ |
2455 |
+ |
2456 |
+ GST_DEBUG_CATEGORY (stridetransform_debug); |
2457 |
+@@ -99,8 +104,6 @@ static gboolean gst_stride_transform_set_caps (GstBaseTransform *base, |
2458 |
+ GstCaps *incaps, GstCaps *outcaps); |
2459 |
+ static GstFlowReturn gst_stride_transform_transform (GstBaseTransform *base, |
2460 |
+ GstBuffer *inbuf, GstBuffer *outbuf); |
2461 |
+-static GstFlowReturn gst_stride_transform_transform_ip (GstBaseTransform *base, |
2462 |
+- GstBuffer *buf); |
2463 |
+ |
2464 |
+ GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, GST_TYPE_VIDEO_FILTER); |
2465 |
+ |
2466 |
+@@ -136,8 +139,6 @@ gst_stride_transform_class_init (GstStrideTransformClass *klass) |
2467 |
+ GST_DEBUG_FUNCPTR (gst_stride_transform_transform_caps); |
2468 |
+ basetransform_class->set_caps = |
2469 |
+ GST_DEBUG_FUNCPTR (gst_stride_transform_set_caps); |
2470 |
+- basetransform_class->transform_ip = |
2471 |
+- GST_DEBUG_FUNCPTR (gst_stride_transform_transform_ip); |
2472 |
+ basetransform_class->transform = |
2473 |
+ GST_DEBUG_FUNCPTR (gst_stride_transform_transform); |
2474 |
+ |
2475 |
+@@ -219,7 +220,7 @@ gst_stride_transform_transform_size (GstBaseTransform *base, |
2476 |
+ * helper to add all fields, other than rowstride to @caps, copied from @s. |
2477 |
+ */ |
2478 |
+ static void |
2479 |
+-add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rowstride) |
2480 |
++add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rowstride, GstPadDirection direction) |
2481 |
+ { |
2482 |
+ gint idx; |
2483 |
+ GstStructure *new_s = gst_structure_new (name, NULL); |
2484 |
+@@ -232,38 +233,39 @@ add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rows |
2485 |
+ while (idx >= 0) { |
2486 |
+ const gchar *name = gst_structure_nth_field_name (s, idx); |
2487 |
+ idx--; |
2488 |
++ |
2489 |
++ /* for format field, check the stride_conversions table to see what |
2490 |
++ * we can support: |
2491 |
++ */ |
2492 |
+ if (!strcmp ("format", name)) { |
2493 |
+- // we can do simple color format translations, such as converting from one |
2494 |
+- // YUV420 format to another: |
2495 |
+- GValue formats = {0}; |
2496 |
+- GValue fourccval = {0}; |
2497 |
+ guint fourcc; |
2498 |
+- if (gst_structure_get_fourcc (s, name, &fourcc)) { |
2499 |
+- switch (gst_video_format_from_fourcc (fourcc)) { |
2500 |
+- case GST_VIDEO_FORMAT_NV12: |
2501 |
+- case GST_VIDEO_FORMAT_I420: |
2502 |
+-GST_DEBUG ("Hmm, let's say I can convert I420<-->NV12.."); |
2503 |
+- g_value_init (&formats, GST_TYPE_LIST); |
2504 |
+- g_value_init (&fourccval, GST_TYPE_FOURCC); |
2505 |
+- gst_value_set_fourcc (&fourccval, |
2506 |
+- GST_MAKE_FOURCC ('I', '4', '2', '0')); |
2507 |
+- gst_value_list_append_value (&formats, &fourccval); |
2508 |
+- gst_value_set_fourcc (&fourccval, |
2509 |
+- GST_MAKE_FOURCC ('N', 'V', '1', '2')); |
2510 |
++ |
2511 |
++ /* XXX double check this: */ |
2512 |
++ gint to_format = (direction == GST_PAD_SINK) ? 1 : 0; |
2513 |
++ gint from_format = (direction == GST_PAD_SRC) ? 1 : 0; |
2514 |
++ |
2515 |
++ if (gst_structure_get_fourcc (s, "format", &fourcc)) { |
2516 |
++ GValue formats = {0}; |
2517 |
++ GValue fourccval = {0}; |
2518 |
++ gint i; |
2519 |
++ GstVideoFormat format = gst_video_format_from_fourcc (fourcc); |
2520 |
++ |
2521 |
++ g_value_init (&formats, GST_TYPE_LIST); |
2522 |
++ g_value_init (&fourccval, GST_TYPE_FOURCC); |
2523 |
++ |
2524 |
++ for (i=0; stride_conversions[i].format[0]!=GST_VIDEO_FORMAT_UNKNOWN; i++) { |
2525 |
++ if (stride_conversions[i].format[from_format] == format) { |
2526 |
++ gst_value_set_fourcc (&fourccval, gst_video_format_to_fourcc |
2527 |
++ (stride_conversions[i].format[to_format])); |
2528 |
+ gst_value_list_append_value (&formats, &fourccval); |
2529 |
+- gst_structure_set_value (new_s, "format", &formats); |
2530 |
+- continue; |
2531 |
+-/* maybe handle other cases later.. |
2532 |
+- case GST_VIDEO_FORMAT_YV12: |
2533 |
+- case GST_VIDEO_FORMAT_YUY2: |
2534 |
+- case GST_VIDEO_FORMAT_UYVY: |
2535 |
+-*/ |
2536 |
+- default: |
2537 |
+- break; |
2538 |
++ } |
2539 |
+ } |
2540 |
++ |
2541 |
++ continue; |
2542 |
+ } |
2543 |
+ } |
2544 |
+ |
2545 |
++ /* copy over all other non-rowstride fields: */ |
2546 |
+ if (strcmp ("rowstride", name)) { |
2547 |
+ const GValue *val = gst_structure_get_value (s, name); |
2548 |
+ gst_structure_set_value (new_s, name, val); |
2549 |
+@@ -297,14 +299,14 @@ gst_stride_transform_transform_caps (GstBaseTransform *base, |
2550 |
+ if (gst_structure_has_name (s, "video/x-raw-yuv") || |
2551 |
+ gst_structure_has_name (s, "video/x-raw-yuv-strided")) { |
2552 |
+ |
2553 |
+- add_all_fields (ret, "video/x-raw-yuv", s, FALSE); |
2554 |
+- add_all_fields (ret, "video/x-raw-yuv-strided", s, TRUE); |
2555 |
++ add_all_fields (ret, "video/x-raw-yuv", s, FALSE, direction); |
2556 |
++ add_all_fields (ret, "video/x-raw-yuv-strided", s, TRUE, direction); |
2557 |
+ |
2558 |
+ } else if (gst_structure_has_name (s, "video/x-raw-rgb") || |
2559 |
+ gst_structure_has_name (s, "video/x-raw-rgb-strided")) { |
2560 |
+ |
2561 |
+- add_all_fields (ret, "video/x-raw-rgb", s, FALSE); |
2562 |
+- add_all_fields (ret, "video/x-raw-rgb-strided", s, TRUE); |
2563 |
++ add_all_fields (ret, "video/x-raw-rgb", s, FALSE, direction); |
2564 |
++ add_all_fields (ret, "video/x-raw-rgb-strided", s, TRUE, direction); |
2565 |
+ |
2566 |
+ } |
2567 |
+ |
2568 |
+@@ -324,211 +326,37 @@ gst_stride_transform_set_caps (GstBaseTransform *base, |
2569 |
+ { |
2570 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
2571 |
+ gint width, height; |
2572 |
++ GstVideoFormat in_format, out_format; |
2573 |
++ gint i; |
2574 |
+ |
2575 |
+ LOG_CAPS (self, incaps); |
2576 |
+ LOG_CAPS (self, outcaps); |
2577 |
+ |
2578 |
+ g_return_val_if_fail (gst_video_format_parse_caps_strided (incaps, |
2579 |
+- &self->in_format, &self->width, &self->height, &self->in_rowstride), FALSE); |
2580 |
++ &in_format, &self->width, &self->height, &self->in_rowstride), FALSE); |
2581 |
+ g_return_val_if_fail (gst_video_format_parse_caps_strided (outcaps, |
2582 |
+- &self->out_format, &width, &height, &self->out_rowstride), FALSE); |
2583 |
+- |
2584 |
+- g_return_val_if_fail (self->width == width, FALSE); |
2585 |
+- g_return_val_if_fail (self->height == height, FALSE); |
2586 |
+- |
2587 |
+- return TRUE; |
2588 |
+-} |
2589 |
+- |
2590 |
+-/* ************************************************************************* */ |
2591 |
+- |
2592 |
+-static void |
2593 |
+-memmove_demux (guchar *new_buf, guchar *orig_buf, gint sz, gint pxstride) |
2594 |
+-{ |
2595 |
+- if (new_buf > orig_buf) { |
2596 |
+- /* copy backwards */ |
2597 |
+- new_buf += (sz * pxstride); |
2598 |
+- orig_buf += sz; |
2599 |
+- while(sz--) { |
2600 |
+- *new_buf = *orig_buf; |
2601 |
+- new_buf -= pxstride; |
2602 |
+- orig_buf--; |
2603 |
+- } |
2604 |
+- } else { |
2605 |
+- while(sz--) { |
2606 |
+- *new_buf = *orig_buf; |
2607 |
+- new_buf += pxstride; |
2608 |
+- orig_buf++; |
2609 |
+- } |
2610 |
+- } |
2611 |
+-} |
2612 |
+- |
2613 |
+-static void |
2614 |
+-stridemove_demux (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height, gint pxstride) |
2615 |
+-{ |
2616 |
+- int row; |
2617 |
+- |
2618 |
+- GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", |
2619 |
+- new_buf, orig_buf, new_width, orig_width, height); |
2620 |
+- /* if increasing the stride, work from bottom-up to avoid overwriting data |
2621 |
+- * that has not been moved yet.. otherwise, work in the opposite order, |
2622 |
+- * for the same reason. |
2623 |
+- */ |
2624 |
+- if (new_width > orig_width) { |
2625 |
+- for (row=height-1; row>=0; row--) { |
2626 |
+- memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width, pxstride); |
2627 |
+- } |
2628 |
+- } else { |
2629 |
+- for (row=0; row<height; row++) { |
2630 |
+- memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width, pxstride); |
2631 |
+- } |
2632 |
+- } |
2633 |
+-} |
2634 |
++ &out_format, &width, &height, &self->out_rowstride), FALSE); |
2635 |
+ |
2636 |
+-/** |
2637 |
+- * Convert from one stride to another... like memmove, but can convert stride in |
2638 |
+- * the process. This function is not aware of pixels, only of bytes. So widths |
2639 |
+- * are given in bytes, not pixels. The new_buf and orig_buf can point to the |
2640 |
+- * same buffers to do an in-place conversion, but the buffer should be large |
2641 |
+- * enough. |
2642 |
+- */ |
2643 |
+-static void |
2644 |
+-stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height) |
2645 |
+-{ |
2646 |
+- int row; |
2647 |
+- |
2648 |
+- GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", |
2649 |
+- new_buf, orig_buf, new_width, orig_width, height); |
2650 |
+- /* if increasing the stride, work from bottom-up to avoid overwriting data |
2651 |
+- * that has not been moved yet.. otherwise, work in the opposite order, |
2652 |
+- * for the same reason. |
2653 |
+- */ |
2654 |
+- if (new_width > orig_width) { |
2655 |
+- for (row=height-1; row>=0; row--) { |
2656 |
+- memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); |
2657 |
+- } |
2658 |
+- } else { |
2659 |
+- for (row=0; row<height; row++) { |
2660 |
+- memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width); |
2661 |
+- } |
2662 |
+- } |
2663 |
+-} |
2664 |
++ self->conversion = NULL; |
2665 |
+ |
2666 |
+- |
2667 |
+-/** |
2668 |
+- * Convert from a non-strided buffer to strided. The two buffer pointers could |
2669 |
+- * be pointing to the same memory block for in-place transform.. assuming that |
2670 |
+- * the buffer is large enough |
2671 |
+- * |
2672 |
+- * @strided: the pointer to the resulting strided buffer |
2673 |
+- * @unstrided: the pointer to the initial unstrided buffer |
2674 |
+- * @fourcc: the color format |
2675 |
+- * @stride: the stride, in bytes |
2676 |
+- * @width: the width in pixels |
2677 |
+- * @height: the height in pixels |
2678 |
+- */ |
2679 |
+-static GstFlowReturn |
2680 |
+-stridify (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
2681 |
+-{ |
2682 |
+- gint width = self->width; |
2683 |
+- gint height = self->height; |
2684 |
+- gint stride = self->out_rowstride; |
2685 |
+- |
2686 |
+- if (self->out_format != self->in_format) { |
2687 |
+- |
2688 |
+- if ((self->in_format == GST_VIDEO_FORMAT_I420) && |
2689 |
+- (self->out_format == GST_VIDEO_FORMAT_NV12)) { |
2690 |
+- /* note: if not an in-place conversion, then doing the U&V in one pass |
2691 |
+- * would be more efficient... but if it is an in-place conversion, I'd |
2692 |
+- * need to think about whether it is potential for the new UV plane to |
2693 |
+- * corrupt the V plane before it is done copying.. |
2694 |
+- */ |
2695 |
+- stridemove_demux ( |
2696 |
+- strided + (height*stride) + 1, |
2697 |
+- unstrided + (int)(height*width*1.25), |
2698 |
+- stride, width/2, height/2, 2); /* move V */ |
2699 |
+- stridemove_demux ( |
2700 |
+- strided + (height*stride), |
2701 |
+- unstrided + (height*width), |
2702 |
+- stride, width/2, height/2, 2); /* move U */ |
2703 |
+- stridemove (strided, unstrided, stride, width, height); /* move Y */ |
2704 |
+- return GST_FLOW_OK; |
2705 |
++ for (i=0; stride_conversions[i].format[0]!=GST_VIDEO_FORMAT_UNKNOWN; i++) { |
2706 |
++ if ((stride_conversions[i].format[0] == in_format) && |
2707 |
++ (stride_conversions[i].format[1] == out_format)) { |
2708 |
++ GST_DEBUG_OBJECT (self, "found stride_conversion: %d", i); |
2709 |
++ self->conversion = &stride_conversions[i]; |
2710 |
++ break; |
2711 |
+ } |
2712 |
+ } |
2713 |
+ |
2714 |
+- switch (self->out_format) { |
2715 |
+- case GST_VIDEO_FORMAT_NV12: |
2716 |
+- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
2717 |
+- stridemove (strided, unstrided, stride, width, (GST_ROUND_UP_2 (height) * 3) / 2); |
2718 |
+- return GST_FLOW_OK; |
2719 |
+- case GST_VIDEO_FORMAT_I420: |
2720 |
+- case GST_VIDEO_FORMAT_YV12: |
2721 |
+- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
2722 |
+- stridemove ( |
2723 |
+- strided + (int)(height*stride*1.5), |
2724 |
+- unstrided + (int)(height*width*1.5), |
2725 |
+- stride, width/2, height); /* move U/V */ |
2726 |
+- stridemove ( |
2727 |
+- strided + (height*stride), |
2728 |
+- unstrided + (height*width), |
2729 |
+- stride, width/2, height); /* move V/U */ |
2730 |
+- stridemove (strided, unstrided, stride, width, height); /* move Y */ |
2731 |
+- return GST_FLOW_OK; |
2732 |
+- case GST_VIDEO_FORMAT_YUY2: |
2733 |
+- case GST_VIDEO_FORMAT_UYVY: |
2734 |
+- g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); |
2735 |
+- stridemove (strided, unstrided, stride, width*2, height); |
2736 |
+- return GST_FLOW_OK; |
2737 |
+- default: |
2738 |
+- GST_WARNING ("unknown color format!\n"); |
2739 |
+- return GST_FLOW_ERROR; |
2740 |
+- } |
2741 |
+-} |
2742 |
+- |
2743 |
++ g_return_val_if_fail (self->conversion, FALSE); |
2744 |
++ g_return_val_if_fail (self->conversion->unstridify || !self->in_rowstride, FALSE); |
2745 |
++ g_return_val_if_fail (self->conversion->stridify || !self->out_rowstride, FALSE); |
2746 |
++ g_return_val_if_fail (self->width == width, FALSE); |
2747 |
++ g_return_val_if_fail (self->height == height, FALSE); |
2748 |
+ |
2749 |
+-/** |
2750 |
+- * Convert from a strided buffer to non-strided. The two buffer pointers could |
2751 |
+- * be pointing to the same memory block for in-place transform.. |
2752 |
+- * |
2753 |
+- * @unstrided: the pointer to the resulting unstrided buffer |
2754 |
+- * @strided: the pointer to the initial strided buffer |
2755 |
+- */ |
2756 |
+-static GstFlowReturn |
2757 |
+-unstridify (GstStrideTransform *self, guchar *unstrided, guchar *strided) |
2758 |
+-{ |
2759 |
+- gint width = self->width; |
2760 |
+- gint height = self->height; |
2761 |
+- gint stride = self->in_rowstride; |
2762 |
+- |
2763 |
+- switch (self->out_format) { |
2764 |
+- case GST_VIDEO_FORMAT_NV12: |
2765 |
+- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
2766 |
+- stridemove (unstrided, strided, width, stride, (GST_ROUND_UP_2 (height) * 3) / 2); |
2767 |
+- return GST_FLOW_OK; |
2768 |
+- case GST_VIDEO_FORMAT_I420: |
2769 |
+- case GST_VIDEO_FORMAT_YV12: |
2770 |
+- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
2771 |
+- stridemove (unstrided, strided, width, stride, height); /* move Y */ |
2772 |
+- stridemove ( |
2773 |
+- unstrided + (height*width), |
2774 |
+- strided + (height*stride), |
2775 |
+- width/2, stride, height); /* move V/U */ |
2776 |
+- stridemove ( |
2777 |
+- unstrided + (int)(height*width*1.5), |
2778 |
+- strided + (int)(height*stride*1.5), |
2779 |
+- width/2, stride, height); /* move U/V */ |
2780 |
+- return GST_FLOW_OK; |
2781 |
+- case GST_VIDEO_FORMAT_YUY2: |
2782 |
+- case GST_VIDEO_FORMAT_UYVY: |
2783 |
+- g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); |
2784 |
+- stridemove (unstrided, strided, width*2, stride, height); |
2785 |
+- return GST_FLOW_OK; |
2786 |
+- default: |
2787 |
+- GST_WARNING ("unknown color format!\n"); |
2788 |
+- return GST_FLOW_ERROR; |
2789 |
+- } |
2790 |
++ return TRUE; |
2791 |
+ } |
2792 |
+ |
2793 |
+- |
2794 |
+ static GstFlowReturn |
2795 |
+ gst_stride_transform_transform (GstBaseTransform *base, |
2796 |
+ GstBuffer *inbuf, GstBuffer *outbuf) |
2797 |
+@@ -543,10 +371,10 @@ gst_stride_transform_transform (GstBaseTransform *base, |
2798 |
+ GST_DEBUG_OBJECT (self, "not implemented"); // TODO |
2799 |
+ return GST_FLOW_ERROR; |
2800 |
+ } else if (self->in_rowstride) { |
2801 |
+- return unstridify (self, |
2802 |
++ return self->conversion->unstridify (self, |
2803 |
+ GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); |
2804 |
+ } else if (self->out_rowstride) { |
2805 |
+- return stridify (self, |
2806 |
++ return self->conversion->stridify (self, |
2807 |
+ GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); |
2808 |
+ } |
2809 |
+ |
2810 |
+@@ -555,12 +383,3 @@ gst_stride_transform_transform (GstBaseTransform *base, |
2811 |
+ |
2812 |
+ return GST_FLOW_ERROR; |
2813 |
+ } |
2814 |
+- |
2815 |
+-static GstFlowReturn |
2816 |
+-gst_stride_transform_transform_ip (GstBaseTransform *base, |
2817 |
+- GstBuffer *buf) |
2818 |
+-{ |
2819 |
+- /* transform function is safe to call with same buffer ptr: |
2820 |
+- */ |
2821 |
+- return gst_stride_transform_transform (base, buf, buf); |
2822 |
+-} |
2823 |
+diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h |
2824 |
+index 0141571..bce2526 100644 |
2825 |
+--- a/gst/stride/gststridetransform.h |
2826 |
++++ b/gst/stride/gststridetransform.h |
2827 |
+@@ -2,7 +2,7 @@ |
2828 |
+ * |
2829 |
+ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ |
2830 |
+ * |
2831 |
+- * Description: V4L2 sink element |
2832 |
++ * Description: stride transform element |
2833 |
+ * Created on: Jul 2, 2009 |
2834 |
+ * Author: Rob Clark <rob@××.com> |
2835 |
+ * |
2836 |
+@@ -29,7 +29,6 @@ |
2837 |
+ #include <gst/video/gstvideofilter.h> |
2838 |
+ #include <gst/video/video.h> |
2839 |
+ |
2840 |
+- |
2841 |
+ G_BEGIN_DECLS |
2842 |
+ |
2843 |
+ #define GST_TYPE_STRIDE_TRANSFORM \ |
2844 |
+@@ -47,6 +46,19 @@ typedef struct _GstStrideTransform GstStrideTransform; |
2845 |
+ typedef struct _GstStrideTransformClass GstStrideTransformClass; |
2846 |
+ |
2847 |
+ /** |
2848 |
++ * stride/colorspace conversion table (used internally) |
2849 |
++ */ |
2850 |
++typedef struct { |
2851 |
++ |
2852 |
++ GstVideoFormat format[2]; /* in_format, out_format */ |
2853 |
++ |
2854 |
++ GstFlowReturn (*stridify) (GstStrideTransform *self, guchar *strided, guchar *unstrided); |
2855 |
++ GstFlowReturn (*unstridify) (GstStrideTransform *self, guchar *unstrided, guchar *strided); |
2856 |
++ |
2857 |
++} Conversion; |
2858 |
++ |
2859 |
++ |
2860 |
++/** |
2861 |
+ * GstStrideTransform: |
2862 |
+ * |
2863 |
+ * Opaque datastructure. |
2864 |
+@@ -55,10 +67,10 @@ struct _GstStrideTransform { |
2865 |
+ GstVideoFilter videofilter; |
2866 |
+ |
2867 |
+ /*< private >*/ |
2868 |
+- GstVideoFormat in_format, out_format; |
2869 |
+ gint width, height; |
2870 |
+ gint in_rowstride; |
2871 |
+ gint out_rowstride; |
2872 |
++ const Conversion *conversion; |
2873 |
+ |
2874 |
+ /* for caching the tranform_size() results.. */ |
2875 |
+ GstCaps *cached_caps[2]; |
2876 |
+-- |
2877 |
+1.7.1 |
2878 |
+ |
2879 |
|
2880 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0011-add-some-neon.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0011-add-some-neon.patch |
2881 |
new file mode 100644 |
2882 |
index 0000000..6737811 |
2883 |
--- /dev/null |
2884 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0011-add-some-neon.patch |
2885 |
@@ -0,0 +1,293 @@ |
2886 |
+From 537d185b9e9b25f7dacb5e5c4dab47bb8524da34 Mon Sep 17 00:00:00 2001 |
2887 |
+From: Rob Clark <rob@××.com> |
2888 |
+Date: Thu, 8 Apr 2010 00:30:25 -0500 |
2889 |
+Subject: [PATCH 11/24] add some neon |
2890 |
+ |
2891 |
+--- |
2892 |
+ configure.ac | 1 + |
2893 |
+ gst/stride/Makefile.am | 1 + |
2894 |
+ gst/stride/armv7.s | 119 ++++++++++++++++++++++++++++++++++++++++++++++++ |
2895 |
+ gst/stride/convert.c | 76 ++++++++++++++++-------------- |
2896 |
+ 4 files changed, 162 insertions(+), 35 deletions(-) |
2897 |
+ create mode 100644 gst/stride/armv7.s |
2898 |
+ |
2899 |
+diff --git a/configure.ac b/configure.ac |
2900 |
+index af6cd52..8e7ba18 100644 |
2901 |
+--- a/configure.ac |
2902 |
++++ b/configure.ac |
2903 |
+@@ -58,6 +58,7 @@ dnl AS_LIBTOOL_TAGS |
2904 |
+ |
2905 |
+ AC_LIBTOOL_WIN32_DLL |
2906 |
+ AM_PROG_LIBTOOL |
2907 |
++AM_PROG_AS |
2908 |
+ |
2909 |
+ dnl *** required versions of GStreamer stuff *** |
2910 |
+ GST_REQ=0.10.32 |
2911 |
+diff --git a/gst/stride/Makefile.am b/gst/stride/Makefile.am |
2912 |
+index 0b61d55..3b466de 100644 |
2913 |
+--- a/gst/stride/Makefile.am |
2914 |
++++ b/gst/stride/Makefile.am |
2915 |
+@@ -3,6 +3,7 @@ plugin_LTLIBRARIES = libgststridetransform.la |
2916 |
+ libgststridetransform_la_SOURCES = \ |
2917 |
+ gststridetransform.c \ |
2918 |
+ convert.c \ |
2919 |
++ armv7.s \ |
2920 |
+ plugin.c |
2921 |
+ |
2922 |
+ libgststridetransform_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) |
2923 |
+diff --git a/gst/stride/armv7.s b/gst/stride/armv7.s |
2924 |
+new file mode 100644 |
2925 |
+index 0000000..ed636f7 |
2926 |
+--- /dev/null |
2927 |
++++ b/gst/stride/armv7.s |
2928 |
+@@ -0,0 +1,119 @@ |
2929 |
++@ GStreamer |
2930 |
++@ |
2931 |
++@ Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ |
2932 |
++@ |
2933 |
++@ Description: NEON/VFP accelerated functions for armv7 architecture |
2934 |
++@ Created on: Nov 27, 2009 |
2935 |
++@ Author: Rob Clark <rob@××.com> |
2936 |
++@ |
2937 |
++@ This library is free software; you can redistribute it and/or |
2938 |
++@ modify it under the terms of the GNU Library General Public |
2939 |
++@ License as published by the Free Software Foundation; either |
2940 |
++@ version 2 of the License, or (at your option) any later version. |
2941 |
++@ |
2942 |
++@ This library is distributed in the hope that it will be useful, |
2943 |
++@ but WITHOUT ANY WARRANTY; without even the implied warranty of |
2944 |
++@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2945 |
++@ Library General Public License for more details. |
2946 |
++@ |
2947 |
++@ You should have received a copy of the GNU Library General Public |
2948 |
++@ License along with this library; if not, write to the |
2949 |
++@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
2950 |
++@ Boston, MA 02111-1307, USA. |
2951 |
++ |
2952 |
++ .fpu neon |
2953 |
++ .text |
2954 |
++ |
2955 |
++ .align |
2956 |
++ .global stride_copy_zip2 |
2957 |
++ .type stride_copy_zip2, %function |
2958 |
++@void |
2959 |
++@stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz) |
2960 |
++@{ |
2961 |
++@@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved |
2962 |
++stride_copy_zip2: |
2963 |
++@ interleave remaining >= 16 bytes: |
2964 |
++ pld [r1, #64] |
2965 |
++ pld [r2, #64] |
2966 |
++ cmp r3, #16 |
2967 |
++ blt stride_copy_zip2_2 |
2968 |
++stride_copy_zip2_1: |
2969 |
++ vld1.8 {q8}, [r1]! |
2970 |
++ vld1.8 {q9}, [r2]! |
2971 |
++ |
2972 |
++ vzip.8 q8, q9 |
2973 |
++ |
2974 |
++ pld [r1, #64] |
2975 |
++ vst1.8 {q8,q9}, [r0]! |
2976 |
++ pld [r2, #64] |
2977 |
++ sub r3, r3, #16 |
2978 |
++ |
2979 |
++ cmp r3, #16 |
2980 |
++ bge stride_copy_zip2_1 |
2981 |
++@ interleave remaining >= 8 bytes: |
2982 |
++stride_copy_zip2_2: |
2983 |
++ cmp r3, #8 |
2984 |
++ blt stride_copy_zip2_3 |
2985 |
++ |
2986 |
++ vld1.8 {d16}, [r1]! |
2987 |
++ vld1.8 {d17}, [r2]! |
2988 |
++ |
2989 |
++ vzip.8 d16, d17 |
2990 |
++ |
2991 |
++ vst1.8 {d16,d17}, [r0]! |
2992 |
++ sub r3, r3, #8 |
2993 |
++ |
2994 |
++@ interleave remaining < 8 bytes: |
2995 |
++stride_copy_zip2_3: |
2996 |
++@XXX |
2997 |
++ bx lr |
2998 |
++@} |
2999 |
++ |
3000 |
++ .align |
3001 |
++ .global stride_copy |
3002 |
++ .type stride_copy, %function |
3003 |
++@void |
3004 |
++@stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) |
3005 |
++@{ |
3006 |
++@@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved |
3007 |
++stride_copy: |
3008 |
++@ copy remaining >= 64 bytes: |
3009 |
++ pld [r1, #64] |
3010 |
++ cmp r2, #64 |
3011 |
++ blt stride_copy_2 |
3012 |
++stride_copy_1: |
3013 |
++ vld1.8 {q8-q9}, [r1]! |
3014 |
++ sub r2, r2, #64 |
3015 |
++ vld1.8 {q10-q11},[r1]! |
3016 |
++ vst1.8 {q8-q9}, [r0]! |
3017 |
++ pld [r1, #64] |
3018 |
++ cmp r2, #64 |
3019 |
++ vst1.8 {q10-q11},[r0]! |
3020 |
++ bge stride_copy_1 |
3021 |
++@ copy remaining >= 32 bytes: |
3022 |
++stride_copy_2: |
3023 |
++ cmp r2, #32 |
3024 |
++ blt stride_copy_3 |
3025 |
++ vld1.8 {q8-q9}, [r1]! |
3026 |
++ sub r2, r2, #32 |
3027 |
++ vst1.8 {q8-q9}, [r0]! |
3028 |
++@ copy remaining >= 16 bytes: |
3029 |
++stride_copy_3: |
3030 |
++ cmp r2, #16 |
3031 |
++ blt stride_copy_4 |
3032 |
++ vld1.8 {q8}, [r1]! |
3033 |
++ sub r2, r2, #16 |
3034 |
++ vst1.8 {q8}, [r0]! |
3035 |
++@ copy remaining >= 8 bytes: |
3036 |
++stride_copy_4: |
3037 |
++ cmp r2, #8 |
3038 |
++ blt stride_copy_5 |
3039 |
++ vld1.8 {d16}, [r1]! |
3040 |
++ sub r2, r2, #8 |
3041 |
++ vst1.8 {d16}, [r0]! |
3042 |
++@ copy remaining < 8 bytes: |
3043 |
++stride_copy_5: |
3044 |
++@XXX |
3045 |
++ bx lr |
3046 |
++@} |
3047 |
++ |
3048 |
+diff --git a/gst/stride/convert.c b/gst/stride/convert.c |
3049 |
+index 860f16c..a15063b 100644 |
3050 |
+--- a/gst/stride/convert.c |
3051 |
++++ b/gst/stride/convert.c |
3052 |
+@@ -37,38 +37,43 @@ GST_DEBUG_CATEGORY_EXTERN (stridetransform_debug); |
3053 |
+ #define GST_CAT_DEFAULT stridetransform_debug |
3054 |
+ |
3055 |
+ |
3056 |
++/* note: some parts of code support in-place transform.. some do not.. I'm |
3057 |
++ * not sure if zip/interleave functions could really support in-place copy.. |
3058 |
++ * I need to think about this after having some sleep ;-) |
3059 |
++ */ |
3060 |
++ |
3061 |
++#define WEAK __attribute__((weak)) |
3062 |
++ |
3063 |
+ /* |
3064 |
+ * Conversion utilities: |
3065 |
+ */ |
3066 |
+ |
3067 |
+-static void |
3068 |
+-memmove_demux (guchar *new_buf, guchar *orig_buf, gint sz, gint pxstride) |
3069 |
++WEAK void |
3070 |
++stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz) |
3071 |
+ { |
3072 |
+- if (new_buf > orig_buf) { |
3073 |
+- /* copy backwards */ |
3074 |
+- new_buf += ((sz - 1) * pxstride); |
3075 |
+- orig_buf += sz - 1; |
3076 |
+- while(sz--) { |
3077 |
+- *new_buf = *orig_buf; |
3078 |
+- new_buf -= pxstride; |
3079 |
+- orig_buf--; |
3080 |
+- } |
3081 |
+- } else { |
3082 |
+- while(sz--) { |
3083 |
+- *new_buf = *orig_buf; |
3084 |
+- new_buf += pxstride; |
3085 |
+- orig_buf++; |
3086 |
+- } |
3087 |
++ while (sz--) { |
3088 |
++ *new_buf++ = *orig_buf1++; |
3089 |
++ *new_buf++ = *orig_buf2++; |
3090 |
+ } |
3091 |
+ } |
3092 |
+ |
3093 |
++WEAK void |
3094 |
++stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) |
3095 |
++{ |
3096 |
++ memcpy (new_buf, orig_buf, sz); |
3097 |
++} |
3098 |
++ |
3099 |
++ |
3100 |
++/** |
3101 |
++ * move to strided buffer, interleaving two planes of identical dimensions |
3102 |
++ */ |
3103 |
+ static void |
3104 |
+-stridemove_demux (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height, gint pxstride) |
3105 |
++stridemove_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint new_width, gint orig_width, gint height) |
3106 |
+ { |
3107 |
+ int row; |
3108 |
+ |
3109 |
+- GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", |
3110 |
+- new_buf, orig_buf, new_width, orig_width, height); |
3111 |
++ GST_DEBUG ("new_buf=%p, orig_buf1=%p, orig_buf2=%p, new_width=%d, orig_width=%d, height=%d", |
3112 |
++ new_buf, orig_buf1, orig_buf2, new_width, orig_width, height); |
3113 |
+ |
3114 |
+ /* if increasing the stride, work from bottom-up to avoid overwriting data |
3115 |
+ * that has not been moved yet.. otherwise, work in the opposite order, |
3116 |
+@@ -76,11 +81,19 @@ stridemove_demux (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_w |
3117 |
+ */ |
3118 |
+ if (new_width > orig_width) { |
3119 |
+ for (row=height-1; row>=0; row--) { |
3120 |
+- memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width, pxstride); |
3121 |
++ stride_copy_zip2 ( |
3122 |
++ new_buf+(new_width*row), |
3123 |
++ orig_buf1+(orig_width*row), |
3124 |
++ orig_buf2+(orig_width*row), |
3125 |
++ orig_width); |
3126 |
+ } |
3127 |
+ } else { |
3128 |
+ for (row=0; row<height; row++) { |
3129 |
+- memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width, pxstride); |
3130 |
++ stride_copy_zip2 ( |
3131 |
++ new_buf+(new_width*row), |
3132 |
++ orig_buf1+(orig_width*row), |
3133 |
++ orig_buf2+(orig_width*row), |
3134 |
++ new_width); |
3135 |
+ } |
3136 |
+ } |
3137 |
+ } |
3138 |
+@@ -106,11 +119,11 @@ stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, |
3139 |
+ */ |
3140 |
+ if (new_width > orig_width) { |
3141 |
+ for (row=height-1; row>=0; row--) { |
3142 |
+- memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); |
3143 |
++ stride_copy (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); |
3144 |
+ } |
3145 |
+ } else { |
3146 |
+ for (row=0; row<height; row++) { |
3147 |
+- memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width); |
3148 |
++ stride_copy (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width); |
3149 |
+ } |
3150 |
+ } |
3151 |
+ } |
3152 |
+@@ -234,19 +247,12 @@ stridify_i420_nv12 (GstStrideTransform *self, guchar *strided, guchar *unstrided |
3153 |
+ |
3154 |
+ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
3155 |
+ |
3156 |
+- /* note: if not an in-place conversion, then doing the U&V in one pass |
3157 |
+- * would be more efficient... but if it is an in-place conversion, I'd |
3158 |
+- * need to think about whether it is potential for the new UV plane to |
3159 |
+- * corrupt the V plane before it is done copying.. |
3160 |
+- */ |
3161 |
+- stridemove_demux ( |
3162 |
+- strided + (height*stride) + 1, |
3163 |
+- unstrided + (int)(height*width*1.25), |
3164 |
+- stride, width/2, height/2, 2); /* move V */ |
3165 |
+- stridemove_demux ( |
3166 |
++ /* XXX widths/heights/strides that are not multiple of four??: */ |
3167 |
++ stridemove_zip2 ( |
3168 |
+ strided + (height*stride), |
3169 |
+ unstrided + (height*width), |
3170 |
+- stride, width/2, height/2, 2); /* move U */ |
3171 |
++ unstrided + (int)(height*width*1.25), |
3172 |
++ stride, width/2, height/2); /* interleave U&V */ |
3173 |
+ stridemove (strided, unstrided, stride, width, height); /* move Y */ |
3174 |
+ |
3175 |
+ return GST_FLOW_OK; |
3176 |
+-- |
3177 |
+1.7.1 |
3178 |
+ |
3179 |
|
3180 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0012-add-support-to-convert-to-YUY2-YUYV-color-format.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0012-add-support-to-convert-to-YUY2-YUYV-color-format.patch |
3181 |
new file mode 100644 |
3182 |
index 0000000..1156754 |
3183 |
--- /dev/null |
3184 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0012-add-support-to-convert-to-YUY2-YUYV-color-format.patch |
3185 |
@@ -0,0 +1,197 @@ |
3186 |
+From 2f3ab39353cb9dde02ba64ab89b7c7725b25ae3b Mon Sep 17 00:00:00 2001 |
3187 |
+From: Rob Clark <rob@××.com> |
3188 |
+Date: Tue, 1 Dec 2009 22:42:43 -0600 |
3189 |
+Subject: [PATCH 12/24] add support to convert to YUY2/YUYV color format |
3190 |
+ |
3191 |
+--- |
3192 |
+ gst/stride/armv7.s | 63 ++++++++++++++++++++++++++++++++++++++++++ |
3193 |
+ gst/stride/convert.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++--- |
3194 |
+ 2 files changed, 133 insertions(+), 4 deletions(-) |
3195 |
+ |
3196 |
+diff --git a/gst/stride/armv7.s b/gst/stride/armv7.s |
3197 |
+index ed636f7..2697a14 100644 |
3198 |
+--- a/gst/stride/armv7.s |
3199 |
++++ b/gst/stride/armv7.s |
3200 |
+@@ -69,6 +69,69 @@ stride_copy_zip2_3: |
3201 |
+ bx lr |
3202 |
+ @} |
3203 |
+ |
3204 |
++ |
3205 |
++ .align |
3206 |
++ .global stride_copy_zip3a |
3207 |
++ .type stride_copy_zip3a, %function |
3208 |
++@void |
3209 |
++@stride_copy_zip3a (guchar *new_buf, |
3210 |
++@ guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, gint sz) |
3211 |
++@{ |
3212 |
++@@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved |
3213 |
++stride_copy_zip3a: |
3214 |
++ pld [r1, #64] |
3215 |
++ pld [r2, #64] |
3216 |
++ pld [r3, #64] |
3217 |
++ ldr ip, [sp] @ the sz arg |
3218 |
++@ interleave remaining >= 32 bytes: |
3219 |
++ cmp ip, #32 |
3220 |
++ blt stride_copy_zip3a_2 |
3221 |
++stride_copy_zip3a_1: |
3222 |
++ vld1.8 {q8}, [r1]! @ Y |
3223 |
++ vld1.8 {q10}, [r1]! @ Y |
3224 |
++ vld1.8 {q9}, [r2]! @ U |
3225 |
++ vld1.8 {q11}, [r3]! @ V |
3226 |
++ |
3227 |
++ pld [r1, #64] |
3228 |
++ pld [r2, #64] |
3229 |
++ pld [r3, #64] |
3230 |
++ |
3231 |
++ vzip.8 q9, q11 @ interleave U&V |
3232 |
++ vzip.8 q8, q9 @ interleave Y1UV1 |
3233 |
++ vzip.8 q10, q11 @ interleave Y2UV2 |
3234 |
++ |
3235 |
++ vst1.8 {q8,q9}, [r0]! |
3236 |
++ vst1.8 {q10,q11}, [r0]! |
3237 |
++ |
3238 |
++ sub ip, ip, #32 |
3239 |
++ |
3240 |
++ cmp ip, #32 |
3241 |
++ bge stride_copy_zip3a_1 |
3242 |
++@ interleave remaining >= 16 bytes: |
3243 |
++stride_copy_zip3a_2: |
3244 |
++ cmp ip, #16 |
3245 |
++ blt stride_copy_zip3a_3 |
3246 |
++ |
3247 |
++ vld1.8 {d16}, [r1]! @ Y |
3248 |
++ vld1.8 {d18}, [r1]! @ Y |
3249 |
++ vld1.8 {d17}, [r2]! @ U |
3250 |
++ vld1.8 {d19}, [r3]! @ V |
3251 |
++ |
3252 |
++ vzip.8 d17, d19 @ interleave U&V |
3253 |
++ vzip.8 d16, d17 @ interleave Y1UV1 |
3254 |
++ vzip.8 d18, d19 @ interleave Y2UV2 |
3255 |
++ |
3256 |
++ vst1.8 {d16,d17}, [r0]! |
3257 |
++ vst1.8 {d18,d19}, [r0]! |
3258 |
++ |
3259 |
++ sub ip, ip, #16 |
3260 |
++@ copy remaining >= 8 bytes: |
3261 |
++stride_copy_zip3a_3: |
3262 |
++@XXX |
3263 |
++ bx lr |
3264 |
++@} |
3265 |
++ |
3266 |
++ |
3267 |
+ .align |
3268 |
+ .global stride_copy |
3269 |
+ .type stride_copy, %function |
3270 |
+diff --git a/gst/stride/convert.c b/gst/stride/convert.c |
3271 |
+index a15063b..0f59e78 100644 |
3272 |
+--- a/gst/stride/convert.c |
3273 |
++++ b/gst/stride/convert.c |
3274 |
+@@ -58,6 +58,19 @@ stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz |
3275 |
+ } |
3276 |
+ |
3277 |
+ WEAK void |
3278 |
++stride_copy_zip3a (guchar *new_buf, |
3279 |
++ guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, gint sz) |
3280 |
++{ |
3281 |
++ while (sz > 1) { |
3282 |
++ *new_buf++ = *orig_buf1++; |
3283 |
++ *new_buf++ = *orig_buf2++; |
3284 |
++ *new_buf++ = *orig_buf1++; |
3285 |
++ *new_buf++ = *orig_buf3++; |
3286 |
++ sz -= 2; |
3287 |
++ } |
3288 |
++} |
3289 |
++ |
3290 |
++WEAK void |
3291 |
+ stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) |
3292 |
+ { |
3293 |
+ memcpy (new_buf, orig_buf, sz); |
3294 |
+@@ -99,6 +112,36 @@ stridemove_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint new |
3295 |
+ } |
3296 |
+ |
3297 |
+ /** |
3298 |
++ * move to strided buffer, interleaving three planes, where the first plane |
3299 |
++ * (orig_buf1) has 2x as many samples.. Ie. ABACABAC.. |
3300 |
++ */ |
3301 |
++static void |
3302 |
++stridemove_zip3a (guchar *new_buf, |
3303 |
++ guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, |
3304 |
++ guint new_width, gint orig_width, gint height) |
3305 |
++{ |
3306 |
++ gint copy_width = (new_width < orig_width) ? new_width : orig_width; |
3307 |
++ |
3308 |
++ while (height > 0) { |
3309 |
++ |
3310 |
++ /* even row */ |
3311 |
++ stride_copy_zip3a (new_buf, orig_buf1, orig_buf2, orig_buf3, copy_width); |
3312 |
++ new_buf += new_width; |
3313 |
++ orig_buf1 += orig_width; |
3314 |
++ |
3315 |
++ /* odd row, recycles same U & V */ |
3316 |
++ stride_copy_zip3a (new_buf, orig_buf1, orig_buf2, orig_buf3, copy_width); |
3317 |
++ new_buf += new_width; |
3318 |
++ orig_buf1 += orig_width; |
3319 |
++ |
3320 |
++ orig_buf2 += orig_width/2; |
3321 |
++ orig_buf3 += orig_width/2; |
3322 |
++ |
3323 |
++ height -= 2; |
3324 |
++ } |
3325 |
++} |
3326 |
++ |
3327 |
++/** |
3328 |
+ * Convert from one stride to another... like memmove, but can convert stride in |
3329 |
+ * the process. This function is not aware of pixels, only of bytes. So widths |
3330 |
+ * are given in bytes, not pixels. The new_buf and orig_buf can point to the |
3331 |
+@@ -250,14 +293,36 @@ stridify_i420_nv12 (GstStrideTransform *self, guchar *strided, guchar *unstrided |
3332 |
+ /* XXX widths/heights/strides that are not multiple of four??: */ |
3333 |
+ stridemove_zip2 ( |
3334 |
+ strided + (height*stride), |
3335 |
+- unstrided + (height*width), |
3336 |
+- unstrided + (int)(height*width*1.25), |
3337 |
+- stride, width/2, height/2); /* interleave U&V */ |
3338 |
+- stridemove (strided, unstrided, stride, width, height); /* move Y */ |
3339 |
++ unstrided + (height*width), /* U */ |
3340 |
++ unstrided + (int)(height*width*1.25), /* V */ |
3341 |
++ stride, width/2, height/2); |
3342 |
++ stridemove (strided, unstrided, stride, width, height); /* Y */ |
3343 |
++ |
3344 |
++ return GST_FLOW_OK; |
3345 |
++} |
3346 |
++ |
3347 |
++/** convert I420 unstrided to YUY2 strided */ |
3348 |
++static GstFlowReturn |
3349 |
++stridify_i420_yuy2 (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
3350 |
++{ |
3351 |
++ gint width = self->width; |
3352 |
++ gint height = self->height; |
3353 |
++ gint stride = self->out_rowstride; |
3354 |
++ |
3355 |
++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
3356 |
++ |
3357 |
++ /* XXX widths/heights/strides that are not multiple of four??: */ |
3358 |
++ stridemove_zip3a ( |
3359 |
++ strided, |
3360 |
++ unstrided, /* Y */ |
3361 |
++ unstrided + (height*width), /* U */ |
3362 |
++ unstrided + (int)(height*width*1.25), /* V */ |
3363 |
++ stride, width, height); |
3364 |
+ |
3365 |
+ return GST_FLOW_OK; |
3366 |
+ } |
3367 |
+ |
3368 |
++ |
3369 |
+ /* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ |
3370 |
+ Conversion stride_conversions[] = { |
3371 |
+ { { GST_VIDEO_FORMAT_NV12, GST_VIDEO_FORMAT_NV12 }, stridify_420sp_420sp, unstridify_420sp_420sp }, |
3372 |
+@@ -266,6 +331,7 @@ Conversion stride_conversions[] = { |
3373 |
+ { { GST_VIDEO_FORMAT_YUY2, GST_VIDEO_FORMAT_YUY2 }, stridify_422i_422i, unstridify_422i_422i }, |
3374 |
+ { { GST_VIDEO_FORMAT_UYVY, GST_VIDEO_FORMAT_UYVY }, stridify_422i_422i, unstridify_422i_422i }, |
3375 |
+ { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_NV12 }, stridify_i420_nv12, NULL }, |
3376 |
++ { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_YUY2 }, stridify_i420_yuy2, NULL }, |
3377 |
+ /* add new entries before here */ |
3378 |
+ { { GST_VIDEO_FORMAT_UNKNOWN } } |
3379 |
+ }; |
3380 |
+-- |
3381 |
+1.7.1 |
3382 |
+ |
3383 |
|
3384 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0013-Add-support-for-RGB565-to-stridetransform.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0013-Add-support-for-RGB565-to-stridetransform.patch |
3385 |
new file mode 100644 |
3386 |
index 0000000..d07c1b9 |
3387 |
--- /dev/null |
3388 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0013-Add-support-for-RGB565-to-stridetransform.patch |
3389 |
@@ -0,0 +1,336 @@ |
3390 |
+From 28a5ad7c5ccfa98ffa7bb1425dc38ab16535fc26 Mon Sep 17 00:00:00 2001 |
3391 |
+From: Castaneda Sheissa, Roberto <rsheissa@××.com> |
3392 |
+Date: Sun, 3 Jan 2010 13:40:30 -0600 |
3393 |
+Subject: [PATCH 13/24] Add support for RGB565 to stridetransform |
3394 |
+ |
3395 |
+--- |
3396 |
+ gst/stride/convert.c | 30 ++++++++++ |
3397 |
+ gst/stride/gststridetransform.c | 120 ++++++++++++++++++++------------------ |
3398 |
+ 2 files changed, 93 insertions(+), 57 deletions(-) |
3399 |
+ |
3400 |
+diff --git a/gst/stride/convert.c b/gst/stride/convert.c |
3401 |
+index 0f59e78..fdb02ae 100644 |
3402 |
+--- a/gst/stride/convert.c |
3403 |
++++ b/gst/stride/convert.c |
3404 |
+@@ -322,6 +322,35 @@ stridify_i420_yuy2 (GstStrideTransform *self, guchar *strided, guchar *unstrided |
3405 |
+ return GST_FLOW_OK; |
3406 |
+ } |
3407 |
+ |
3408 |
++/** convert RGB565 to RGB565 strided **/ |
3409 |
++static GstFlowReturn |
3410 |
++stridify_rgb565_rgb565 (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
3411 |
++{ |
3412 |
++ gint width = self->width; |
3413 |
++ gint height = self->height; |
3414 |
++ gint stride = self->out_rowstride; |
3415 |
++ |
3416 |
++ g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); |
3417 |
++ |
3418 |
++ stridemove (strided, unstrided, stride, width*2, height); |
3419 |
++ |
3420 |
++ return GST_FLOW_OK; |
3421 |
++} |
3422 |
++ |
3423 |
++/** convert RGB565 strided to RGB565 **/ |
3424 |
++static GstFlowReturn |
3425 |
++unstridify_rgb565_rgb565 (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
3426 |
++{ |
3427 |
++ gint width = self->width; |
3428 |
++ gint height = self->height; |
3429 |
++ gint stride = self->in_rowstride; |
3430 |
++ |
3431 |
++ g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); |
3432 |
++ |
3433 |
++ stridemove (unstrided, strided, width*2, stride, height); |
3434 |
++ return GST_FLOW_OK; |
3435 |
++} |
3436 |
++ |
3437 |
+ |
3438 |
+ /* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ |
3439 |
+ Conversion stride_conversions[] = { |
3440 |
+@@ -332,6 +361,7 @@ Conversion stride_conversions[] = { |
3441 |
+ { { GST_VIDEO_FORMAT_UYVY, GST_VIDEO_FORMAT_UYVY }, stridify_422i_422i, unstridify_422i_422i }, |
3442 |
+ { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_NV12 }, stridify_i420_nv12, NULL }, |
3443 |
+ { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_YUY2 }, stridify_i420_yuy2, NULL }, |
3444 |
++ { { GST_VIDEO_FORMAT_RGB16, GST_VIDEO_FORMAT_RGB16 }, stridify_rgb565_rgb565, unstridify_rgb565_rgb565 }, |
3445 |
+ /* add new entries before here */ |
3446 |
+ { { GST_VIDEO_FORMAT_UNKNOWN } } |
3447 |
+ }; |
3448 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
3449 |
+index 6ab0479..c35be73 100644 |
3450 |
+--- a/gst/stride/gststridetransform.c |
3451 |
++++ b/gst/stride/gststridetransform.c |
3452 |
+@@ -66,46 +66,47 @@ GST_ELEMENT_DETAILS ("Stride transform", |
3453 |
+ |
3454 |
+ |
3455 |
+ /* TODO: add rgb formats too! */ |
3456 |
+-#define SUPPORTED_CAPS \ |
3457 |
+- GST_VIDEO_CAPS_YUV_STRIDED ("{ I420, YV12, YUY2, UYVY, NV12 }", "[ 0, max ]") |
3458 |
++#define YUV_SUPPORTED_CAPS \ |
3459 |
++ GST_VIDEO_CAPS_YUV_STRIDED ("{I420, YV12, YUY2, UYVY, NV12 }", "[ 0, max ]") |
3460 |
+ |
3461 |
++#define RGB_SUPPORTED_CAPS \ |
3462 |
++ GST_VIDEO_CAPS_RGB_16_STRIDED ("[ 0, max ]") |
3463 |
+ |
3464 |
+-static GstStaticPadTemplate src_template = |
3465 |
+-GST_STATIC_PAD_TEMPLATE ("src", |
3466 |
++ |
3467 |
++static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", |
3468 |
+ GST_PAD_SRC, |
3469 |
+ GST_PAD_ALWAYS, |
3470 |
+- GST_STATIC_CAPS (SUPPORTED_CAPS) |
3471 |
+-); |
3472 |
++ GST_STATIC_CAPS (YUV_SUPPORTED_CAPS ";" RGB_SUPPORTED_CAPS) |
3473 |
++ ); |
3474 |
+ |
3475 |
+-static GstStaticPadTemplate sink_template = |
3476 |
+-GST_STATIC_PAD_TEMPLATE ("sink", |
3477 |
++static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", |
3478 |
+ GST_PAD_SINK, |
3479 |
+ GST_PAD_ALWAYS, |
3480 |
+- GST_STATIC_CAPS (SUPPORTED_CAPS) |
3481 |
+-); |
3482 |
++ GST_STATIC_CAPS (YUV_SUPPORTED_CAPS ";" RGB_SUPPORTED_CAPS) |
3483 |
++ ); |
3484 |
+ |
3485 |
+ |
3486 |
+ GST_DEBUG_CATEGORY (stridetransform_debug); |
3487 |
+ #define GST_CAT_DEFAULT stridetransform_debug |
3488 |
+ |
3489 |
+ /* type functions */ |
3490 |
+-static void gst_stride_transform_dispose (GObject *obj); |
3491 |
++static void gst_stride_transform_dispose (GObject * obj); |
3492 |
+ |
3493 |
+ /* GstBaseTransform functions */ |
3494 |
+-static gboolean gst_stride_transform_get_unit_size (GstBaseTransform *base, |
3495 |
+- GstCaps *caps, guint *size); |
3496 |
+-static gboolean gst_stride_transform_transform_size (GstBaseTransform *base, |
3497 |
++static gboolean gst_stride_transform_get_unit_size (GstBaseTransform * base, |
3498 |
++ GstCaps * caps, guint * size); |
3499 |
++static gboolean gst_stride_transform_transform_size (GstBaseTransform * base, |
3500 |
+ GstPadDirection direction, |
3501 |
+- GstCaps *caps, guint size, |
3502 |
+- GstCaps *othercaps, guint *othersize); |
3503 |
+-static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform *base, |
3504 |
+- GstPadDirection direction, GstCaps *caps); |
3505 |
+-static gboolean gst_stride_transform_set_caps (GstBaseTransform *base, |
3506 |
+- GstCaps *incaps, GstCaps *outcaps); |
3507 |
+-static GstFlowReturn gst_stride_transform_transform (GstBaseTransform *base, |
3508 |
+- GstBuffer *inbuf, GstBuffer *outbuf); |
3509 |
++ GstCaps * caps, guint size, GstCaps * othercaps, guint * othersize); |
3510 |
++static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform * base, |
3511 |
++ GstPadDirection direction, GstCaps * caps); |
3512 |
++static gboolean gst_stride_transform_set_caps (GstBaseTransform * base, |
3513 |
++ GstCaps * incaps, GstCaps * outcaps); |
3514 |
++static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, |
3515 |
++ GstBuffer * inbuf, GstBuffer * outbuf); |
3516 |
+ |
3517 |
+-GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, GST_TYPE_VIDEO_FILTER); |
3518 |
++GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, |
3519 |
++ GST_TYPE_VIDEO_FILTER); |
3520 |
+ |
3521 |
+ |
3522 |
+ static void |
3523 |
+@@ -113,7 +114,8 @@ gst_stride_transform_base_init (gpointer g_class) |
3524 |
+ { |
3525 |
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); |
3526 |
+ |
3527 |
+- GST_DEBUG_CATEGORY_INIT (stridetransform_debug, "stride", 0, "stride transform element"); |
3528 |
++ GST_DEBUG_CATEGORY_INIT (stridetransform_debug, "stride", 0, |
3529 |
++ "stride transform element"); |
3530 |
+ |
3531 |
+ gst_element_class_set_details (gstelement_class, &stridetransform_details); |
3532 |
+ |
3533 |
+@@ -124,7 +126,7 @@ gst_stride_transform_base_init (gpointer g_class) |
3534 |
+ } |
3535 |
+ |
3536 |
+ static void |
3537 |
+-gst_stride_transform_class_init (GstStrideTransformClass *klass) |
3538 |
++gst_stride_transform_class_init (GstStrideTransformClass * klass) |
3539 |
+ { |
3540 |
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
3541 |
+ GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass); |
3542 |
+@@ -146,14 +148,15 @@ gst_stride_transform_class_init (GstStrideTransformClass *klass) |
3543 |
+ } |
3544 |
+ |
3545 |
+ static void |
3546 |
+-gst_stride_transform_init (GstStrideTransform *self, GstStrideTransformClass *klass) |
3547 |
++gst_stride_transform_init (GstStrideTransform * self, |
3548 |
++ GstStrideTransformClass * klass) |
3549 |
+ { |
3550 |
+ GST_DEBUG_OBJECT (self, "not implemented"); |
3551 |
+ } |
3552 |
+ |
3553 |
+ |
3554 |
+ static void |
3555 |
+-gst_stride_transform_dispose (GObject *object) |
3556 |
++gst_stride_transform_dispose (GObject * object) |
3557 |
+ { |
3558 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (object); |
3559 |
+ GST_DEBUG_OBJECT (self, "not implemented"); |
3560 |
+@@ -164,15 +167,15 @@ gst_stride_transform_dispose (GObject *object) |
3561 |
+ * figure out the required buffer size based on @caps |
3562 |
+ */ |
3563 |
+ static gboolean |
3564 |
+-gst_stride_transform_get_unit_size (GstBaseTransform *base, |
3565 |
+- GstCaps *caps, guint *size) |
3566 |
++gst_stride_transform_get_unit_size (GstBaseTransform * base, |
3567 |
++ GstCaps * caps, guint * size) |
3568 |
+ { |
3569 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
3570 |
+ GstVideoFormat format; |
3571 |
+ gint width, height, rowstride; |
3572 |
+ |
3573 |
+- g_return_val_if_fail (gst_video_format_parse_caps_strided ( |
3574 |
+- caps, &format, &width, &height, &rowstride), FALSE); |
3575 |
++ g_return_val_if_fail (gst_video_format_parse_caps_strided (caps, &format, |
3576 |
++ &width, &height, &rowstride), FALSE); |
3577 |
+ |
3578 |
+ *size = gst_video_format_get_size_strided (format, width, height, rowstride); |
3579 |
+ |
3580 |
+@@ -188,16 +191,14 @@ gst_stride_transform_get_unit_size (GstBaseTransform *base, |
3581 |
+ * buffer size is a multiple of the unit size.. which doesn't hold true. |
3582 |
+ */ |
3583 |
+ static gboolean |
3584 |
+-gst_stride_transform_transform_size (GstBaseTransform *base, |
3585 |
++gst_stride_transform_transform_size (GstBaseTransform * base, |
3586 |
+ GstPadDirection direction, |
3587 |
+- GstCaps *caps, guint size, |
3588 |
+- GstCaps *othercaps, guint *othersize) |
3589 |
++ GstCaps * caps, guint size, GstCaps * othercaps, guint * othersize) |
3590 |
+ { |
3591 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
3592 |
+ guint idx = (direction == GST_PAD_SINK) ? 0 : 1; |
3593 |
+ |
3594 |
+- if (self->cached_caps[idx] != othercaps) |
3595 |
+- { |
3596 |
++ if (self->cached_caps[idx] != othercaps) { |
3597 |
+ guint sz; |
3598 |
+ if (!gst_stride_transform_get_unit_size (base, othercaps, &sz)) { |
3599 |
+ return FALSE; |
3600 |
+@@ -220,13 +221,15 @@ gst_stride_transform_transform_size (GstBaseTransform *base, |
3601 |
+ * helper to add all fields, other than rowstride to @caps, copied from @s. |
3602 |
+ */ |
3603 |
+ static void |
3604 |
+-add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rowstride, GstPadDirection direction) |
3605 |
++add_all_fields (GstCaps * caps, const gchar * name, GstStructure * s, |
3606 |
++ gboolean rowstride, GstPadDirection direction) |
3607 |
+ { |
3608 |
+ gint idx; |
3609 |
+ GstStructure *new_s = gst_structure_new (name, NULL); |
3610 |
+ |
3611 |
+ if (rowstride) { |
3612 |
+- gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); |
3613 |
++ gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, G_MAXINT, |
3614 |
++ NULL); |
3615 |
+ } |
3616 |
+ |
3617 |
+ idx = gst_structure_n_fields (s) - 1; |
3618 |
+@@ -245,15 +248,16 @@ add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rows |
3619 |
+ gint from_format = (direction == GST_PAD_SRC) ? 1 : 0; |
3620 |
+ |
3621 |
+ if (gst_structure_get_fourcc (s, "format", &fourcc)) { |
3622 |
+- GValue formats = {0}; |
3623 |
+- GValue fourccval = {0}; |
3624 |
++ GValue formats = { 0 }; |
3625 |
++ GValue fourccval = { 0 }; |
3626 |
+ gint i; |
3627 |
+ GstVideoFormat format = gst_video_format_from_fourcc (fourcc); |
3628 |
+ |
3629 |
+ g_value_init (&formats, GST_TYPE_LIST); |
3630 |
+ g_value_init (&fourccval, GST_TYPE_FOURCC); |
3631 |
+ |
3632 |
+- for (i=0; stride_conversions[i].format[0]!=GST_VIDEO_FORMAT_UNKNOWN; i++) { |
3633 |
++ for (i = 0; stride_conversions[i].format[0] != GST_VIDEO_FORMAT_UNKNOWN; |
3634 |
++ i++) { |
3635 |
+ if (stride_conversions[i].format[from_format] == format) { |
3636 |
+ gst_value_set_fourcc (&fourccval, gst_video_format_to_fourcc |
3637 |
+ (stride_conversions[i].format[to_format])); |
3638 |
+@@ -281,8 +285,8 @@ add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rows |
3639 |
+ * identical parameters |
3640 |
+ */ |
3641 |
+ static GstCaps * |
3642 |
+-gst_stride_transform_transform_caps (GstBaseTransform *base, |
3643 |
+- GstPadDirection direction, GstCaps *caps) |
3644 |
++gst_stride_transform_transform_caps (GstBaseTransform * base, |
3645 |
++ GstPadDirection direction, GstCaps * caps) |
3646 |
+ { |
3647 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
3648 |
+ GstCaps *ret; |
3649 |
+@@ -321,8 +325,8 @@ gst_stride_transform_transform_caps (GstBaseTransform *base, |
3650 |
+ * plus the requested rowstride of the @incaps and @outcaps |
3651 |
+ */ |
3652 |
+ static gboolean |
3653 |
+-gst_stride_transform_set_caps (GstBaseTransform *base, |
3654 |
+- GstCaps *incaps, GstCaps *outcaps) |
3655 |
++gst_stride_transform_set_caps (GstBaseTransform * base, |
3656 |
++ GstCaps * incaps, GstCaps * outcaps) |
3657 |
+ { |
3658 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
3659 |
+ gint width, height; |
3660 |
+@@ -333,13 +337,13 @@ gst_stride_transform_set_caps (GstBaseTransform *base, |
3661 |
+ LOG_CAPS (self, outcaps); |
3662 |
+ |
3663 |
+ g_return_val_if_fail (gst_video_format_parse_caps_strided (incaps, |
3664 |
+- &in_format, &self->width, &self->height, &self->in_rowstride), FALSE); |
3665 |
++ &in_format, &self->width, &self->height, &self->in_rowstride), FALSE); |
3666 |
+ g_return_val_if_fail (gst_video_format_parse_caps_strided (outcaps, |
3667 |
+- &out_format, &width, &height, &self->out_rowstride), FALSE); |
3668 |
++ &out_format, &width, &height, &self->out_rowstride), FALSE); |
3669 |
+ |
3670 |
+ self->conversion = NULL; |
3671 |
+ |
3672 |
+- for (i=0; stride_conversions[i].format[0]!=GST_VIDEO_FORMAT_UNKNOWN; i++) { |
3673 |
++ for (i = 0; stride_conversions[i].format[0] != GST_VIDEO_FORMAT_UNKNOWN; i++) { |
3674 |
+ if ((stride_conversions[i].format[0] == in_format) && |
3675 |
+ (stride_conversions[i].format[1] == out_format)) { |
3676 |
+ GST_DEBUG_OBJECT (self, "found stride_conversion: %d", i); |
3677 |
+@@ -349,26 +353,27 @@ gst_stride_transform_set_caps (GstBaseTransform *base, |
3678 |
+ } |
3679 |
+ |
3680 |
+ g_return_val_if_fail (self->conversion, FALSE); |
3681 |
+- g_return_val_if_fail (self->conversion->unstridify || !self->in_rowstride, FALSE); |
3682 |
+- g_return_val_if_fail (self->conversion->stridify || !self->out_rowstride, FALSE); |
3683 |
+- g_return_val_if_fail (self->width == width, FALSE); |
3684 |
++ g_return_val_if_fail (self->conversion->unstridify |
3685 |
++ || !self->in_rowstride, FALSE); |
3686 |
++ g_return_val_if_fail (self->conversion->stridify |
3687 |
++ || !self->out_rowstride, FALSE); |
3688 |
++ g_return_val_if_fail (self->width == width, FALSE); |
3689 |
+ g_return_val_if_fail (self->height == height, FALSE); |
3690 |
+ |
3691 |
+ return TRUE; |
3692 |
+ } |
3693 |
+ |
3694 |
+ static GstFlowReturn |
3695 |
+-gst_stride_transform_transform (GstBaseTransform *base, |
3696 |
+- GstBuffer *inbuf, GstBuffer *outbuf) |
3697 |
++gst_stride_transform_transform (GstBaseTransform * base, |
3698 |
++ GstBuffer * inbuf, GstBuffer * outbuf) |
3699 |
+ { |
3700 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
3701 |
+ |
3702 |
+ GST_DEBUG_OBJECT (self, "inbuf=%p (size=%d), outbuf=%p (size=%d)", |
3703 |
+- inbuf, GST_BUFFER_SIZE (inbuf), |
3704 |
+- outbuf, GST_BUFFER_SIZE (outbuf)); |
3705 |
++ inbuf, GST_BUFFER_SIZE (inbuf), outbuf, GST_BUFFER_SIZE (outbuf)); |
3706 |
+ |
3707 |
+ if (self->in_rowstride && self->out_rowstride) { |
3708 |
+- GST_DEBUG_OBJECT (self, "not implemented"); // TODO |
3709 |
++ GST_DEBUG_OBJECT (self, "not implemented"); // TODO |
3710 |
+ return GST_FLOW_ERROR; |
3711 |
+ } else if (self->in_rowstride) { |
3712 |
+ return self->conversion->unstridify (self, |
3713 |
+@@ -378,7 +383,8 @@ gst_stride_transform_transform (GstBaseTransform *base, |
3714 |
+ GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); |
3715 |
+ } |
3716 |
+ |
3717 |
+- GST_DEBUG_OBJECT (self, "this shouldn't happen! in_rowstride=%d, out_rowstride=%d", |
3718 |
++ GST_DEBUG_OBJECT (self, |
3719 |
++ "this shouldn't happen! in_rowstride=%d, out_rowstride=%d", |
3720 |
+ self->in_rowstride, self->out_rowstride); |
3721 |
+ |
3722 |
+ return GST_FLOW_ERROR; |
3723 |
+-- |
3724 |
+1.7.1 |
3725 |
+ |
3726 |
|
3727 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0014-stridetransform-updates-for-new-extra-anal-compiler-.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0014-stridetransform-updates-for-new-extra-anal-compiler-.patch |
3728 |
new file mode 100644 |
3729 |
index 0000000..4e60f32 |
3730 |
--- /dev/null |
3731 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0014-stridetransform-updates-for-new-extra-anal-compiler-.patch |
3732 |
@@ -0,0 +1,61 @@ |
3733 |
+From e97373aac252f312c5ac69305228db50886a7c5c Mon Sep 17 00:00:00 2001 |
3734 |
+From: Rob Clark <rob@××.com> |
3735 |
+Date: Thu, 8 Apr 2010 03:30:35 -0500 |
3736 |
+Subject: [PATCH 14/24] stridetransform: updates for new extra-anal compiler warning flags |
3737 |
+ |
3738 |
+--- |
3739 |
+ gst/stride/convert.c | 6 ++++++ |
3740 |
+ gst/stride/gststridetransform.c | 13 ++++--------- |
3741 |
+ 2 files changed, 10 insertions(+), 9 deletions(-) |
3742 |
+ |
3743 |
+diff --git a/gst/stride/convert.c b/gst/stride/convert.c |
3744 |
+index fdb02ae..ad9c0aa 100644 |
3745 |
+--- a/gst/stride/convert.c |
3746 |
++++ b/gst/stride/convert.c |
3747 |
+@@ -48,6 +48,12 @@ GST_DEBUG_CATEGORY_EXTERN (stridetransform_debug); |
3748 |
+ * Conversion utilities: |
3749 |
+ */ |
3750 |
+ |
3751 |
++void stride_copy_zip2 (guchar * new_buf, guchar * orig_buf1, |
3752 |
++ guchar * orig_buf2, gint sz); |
3753 |
++void stride_copy_zip3a (guchar * new_buf, guchar * orig_buf1, |
3754 |
++ guchar * orig_buf2, guchar * orig_buf3, gint sz); |
3755 |
++void stride_copy (guchar * new_buf, guchar * orig_buf, gint sz); |
3756 |
++ |
3757 |
+ WEAK void |
3758 |
+ stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz) |
3759 |
+ { |
3760 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
3761 |
+index c35be73..de07c11 100644 |
3762 |
+--- a/gst/stride/gststridetransform.c |
3763 |
++++ b/gst/stride/gststridetransform.c |
3764 |
+@@ -57,14 +57,6 @@ |
3765 |
+ /* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ |
3766 |
+ extern const Conversion stride_conversions[]; |
3767 |
+ |
3768 |
+- |
3769 |
+-static const GstElementDetails stridetransform_details = |
3770 |
+-GST_ELEMENT_DETAILS ("Stride transform", |
3771 |
+- "Filter/Converter/Video", |
3772 |
+- "Convert between video buffers with and without stride, or with differing stride", |
3773 |
+- "Rob Clark <rob@××.com>,"); |
3774 |
+- |
3775 |
+- |
3776 |
+ /* TODO: add rgb formats too! */ |
3777 |
+ #define YUV_SUPPORTED_CAPS \ |
3778 |
+ GST_VIDEO_CAPS_YUV_STRIDED ("{I420, YV12, YUY2, UYVY, NV12 }", "[ 0, max ]") |
3779 |
+@@ -117,7 +109,10 @@ gst_stride_transform_base_init (gpointer g_class) |
3780 |
+ GST_DEBUG_CATEGORY_INIT (stridetransform_debug, "stride", 0, |
3781 |
+ "stride transform element"); |
3782 |
+ |
3783 |
+- gst_element_class_set_details (gstelement_class, &stridetransform_details); |
3784 |
++ gst_element_class_set_details_simple (gstelement_class, |
3785 |
++ "Stride transform", "Filter/Converter/Video", |
3786 |
++ "Convert between video buffers with and without stride, or with differing stride", |
3787 |
++ "Rob Clark <rob@××.com>,"); |
3788 |
+ |
3789 |
+ gst_element_class_add_pad_template (gstelement_class, |
3790 |
+ gst_static_pad_template_get (&sink_template)); |
3791 |
+-- |
3792 |
+1.7.1 |
3793 |
+ |
3794 |
|
3795 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0015-stridetransform-fix-problem-transforming-caps-with-l.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0015-stridetransform-fix-problem-transforming-caps-with-l.patch |
3796 |
new file mode 100644 |
3797 |
index 0000000..0d757d9 |
3798 |
--- /dev/null |
3799 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0015-stridetransform-fix-problem-transforming-caps-with-l.patch |
3800 |
@@ -0,0 +1,544 @@ |
3801 |
+From c8db3522e32ca6afbbd117b816068516eed8c594 Mon Sep 17 00:00:00 2001 |
3802 |
+From: Rob Clark <rob@××.com> |
3803 |
+Date: Sat, 30 Jan 2010 14:32:42 -0600 |
3804 |
+Subject: [PATCH 15/24] stridetransform: fix problem transforming caps with list of fourcc's |
3805 |
+ |
3806 |
+previous logic assumed that the format field would contain just a single fourcc |
3807 |
+--- |
3808 |
+ gst/stride/convert.c | 206 ++++++++++++++++++++------------------- |
3809 |
+ gst/stride/gststridetransform.c | 78 +++++++++++----- |
3810 |
+ 2 files changed, 159 insertions(+), 125 deletions(-) |
3811 |
+ |
3812 |
+diff --git a/gst/stride/convert.c b/gst/stride/convert.c |
3813 |
+index ad9c0aa..17f9e2a 100644 |
3814 |
+--- a/gst/stride/convert.c |
3815 |
++++ b/gst/stride/convert.c |
3816 |
+@@ -55,7 +55,8 @@ void stride_copy_zip3a (guchar * new_buf, guchar * orig_buf1, |
3817 |
+ void stride_copy (guchar * new_buf, guchar * orig_buf, gint sz); |
3818 |
+ |
3819 |
+ WEAK void |
3820 |
+-stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz) |
3821 |
++stride_copy_zip2 (guchar * new_buf, guchar * orig_buf1, guchar * orig_buf2, |
3822 |
++ gint sz) |
3823 |
+ { |
3824 |
+ while (sz--) { |
3825 |
+ *new_buf++ = *orig_buf1++; |
3826 |
+@@ -64,8 +65,8 @@ stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz |
3827 |
+ } |
3828 |
+ |
3829 |
+ WEAK void |
3830 |
+-stride_copy_zip3a (guchar *new_buf, |
3831 |
+- guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, gint sz) |
3832 |
++stride_copy_zip3a (guchar * new_buf, |
3833 |
++ guchar * orig_buf1, guchar * orig_buf2, guchar * orig_buf3, gint sz) |
3834 |
+ { |
3835 |
+ while (sz > 1) { |
3836 |
+ *new_buf++ = *orig_buf1++; |
3837 |
+@@ -77,7 +78,7 @@ stride_copy_zip3a (guchar *new_buf, |
3838 |
+ } |
3839 |
+ |
3840 |
+ WEAK void |
3841 |
+-stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) |
3842 |
++stride_copy (guchar * new_buf, guchar * orig_buf, gint sz) |
3843 |
+ { |
3844 |
+ memcpy (new_buf, orig_buf, sz); |
3845 |
+ } |
3846 |
+@@ -87,11 +88,13 @@ stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) |
3847 |
+ * move to strided buffer, interleaving two planes of identical dimensions |
3848 |
+ */ |
3849 |
+ static void |
3850 |
+-stridemove_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint new_width, gint orig_width, gint height) |
3851 |
++stridemove_zip2 (guchar * new_buf, guchar * orig_buf1, guchar * orig_buf2, |
3852 |
++ gint new_width, gint orig_width, gint height) |
3853 |
+ { |
3854 |
+ int row; |
3855 |
+ |
3856 |
+- GST_DEBUG ("new_buf=%p, orig_buf1=%p, orig_buf2=%p, new_width=%d, orig_width=%d, height=%d", |
3857 |
++ GST_DEBUG |
3858 |
++ ("new_buf=%p, orig_buf1=%p, orig_buf2=%p, new_width=%d, orig_width=%d, height=%d", |
3859 |
+ new_buf, orig_buf1, orig_buf2, new_width, orig_width, height); |
3860 |
+ |
3861 |
+ /* if increasing the stride, work from bottom-up to avoid overwriting data |
3862 |
+@@ -99,20 +102,16 @@ stridemove_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint new |
3863 |
+ * for the same reason. |
3864 |
+ */ |
3865 |
+ if (new_width > orig_width) { |
3866 |
+- for (row=height-1; row>=0; row--) { |
3867 |
+- stride_copy_zip2 ( |
3868 |
+- new_buf+(new_width*row), |
3869 |
+- orig_buf1+(orig_width*row), |
3870 |
+- orig_buf2+(orig_width*row), |
3871 |
+- orig_width); |
3872 |
++ for (row = height - 1; row >= 0; row--) { |
3873 |
++ stride_copy_zip2 (new_buf + (new_width * row), |
3874 |
++ orig_buf1 + (orig_width * row), |
3875 |
++ orig_buf2 + (orig_width * row), orig_width); |
3876 |
+ } |
3877 |
+ } else { |
3878 |
+- for (row=0; row<height; row++) { |
3879 |
+- stride_copy_zip2 ( |
3880 |
+- new_buf+(new_width*row), |
3881 |
+- orig_buf1+(orig_width*row), |
3882 |
+- orig_buf2+(orig_width*row), |
3883 |
+- new_width); |
3884 |
++ for (row = 0; row < height; row++) { |
3885 |
++ stride_copy_zip2 (new_buf + (new_width * row), |
3886 |
++ orig_buf1 + (orig_width * row), |
3887 |
++ orig_buf2 + (orig_width * row), new_width); |
3888 |
+ } |
3889 |
+ } |
3890 |
+ } |
3891 |
+@@ -122,8 +121,8 @@ stridemove_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint new |
3892 |
+ * (orig_buf1) has 2x as many samples.. Ie. ABACABAC.. |
3893 |
+ */ |
3894 |
+ static void |
3895 |
+-stridemove_zip3a (guchar *new_buf, |
3896 |
+- guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, |
3897 |
++stridemove_zip3a (guchar * new_buf, |
3898 |
++ guchar * orig_buf1, guchar * orig_buf2, guchar * orig_buf3, |
3899 |
+ guint new_width, gint orig_width, gint height) |
3900 |
+ { |
3901 |
+ gint copy_width = (new_width < orig_width) ? new_width : orig_width; |
3902 |
+@@ -140,8 +139,8 @@ stridemove_zip3a (guchar *new_buf, |
3903 |
+ new_buf += new_width; |
3904 |
+ orig_buf1 += orig_width; |
3905 |
+ |
3906 |
+- orig_buf2 += orig_width/2; |
3907 |
+- orig_buf3 += orig_width/2; |
3908 |
++ orig_buf2 += orig_width / 2; |
3909 |
++ orig_buf3 += orig_width / 2; |
3910 |
+ |
3911 |
+ height -= 2; |
3912 |
+ } |
3913 |
+@@ -155,7 +154,8 @@ stridemove_zip3a (guchar *new_buf, |
3914 |
+ * enough. |
3915 |
+ */ |
3916 |
+ static void |
3917 |
+-stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height) |
3918 |
++stridemove (guchar * new_buf, guchar * orig_buf, gint new_width, |
3919 |
++ gint orig_width, gint height) |
3920 |
+ { |
3921 |
+ int row; |
3922 |
+ |
3923 |
+@@ -167,12 +167,14 @@ stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, |
3924 |
+ * for the same reason. |
3925 |
+ */ |
3926 |
+ if (new_width > orig_width) { |
3927 |
+- for (row=height-1; row>=0; row--) { |
3928 |
+- stride_copy (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); |
3929 |
++ for (row = height - 1; row >= 0; row--) { |
3930 |
++ stride_copy (new_buf + (new_width * row), orig_buf + (orig_width * row), |
3931 |
++ orig_width); |
3932 |
+ } |
3933 |
+ } else { |
3934 |
+- for (row=0; row<height; row++) { |
3935 |
+- stride_copy (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width); |
3936 |
++ for (row = 0; row < height; row++) { |
3937 |
++ stride_copy (new_buf + (new_width * row), orig_buf + (orig_width * row), |
3938 |
++ new_width); |
3939 |
+ } |
3940 |
+ } |
3941 |
+ } |
3942 |
+@@ -183,9 +185,10 @@ stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, |
3943 |
+ |
3944 |
+ /** convert 4:2:0 semiplanar to same 4:2:0 semiplanar */ |
3945 |
+ static GstFlowReturn |
3946 |
+-unstridify_420sp_420sp (GstStrideTransform *self, guchar *unstrided, guchar *strided) |
3947 |
++unstridify_420sp_420sp (GstStrideTransform * self, guchar * unstrided, |
3948 |
++ guchar * strided) |
3949 |
+ { |
3950 |
+- gint width = self->width; |
3951 |
++ gint width = self->width; |
3952 |
+ gint height = self->height; |
3953 |
+ gint stride = self->in_rowstride; |
3954 |
+ |
3955 |
+@@ -196,10 +199,12 @@ unstridify_420sp_420sp (GstStrideTransform *self, guchar *unstrided, guchar *str |
3956 |
+ |
3957 |
+ return GST_FLOW_OK; |
3958 |
+ } |
3959 |
++ |
3960 |
+ static GstFlowReturn |
3961 |
+-stridify_420sp_420sp (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
3962 |
++stridify_420sp_420sp (GstStrideTransform * self, guchar * strided, |
3963 |
++ guchar * unstrided) |
3964 |
+ { |
3965 |
+- gint width = self->width; |
3966 |
++ gint width = self->width; |
3967 |
+ gint height = self->height; |
3968 |
+ gint stride = self->out_rowstride; |
3969 |
+ |
3970 |
+@@ -214,115 +219,107 @@ stridify_420sp_420sp (GstStrideTransform *self, guchar *strided, guchar *unstrid |
3971 |
+ |
3972 |
+ /** convert 4:2:0 planar to same 4:2:0 planar */ |
3973 |
+ static GstFlowReturn |
3974 |
+-unstridify_420p_420p (GstStrideTransform *self, guchar *unstrided, guchar *strided) |
3975 |
++unstridify_420p_420p (GstStrideTransform * self, guchar * unstrided, |
3976 |
++ guchar * strided) |
3977 |
+ { |
3978 |
+- gint width = self->width; |
3979 |
++ gint width = self->width; |
3980 |
+ gint height = self->height; |
3981 |
+ gint stride = self->in_rowstride; |
3982 |
+ |
3983 |
+ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
3984 |
+ |
3985 |
+- stridemove (unstrided, strided, width, stride, height); /* move Y */ |
3986 |
+- stridemove ( |
3987 |
+- unstrided + (height*width), |
3988 |
+- strided + (height*stride), |
3989 |
+- width/2, stride, height); /* move V/U */ |
3990 |
++ stridemove (unstrided, strided, width, stride, height); /* move Y */ |
3991 |
++ stridemove (unstrided + (height * width), strided + (height * stride), width / 2, stride, height); /* move V/U */ |
3992 |
+ /* XXX odd widths/heights/strides: */ |
3993 |
+- stridemove ( |
3994 |
+- unstrided + (int)(height*width*1.5), |
3995 |
+- strided + (int)(height*stride*1.5), |
3996 |
+- width/2, stride, height); /* move U/V */ |
3997 |
++ stridemove (unstrided + (int) (height * width * 1.5), strided + (int) (height * stride * 1.5), width / 2, stride, height); /* move U/V */ |
3998 |
+ |
3999 |
+ return GST_FLOW_OK; |
4000 |
+ } |
4001 |
++ |
4002 |
+ static GstFlowReturn |
4003 |
+-stridify_420p_420p (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
4004 |
++stridify_420p_420p (GstStrideTransform * self, guchar * strided, |
4005 |
++ guchar * unstrided) |
4006 |
+ { |
4007 |
+- gint width = self->width; |
4008 |
++ gint width = self->width; |
4009 |
+ gint height = self->height; |
4010 |
+ gint stride = self->out_rowstride; |
4011 |
+ |
4012 |
+ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
4013 |
+ |
4014 |
+ /* XXX odd widths/heights/strides: */ |
4015 |
+- stridemove ( |
4016 |
+- strided + (int)(height*stride*1.5), |
4017 |
+- unstrided + (int)(height*width*1.5), |
4018 |
+- stride, width/2, height); /* move U/V */ |
4019 |
+- stridemove ( |
4020 |
+- strided + (height*stride), |
4021 |
+- unstrided + (height*width), |
4022 |
+- stride, width/2, height); /* move V/U */ |
4023 |
+- stridemove (strided, unstrided, stride, width, height); /* move Y */ |
4024 |
++ stridemove (strided + (int) (height * stride * 1.5), unstrided + (int) (height * width * 1.5), stride, width / 2, height); /* move U/V */ |
4025 |
++ stridemove (strided + (height * stride), unstrided + (height * width), stride, width / 2, height); /* move V/U */ |
4026 |
++ stridemove (strided, unstrided, stride, width, height); /* move Y */ |
4027 |
+ |
4028 |
+ return GST_FLOW_OK; |
4029 |
+ } |
4030 |
+ |
4031 |
+ /** convert 4:2:2 packed to same 4:2:2 packed */ |
4032 |
+ static GstFlowReturn |
4033 |
+-unstridify_422i_422i (GstStrideTransform *self, guchar *unstrided, guchar *strided) |
4034 |
++unstridify_422i_422i (GstStrideTransform * self, guchar * unstrided, |
4035 |
++ guchar * strided) |
4036 |
+ { |
4037 |
+- gint width = self->width; |
4038 |
++ gint width = self->width; |
4039 |
+ gint height = self->height; |
4040 |
+ gint stride = self->in_rowstride; |
4041 |
+ |
4042 |
+- g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); |
4043 |
++ g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); |
4044 |
+ |
4045 |
+- stridemove (unstrided, strided, width*2, stride, height); |
4046 |
++ stridemove (unstrided, strided, width * 2, stride, height); |
4047 |
+ |
4048 |
+ return GST_FLOW_OK; |
4049 |
+ } |
4050 |
++ |
4051 |
+ static GstFlowReturn |
4052 |
+-stridify_422i_422i (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
4053 |
++stridify_422i_422i (GstStrideTransform * self, guchar * strided, |
4054 |
++ guchar * unstrided) |
4055 |
+ { |
4056 |
+- gint width = self->width; |
4057 |
++ gint width = self->width; |
4058 |
+ gint height = self->height; |
4059 |
+ gint stride = self->out_rowstride; |
4060 |
+ |
4061 |
+- g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); |
4062 |
++ g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); |
4063 |
+ |
4064 |
+- stridemove (strided, unstrided, stride, width*2, height); |
4065 |
++ stridemove (strided, unstrided, stride, width * 2, height); |
4066 |
+ |
4067 |
+ return GST_FLOW_OK; |
4068 |
+ } |
4069 |
+ |
4070 |
+ /** convert I420 unstrided to NV12 strided */ |
4071 |
+ static GstFlowReturn |
4072 |
+-stridify_i420_nv12 (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
4073 |
++stridify_i420_nv12 (GstStrideTransform * self, guchar * strided, |
4074 |
++ guchar * unstrided) |
4075 |
+ { |
4076 |
+- gint width = self->width; |
4077 |
++ gint width = self->width; |
4078 |
+ gint height = self->height; |
4079 |
+ gint stride = self->out_rowstride; |
4080 |
+ |
4081 |
+ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
4082 |
+ |
4083 |
+ /* XXX widths/heights/strides that are not multiple of four??: */ |
4084 |
+- stridemove_zip2 ( |
4085 |
+- strided + (height*stride), |
4086 |
+- unstrided + (height*width), /* U */ |
4087 |
+- unstrided + (int)(height*width*1.25), /* V */ |
4088 |
+- stride, width/2, height/2); |
4089 |
+- stridemove (strided, unstrided, stride, width, height); /* Y */ |
4090 |
++ stridemove_zip2 (strided + (height * stride), unstrided + (height * width), /* U */ |
4091 |
++ unstrided + (int) (height * width * 1.25), /* V */ |
4092 |
++ stride, width / 2, height / 2); |
4093 |
++ stridemove (strided, unstrided, stride, width, height); /* Y */ |
4094 |
+ |
4095 |
+ return GST_FLOW_OK; |
4096 |
+ } |
4097 |
+ |
4098 |
+ /** convert I420 unstrided to YUY2 strided */ |
4099 |
+ static GstFlowReturn |
4100 |
+-stridify_i420_yuy2 (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
4101 |
++stridify_i420_yuy2 (GstStrideTransform * self, guchar * strided, |
4102 |
++ guchar * unstrided) |
4103 |
+ { |
4104 |
+- gint width = self->width; |
4105 |
++ gint width = self->width; |
4106 |
+ gint height = self->height; |
4107 |
+ gint stride = self->out_rowstride; |
4108 |
+ |
4109 |
+ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
4110 |
+ |
4111 |
+ /* XXX widths/heights/strides that are not multiple of four??: */ |
4112 |
+- stridemove_zip3a ( |
4113 |
+- strided, |
4114 |
+- unstrided, /* Y */ |
4115 |
+- unstrided + (height*width), /* U */ |
4116 |
+- unstrided + (int)(height*width*1.25), /* V */ |
4117 |
++ stridemove_zip3a (strided, unstrided, /* Y */ |
4118 |
++ unstrided + (height * width), /* U */ |
4119 |
++ unstrided + (int) (height * width * 1.25), /* V */ |
4120 |
+ stride, width, height); |
4121 |
+ |
4122 |
+ return GST_FLOW_OK; |
4123 |
+@@ -330,46 +327,51 @@ stridify_i420_yuy2 (GstStrideTransform *self, guchar *strided, guchar *unstrided |
4124 |
+ |
4125 |
+ /** convert RGB565 to RGB565 strided **/ |
4126 |
+ static GstFlowReturn |
4127 |
+-stridify_rgb565_rgb565 (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
4128 |
++stridify_rgb565_rgb565 (GstStrideTransform * self, guchar * strided, |
4129 |
++ guchar * unstrided) |
4130 |
+ { |
4131 |
+- gint width = self->width; |
4132 |
+- gint height = self->height; |
4133 |
+- gint stride = self->out_rowstride; |
4134 |
++ gint width = self->width; |
4135 |
++ gint height = self->height; |
4136 |
++ gint stride = self->out_rowstride; |
4137 |
+ |
4138 |
+- g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); |
4139 |
++ g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); |
4140 |
+ |
4141 |
+- stridemove (strided, unstrided, stride, width*2, height); |
4142 |
++ stridemove (strided, unstrided, stride, width * 2, height); |
4143 |
+ |
4144 |
+- return GST_FLOW_OK; |
4145 |
++ return GST_FLOW_OK; |
4146 |
+ } |
4147 |
+ |
4148 |
+ /** convert RGB565 strided to RGB565 **/ |
4149 |
+ static GstFlowReturn |
4150 |
+-unstridify_rgb565_rgb565 (GstStrideTransform *self, guchar *strided, guchar *unstrided) |
4151 |
++unstridify_rgb565_rgb565 (GstStrideTransform * self, guchar * strided, |
4152 |
++ guchar * unstrided) |
4153 |
+ { |
4154 |
+- gint width = self->width; |
4155 |
+- gint height = self->height; |
4156 |
+- gint stride = self->in_rowstride; |
4157 |
++ gint width = self->width; |
4158 |
++ gint height = self->height; |
4159 |
++ gint stride = self->in_rowstride; |
4160 |
+ |
4161 |
+- g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); |
4162 |
++ g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); |
4163 |
+ |
4164 |
+- stridemove (unstrided, strided, width*2, stride, height); |
4165 |
+- return GST_FLOW_OK; |
4166 |
++ stridemove (unstrided, strided, width * 2, stride, height); |
4167 |
++ return GST_FLOW_OK; |
4168 |
+ } |
4169 |
+ |
4170 |
++#define CONVERT(tofmt, fromfmt, stridify, unstridify) \ |
4171 |
++ { \ |
4172 |
++ { GST_VIDEO_FORMAT_##tofmt, GST_VIDEO_FORMAT_##fromfmt }, \ |
4173 |
++ stridify, unstridify \ |
4174 |
++ } |
4175 |
+ |
4176 |
+ /* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ |
4177 |
+-Conversion stride_conversions[] = { |
4178 |
+- { { GST_VIDEO_FORMAT_NV12, GST_VIDEO_FORMAT_NV12 }, stridify_420sp_420sp, unstridify_420sp_420sp }, |
4179 |
+- { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_I420 }, stridify_420p_420p, unstridify_420p_420p }, |
4180 |
+- { { GST_VIDEO_FORMAT_YV12, GST_VIDEO_FORMAT_YV12 }, stridify_420p_420p, unstridify_420p_420p }, |
4181 |
+- { { GST_VIDEO_FORMAT_YUY2, GST_VIDEO_FORMAT_YUY2 }, stridify_422i_422i, unstridify_422i_422i }, |
4182 |
+- { { GST_VIDEO_FORMAT_UYVY, GST_VIDEO_FORMAT_UYVY }, stridify_422i_422i, unstridify_422i_422i }, |
4183 |
+- { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_NV12 }, stridify_i420_nv12, NULL }, |
4184 |
+- { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_YUY2 }, stridify_i420_yuy2, NULL }, |
4185 |
+- { { GST_VIDEO_FORMAT_RGB16, GST_VIDEO_FORMAT_RGB16 }, stridify_rgb565_rgb565, unstridify_rgb565_rgb565 }, |
4186 |
++const Conversion stride_conversions[] = { |
4187 |
++ CONVERT (NV12, NV12, stridify_420sp_420sp, unstridify_420sp_420sp), |
4188 |
++ CONVERT (I420, I420, stridify_420p_420p, unstridify_420p_420p), |
4189 |
++ CONVERT (YV12, YV12, stridify_420p_420p, unstridify_420p_420p), |
4190 |
++ CONVERT (YUY2, YUY2, stridify_422i_422i, unstridify_422i_422i), |
4191 |
++ CONVERT (UYVY, UYVY, stridify_422i_422i, unstridify_422i_422i), |
4192 |
++ CONVERT (I420, NV12, stridify_i420_nv12, NULL), |
4193 |
++ CONVERT (I420, YUY2, stridify_i420_yuy2, NULL), |
4194 |
++ CONVERT (RGB16, RGB16, stridify_rgb565_rgb565, unstridify_rgb565_rgb565), |
4195 |
+ /* add new entries before here */ |
4196 |
+- { { GST_VIDEO_FORMAT_UNKNOWN } } |
4197 |
++ {{GST_VIDEO_FORMAT_UNKNOWN}} |
4198 |
+ }; |
4199 |
+- |
4200 |
+- |
4201 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
4202 |
+index de07c11..4469e7f 100644 |
4203 |
+--- a/gst/stride/gststridetransform.c |
4204 |
++++ b/gst/stride/gststridetransform.c |
4205 |
+@@ -146,7 +146,9 @@ static void |
4206 |
+ gst_stride_transform_init (GstStrideTransform * self, |
4207 |
+ GstStrideTransformClass * klass) |
4208 |
+ { |
4209 |
+- GST_DEBUG_OBJECT (self, "not implemented"); |
4210 |
++ GST_DEBUG_OBJECT (self, "ENTER"); |
4211 |
++ self->cached_caps[0] = NULL; |
4212 |
++ self->cached_caps[1] = NULL; |
4213 |
+ } |
4214 |
+ |
4215 |
+ |
4216 |
+@@ -154,7 +156,7 @@ static void |
4217 |
+ gst_stride_transform_dispose (GObject * object) |
4218 |
+ { |
4219 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (object); |
4220 |
+- GST_DEBUG_OBJECT (self, "not implemented"); |
4221 |
++ GST_DEBUG_OBJECT (self, "ENTER"); |
4222 |
+ G_OBJECT_CLASS (parent_class)->dispose (object); |
4223 |
+ } |
4224 |
+ |
4225 |
+@@ -210,7 +212,30 @@ gst_stride_transform_transform_size (GstBaseTransform * base, |
4226 |
+ return TRUE; |
4227 |
+ } |
4228 |
+ |
4229 |
++/** |
4230 |
++ * helper to check possible @fourcc conversions to the list @formats |
4231 |
++ */ |
4232 |
++static void |
4233 |
++add_all_fourcc_conversions (GValue * formats, guint32 fourcc, |
4234 |
++ GstPadDirection direction) |
4235 |
++{ |
4236 |
++ gint to_format = (direction == GST_PAD_SINK) ? 1 : 0; |
4237 |
++ gint from_format = (direction == GST_PAD_SRC) ? 1 : 0; |
4238 |
++ GValue fourccval = { 0 }; |
4239 |
++ gint i; |
4240 |
++ GstVideoFormat format = gst_video_format_from_fourcc (fourcc); |
4241 |
+ |
4242 |
++ g_value_init (&fourccval, GST_TYPE_FOURCC); |
4243 |
++ |
4244 |
++ for (i = 0; stride_conversions[i].format[0] != GST_VIDEO_FORMAT_UNKNOWN; i++) { |
4245 |
++ if (stride_conversions[i].format[from_format] == format) { |
4246 |
++ guint result_fourcc = |
4247 |
++ gst_video_format_to_fourcc (stride_conversions[i].format[to_format]); |
4248 |
++ gst_value_set_fourcc (&fourccval, result_fourcc); |
4249 |
++ gst_value_list_append_value (formats, &fourccval); |
4250 |
++ } |
4251 |
++ } |
4252 |
++} |
4253 |
+ |
4254 |
+ /** |
4255 |
+ * helper to add all fields, other than rowstride to @caps, copied from @s. |
4256 |
+@@ -230,43 +255,44 @@ add_all_fields (GstCaps * caps, const gchar * name, GstStructure * s, |
4257 |
+ idx = gst_structure_n_fields (s) - 1; |
4258 |
+ while (idx >= 0) { |
4259 |
+ const gchar *name = gst_structure_nth_field_name (s, idx); |
4260 |
++ const GValue *val = gst_structure_get_value (s, name); |
4261 |
++ |
4262 |
+ idx--; |
4263 |
+ |
4264 |
+ /* for format field, check the stride_conversions table to see what |
4265 |
+ * we can support: |
4266 |
+ */ |
4267 |
+ if (!strcmp ("format", name)) { |
4268 |
+- guint fourcc; |
4269 |
++ GValue formats = { 0 }; |
4270 |
+ |
4271 |
+- /* XXX double check this: */ |
4272 |
+- gint to_format = (direction == GST_PAD_SINK) ? 1 : 0; |
4273 |
+- gint from_format = (direction == GST_PAD_SRC) ? 1 : 0; |
4274 |
++ g_value_init (&formats, GST_TYPE_LIST); |
4275 |
+ |
4276 |
+- if (gst_structure_get_fourcc (s, "format", &fourcc)) { |
4277 |
+- GValue formats = { 0 }; |
4278 |
+- GValue fourccval = { 0 }; |
4279 |
++ if (GST_VALUE_HOLDS_FOURCC (val)) { |
4280 |
++ add_all_fourcc_conversions (&formats, |
4281 |
++ gst_value_get_fourcc (val), direction); |
4282 |
++ } else if (GST_VALUE_HOLDS_LIST (val)) { |
4283 |
+ gint i; |
4284 |
+- GstVideoFormat format = gst_video_format_from_fourcc (fourcc); |
4285 |
+- |
4286 |
+- g_value_init (&formats, GST_TYPE_LIST); |
4287 |
+- g_value_init (&fourccval, GST_TYPE_FOURCC); |
4288 |
+- |
4289 |
+- for (i = 0; stride_conversions[i].format[0] != GST_VIDEO_FORMAT_UNKNOWN; |
4290 |
+- i++) { |
4291 |
+- if (stride_conversions[i].format[from_format] == format) { |
4292 |
+- gst_value_set_fourcc (&fourccval, gst_video_format_to_fourcc |
4293 |
+- (stride_conversions[i].format[to_format])); |
4294 |
+- gst_value_list_append_value (&formats, &fourccval); |
4295 |
++ for (i = 0; i < gst_value_list_get_size (val); i++) { |
4296 |
++ const GValue *list_val = gst_value_list_get_value (val, i); |
4297 |
++ if (GST_VALUE_HOLDS_FOURCC (list_val)) { |
4298 |
++ add_all_fourcc_conversions (&formats, |
4299 |
++ gst_value_get_fourcc (list_val), direction); |
4300 |
++ } else { |
4301 |
++ GST_WARNING ("malformed caps!!"); |
4302 |
++ break; |
4303 |
+ } |
4304 |
+ } |
4305 |
+- |
4306 |
+- continue; |
4307 |
++ } else { |
4308 |
++ GST_WARNING ("malformed caps!!"); |
4309 |
+ } |
4310 |
++ |
4311 |
++ gst_structure_set_value (new_s, "format", &formats); |
4312 |
++ |
4313 |
++ continue; |
4314 |
+ } |
4315 |
+ |
4316 |
+ /* copy over all other non-rowstride fields: */ |
4317 |
+ if (strcmp ("rowstride", name)) { |
4318 |
+- const GValue *val = gst_structure_get_value (s, name); |
4319 |
+ gst_structure_set_value (new_s, name, val); |
4320 |
+ } |
4321 |
+ } |
4322 |
+@@ -347,6 +373,10 @@ gst_stride_transform_set_caps (GstBaseTransform * base, |
4323 |
+ } |
4324 |
+ } |
4325 |
+ |
4326 |
++ GST_DEBUG_OBJECT (self, |
4327 |
++ "conversion[%d]=%p, in_rowstride=%d, out_rowstride=%d", |
4328 |
++ i, self->conversion, self->in_rowstride, self->out_rowstride); |
4329 |
++ |
4330 |
+ g_return_val_if_fail (self->conversion, FALSE); |
4331 |
+ g_return_val_if_fail (self->conversion->unstridify |
4332 |
+ || !self->in_rowstride, FALSE); |
4333 |
+@@ -355,6 +385,8 @@ gst_stride_transform_set_caps (GstBaseTransform * base, |
4334 |
+ g_return_val_if_fail (self->width == width, FALSE); |
4335 |
+ g_return_val_if_fail (self->height == height, FALSE); |
4336 |
+ |
4337 |
++ GST_DEBUG_OBJECT (self, "caps are ok"); |
4338 |
++ |
4339 |
+ return TRUE; |
4340 |
+ } |
4341 |
+ |
4342 |
+-- |
4343 |
+1.7.1 |
4344 |
+ |
4345 |
|
4346 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0016-modify-playbin-to-use-stridetransform.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0016-modify-playbin-to-use-stridetransform.patch |
4347 |
new file mode 100644 |
4348 |
index 0000000..82c9b25 |
4349 |
--- /dev/null |
4350 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0016-modify-playbin-to-use-stridetransform.patch |
4351 |
@@ -0,0 +1,62 @@ |
4352 |
+From eb2753337944d24419dc13968137bf06a5e8f77c Mon Sep 17 00:00:00 2001 |
4353 |
+From: Rob Clark <rob@××.com> |
4354 |
+Date: Sat, 6 Feb 2010 22:10:16 -0600 |
4355 |
+Subject: [PATCH 16/24] modify playbin to use stridetransform |
4356 |
+ |
4357 |
+--- |
4358 |
+ gst/playback/gstplaysink.c | 29 ++++------------------------- |
4359 |
+ 1 files changed, 4 insertions(+), 25 deletions(-) |
4360 |
+ |
4361 |
+diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c |
4362 |
+index bb41a03..dedd3be 100644 |
4363 |
+--- a/gst/playback/gstplaysink.c |
4364 |
++++ b/gst/playback/gstplaysink.c |
4365 |
+@@ -1267,13 +1267,13 @@ gen_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async) |
4366 |
+ } |
4367 |
+ |
4368 |
+ if (raw && !(playsink->flags & GST_PLAY_FLAG_NATIVE_VIDEO)) { |
4369 |
+- GST_DEBUG_OBJECT (playsink, "creating ffmpegcolorspace"); |
4370 |
+- chain->conv = gst_element_factory_make ("ffmpegcolorspace", "vconv"); |
4371 |
++ GST_DEBUG_OBJECT (playsink, "creating stridetransform"); |
4372 |
++ chain->conv = gst_element_factory_make ("stridetransform", "vconv"); |
4373 |
+ if (chain->conv == NULL) { |
4374 |
+- post_missing_element_message (playsink, "ffmpegcolorspace"); |
4375 |
++ post_missing_element_message (playsink, "stridetransform"); |
4376 |
+ GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN, |
4377 |
+ (_("Missing element '%s' - check your GStreamer installation."), |
4378 |
+- "ffmpegcolorspace"), ("video rendering might fail")); |
4379 |
++ "stridetransform"), ("video rendering might fail")); |
4380 |
+ } else { |
4381 |
+ gst_bin_add (bin, chain->conv); |
4382 |
+ if (prev) { |
4383 |
+@@ -1285,27 +1285,6 @@ gen_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async) |
4384 |
+ } |
4385 |
+ prev = chain->conv; |
4386 |
+ } |
4387 |
+- |
4388 |
+- GST_DEBUG_OBJECT (playsink, "creating videoscale"); |
4389 |
+- chain->scale = gst_element_factory_make ("videoscale", "vscale"); |
4390 |
+- if (chain->scale == NULL) { |
4391 |
+- post_missing_element_message (playsink, "videoscale"); |
4392 |
+- GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN, |
4393 |
+- (_("Missing element '%s' - check your GStreamer installation."), |
4394 |
+- "videoscale"), ("possibly a liboil version mismatch?")); |
4395 |
+- } else { |
4396 |
+- /* Add black borders if necessary to keep the DAR */ |
4397 |
+- g_object_set (chain->scale, "add-borders", TRUE, NULL); |
4398 |
+- gst_bin_add (bin, chain->scale); |
4399 |
+- if (prev) { |
4400 |
+- if (!gst_element_link_pads_full (prev, "src", chain->scale, "sink", |
4401 |
+- GST_PAD_LINK_CHECK_TEMPLATE_CAPS)) |
4402 |
+- goto link_failed; |
4403 |
+- } else { |
4404 |
+- head = chain->scale; |
4405 |
+- } |
4406 |
+- prev = chain->scale; |
4407 |
+- } |
4408 |
+ } |
4409 |
+ |
4410 |
+ if (prev) { |
4411 |
+-- |
4412 |
+1.7.1 |
4413 |
+ |
4414 |
|
4415 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0017-playbin-disable-interlaced-support.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0017-playbin-disable-interlaced-support.patch |
4416 |
new file mode 100644 |
4417 |
index 0000000..44bb868 |
4418 |
--- /dev/null |
4419 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0017-playbin-disable-interlaced-support.patch |
4420 |
@@ -0,0 +1,33 @@ |
4421 |
+From 82d8f741f626ed449c84e0ae4c8e27219557149e Mon Sep 17 00:00:00 2001 |
4422 |
+From: Rob Clark <rob@××.com> |
4423 |
+Date: Thu, 19 Aug 2010 10:32:52 -0500 |
4424 |
+Subject: [PATCH 17/24] playbin: disable interlaced support |
4425 |
+ |
4426 |
+Latest totem is enabling interlaced support, which causes similar issues |
4427 |
+to when native-video is not used.. for now, since none of the codecs |
4428 |
+support it, disable interlaced support. |
4429 |
+--- |
4430 |
+ gst/playback/gstplaysink.c | 2 ++ |
4431 |
+ 1 files changed, 2 insertions(+), 0 deletions(-) |
4432 |
+ |
4433 |
+diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c |
4434 |
+index dedd3be..957f288 100644 |
4435 |
+--- a/gst/playback/gstplaysink.c |
4436 |
++++ b/gst/playback/gstplaysink.c |
4437 |
+@@ -2118,11 +2118,13 @@ gst_play_sink_reconfigure (GstPlaySink * playsink) |
4438 |
+ /* we have video and we are requested to show it */ |
4439 |
+ need_video = TRUE; |
4440 |
+ |
4441 |
++#if 0 |
4442 |
+ /* we only deinterlace if native video is not requested and |
4443 |
+ * we have raw video */ |
4444 |
+ if ((flags & GST_PLAY_FLAG_DEINTERLACE) |
4445 |
+ && !(flags & GST_PLAY_FLAG_NATIVE_VIDEO) && playsink->video_pad_raw) |
4446 |
+ need_deinterlace = TRUE; |
4447 |
++#endif |
4448 |
+ } |
4449 |
+ |
4450 |
+ if (playsink->audio_pad) { |
4451 |
+-- |
4452 |
+1.7.1 |
4453 |
+ |
4454 |
|
4455 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0018-textoverlay-add-stride-support.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0018-textoverlay-add-stride-support.patch |
4456 |
new file mode 100644 |
4457 |
index 0000000..8c0c423 |
4458 |
--- /dev/null |
4459 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0018-textoverlay-add-stride-support.patch |
4460 |
@@ -0,0 +1,132 @@ |
4461 |
+From 8cd575c6c2f46464d7704e07102a648bba08a6c6 Mon Sep 17 00:00:00 2001 |
4462 |
+From: Rob Clark <rob@××.com> |
4463 |
+Date: Mon, 23 Aug 2010 14:01:14 -0500 |
4464 |
+Subject: [PATCH 18/24] textoverlay: add stride support |
4465 |
+ |
4466 |
+--- |
4467 |
+ ext/pango/gsttextoverlay.c | 37 +++++++++++++++++++++++++------------ |
4468 |
+ ext/pango/gsttextoverlay.h | 1 + |
4469 |
+ 2 files changed, 26 insertions(+), 12 deletions(-) |
4470 |
+ |
4471 |
+diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c |
4472 |
+index 915a59c..1bf3638 100644 |
4473 |
+--- a/ext/pango/gsttextoverlay.c |
4474 |
++++ b/ext/pango/gsttextoverlay.c |
4475 |
+@@ -187,7 +187,7 @@ static GstStaticPadTemplate src_template_factory = |
4476 |
+ GST_PAD_ALWAYS, |
4477 |
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx ";" |
4478 |
+ GST_VIDEO_CAPS_xRGB ";" |
4479 |
+- GST_VIDEO_CAPS_YUV ("{AYUV, I420, UYVY, NV12, NV21}")) |
4480 |
++ GST_VIDEO_CAPS_YUV_STRIDED ("{AYUV, I420, UYVY, NV12, NV21}", "[0, max]")) |
4481 |
+ ); |
4482 |
+ |
4483 |
+ static GstStaticPadTemplate video_sink_template_factory = |
4484 |
+@@ -196,7 +196,7 @@ static GstStaticPadTemplate video_sink_template_factory = |
4485 |
+ GST_PAD_ALWAYS, |
4486 |
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx ";" |
4487 |
+ GST_VIDEO_CAPS_xRGB ";" |
4488 |
+- GST_VIDEO_CAPS_YUV ("{AYUV, I420, UYVY, NV12, NV21}")) |
4489 |
++ GST_VIDEO_CAPS_YUV_STRIDED ("{AYUV, I420, UYVY, NV12, NV21}", "[0, max]")) |
4490 |
+ ); |
4491 |
+ |
4492 |
+ static GstStaticPadTemplate text_sink_template_factory = |
4493 |
+@@ -724,12 +724,13 @@ gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps) |
4494 |
+ |
4495 |
+ overlay->width = 0; |
4496 |
+ overlay->height = 0; |
4497 |
++ overlay->rowstride = 0; |
4498 |
+ structure = gst_caps_get_structure (caps, 0); |
4499 |
+ fps = gst_structure_get_value (structure, "framerate"); |
4500 |
+ |
4501 |
+ if (fps |
4502 |
+- && gst_video_format_parse_caps (caps, &overlay->format, &overlay->width, |
4503 |
+- &overlay->height)) { |
4504 |
++ && gst_video_format_parse_caps_strided (caps, &overlay->format, &overlay->width, |
4505 |
++ &overlay->height, &overlay->rowstride)) { |
4506 |
+ ret = gst_pad_set_caps (overlay->srcpad, caps); |
4507 |
+ } |
4508 |
+ |
4509 |
+@@ -1364,14 +1365,21 @@ gst_text_overlay_render_pangocairo (GstTextOverlay * overlay, |
4510 |
+ #define BOX_XPAD 6 |
4511 |
+ #define BOX_YPAD 6 |
4512 |
+ |
4513 |
++static gint |
4514 |
++gst_text_overlay_get_stride (GstTextOverlay * overlay, gint component) |
4515 |
++{ |
4516 |
++ if (overlay->rowstride) |
4517 |
++ return overlay->rowstride; |
4518 |
++ return gst_video_format_get_row_stride (overlay->format, 0, overlay->width); |
4519 |
++} |
4520 |
++ |
4521 |
+ static inline void |
4522 |
+ gst_text_overlay_shade_planar_Y (GstTextOverlay * overlay, guchar * dest, |
4523 |
+ gint x0, gint x1, gint y0, gint y1) |
4524 |
+ { |
4525 |
+ gint i, j, dest_stride; |
4526 |
+ |
4527 |
+- dest_stride = gst_video_format_get_row_stride (overlay->format, 0, |
4528 |
+- overlay->width); |
4529 |
++ dest_stride = gst_text_overlay_get_stride (overlay, 0); |
4530 |
+ |
4531 |
+ x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width); |
4532 |
+ x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width); |
4533 |
+@@ -1436,7 +1444,9 @@ static inline void |
4534 |
+ gst_text_overlay_shade_xRGB (GstTextOverlay * overlay, guchar * dest, |
4535 |
+ gint x0, gint x1, gint y0, gint y1) |
4536 |
+ { |
4537 |
+- gint i, j; |
4538 |
++ gint i, j, dest_stride; |
4539 |
++ |
4540 |
++ dest_stride = gst_text_overlay_get_stride (overlay, 0); |
4541 |
+ |
4542 |
+ x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width); |
4543 |
+ x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width); |
4544 |
+@@ -1448,7 +1458,7 @@ gst_text_overlay_shade_xRGB (GstTextOverlay * overlay, guchar * dest, |
4545 |
+ for (j = x0; j < x1; j++) { |
4546 |
+ gint y, y_pos, k; |
4547 |
+ |
4548 |
+- y_pos = (i * 4 * overlay->width) + j * 4; |
4549 |
++ y_pos = (i * dest_stride) + j * 4; |
4550 |
+ for (k = 0; k < 4; k++) { |
4551 |
+ y = dest[y_pos + k] + overlay->shading_value; |
4552 |
+ dest[y_pos + k] = CLAMP (y, 0, 255); |
4553 |
+@@ -1480,10 +1490,10 @@ gst_text_overlay_blit_NV12_NV21 (GstTextOverlay * overlay, |
4554 |
+ w = overlay->width; |
4555 |
+ h = overlay->height; |
4556 |
+ |
4557 |
+- y_stride = gst_video_format_get_row_stride (overlay->format, 0, w); |
4558 |
+- uv_stride = gst_video_format_get_row_stride (overlay->format, 1, w); |
4559 |
+- u_offset = gst_video_format_get_component_offset (overlay->format, 1, w, h); |
4560 |
+- v_offset = gst_video_format_get_component_offset (overlay->format, 2, w, h); |
4561 |
++ y_stride = gst_text_overlay_get_stride (overlay, 0); |
4562 |
++ uv_stride = gst_text_overlay_get_stride (overlay, 1); |
4563 |
++ u_offset = gst_video_format_get_component_offset (overlay->format, 1, y_stride, h); |
4564 |
++ v_offset = gst_video_format_get_component_offset (overlay->format, 2, y_stride, h); |
4565 |
+ |
4566 |
+ gst_text_overlay_blit_1 (overlay, yuv_pixels, xpos, ypos, overlay->text_image, |
4567 |
+ y_stride); |
4568 |
+@@ -1509,6 +1519,9 @@ gst_text_overlay_blit_I420 (GstTextOverlay * overlay, |
4569 |
+ w = overlay->width; |
4570 |
+ h = overlay->height; |
4571 |
+ |
4572 |
++ /* XXX this is not updated for rowstride.. but rowstride could be |
4573 |
++ * ambiguous for I420.. is the U and V plane rowstride or rowstride/2? |
4574 |
++ */ |
4575 |
+ y_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 0, w); |
4576 |
+ u_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 1, w); |
4577 |
+ v_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 2, w); |
4578 |
+diff --git a/ext/pango/gsttextoverlay.h b/ext/pango/gsttextoverlay.h |
4579 |
+index 5fddf3a..bc2940b 100644 |
4580 |
+--- a/ext/pango/gsttextoverlay.h |
4581 |
++++ b/ext/pango/gsttextoverlay.h |
4582 |
+@@ -112,6 +112,7 @@ struct _GstTextOverlay { |
4583 |
+ |
4584 |
+ gint width; |
4585 |
+ gint height; |
4586 |
++ gint rowstride; |
4587 |
+ gint fps_n; |
4588 |
+ gint fps_d; |
4589 |
+ GstVideoFormat format; |
4590 |
+-- |
4591 |
+1.7.1 |
4592 |
+ |
4593 |
|
4594 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0019-video-more-flexible-video-caps-utility.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0019-video-more-flexible-video-caps-utility.patch |
4595 |
new file mode 100644 |
4596 |
index 0000000..fcf4fd6 |
4597 |
--- /dev/null |
4598 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0019-video-more-flexible-video-caps-utility.patch |
4599 |
@@ -0,0 +1,228 @@ |
4600 |
+From ecac5f6e2cab295e742784f6d4d11800b1f37c6d Mon Sep 17 00:00:00 2001 |
4601 |
+From: Rob Clark <rob@××.com> |
4602 |
+Date: Mon, 13 Sep 2010 19:04:47 -0500 |
4603 |
+Subject: [PATCH 19/24] video: more flexible video caps utility |
4604 |
+ |
4605 |
+Add gst_video_format_new_caps_simple() to allow for more flexible video |
4606 |
+caps builder, which could be used for template caps and non-fixed caps. |
4607 |
+--- |
4608 |
+ gst-libs/gst/video/video.c | 129 ++++++++++++++++++++++++++------------------ |
4609 |
+ gst-libs/gst/video/video.h | 2 + |
4610 |
+ 2 files changed, 78 insertions(+), 53 deletions(-) |
4611 |
+ |
4612 |
+diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c |
4613 |
+index ff9c4fb..ef8edcc 100644 |
4614 |
+--- a/gst-libs/gst/video/video.c |
4615 |
++++ b/gst-libs/gst/video/video.c |
4616 |
+@@ -590,15 +590,12 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, |
4617 |
+ } |
4618 |
+ |
4619 |
+ /** |
4620 |
+- * gst_video_format_new_caps_strided: |
4621 |
++ * gst_video_format_new_caps_simple: |
4622 |
+ * @format: the #GstVideoFormat describing the raw video format |
4623 |
+- * @width: width of video |
4624 |
+- * @height: height of video |
4625 |
+- * @rowstride: the rowstride (in bytes), or 0 if no rowstride |
4626 |
+- * @framerate_n: numerator of frame rate |
4627 |
+- * @framerate_d: denominator of frame rate |
4628 |
+- * @par_n: numerator of pixel aspect ratio |
4629 |
+- * @par_d: denominator of pixel aspect ratio |
4630 |
++ * @rowstride: 0 for unstrided, -1 for any stride (unfixed), or other |
4631 |
++ * for fixed stride |
4632 |
++ * @fieldname: first field to set |
4633 |
++ * @...: additional arguments |
4634 |
+ * |
4635 |
+ * Creates a new #GstCaps object based on the parameters provided. |
4636 |
+ * |
4637 |
+@@ -607,25 +604,20 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, |
4638 |
+ * Returns: a new #GstCaps object, or NULL if there was an error |
4639 |
+ */ |
4640 |
+ GstCaps * |
4641 |
+-gst_video_format_new_caps_strided (GstVideoFormat format, |
4642 |
+- int width, int height, int rowstride, |
4643 |
+- int framerate_n, int framerate_d, int par_n, int par_d) |
4644 |
++gst_video_format_new_caps_simple (GstVideoFormat format, int rowstride, |
4645 |
++ const char *fieldname, ...) |
4646 |
+ { |
4647 |
+- GstCaps *caps = NULL; |
4648 |
++ va_list varargs; |
4649 |
++ GstStructure *s; |
4650 |
+ |
4651 |
+ g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL); |
4652 |
+- g_return_val_if_fail (width > 0 && height > 0, NULL); |
4653 |
+ |
4654 |
+ if (gst_video_format_is_yuv (format)) { |
4655 |
+- caps = gst_caps_new_simple ( |
4656 |
+- rowstride ? "video/x-raw-yuv-strided" : "video/x-raw-yuv", |
4657 |
++ s = gst_structure_new (rowstride ? |
4658 |
++ "video/x-raw-yuv-strided" : "video/x-raw-yuv", |
4659 |
+ "format", GST_TYPE_FOURCC, gst_video_format_to_fourcc (format), |
4660 |
+- "width", G_TYPE_INT, width, |
4661 |
+- "height", G_TYPE_INT, height, |
4662 |
+- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, |
4663 |
+- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); |
4664 |
++ NULL); |
4665 |
+ } else if (gst_video_format_is_rgb (format)) { |
4666 |
+- GstCaps *caps; |
4667 |
+ int red_mask = 0; |
4668 |
+ int blue_mask = 0; |
4669 |
+ int green_mask = 0; |
4670 |
+@@ -684,15 +676,12 @@ gst_video_format_new_caps_strided (GstVideoFormat format, |
4671 |
+ } else { |
4672 |
+ mask = 0xff0000; |
4673 |
+ } |
4674 |
+- red_mask = |
4675 |
+- mask >> (8 * gst_video_format_get_component_offset (format, 0, |
4676 |
+- width, height)); |
4677 |
+- green_mask = |
4678 |
+- mask >> (8 * gst_video_format_get_component_offset (format, 1, |
4679 |
+- width, height)); |
4680 |
+- blue_mask = |
4681 |
+- mask >> (8 * gst_video_format_get_component_offset (format, 2, |
4682 |
+- width, height)); |
4683 |
++ red_mask = mask >> |
4684 |
++ (8 * gst_video_format_get_component_offset (format, 0, 1, 1)); |
4685 |
++ green_mask = mask >> |
4686 |
++ (8 * gst_video_format_get_component_offset (format, 1, 1, 1)); |
4687 |
++ blue_mask = mask >> |
4688 |
++ (8 * gst_video_format_get_component_offset (format, 2, 1, 1)); |
4689 |
+ } else if (bpp == 16) { |
4690 |
+ switch (format) { |
4691 |
+ case GST_VIDEO_FORMAT_RGB16: |
4692 |
+@@ -723,17 +712,13 @@ gst_video_format_new_caps_strided (GstVideoFormat format, |
4693 |
+ return NULL; |
4694 |
+ } |
4695 |
+ |
4696 |
+- caps = gst_caps_new_simple ( |
4697 |
++ s = gst_structure_new ( |
4698 |
+ rowstride ? "video/x-raw-rgb-strided" : "video/x-raw-rgb", |
4699 |
+ "bpp", G_TYPE_INT, bpp, |
4700 |
+- "depth", G_TYPE_INT, depth, |
4701 |
+- "width", G_TYPE_INT, width, |
4702 |
+- "height", G_TYPE_INT, height, |
4703 |
+- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, |
4704 |
+- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); |
4705 |
++ "depth", G_TYPE_INT, depth, NULL); |
4706 |
+ |
4707 |
+ if (bpp != 8) { |
4708 |
+- gst_caps_set_simple (caps, |
4709 |
++ gst_structure_set (s, |
4710 |
+ "endianness", G_TYPE_INT, G_BIG_ENDIAN, |
4711 |
+ "red_mask", G_TYPE_INT, red_mask, |
4712 |
+ "green_mask", G_TYPE_INT, green_mask, |
4713 |
+@@ -741,10 +726,12 @@ gst_video_format_new_caps_strided (GstVideoFormat format, |
4714 |
+ } |
4715 |
+ |
4716 |
+ if (have_alpha) { |
4717 |
+- alpha_mask = |
4718 |
+- mask >> (8 * gst_video_format_get_component_offset (format, 3, |
4719 |
+- width, height)); |
4720 |
+- gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, alpha_mask, NULL); |
4721 |
++ /* note: we are passing a bogus width/height to get_component_offset(), |
4722 |
++ * but those parameters are ignored for the packed formats so it is ok |
4723 |
++ */ |
4724 |
++ alpha_mask = mask >> |
4725 |
++ (8 * gst_video_format_get_component_offset (format, 3, 1, 1)); |
4726 |
++ gst_structure_set (s, "alpha_mask", G_TYPE_INT, alpha_mask, NULL); |
4727 |
+ } |
4728 |
+ } else if (gst_video_format_is_gray (format)) { |
4729 |
+ int bpp; |
4730 |
+@@ -770,32 +757,68 @@ gst_video_format_new_caps_strided (GstVideoFormat format, |
4731 |
+ } |
4732 |
+ |
4733 |
+ if (bpp > 8) { |
4734 |
+- caps = gst_caps_new_simple ("video/x-raw-gray", |
4735 |
++ s = gst_structure_new (rowstride ? |
4736 |
++ "video/x-raw-gray-strided" : "video/x-raw-gray", |
4737 |
+ "bpp", G_TYPE_INT, bpp, |
4738 |
+ "depth", G_TYPE_INT, depth, |
4739 |
+- "width", G_TYPE_INT, width, |
4740 |
+- "height", G_TYPE_INT, height, |
4741 |
+- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, |
4742 |
+- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); |
4743 |
++ NULL); |
4744 |
+ } else { |
4745 |
+- caps = gst_caps_new_simple ("video/x-raw-gray", |
4746 |
++ s = gst_structure_new (rowstride ? |
4747 |
++ "video/x-raw-gray-strided" : "video/x-raw-gray", |
4748 |
+ "bpp", G_TYPE_INT, bpp, |
4749 |
+ "depth", G_TYPE_INT, depth, |
4750 |
+ "endianness", G_TYPE_INT, G_BIG_ENDIAN, |
4751 |
+- "width", G_TYPE_INT, width, |
4752 |
+- "height", G_TYPE_INT, height, |
4753 |
+- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, |
4754 |
+- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); |
4755 |
++ NULL); |
4756 |
+ } |
4757 |
+ } else { |
4758 |
+ return NULL; |
4759 |
+ } |
4760 |
+ |
4761 |
+- if (rowstride) { |
4762 |
+- gst_caps_set_simple (caps, "rowstride", G_TYPE_INT, rowstride, NULL); |
4763 |
++ if (rowstride > 0) { |
4764 |
++ gst_structure_set (s, "rowstride", |
4765 |
++ G_TYPE_INT, rowstride, NULL); |
4766 |
++ } else if (rowstride < 0) { |
4767 |
++ gst_structure_set (s, "rowstride", |
4768 |
++ GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); |
4769 |
+ } |
4770 |
+ |
4771 |
+- return caps; |
4772 |
++ va_start (varargs, fieldname); |
4773 |
++ gst_structure_set_valist (s, fieldname, varargs); |
4774 |
++ va_end (varargs); |
4775 |
++ |
4776 |
++ return gst_caps_new_full (s, NULL); |
4777 |
++} |
4778 |
++ |
4779 |
++/** |
4780 |
++ * gst_video_format_new_caps_strided: |
4781 |
++ * @format: the #GstVideoFormat describing the raw video format |
4782 |
++ * @width: width of video |
4783 |
++ * @height: height of video |
4784 |
++ * @rowstride: the rowstride (in bytes), or 0 if no rowstride |
4785 |
++ * @framerate_n: numerator of frame rate |
4786 |
++ * @framerate_d: denominator of frame rate |
4787 |
++ * @par_n: numerator of pixel aspect ratio |
4788 |
++ * @par_d: denominator of pixel aspect ratio |
4789 |
++ * |
4790 |
++ * Creates a new #GstCaps object based on the parameters provided. |
4791 |
++ * |
4792 |
++ * Since: ??? |
4793 |
++ * |
4794 |
++ * Returns: a new #GstCaps object, or NULL if there was an error |
4795 |
++ */ |
4796 |
++GstCaps * |
4797 |
++gst_video_format_new_caps_strided (GstVideoFormat format, |
4798 |
++ int width, int height, int rowstride, |
4799 |
++ int framerate_n, int framerate_d, int par_n, int par_d) |
4800 |
++{ |
4801 |
++ g_return_val_if_fail (width > 0 && height > 0, NULL); |
4802 |
++ |
4803 |
++ return gst_video_format_new_caps_simple (format, rowstride, |
4804 |
++ "width", G_TYPE_INT, width, |
4805 |
++ "height", G_TYPE_INT, height, |
4806 |
++ "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, |
4807 |
++ "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, |
4808 |
++ NULL); |
4809 |
+ } |
4810 |
+ |
4811 |
+ /** |
4812 |
+diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h |
4813 |
+index 5bac21f..bbd33f7 100644 |
4814 |
+--- a/gst-libs/gst/video/video.h |
4815 |
++++ b/gst-libs/gst/video/video.h |
4816 |
+@@ -430,6 +430,8 @@ GstCaps * gst_video_format_new_caps_interlaced (GstVideoFormat format, |
4817 |
+ GstCaps * gst_video_format_new_caps_strided (GstVideoFormat format, |
4818 |
+ int width, int height, int rowstride, |
4819 |
+ int framerate_n, int framerate_d, int par_n, int par_d); |
4820 |
++GstCaps * gst_video_format_new_caps_simple (GstVideoFormat format, |
4821 |
++ int rowstride, const char *fieldname, ...); |
4822 |
+ GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc); |
4823 |
+ guint32 gst_video_format_to_fourcc (GstVideoFormat format); |
4824 |
+ gboolean gst_video_format_is_rgb (GstVideoFormat format); |
4825 |
+-- |
4826 |
+1.7.1 |
4827 |
+ |
4828 |
|
4829 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0020-video-fix-endianess-issue-for-16bit-RGB-formats.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0020-video-fix-endianess-issue-for-16bit-RGB-formats.patch |
4830 |
new file mode 100644 |
4831 |
index 0000000..bf07cea |
4832 |
--- /dev/null |
4833 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0020-video-fix-endianess-issue-for-16bit-RGB-formats.patch |
4834 |
@@ -0,0 +1,41 @@ |
4835 |
+From 569f9ca7a8ce923d43956771e8a142a9b31114f1 Mon Sep 17 00:00:00 2001 |
4836 |
+From: Rob Clark <rob@××.com> |
4837 |
+Date: Mon, 13 Sep 2010 19:05:56 -0500 |
4838 |
+Subject: [PATCH 20/24] video: fix endianess issue for 16bit RGB formats |
4839 |
+ |
4840 |
+--- |
4841 |
+ gst-libs/gst/video/video.c | 4 +++- |
4842 |
+ 1 files changed, 3 insertions(+), 1 deletions(-) |
4843 |
+ |
4844 |
+diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c |
4845 |
+index ef8edcc..a5ec6b7 100644 |
4846 |
+--- a/gst-libs/gst/video/video.c |
4847 |
++++ b/gst-libs/gst/video/video.c |
4848 |
+@@ -625,6 +625,7 @@ gst_video_format_new_caps_simple (GstVideoFormat format, int rowstride, |
4849 |
+ int depth; |
4850 |
+ int bpp; |
4851 |
+ gboolean have_alpha; |
4852 |
++ int endianness = G_BIG_ENDIAN; |
4853 |
+ unsigned int mask = 0; |
4854 |
+ |
4855 |
+ switch (format) { |
4856 |
+@@ -708,6 +709,7 @@ gst_video_format_new_caps_simple (GstVideoFormat format, int rowstride, |
4857 |
+ default: |
4858 |
+ return NULL; |
4859 |
+ } |
4860 |
++ endianness = G_BYTE_ORDER; |
4861 |
+ } else if (bpp != 8) { |
4862 |
+ return NULL; |
4863 |
+ } |
4864 |
+@@ -719,7 +721,7 @@ gst_video_format_new_caps_simple (GstVideoFormat format, int rowstride, |
4865 |
+ |
4866 |
+ if (bpp != 8) { |
4867 |
+ gst_structure_set (s, |
4868 |
+- "endianness", G_TYPE_INT, G_BIG_ENDIAN, |
4869 |
++ "endianness", G_TYPE_INT, endianness, |
4870 |
+ "red_mask", G_TYPE_INT, red_mask, |
4871 |
+ "green_mask", G_TYPE_INT, green_mask, |
4872 |
+ "blue_mask", G_TYPE_INT, blue_mask, NULL); |
4873 |
+-- |
4874 |
+1.7.1 |
4875 |
+ |
4876 |
|
4877 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0021-stride-more-flexible-stride-color-conversion.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0021-stride-more-flexible-stride-color-conversion.patch |
4878 |
new file mode 100644 |
4879 |
index 0000000..b897c5e |
4880 |
--- /dev/null |
4881 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0021-stride-more-flexible-stride-color-conversion.patch |
4882 |
@@ -0,0 +1,1131 @@ |
4883 |
+From e8e3c9ae037daa4abd60f08bc49f370dd5f7b3c6 Mon Sep 17 00:00:00 2001 |
4884 |
+From: Rob Clark <rob@××.com> |
4885 |
+Date: Mon, 13 Sep 2010 19:10:36 -0500 |
4886 |
+Subject: [PATCH 21/24] stride: more flexible stride/color conversion |
4887 |
+ |
4888 |
+Refactor stride transform element to address a number of limitations: |
4889 |
+1) support converting buffers from one rowstride to another, in addition to |
4890 |
+just handling conversion from strided <-> unstrided. |
4891 |
+2) refactor convert code to make it easier to add new formats |
4892 |
+3) refactor caps handling code to build template caps based upon color |
4893 |
+formats listed in convert (stride_conversions table). |
4894 |
+4) refactor caps parsing/building to correctly handle RGB formats |
4895 |
+5) add support for crop.. currently we optimize by just only copying the |
4896 |
+uncropped part of the frame, but this is the first step to true handling of |
4897 |
+cropping, so that we can crop out padding for the benefit of sink elements |
4898 |
+that don't understand crop or stride. (The convert code handles it fine.. |
4899 |
+the caps parsing/building in gststridetransform.c would need to handle caps |
4900 |
+re-negotiation when the crop changes for this to be complete.) |
4901 |
+--- |
4902 |
+ gst/stride/armv7.s | 8 +- |
4903 |
+ gst/stride/convert.c | 400 ++++++++++++++++++++------------------- |
4904 |
+ gst/stride/gststridetransform.c | 375 +++++++++++++++++++++++++------------ |
4905 |
+ gst/stride/gststridetransform.h | 25 +++- |
4906 |
+ 4 files changed, 490 insertions(+), 318 deletions(-) |
4907 |
+ |
4908 |
+diff --git a/gst/stride/armv7.s b/gst/stride/armv7.s |
4909 |
+index 2697a14..5f4200d 100644 |
4910 |
+--- a/gst/stride/armv7.s |
4911 |
++++ b/gst/stride/armv7.s |
4912 |
+@@ -28,7 +28,7 @@ |
4913 |
+ .global stride_copy_zip2 |
4914 |
+ .type stride_copy_zip2, %function |
4915 |
+ @void |
4916 |
+-@stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz) |
4917 |
++@stride_copy_zip2 (guchar * out, guchar * in1, guchar * in2, gint sz) |
4918 |
+ @{ |
4919 |
+ @@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved |
4920 |
+ stride_copy_zip2: |
4921 |
+@@ -74,8 +74,8 @@ stride_copy_zip2_3: |
4922 |
+ .global stride_copy_zip3a |
4923 |
+ .type stride_copy_zip3a, %function |
4924 |
+ @void |
4925 |
+-@stride_copy_zip3a (guchar *new_buf, |
4926 |
+-@ guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, gint sz) |
4927 |
++@stride_copy_zip3a (guchar * out, |
4928 |
++@ guchar * in1, guchar * in2, guchar * in3, gint sz) |
4929 |
+ @{ |
4930 |
+ @@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved |
4931 |
+ stride_copy_zip3a: |
4932 |
+@@ -136,7 +136,7 @@ stride_copy_zip3a_3: |
4933 |
+ .global stride_copy |
4934 |
+ .type stride_copy, %function |
4935 |
+ @void |
4936 |
+-@stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) |
4937 |
++@stride_copy (guchar *out, guchar *in, gint sz) |
4938 |
+ @{ |
4939 |
+ @@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved |
4940 |
+ stride_copy: |
4941 |
+diff --git a/gst/stride/convert.c b/gst/stride/convert.c |
4942 |
+index 17f9e2a..5d392ac 100644 |
4943 |
+--- a/gst/stride/convert.c |
4944 |
++++ b/gst/stride/convert.c |
4945 |
+@@ -55,32 +55,31 @@ void stride_copy_zip3a (guchar * new_buf, guchar * orig_buf1, |
4946 |
+ void stride_copy (guchar * new_buf, guchar * orig_buf, gint sz); |
4947 |
+ |
4948 |
+ WEAK void |
4949 |
+-stride_copy_zip2 (guchar * new_buf, guchar * orig_buf1, guchar * orig_buf2, |
4950 |
+- gint sz) |
4951 |
++stride_copy_zip2 (guchar * out, guchar * in1, guchar * in2, gint sz) |
4952 |
+ { |
4953 |
+ while (sz--) { |
4954 |
+- *new_buf++ = *orig_buf1++; |
4955 |
+- *new_buf++ = *orig_buf2++; |
4956 |
++ *out++ = *in1++; |
4957 |
++ *out++ = *in2++; |
4958 |
+ } |
4959 |
+ } |
4960 |
+ |
4961 |
+ WEAK void |
4962 |
+-stride_copy_zip3a (guchar * new_buf, |
4963 |
+- guchar * orig_buf1, guchar * orig_buf2, guchar * orig_buf3, gint sz) |
4964 |
++stride_copy_zip3a (guchar * out, |
4965 |
++ guchar * in1, guchar * in2, guchar * in3, gint sz) |
4966 |
+ { |
4967 |
+ while (sz > 1) { |
4968 |
+- *new_buf++ = *orig_buf1++; |
4969 |
+- *new_buf++ = *orig_buf2++; |
4970 |
+- *new_buf++ = *orig_buf1++; |
4971 |
+- *new_buf++ = *orig_buf3++; |
4972 |
++ *out++ = *in1++; |
4973 |
++ *out++ = *in2++; |
4974 |
++ *out++ = *in1++; |
4975 |
++ *out++ = *in3++; |
4976 |
+ sz -= 2; |
4977 |
+ } |
4978 |
+ } |
4979 |
+ |
4980 |
+ WEAK void |
4981 |
+-stride_copy (guchar * new_buf, guchar * orig_buf, gint sz) |
4982 |
++stride_copy (guchar * out, guchar * in, gint sz) |
4983 |
+ { |
4984 |
+- memcpy (new_buf, orig_buf, sz); |
4985 |
++ memcpy (out, in, sz); |
4986 |
+ } |
4987 |
+ |
4988 |
+ |
4989 |
+@@ -88,31 +87,19 @@ stride_copy (guchar * new_buf, guchar * orig_buf, gint sz) |
4990 |
+ * move to strided buffer, interleaving two planes of identical dimensions |
4991 |
+ */ |
4992 |
+ static void |
4993 |
+-stridemove_zip2 (guchar * new_buf, guchar * orig_buf1, guchar * orig_buf2, |
4994 |
+- gint new_width, gint orig_width, gint height) |
4995 |
++stridemove_zip2 (guchar * out, guchar * in1, guchar * in2, |
4996 |
++ gint out_bpl, gint in_bpl, gint width, gint height) |
4997 |
+ { |
4998 |
+ int row; |
4999 |
+ |
5000 |
+ GST_DEBUG |
5001 |
+- ("new_buf=%p, orig_buf1=%p, orig_buf2=%p, new_width=%d, orig_width=%d, height=%d", |
5002 |
+- new_buf, orig_buf1, orig_buf2, new_width, orig_width, height); |
5003 |
+- |
5004 |
+- /* if increasing the stride, work from bottom-up to avoid overwriting data |
5005 |
+- * that has not been moved yet.. otherwise, work in the opposite order, |
5006 |
+- * for the same reason. |
5007 |
+- */ |
5008 |
+- if (new_width > orig_width) { |
5009 |
+- for (row = height - 1; row >= 0; row--) { |
5010 |
+- stride_copy_zip2 (new_buf + (new_width * row), |
5011 |
+- orig_buf1 + (orig_width * row), |
5012 |
+- orig_buf2 + (orig_width * row), orig_width); |
5013 |
+- } |
5014 |
+- } else { |
5015 |
+- for (row = 0; row < height; row++) { |
5016 |
+- stride_copy_zip2 (new_buf + (new_width * row), |
5017 |
+- orig_buf1 + (orig_width * row), |
5018 |
+- orig_buf2 + (orig_width * row), new_width); |
5019 |
+- } |
5020 |
++ ("out=%p, in1=%p, in2=%p, out_bpl=%d, in_bpl=%d, width=%d, height=%d", |
5021 |
++ out, in1, in2, out_bpl, in_bpl, width, height); |
5022 |
++ |
5023 |
++ for (row = 0; row < height; row++) { |
5024 |
++ stride_copy_zip2 (out + (out_bpl * row), |
5025 |
++ in1 + (in_bpl * row), |
5026 |
++ in2 + (in_bpl * row), width); |
5027 |
+ } |
5028 |
+ } |
5029 |
+ |
5030 |
+@@ -121,26 +108,28 @@ stridemove_zip2 (guchar * new_buf, guchar * orig_buf1, guchar * orig_buf2, |
5031 |
+ * (orig_buf1) has 2x as many samples.. Ie. ABACABAC.. |
5032 |
+ */ |
5033 |
+ static void |
5034 |
+-stridemove_zip3a (guchar * new_buf, |
5035 |
+- guchar * orig_buf1, guchar * orig_buf2, guchar * orig_buf3, |
5036 |
+- guint new_width, gint orig_width, gint height) |
5037 |
++stridemove_zip3a (guchar * out, |
5038 |
++ guchar * in1, guchar * in2, guchar * in3, |
5039 |
++ guint out_bpl, gint in_bpl, gint width, gint height) |
5040 |
+ { |
5041 |
+- gint copy_width = (new_width < orig_width) ? new_width : orig_width; |
5042 |
++ GST_DEBUG |
5043 |
++ ("out=%p, in1=%p, in2=%p, in3=%p, out_bpl=%d, in_bpl=%d, width=%d, height=%d", |
5044 |
++ out, in1, in2, in3, out_bpl, in_bpl, width, height); |
5045 |
+ |
5046 |
+ while (height > 0) { |
5047 |
+ |
5048 |
+ /* even row */ |
5049 |
+- stride_copy_zip3a (new_buf, orig_buf1, orig_buf2, orig_buf3, copy_width); |
5050 |
+- new_buf += new_width; |
5051 |
+- orig_buf1 += orig_width; |
5052 |
++ stride_copy_zip3a (out, in1, in2, in3, width); |
5053 |
++ out += out_bpl; |
5054 |
++ in1 += in_bpl; |
5055 |
+ |
5056 |
+ /* odd row, recycles same U & V */ |
5057 |
+- stride_copy_zip3a (new_buf, orig_buf1, orig_buf2, orig_buf3, copy_width); |
5058 |
+- new_buf += new_width; |
5059 |
+- orig_buf1 += orig_width; |
5060 |
++ stride_copy_zip3a (out, in1, in2, in3, width); |
5061 |
++ out += out_bpl; |
5062 |
++ in1 += in_bpl; |
5063 |
+ |
5064 |
+- orig_buf2 += orig_width / 2; |
5065 |
+- orig_buf3 += orig_width / 2; |
5066 |
++ in2 += in_bpl / 2; |
5067 |
++ in3 += in_bpl / 2; |
5068 |
+ |
5069 |
+ height -= 2; |
5070 |
+ } |
5071 |
+@@ -154,28 +143,18 @@ stridemove_zip3a (guchar * new_buf, |
5072 |
+ * enough. |
5073 |
+ */ |
5074 |
+ static void |
5075 |
+-stridemove (guchar * new_buf, guchar * orig_buf, gint new_width, |
5076 |
+- gint orig_width, gint height) |
5077 |
++stridemove (guchar * out, guchar * in, gint out_bpl, gint in_bpl, |
5078 |
++ gint width, gint height) |
5079 |
+ { |
5080 |
+ int row; |
5081 |
+ |
5082 |
+- GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", |
5083 |
+- new_buf, orig_buf, new_width, orig_width, height); |
5084 |
+- |
5085 |
+- /* if increasing the stride, work from bottom-up to avoid overwriting data |
5086 |
+- * that has not been moved yet.. otherwise, work in the opposite order, |
5087 |
+- * for the same reason. |
5088 |
+- */ |
5089 |
+- if (new_width > orig_width) { |
5090 |
+- for (row = height - 1; row >= 0; row--) { |
5091 |
+- stride_copy (new_buf + (new_width * row), orig_buf + (orig_width * row), |
5092 |
+- orig_width); |
5093 |
+- } |
5094 |
+- } else { |
5095 |
+- for (row = 0; row < height; row++) { |
5096 |
+- stride_copy (new_buf + (new_width * row), orig_buf + (orig_width * row), |
5097 |
+- new_width); |
5098 |
+- } |
5099 |
++ GST_DEBUG ("out=%p, in=%p, out_bpl=%d, in_bpl=%d, width=%d, height=%d", |
5100 |
++ out, in, out_bpl, in_bpl, width, height); |
5101 |
++ |
5102 |
++ for (row = 0; row < height; row++) { |
5103 |
++ stride_copy (out, in, width); |
5104 |
++ out += out_bpl; |
5105 |
++ in += in_bpl; |
5106 |
+ } |
5107 |
+ } |
5108 |
+ |
5109 |
+@@ -183,195 +162,232 @@ stridemove (guchar * new_buf, guchar * orig_buf, gint new_width, |
5110 |
+ * Conversion Functions: |
5111 |
+ */ |
5112 |
+ |
5113 |
+-/** convert 4:2:0 semiplanar to same 4:2:0 semiplanar */ |
5114 |
+-static GstFlowReturn |
5115 |
+-unstridify_420sp_420sp (GstStrideTransform * self, guchar * unstrided, |
5116 |
+- guchar * strided) |
5117 |
++/** |
5118 |
++ * helper to calculate offsets/sizes that are re-used for each frame (until |
5119 |
++ * caps or crop changes) |
5120 |
++ * @isx: input sub-sampling in x direction |
5121 |
++ * @osx: output sub-sampling in x direction |
5122 |
++ * @isy: input sub-sampling in y direction |
5123 |
++ * @isx: input sub-sampling in y direction |
5124 |
++ */ |
5125 |
++static inline gboolean refresh_cache(GstStrideTransform * self, |
5126 |
++ gint nplanes, gint bpp, gint * isx, gint * osx, gint * isy, gint * osy) |
5127 |
+ { |
5128 |
+- gint width = self->width; |
5129 |
+- gint height = self->height; |
5130 |
+- gint stride = self->in_rowstride; |
5131 |
++ gint in_off, out_off; |
5132 |
++ int i; |
5133 |
+ |
5134 |
+- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
5135 |
++ if (((self->crop_top + self->crop_height) > self->height) || |
5136 |
++ ((self->crop_left + self->crop_width) > self->width)) { |
5137 |
++ GST_ERROR_OBJECT (self, "invalid crop parameter"); |
5138 |
++ return GST_FLOW_ERROR; |
5139 |
++ } |
5140 |
+ |
5141 |
+- stridemove (unstrided, strided, width, stride, |
5142 |
+- (GST_ROUND_UP_2 (height) * 3) / 2); |
5143 |
++ in_off = out_off = 0; |
5144 |
+ |
5145 |
+- return GST_FLOW_OK; |
5146 |
+-} |
5147 |
++ for (i = 0; i < nplanes; i++) { |
5148 |
++ Cache * cache = &self->cache[i]; |
5149 |
+ |
5150 |
+-static GstFlowReturn |
5151 |
+-stridify_420sp_420sp (GstStrideTransform * self, guchar * strided, |
5152 |
+- guchar * unstrided) |
5153 |
+-{ |
5154 |
+- gint width = self->width; |
5155 |
+- gint height = self->height; |
5156 |
+- gint stride = self->out_rowstride; |
5157 |
++ cache->in_bpl = self->in_rowstride ? |
5158 |
++ self->in_rowstride : bpp * self->width; |
5159 |
+ |
5160 |
+- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
5161 |
++ cache->out_bpl = self->out_rowstride ? |
5162 |
++ self->out_rowstride : bpp * self->width; |
5163 |
+ |
5164 |
+- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
5165 |
+- stridemove (strided, unstrided, stride, width, |
5166 |
+- (GST_ROUND_UP_2 (height) * 3) / 2); |
5167 |
++ if ((cache->in_bpl < (self->width * bpp)) || |
5168 |
++ (cache->out_bpl < (self->width * bpp))) { |
5169 |
++ GST_ERROR_OBJECT (self, "invalid stride parameter"); |
5170 |
++ return GST_FLOW_ERROR; |
5171 |
++ } |
5172 |
+ |
5173 |
+- return GST_FLOW_OK; |
5174 |
+-} |
5175 |
++ cache->width = self->crop_width ? |
5176 |
++ self->crop_width : self->width; |
5177 |
+ |
5178 |
+-/** convert 4:2:0 planar to same 4:2:0 planar */ |
5179 |
+-static GstFlowReturn |
5180 |
+-unstridify_420p_420p (GstStrideTransform * self, guchar * unstrided, |
5181 |
+- guchar * strided) |
5182 |
+-{ |
5183 |
+- gint width = self->width; |
5184 |
+- gint height = self->height; |
5185 |
+- gint stride = self->in_rowstride; |
5186 |
++ cache->height = self->crop_height ? |
5187 |
++ self->crop_height : self->height; |
5188 |
+ |
5189 |
+- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
5190 |
++ if ((cache->width > self->width) || |
5191 |
++ (cache->height > self->height)) { |
5192 |
++ GST_ERROR_OBJECT (self, "invalid crop width/height parameter"); |
5193 |
++ return GST_FLOW_ERROR; |
5194 |
++ } |
5195 |
+ |
5196 |
+- stridemove (unstrided, strided, width, stride, height); /* move Y */ |
5197 |
+- stridemove (unstrided + (height * width), strided + (height * stride), width / 2, stride, height); /* move V/U */ |
5198 |
+- /* XXX odd widths/heights/strides: */ |
5199 |
+- stridemove (unstrided + (int) (height * width * 1.5), strided + (int) (height * stride * 1.5), width / 2, stride, height); /* move U/V */ |
5200 |
++ /* note: everything above here is same for each plane, so in theory we |
5201 |
++ * could only calculate on first plane, and copy on subsequent planes |
5202 |
++ */ |
5203 |
++ |
5204 |
++ /* adjust for sub-sampling and bytes per pixel (bpp): */ |
5205 |
++ cache->in_bpl /= *isx; |
5206 |
++ cache->out_bpl /= *osx; |
5207 |
++ cache->width *= bpp; |
5208 |
++ cache->width /= *isx; |
5209 |
++ cache->height /= *isy; |
5210 |
++ |
5211 |
++ /* calculate offset to beginning of data to copy/transform: */ |
5212 |
++ cache->in_off = in_off; |
5213 |
++ cache->in_off += (bpp * self->crop_left / *isx) + |
5214 |
++ (cache->in_bpl * self->crop_top / *isy); |
5215 |
++ |
5216 |
++ cache->out_off = out_off; |
5217 |
++ cache->out_off += (bpp * self->crop_left / *osx) + |
5218 |
++ (cache->out_bpl * self->crop_top / *osy); |
5219 |
++ |
5220 |
++ in_off += (self->height / *isy) * cache->in_bpl; |
5221 |
++ out_off += (self->height / *osy) * cache->out_bpl; |
5222 |
++ |
5223 |
++ osx++; |
5224 |
++ isx++; |
5225 |
++ osy++; |
5226 |
++ isy++; |
5227 |
++ } |
5228 |
+ |
5229 |
+ return GST_FLOW_OK; |
5230 |
+ } |
5231 |
+ |
5232 |
+-static GstFlowReturn |
5233 |
+-stridify_420p_420p (GstStrideTransform * self, guchar * strided, |
5234 |
+- guchar * unstrided) |
5235 |
++/** perform simple convert between buffers of same format */ |
5236 |
++static inline GstFlowReturn convert_n_n (GstStrideTransform *self, |
5237 |
++ guchar * out, guchar * in, gint nplanes) |
5238 |
+ { |
5239 |
+- gint width = self->width; |
5240 |
+- gint height = self->height; |
5241 |
+- gint stride = self->out_rowstride; |
5242 |
+- |
5243 |
+- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
5244 |
++ int i; |
5245 |
+ |
5246 |
+- /* XXX odd widths/heights/strides: */ |
5247 |
+- stridemove (strided + (int) (height * stride * 1.5), unstrided + (int) (height * width * 1.5), stride, width / 2, height); /* move U/V */ |
5248 |
+- stridemove (strided + (height * stride), unstrided + (height * width), stride, width / 2, height); /* move V/U */ |
5249 |
+- stridemove (strided, unstrided, stride, width, height); /* move Y */ |
5250 |
++ for (i = 0; i < nplanes; i++) { |
5251 |
++ stridemove (out + self->cache[i].out_off, in + self->cache[i].in_off, |
5252 |
++ self->cache[i].out_bpl, self->cache[i].in_bpl, |
5253 |
++ self->cache[i].width, self->cache[i].height); |
5254 |
++ } |
5255 |
+ |
5256 |
+ return GST_FLOW_OK; |
5257 |
+ } |
5258 |
+ |
5259 |
+-/** convert 4:2:2 packed to same 4:2:2 packed */ |
5260 |
++/** convert 4:2:0 semiplanar to same 4:2:0 semiplanar */ |
5261 |
+ static GstFlowReturn |
5262 |
+-unstridify_422i_422i (GstStrideTransform * self, guchar * unstrided, |
5263 |
+- guchar * strided) |
5264 |
++convert_420sp_420sp (GstStrideTransform * self, |
5265 |
++ guchar * out, guchar * in) |
5266 |
+ { |
5267 |
+- gint width = self->width; |
5268 |
+- gint height = self->height; |
5269 |
+- gint stride = self->in_rowstride; |
5270 |
+- |
5271 |
+- g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); |
5272 |
+- |
5273 |
+- stridemove (unstrided, strided, width * 2, stride, height); |
5274 |
++ if (G_UNLIKELY (self->needs_refresh)) { |
5275 |
++ gint sx[] = {1, 1}; |
5276 |
++ gint sy[] = {1, 2}; |
5277 |
++ if (refresh_cache (self, 2, 1, sx, sx, sy, sy)) |
5278 |
++ return GST_FLOW_ERROR; |
5279 |
++ self->needs_refresh = FALSE; |
5280 |
++ } |
5281 |
+ |
5282 |
+- return GST_FLOW_OK; |
5283 |
++ return convert_n_n (self, out, in, 2); |
5284 |
+ } |
5285 |
+ |
5286 |
++/** convert 4:2:0 planar to same 4:2:0 planar */ |
5287 |
+ static GstFlowReturn |
5288 |
+-stridify_422i_422i (GstStrideTransform * self, guchar * strided, |
5289 |
+- guchar * unstrided) |
5290 |
++convert_420p_420p (GstStrideTransform * self, |
5291 |
++ guchar * out, guchar * in) |
5292 |
+ { |
5293 |
+- gint width = self->width; |
5294 |
+- gint height = self->height; |
5295 |
+- gint stride = self->out_rowstride; |
5296 |
+- |
5297 |
+- g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); |
5298 |
+- |
5299 |
+- stridemove (strided, unstrided, stride, width * 2, height); |
5300 |
++ if (G_UNLIKELY (self->needs_refresh)) { |
5301 |
++ gint sx[] = {1, 2, 2}; |
5302 |
++ gint sy[] = {1, 2, 2}; |
5303 |
++ if (refresh_cache (self, 3, 1, sx, sx, sy, sy)) |
5304 |
++ return GST_FLOW_ERROR; |
5305 |
++ self->needs_refresh = FALSE; |
5306 |
++ } |
5307 |
+ |
5308 |
+- return GST_FLOW_OK; |
5309 |
++ return convert_n_n (self, out, in, 3); |
5310 |
+ } |
5311 |
+ |
5312 |
+-/** convert I420 unstrided to NV12 strided */ |
5313 |
++/** convert 4:2:2 packed to same 4:2:2 packed */ |
5314 |
++ |
5315 |
+ static GstFlowReturn |
5316 |
+-stridify_i420_nv12 (GstStrideTransform * self, guchar * strided, |
5317 |
+- guchar * unstrided) |
5318 |
++convert_422i_422i (GstStrideTransform * self, |
5319 |
++ guchar * out, guchar * in) |
5320 |
+ { |
5321 |
+- gint width = self->width; |
5322 |
+- gint height = self->height; |
5323 |
+- gint stride = self->out_rowstride; |
5324 |
+- |
5325 |
+- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
5326 |
+- |
5327 |
+- /* XXX widths/heights/strides that are not multiple of four??: */ |
5328 |
+- stridemove_zip2 (strided + (height * stride), unstrided + (height * width), /* U */ |
5329 |
+- unstrided + (int) (height * width * 1.25), /* V */ |
5330 |
+- stride, width / 2, height / 2); |
5331 |
+- stridemove (strided, unstrided, stride, width, height); /* Y */ |
5332 |
++ if (G_UNLIKELY (self->needs_refresh)) { |
5333 |
++ gint sx[] = {1}; |
5334 |
++ gint sy[] = {1}; |
5335 |
++ if (refresh_cache (self, 1, 2, sx, sx, sy, sy)) |
5336 |
++ return GST_FLOW_ERROR; |
5337 |
++ self->needs_refresh = FALSE; |
5338 |
++ } |
5339 |
+ |
5340 |
+- return GST_FLOW_OK; |
5341 |
++ return convert_n_n (self, out, in, 1); |
5342 |
+ } |
5343 |
+ |
5344 |
+-/** convert I420 unstrided to YUY2 strided */ |
5345 |
++/** convert I420 unstrided to NV12 strided */ |
5346 |
+ static GstFlowReturn |
5347 |
+-stridify_i420_yuy2 (GstStrideTransform * self, guchar * strided, |
5348 |
+- guchar * unstrided) |
5349 |
++convert_i420_nv12 (GstStrideTransform * self, |
5350 |
++ guchar * out, guchar * in) |
5351 |
+ { |
5352 |
+- gint width = self->width; |
5353 |
+- gint height = self->height; |
5354 |
+- gint stride = self->out_rowstride; |
5355 |
++ GstFlowReturn ret; |
5356 |
++ |
5357 |
++ if (G_UNLIKELY (self->needs_refresh)) { |
5358 |
++ gint isx[] = {1, 2, 2}; |
5359 |
++ gint osx[] = {1, 1, 1}; |
5360 |
++ gint sy[] = {1, 2, 2}; |
5361 |
++ if (refresh_cache (self, 3, 1, isx, osx, sy, sy)) |
5362 |
++ return GST_FLOW_ERROR; |
5363 |
++ self->needs_refresh = FALSE; |
5364 |
++ } |
5365 |
+ |
5366 |
+- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); |
5367 |
++ ret = convert_n_n (self, out, in, 1); |
5368 |
++ if (ret != GST_FLOW_OK) |
5369 |
++ return ret; |
5370 |
+ |
5371 |
+- /* XXX widths/heights/strides that are not multiple of four??: */ |
5372 |
+- stridemove_zip3a (strided, unstrided, /* Y */ |
5373 |
+- unstrided + (height * width), /* U */ |
5374 |
+- unstrided + (int) (height * width * 1.25), /* V */ |
5375 |
+- stride, width, height); |
5376 |
++ stridemove_zip2 (out + self->cache[1].out_off, |
5377 |
++ in + self->cache[1].in_off, /* U */ |
5378 |
++ in + self->cache[2].in_off, /* V */ |
5379 |
++ self->cache[2].out_bpl, |
5380 |
++ self->cache[1].in_bpl, |
5381 |
++ self->cache[1].width, |
5382 |
++ self->cache[1].height); |
5383 |
+ |
5384 |
+ return GST_FLOW_OK; |
5385 |
+ } |
5386 |
+ |
5387 |
+-/** convert RGB565 to RGB565 strided **/ |
5388 |
++/** convert I420 unstrided to YUY2 strided */ |
5389 |
+ static GstFlowReturn |
5390 |
+-stridify_rgb565_rgb565 (GstStrideTransform * self, guchar * strided, |
5391 |
+- guchar * unstrided) |
5392 |
++convert_i420_yuy2 (GstStrideTransform * self, |
5393 |
++ guchar * out, guchar * in) |
5394 |
+ { |
5395 |
+- gint width = self->width; |
5396 |
+- gint height = self->height; |
5397 |
+- gint stride = self->out_rowstride; |
5398 |
+- |
5399 |
+- g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); |
5400 |
++ if (G_UNLIKELY (self->needs_refresh)) { |
5401 |
++ gint sx[] = {1, 2, 2}; |
5402 |
++ gint sy[] = {1, 2, 2}; |
5403 |
++ if (refresh_cache (self, 3, 1, sx, sx, sy, sy)) |
5404 |
++ return GST_FLOW_ERROR; |
5405 |
++ self->needs_refresh = FALSE; |
5406 |
++ } |
5407 |
+ |
5408 |
+- stridemove (strided, unstrided, stride, width * 2, height); |
5409 |
++ stridemove_zip3a (out, |
5410 |
++ in + self->cache[0].in_off, /* Y */ |
5411 |
++ in + self->cache[1].in_off, /* U */ |
5412 |
++ in + self->cache[2].in_off, /* V */ |
5413 |
++ self->cache[0].out_bpl, |
5414 |
++ self->cache[0].in_bpl, |
5415 |
++ self->cache[0].width, |
5416 |
++ self->cache[0].height); |
5417 |
+ |
5418 |
+ return GST_FLOW_OK; |
5419 |
+ } |
5420 |
+ |
5421 |
+-/** convert RGB565 strided to RGB565 **/ |
5422 |
++/** convert 16bpp rgb formats */ |
5423 |
+ static GstFlowReturn |
5424 |
+-unstridify_rgb565_rgb565 (GstStrideTransform * self, guchar * strided, |
5425 |
+- guchar * unstrided) |
5426 |
++convert_rgb16_rgb16 (GstStrideTransform * self, |
5427 |
++ guchar * out, guchar * in) |
5428 |
+ { |
5429 |
+- gint width = self->width; |
5430 |
+- gint height = self->height; |
5431 |
+- gint stride = self->in_rowstride; |
5432 |
+- |
5433 |
+- g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); |
5434 |
+- |
5435 |
+- stridemove (unstrided, strided, width * 2, stride, height); |
5436 |
+- return GST_FLOW_OK; |
5437 |
++ /* format is same 2-bytes per pixel */ |
5438 |
++ return convert_422i_422i (self, out, in); |
5439 |
+ } |
5440 |
+ |
5441 |
+-#define CONVERT(tofmt, fromfmt, stridify, unstridify) \ |
5442 |
++#define CONVERT(tofmt, fromfmt, convert) \ |
5443 |
+ { \ |
5444 |
+ { GST_VIDEO_FORMAT_##tofmt, GST_VIDEO_FORMAT_##fromfmt }, \ |
5445 |
+- stridify, unstridify \ |
5446 |
++ convert \ |
5447 |
+ } |
5448 |
+ |
5449 |
+ /* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ |
5450 |
+ const Conversion stride_conversions[] = { |
5451 |
+- CONVERT (NV12, NV12, stridify_420sp_420sp, unstridify_420sp_420sp), |
5452 |
+- CONVERT (I420, I420, stridify_420p_420p, unstridify_420p_420p), |
5453 |
+- CONVERT (YV12, YV12, stridify_420p_420p, unstridify_420p_420p), |
5454 |
+- CONVERT (YUY2, YUY2, stridify_422i_422i, unstridify_422i_422i), |
5455 |
+- CONVERT (UYVY, UYVY, stridify_422i_422i, unstridify_422i_422i), |
5456 |
+- CONVERT (I420, NV12, stridify_i420_nv12, NULL), |
5457 |
+- CONVERT (I420, YUY2, stridify_i420_yuy2, NULL), |
5458 |
+- CONVERT (RGB16, RGB16, stridify_rgb565_rgb565, unstridify_rgb565_rgb565), |
5459 |
++ CONVERT (NV12, NV12, convert_420sp_420sp), |
5460 |
++ CONVERT (I420, I420, convert_420p_420p), |
5461 |
++ CONVERT (YV12, YV12, convert_420p_420p), |
5462 |
++ CONVERT (YUY2, YUY2, convert_422i_422i), |
5463 |
++ CONVERT (UYVY, UYVY, convert_422i_422i), |
5464 |
++ CONVERT (I420, NV12, convert_i420_nv12), |
5465 |
++ CONVERT (I420, YUY2, convert_i420_yuy2), |
5466 |
++ CONVERT (RGB16, RGB16, convert_rgb16_rgb16), |
5467 |
+ /* add new entries before here */ |
5468 |
+ {{GST_VIDEO_FORMAT_UNKNOWN}} |
5469 |
+ }; |
5470 |
+diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c |
5471 |
+index 4469e7f..7874ed4 100644 |
5472 |
+--- a/gst/stride/gststridetransform.c |
5473 |
++++ b/gst/stride/gststridetransform.c |
5474 |
+@@ -57,27 +57,6 @@ |
5475 |
+ /* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ |
5476 |
+ extern const Conversion stride_conversions[]; |
5477 |
+ |
5478 |
+-/* TODO: add rgb formats too! */ |
5479 |
+-#define YUV_SUPPORTED_CAPS \ |
5480 |
+- GST_VIDEO_CAPS_YUV_STRIDED ("{I420, YV12, YUY2, UYVY, NV12 }", "[ 0, max ]") |
5481 |
+- |
5482 |
+-#define RGB_SUPPORTED_CAPS \ |
5483 |
+- GST_VIDEO_CAPS_RGB_16_STRIDED ("[ 0, max ]") |
5484 |
+- |
5485 |
+- |
5486 |
+-static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", |
5487 |
+- GST_PAD_SRC, |
5488 |
+- GST_PAD_ALWAYS, |
5489 |
+- GST_STATIC_CAPS (YUV_SUPPORTED_CAPS ";" RGB_SUPPORTED_CAPS) |
5490 |
+- ); |
5491 |
+- |
5492 |
+-static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", |
5493 |
+- GST_PAD_SINK, |
5494 |
+- GST_PAD_ALWAYS, |
5495 |
+- GST_STATIC_CAPS (YUV_SUPPORTED_CAPS ";" RGB_SUPPORTED_CAPS) |
5496 |
+- ); |
5497 |
+- |
5498 |
+- |
5499 |
+ GST_DEBUG_CATEGORY (stridetransform_debug); |
5500 |
+ #define GST_CAT_DEFAULT stridetransform_debug |
5501 |
+ |
5502 |
+@@ -85,6 +64,8 @@ GST_DEBUG_CATEGORY (stridetransform_debug); |
5503 |
+ static void gst_stride_transform_dispose (GObject * obj); |
5504 |
+ |
5505 |
+ /* GstBaseTransform functions */ |
5506 |
++static gboolean gst_stride_transform_event (GstBaseTransform * trans, |
5507 |
++ GstEvent * event); |
5508 |
+ static gboolean gst_stride_transform_get_unit_size (GstBaseTransform * base, |
5509 |
+ GstCaps * caps, guint * size); |
5510 |
+ static gboolean gst_stride_transform_transform_size (GstBaseTransform * base, |
5511 |
+@@ -96,6 +77,7 @@ static gboolean gst_stride_transform_set_caps (GstBaseTransform * base, |
5512 |
+ GstCaps * incaps, GstCaps * outcaps); |
5513 |
+ static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, |
5514 |
+ GstBuffer * inbuf, GstBuffer * outbuf); |
5515 |
++static GstCaps * get_all_templ_caps (GstPadDirection direction); |
5516 |
+ |
5517 |
+ GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, |
5518 |
+ GST_TYPE_VIDEO_FILTER); |
5519 |
+@@ -115,9 +97,11 @@ gst_stride_transform_base_init (gpointer g_class) |
5520 |
+ "Rob Clark <rob@××.com>,"); |
5521 |
+ |
5522 |
+ gst_element_class_add_pad_template (gstelement_class, |
5523 |
+- gst_static_pad_template_get (&sink_template)); |
5524 |
++ gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, |
5525 |
++ get_all_templ_caps (GST_PAD_SINK))); |
5526 |
+ gst_element_class_add_pad_template (gstelement_class, |
5527 |
+- gst_static_pad_template_get (&src_template)); |
5528 |
++ gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, |
5529 |
++ get_all_templ_caps (GST_PAD_SRC))); |
5530 |
+ } |
5531 |
+ |
5532 |
+ static void |
5533 |
+@@ -128,6 +112,8 @@ gst_stride_transform_class_init (GstStrideTransformClass * klass) |
5534 |
+ |
5535 |
+ gobject_class->dispose = gst_stride_transform_dispose; |
5536 |
+ |
5537 |
++ basetransform_class->event = |
5538 |
++ GST_DEBUG_FUNCPTR (gst_stride_transform_event); |
5539 |
+ basetransform_class->get_unit_size = |
5540 |
+ GST_DEBUG_FUNCPTR (gst_stride_transform_get_unit_size); |
5541 |
+ basetransform_class->transform_size = |
5542 |
+@@ -160,6 +146,35 @@ gst_stride_transform_dispose (GObject * object) |
5543 |
+ G_OBJECT_CLASS (parent_class)->dispose (object); |
5544 |
+ } |
5545 |
+ |
5546 |
++static gboolean |
5547 |
++gst_stride_transform_event (GstBaseTransform * trans, GstEvent * event) |
5548 |
++{ |
5549 |
++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (trans); |
5550 |
++ |
5551 |
++ GST_DEBUG_OBJECT (self, "event %" GST_PTR_FORMAT, event); |
5552 |
++ |
5553 |
++ switch (GST_EVENT_TYPE (event)) { |
5554 |
++ /* if we get a crop, we don't change output size (yet, although it |
5555 |
++ * would be nice to be able to figure out if the sink supported |
5556 |
++ * cropping and if it does not perform the crop ourselves.. which |
5557 |
++ * would involve adjusting output caps appropriately). For now |
5558 |
++ * we just treat it as an optimization and avoid copying the data |
5559 |
++ * that will be later cropped out by the sink. |
5560 |
++ */ |
5561 |
++ case GST_EVENT_CROP: |
5562 |
++ gst_event_parse_crop (event, &self->crop_top, &self->crop_left, |
5563 |
++ &self->crop_width, &self->crop_height); |
5564 |
++ self->needs_refresh = TRUE; |
5565 |
++ GST_DEBUG_OBJECT (self, "cropping at %d,%d %dx%d", self->crop_top, |
5566 |
++ self->crop_left, self->crop_width, self->crop_height); |
5567 |
++ default: |
5568 |
++ break; |
5569 |
++ } |
5570 |
++ |
5571 |
++ /* forward all events */ |
5572 |
++ return TRUE; |
5573 |
++} |
5574 |
++ |
5575 |
+ /** |
5576 |
+ * figure out the required buffer size based on @caps |
5577 |
+ */ |
5578 |
+@@ -212,95 +227,205 @@ gst_stride_transform_transform_size (GstBaseTransform * base, |
5579 |
+ return TRUE; |
5580 |
+ } |
5581 |
+ |
5582 |
++static inline GstCaps * |
5583 |
++get_templ_caps (GstVideoFormat fmt, gboolean strided) |
5584 |
++{ |
5585 |
++ return gst_video_format_new_caps_simple (fmt, |
5586 |
++ strided ? -1 : 0, |
5587 |
++ "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, |
5588 |
++ "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, |
5589 |
++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, |
5590 |
++ NULL); |
5591 |
++} |
5592 |
++ |
5593 |
+ /** |
5594 |
+- * helper to check possible @fourcc conversions to the list @formats |
5595 |
++ * Utility to get all possible template caps for given direction |
5596 |
+ */ |
5597 |
+-static void |
5598 |
+-add_all_fourcc_conversions (GValue * formats, guint32 fourcc, |
5599 |
+- GstPadDirection direction) |
5600 |
++static GstCaps * |
5601 |
++get_all_templ_caps (GstPadDirection direction) |
5602 |
+ { |
5603 |
++ int i; |
5604 |
+ gint to_format = (direction == GST_PAD_SINK) ? 1 : 0; |
5605 |
+- gint from_format = (direction == GST_PAD_SRC) ? 1 : 0; |
5606 |
+- GValue fourccval = { 0 }; |
5607 |
+- gint i; |
5608 |
+- GstVideoFormat format = gst_video_format_from_fourcc (fourcc); |
5609 |
+- |
5610 |
+- g_value_init (&fourccval, GST_TYPE_FOURCC); |
5611 |
++ GstCaps *templ = gst_caps_new_empty (); |
5612 |
+ |
5613 |
+- for (i = 0; stride_conversions[i].format[0] != GST_VIDEO_FORMAT_UNKNOWN; i++) { |
5614 |
+- if (stride_conversions[i].format[from_format] == format) { |
5615 |
+- guint result_fourcc = |
5616 |
+- gst_video_format_to_fourcc (stride_conversions[i].format[to_format]); |
5617 |
+- gst_value_set_fourcc (&fourccval, result_fourcc); |
5618 |
+- gst_value_list_append_value (formats, &fourccval); |
5619 |
+- } |
5620 |
++ for (i = 0; stride_conversions[i].format[0]; i++) { |
5621 |
++ const Conversion *c = &stride_conversions[i]; |
5622 |
++ gst_caps_append (templ, get_templ_caps (c->format[to_format], TRUE)); |
5623 |
++ gst_caps_append (templ, get_templ_caps (c->format[to_format], FALSE)); |
5624 |
+ } |
5625 |
++ |
5626 |
++ gst_caps_do_simplify (templ); |
5627 |
++ |
5628 |
++ GST_DEBUG ("template %s caps: %"GST_PTR_FORMAT, |
5629 |
++ (direction == GST_PAD_SINK) ? "sink" : "src", templ); |
5630 |
++ |
5631 |
++ return templ; |
5632 |
+ } |
5633 |
+ |
5634 |
+-/** |
5635 |
+- * helper to add all fields, other than rowstride to @caps, copied from @s. |
5636 |
+- */ |
5637 |
+-static void |
5638 |
+-add_all_fields (GstCaps * caps, const gchar * name, GstStructure * s, |
5639 |
+- gboolean rowstride, GstPadDirection direction) |
5640 |
++static inline gboolean |
5641 |
++is_filtered_field (const gchar *name) |
5642 |
+ { |
5643 |
+- gint idx; |
5644 |
+- GstStructure *new_s = gst_structure_new (name, NULL); |
5645 |
++ static const gchar * filtered_fields[] = { |
5646 |
++ "rowstride", "format", "bpp", "depth", "endianness", |
5647 |
++ "red_mask", "green_mask", "blue_mask" |
5648 |
++ }; |
5649 |
++ gint i; |
5650 |
++ for (i = 0; i < G_N_ELEMENTS (filtered_fields); i++) |
5651 |
++ if (!strcmp (filtered_fields[i], name)) |
5652 |
++ return TRUE; |
5653 |
++ return FALSE; |
5654 |
++} |
5655 |
+ |
5656 |
+- if (rowstride) { |
5657 |
+- gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, G_MAXINT, |
5658 |
+- NULL); |
5659 |
+- } |
5660 |
++static inline GstCaps * |
5661 |
++get_caps (GstVideoFormat fmt, gboolean strided, GstStructure *s) |
5662 |
++{ |
5663 |
++ gint idx; |
5664 |
++ GstCaps *ret = |
5665 |
++ gst_video_format_new_caps_simple (fmt, strided ? -1 : 0, NULL); |
5666 |
+ |
5667 |
+ idx = gst_structure_n_fields (s) - 1; |
5668 |
+ while (idx >= 0) { |
5669 |
+ const gchar *name = gst_structure_nth_field_name (s, idx); |
5670 |
+- const GValue *val = gst_structure_get_value (s, name); |
5671 |
+ |
5672 |
+ idx--; |
5673 |
+ |
5674 |
+- /* for format field, check the stride_conversions table to see what |
5675 |
+- * we can support: |
5676 |
++ /* filter out certain format specific fields.. copy everything else |
5677 |
++ * from the original struct |
5678 |
+ */ |
5679 |
+- if (!strcmp ("format", name)) { |
5680 |
+- GValue formats = { 0 }; |
5681 |
+- |
5682 |
+- g_value_init (&formats, GST_TYPE_LIST); |
5683 |
++ if (!is_filtered_field (name)) { |
5684 |
++ const GValue *val = gst_structure_get_value (s, name); |
5685 |
++ gst_caps_set_value (ret, name, val); |
5686 |
++ } |
5687 |
++ } |
5688 |
+ |
5689 |
+- if (GST_VALUE_HOLDS_FOURCC (val)) { |
5690 |
+- add_all_fourcc_conversions (&formats, |
5691 |
+- gst_value_get_fourcc (val), direction); |
5692 |
+- } else if (GST_VALUE_HOLDS_LIST (val)) { |
5693 |
+- gint i; |
5694 |
+- for (i = 0; i < gst_value_list_get_size (val); i++) { |
5695 |
+- const GValue *list_val = gst_value_list_get_value (val, i); |
5696 |
+- if (GST_VALUE_HOLDS_FOURCC (list_val)) { |
5697 |
+- add_all_fourcc_conversions (&formats, |
5698 |
+- gst_value_get_fourcc (list_val), direction); |
5699 |
+- } else { |
5700 |
+- GST_WARNING ("malformed caps!!"); |
5701 |
+- break; |
5702 |
+- } |
5703 |
+- } |
5704 |
+- } else { |
5705 |
+- GST_WARNING ("malformed caps!!"); |
5706 |
+- } |
5707 |
++ return ret; |
5708 |
++} |
5709 |
+ |
5710 |
+- gst_structure_set_value (new_s, "format", &formats); |
5711 |
++/** |
5712 |
++ * Utility to get all possible caps that can be converted to/from (depending |
5713 |
++ * on 'direction') the specified 'fmt'. The rest of the fields are populated |
5714 |
++ * from 's' |
5715 |
++ */ |
5716 |
++static GstCaps * |
5717 |
++get_all_caps (GstPadDirection direction, GstVideoFormat fmt, GstStructure *s) |
5718 |
++{ |
5719 |
++ GstCaps *ret = gst_caps_new_empty (); |
5720 |
++ gint to_format = (direction == GST_PAD_SINK) ? 1 : 0; |
5721 |
++ gint from_format = (direction == GST_PAD_SRC) ? 1 : 0; |
5722 |
++ gint i; |
5723 |
+ |
5724 |
+- continue; |
5725 |
++ for (i = 0; stride_conversions[i].format[0]; i++) { |
5726 |
++ const Conversion *c = &stride_conversions[i]; |
5727 |
++ if (c->format[from_format] == fmt) { |
5728 |
++ gst_caps_append (ret, get_caps (c->format[to_format], TRUE, s)); |
5729 |
++ gst_caps_append (ret, get_caps (c->format[to_format], FALSE, s)); |
5730 |
+ } |
5731 |
++ } |
5732 |
++ |
5733 |
++ return ret; |
5734 |
++} |
5735 |
+ |
5736 |
+- /* copy over all other non-rowstride fields: */ |
5737 |
+- if (strcmp ("rowstride", name)) { |
5738 |
+- gst_structure_set_value (new_s, name, val); |
5739 |
++/** convert GValue holding fourcc to GstVideoFormat (for YUV) */ |
5740 |
++static inline GstVideoFormat |
5741 |
++fmt_from_val (const GValue *val) |
5742 |
++{ |
5743 |
++ return gst_video_format_from_fourcc (gst_value_get_fourcc (val)); |
5744 |
++} |
5745 |
++ |
5746 |
++/** convert structure to GstVideoFormat (for RGB) */ |
5747 |
++static inline GstVideoFormat |
5748 |
++fmt_from_struct (const GstStructure *s) |
5749 |
++{ |
5750 |
++ /* hmm.. this is not supporting any case where ranges/lists are used |
5751 |
++ * for any of the rgb related fields in the caps. But I'm not quite |
5752 |
++ * sure a sane way to handle that.. rgb caps suck |
5753 |
++ */ |
5754 |
++ gint depth, bpp, endianness; |
5755 |
++ gint red_mask, green_mask, blue_mask, alpha_mask; |
5756 |
++ gboolean have_alpha, ok = TRUE; |
5757 |
++ |
5758 |
++ ok &= gst_structure_get_int (s, "depth", &depth); |
5759 |
++ ok &= gst_structure_get_int (s, "bpp", &bpp); |
5760 |
++ ok &= gst_structure_get_int (s, "endianness", &endianness); |
5761 |
++ ok &= gst_structure_get_int (s, "red_mask", &red_mask); |
5762 |
++ ok &= gst_structure_get_int (s, "green_mask", &green_mask); |
5763 |
++ ok &= gst_structure_get_int (s, "blue_mask", &blue_mask); |
5764 |
++ have_alpha = gst_structure_get_int (s, "alpha_mask", &alpha_mask); |
5765 |
++ |
5766 |
++ if (!ok) |
5767 |
++ return GST_VIDEO_FORMAT_UNKNOWN; |
5768 |
++ |
5769 |
++ if (depth == 24 && bpp == 32 && endianness == G_BIG_ENDIAN) { |
5770 |
++ if (red_mask == 0xff000000 && green_mask == 0x00ff0000 && |
5771 |
++ blue_mask == 0x0000ff00) { |
5772 |
++ return GST_VIDEO_FORMAT_RGBx; |
5773 |
++ } |
5774 |
++ if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 && |
5775 |
++ blue_mask == 0xff000000) { |
5776 |
++ return GST_VIDEO_FORMAT_BGRx; |
5777 |
++ } |
5778 |
++ if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 && |
5779 |
++ blue_mask == 0x000000ff) { |
5780 |
++ return GST_VIDEO_FORMAT_xRGB; |
5781 |
++ } |
5782 |
++ if (red_mask == 0x000000ff && green_mask == 0x0000ff00 && |
5783 |
++ blue_mask == 0x00ff0000) { |
5784 |
++ return GST_VIDEO_FORMAT_xBGR; |
5785 |
++ } |
5786 |
++ } else if (depth == 32 && bpp == 32 && endianness == G_BIG_ENDIAN && |
5787 |
++ have_alpha) { |
5788 |
++ if (red_mask == 0xff000000 && green_mask == 0x00ff0000 && |
5789 |
++ blue_mask == 0x0000ff00 && alpha_mask == 0x000000ff) { |
5790 |
++ return GST_VIDEO_FORMAT_RGBA; |
5791 |
++ } |
5792 |
++ if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 && |
5793 |
++ blue_mask == 0xff000000 && alpha_mask == 0x000000ff) { |
5794 |
++ return GST_VIDEO_FORMAT_BGRA; |
5795 |
++ } |
5796 |
++ if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 && |
5797 |
++ blue_mask == 0x000000ff && alpha_mask == 0xff000000) { |
5798 |
++ return GST_VIDEO_FORMAT_ARGB; |
5799 |
++ } |
5800 |
++ if (red_mask == 0x000000ff && green_mask == 0x0000ff00 && |
5801 |
++ blue_mask == 0x00ff0000 && alpha_mask == 0xff000000) { |
5802 |
++ return GST_VIDEO_FORMAT_ABGR; |
5803 |
++ } |
5804 |
++ } else if (depth == 24 && bpp == 24 && endianness == G_BIG_ENDIAN) { |
5805 |
++ if (red_mask == 0xff0000 && green_mask == 0x00ff00 && |
5806 |
++ blue_mask == 0x0000ff) { |
5807 |
++ return GST_VIDEO_FORMAT_RGB; |
5808 |
++ } |
5809 |
++ if (red_mask == 0x0000ff && green_mask == 0x00ff00 && |
5810 |
++ blue_mask == 0xff0000) { |
5811 |
++ return GST_VIDEO_FORMAT_BGR; |
5812 |
++ } |
5813 |
++ } else if ((depth == 15 || depth == 16) && bpp == 16 && |
5814 |
++ endianness == G_BYTE_ORDER) { |
5815 |
++ if (red_mask == GST_VIDEO_COMP1_MASK_16_INT |
5816 |
++ && green_mask == GST_VIDEO_COMP2_MASK_16_INT |
5817 |
++ && blue_mask == GST_VIDEO_COMP3_MASK_16_INT) { |
5818 |
++ return GST_VIDEO_FORMAT_RGB16; |
5819 |
++ } |
5820 |
++ if (red_mask == GST_VIDEO_COMP3_MASK_16_INT |
5821 |
++ && green_mask == GST_VIDEO_COMP2_MASK_16_INT |
5822 |
++ && blue_mask == GST_VIDEO_COMP1_MASK_16_INT) { |
5823 |
++ return GST_VIDEO_FORMAT_BGR16; |
5824 |
++ } |
5825 |
++ if (red_mask == GST_VIDEO_COMP1_MASK_15_INT |
5826 |
++ && green_mask == GST_VIDEO_COMP2_MASK_15_INT |
5827 |
++ && blue_mask == GST_VIDEO_COMP3_MASK_15_INT) { |
5828 |
++ return GST_VIDEO_FORMAT_RGB15; |
5829 |
++ } |
5830 |
++ if (red_mask == GST_VIDEO_COMP3_MASK_15_INT |
5831 |
++ && green_mask == GST_VIDEO_COMP2_MASK_15_INT |
5832 |
++ && blue_mask == GST_VIDEO_COMP1_MASK_15_INT) { |
5833 |
++ return GST_VIDEO_FORMAT_BGR15; |
5834 |
+ } |
5835 |
+ } |
5836 |
+ |
5837 |
+- gst_caps_merge_structure (caps, new_s); |
5838 |
++ return GST_VIDEO_FORMAT_UNKNOWN; |
5839 |
+ } |
5840 |
+ |
5841 |
+- |
5842 |
+ /** |
5843 |
+ * we can transform @caps to strided or non-strided caps with otherwise |
5844 |
+ * identical parameters |
5845 |
+@@ -310,31 +435,50 @@ gst_stride_transform_transform_caps (GstBaseTransform * base, |
5846 |
+ GstPadDirection direction, GstCaps * caps) |
5847 |
+ { |
5848 |
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); |
5849 |
+- GstCaps *ret; |
5850 |
+- GstStructure *s; |
5851 |
+- |
5852 |
+- g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL); |
5853 |
+- |
5854 |
+- GST_DEBUG_OBJECT (self, "direction=%d, caps=%p", direction, caps); |
5855 |
+- LOG_CAPS (self, caps); |
5856 |
+- |
5857 |
+- ret = gst_caps_new_empty (); |
5858 |
+- s = gst_caps_get_structure (caps, 0); |
5859 |
+- |
5860 |
+- if (gst_structure_has_name (s, "video/x-raw-yuv") || |
5861 |
+- gst_structure_has_name (s, "video/x-raw-yuv-strided")) { |
5862 |
+- |
5863 |
+- add_all_fields (ret, "video/x-raw-yuv", s, FALSE, direction); |
5864 |
+- add_all_fields (ret, "video/x-raw-yuv-strided", s, TRUE, direction); |
5865 |
+- |
5866 |
+- } else if (gst_structure_has_name (s, "video/x-raw-rgb") || |
5867 |
+- gst_structure_has_name (s, "video/x-raw-rgb-strided")) { |
5868 |
+- |
5869 |
+- add_all_fields (ret, "video/x-raw-rgb", s, FALSE, direction); |
5870 |
+- add_all_fields (ret, "video/x-raw-rgb-strided", s, TRUE, direction); |
5871 |
++ GstCaps *ret = gst_caps_new_empty (); |
5872 |
++ int i; |
5873 |
++ |
5874 |
++ for (i = 0; i < gst_caps_get_size (caps); i++) { |
5875 |
++ GstStructure *s = gst_caps_get_structure (caps, i); |
5876 |
++ const char *name = gst_structure_get_name (s); |
5877 |
++ |
5878 |
++ /* this is a bit ugly.. ideally it would be easier to parse caps |
5879 |
++ * a bit more generically without having to care so much about |
5880 |
++ * difference between RGB and YUV.. but YUV can be specified as |
5881 |
++ * a list of format params, whereas RGB is a combination of many |
5882 |
++ * fields.. |
5883 |
++ */ |
5884 |
++ if (g_str_has_prefix (name, "video/x-raw-yuv")) { |
5885 |
++ const GValue *val = gst_structure_get_value (s, "format"); |
5886 |
+ |
5887 |
++ if (GST_VALUE_HOLDS_FOURCC (val)) { |
5888 |
++ gst_caps_append (ret, |
5889 |
++ get_all_caps (direction, fmt_from_val (val), s)); |
5890 |
++ } else if (GST_VALUE_HOLDS_LIST (val)) { |
5891 |
++ gint j; |
5892 |
++ for (j = 0; j < gst_value_list_get_size (val); j++) { |
5893 |
++ const GValue *list_val = gst_value_list_get_value (val, j); |
5894 |
++ if (GST_VALUE_HOLDS_FOURCC (list_val)) { |
5895 |
++ gst_caps_append (ret, |
5896 |
++ get_all_caps (direction, fmt_from_val (list_val), s)); |
5897 |
++ } else { |
5898 |
++ GST_WARNING_OBJECT (self, |
5899 |
++ "malformed format in caps: %"GST_PTR_FORMAT, s); |
5900 |
++ break; |
5901 |
++ } |
5902 |
++ } |
5903 |
++ } else { |
5904 |
++ GST_WARNING_OBJECT (self, "malformed yuv caps: %"GST_PTR_FORMAT, s); |
5905 |
++ } |
5906 |
++ } else if (g_str_has_prefix (name, "video/x-raw-rgb")) { |
5907 |
++ gst_caps_append (ret, get_all_caps (direction, fmt_from_struct (s), s)); |
5908 |
++ } else { |
5909 |
++ GST_WARNING_OBJECT (self, "ignoring: %"GST_PTR_FORMAT, s); |
5910 |
++ } |
5911 |
+ } |
5912 |
+ |
5913 |
++ gst_caps_do_simplify (ret); |
5914 |
++ |
5915 |
+ LOG_CAPS (self, ret); |
5916 |
+ |
5917 |
+ return ret; |
5918 |
+@@ -369,6 +513,7 @@ gst_stride_transform_set_caps (GstBaseTransform * base, |
5919 |
+ (stride_conversions[i].format[1] == out_format)) { |
5920 |
+ GST_DEBUG_OBJECT (self, "found stride_conversion: %d", i); |
5921 |
+ self->conversion = &stride_conversions[i]; |
5922 |
++ self->needs_refresh = TRUE; |
5923 |
+ break; |
5924 |
+ } |
5925 |
+ } |
5926 |
+@@ -378,10 +523,6 @@ gst_stride_transform_set_caps (GstBaseTransform * base, |
5927 |
+ i, self->conversion, self->in_rowstride, self->out_rowstride); |
5928 |
+ |
5929 |
+ g_return_val_if_fail (self->conversion, FALSE); |
5930 |
+- g_return_val_if_fail (self->conversion->unstridify |
5931 |
+- || !self->in_rowstride, FALSE); |
5932 |
+- g_return_val_if_fail (self->conversion->stridify |
5933 |
+- || !self->out_rowstride, FALSE); |
5934 |
+ g_return_val_if_fail (self->width == width, FALSE); |
5935 |
+ g_return_val_if_fail (self->height == height, FALSE); |
5936 |
+ |
5937 |
+@@ -399,20 +540,14 @@ gst_stride_transform_transform (GstBaseTransform * base, |
5938 |
+ GST_DEBUG_OBJECT (self, "inbuf=%p (size=%d), outbuf=%p (size=%d)", |
5939 |
+ inbuf, GST_BUFFER_SIZE (inbuf), outbuf, GST_BUFFER_SIZE (outbuf)); |
5940 |
+ |
5941 |
+- if (self->in_rowstride && self->out_rowstride) { |
5942 |
+- GST_DEBUG_OBJECT (self, "not implemented"); // TODO |
5943 |
+- return GST_FLOW_ERROR; |
5944 |
+- } else if (self->in_rowstride) { |
5945 |
+- return self->conversion->unstridify (self, |
5946 |
+- GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); |
5947 |
+- } else if (self->out_rowstride) { |
5948 |
+- return self->conversion->stridify (self, |
5949 |
++ if (self->conversion) { |
5950 |
++ return self->conversion->convert (self, |
5951 |
+ GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); |
5952 |
+ } |
5953 |
+ |
5954 |
+ GST_DEBUG_OBJECT (self, |
5955 |
+- "this shouldn't happen! in_rowstride=%d, out_rowstride=%d", |
5956 |
+- self->in_rowstride, self->out_rowstride); |
5957 |
++ "this shouldn't happen! in_rowstride=%d, out_rowstride=%d, conversion=%p", |
5958 |
++ self->in_rowstride, self->out_rowstride, self->conversion); |
5959 |
+ |
5960 |
+ return GST_FLOW_ERROR; |
5961 |
+ } |
5962 |
+diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h |
5963 |
+index bce2526..34733cd 100644 |
5964 |
+--- a/gst/stride/gststridetransform.h |
5965 |
++++ b/gst/stride/gststridetransform.h |
5966 |
+@@ -52,11 +52,18 @@ typedef struct { |
5967 |
+ |
5968 |
+ GstVideoFormat format[2]; /* in_format, out_format */ |
5969 |
+ |
5970 |
+- GstFlowReturn (*stridify) (GstStrideTransform *self, guchar *strided, guchar *unstrided); |
5971 |
+- GstFlowReturn (*unstridify) (GstStrideTransform *self, guchar *unstrided, guchar *strided); |
5972 |
++ GstFlowReturn (*convert) (GstStrideTransform *self, guchar *out, guchar *in); |
5973 |
+ |
5974 |
+ } Conversion; |
5975 |
+ |
5976 |
++typedef struct { |
5977 |
++ gint in_bpl; /* bytes per line in input */ |
5978 |
++ gint out_bpl; /* bytes per line in output */ |
5979 |
++ gint in_off; |
5980 |
++ gint out_off; |
5981 |
++ gint width; |
5982 |
++ gint height; |
5983 |
++} Cache; |
5984 |
+ |
5985 |
+ /** |
5986 |
+ * GstStrideTransform: |
5987 |
+@@ -67,9 +74,23 @@ struct _GstStrideTransform { |
5988 |
+ GstVideoFilter videofilter; |
5989 |
+ |
5990 |
+ /*< private >*/ |
5991 |
++ |
5992 |
++ /* values set from caps: */ |
5993 |
+ gint width, height; |
5994 |
+ gint in_rowstride; |
5995 |
+ gint out_rowstride; |
5996 |
++ |
5997 |
++ /* values set from set from crop event: */ |
5998 |
++ gint crop_width, crop_height, crop_top, crop_left; |
5999 |
++ |
6000 |
++ /* cached values used for each conversion, indexed by plane in case of |
6001 |
++ * multi-planar formats. These won't have zero values meaning not-used |
6002 |
++ * (as long as !needs_refresh), but will be set to whatever byte width/ |
6003 |
++ * offset is appropriate for the format. |
6004 |
++ */ |
6005 |
++ Cache cache[3]; |
6006 |
++ gboolean needs_refresh; |
6007 |
++ |
6008 |
+ const Conversion *conversion; |
6009 |
+ |
6010 |
+ /* for caching the tranform_size() results.. */ |
6011 |
+-- |
6012 |
+1.7.1 |
6013 |
+ |
6014 |
|
6015 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0022-stride-support-for-32bit-RGB-formats.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0022-stride-support-for-32bit-RGB-formats.patch |
6016 |
new file mode 100644 |
6017 |
index 0000000..ac56a08 |
6018 |
--- /dev/null |
6019 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0022-stride-support-for-32bit-RGB-formats.patch |
6020 |
@@ -0,0 +1,54 @@ |
6021 |
+From 30b32e864e9a77b66a36d27d3b071f59633d08b7 Mon Sep 17 00:00:00 2001 |
6022 |
+From: Rob Clark <rob@××.com> |
6023 |
+Date: Mon, 13 Sep 2010 19:16:02 -0500 |
6024 |
+Subject: [PATCH 22/24] stride: support for 32bit RGB formats |
6025 |
+ |
6026 |
+--- |
6027 |
+ gst/stride/convert.c | 24 ++++++++++++++++++++++++ |
6028 |
+ 1 files changed, 24 insertions(+), 0 deletions(-) |
6029 |
+ |
6030 |
+diff --git a/gst/stride/convert.c b/gst/stride/convert.c |
6031 |
+index 5d392ac..7f976a5 100644 |
6032 |
+--- a/gst/stride/convert.c |
6033 |
++++ b/gst/stride/convert.c |
6034 |
+@@ -372,6 +372,22 @@ convert_rgb16_rgb16 (GstStrideTransform * self, |
6035 |
+ return convert_422i_422i (self, out, in); |
6036 |
+ } |
6037 |
+ |
6038 |
++/** convert 32bbp rgb formats */ |
6039 |
++static GstFlowReturn |
6040 |
++convert_rgb32_rgb32 (GstStrideTransform * self, |
6041 |
++ guchar * out, guchar * in) |
6042 |
++{ |
6043 |
++ if (G_UNLIKELY (self->needs_refresh)) { |
6044 |
++ gint sx[] = {1}; |
6045 |
++ gint sy[] = {1}; |
6046 |
++ if (refresh_cache (self, 1, 4, sx, sx, sy, sy)) |
6047 |
++ return GST_FLOW_ERROR; |
6048 |
++ self->needs_refresh = FALSE; |
6049 |
++ } |
6050 |
++ |
6051 |
++ return convert_n_n (self, out, in, 1); |
6052 |
++} |
6053 |
++ |
6054 |
+ #define CONVERT(tofmt, fromfmt, convert) \ |
6055 |
+ { \ |
6056 |
+ { GST_VIDEO_FORMAT_##tofmt, GST_VIDEO_FORMAT_##fromfmt }, \ |
6057 |
+@@ -388,6 +404,14 @@ const Conversion stride_conversions[] = { |
6058 |
+ CONVERT (I420, NV12, convert_i420_nv12), |
6059 |
+ CONVERT (I420, YUY2, convert_i420_yuy2), |
6060 |
+ CONVERT (RGB16, RGB16, convert_rgb16_rgb16), |
6061 |
++ CONVERT (RGBx, RGBx, convert_rgb32_rgb32), |
6062 |
++ CONVERT (BGRx, BGRx, convert_rgb32_rgb32), |
6063 |
++ CONVERT (xRGB, xRGB, convert_rgb32_rgb32), |
6064 |
++ CONVERT (xBGR, xBGR, convert_rgb32_rgb32), |
6065 |
++ CONVERT (RGBA, RGBA, convert_rgb32_rgb32), |
6066 |
++ CONVERT (BGRA, BGRA, convert_rgb32_rgb32), |
6067 |
++ CONVERT (ARGB, ARGB, convert_rgb32_rgb32), |
6068 |
++ CONVERT (ABGR, ABGR, convert_rgb32_rgb32), |
6069 |
+ /* add new entries before here */ |
6070 |
+ {{GST_VIDEO_FORMAT_UNKNOWN}} |
6071 |
+ }; |
6072 |
+-- |
6073 |
+1.7.1 |
6074 |
+ |
6075 |
|
6076 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0023-ffmpegcolorspace-support-for-rowstride.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0023-ffmpegcolorspace-support-for-rowstride.patch |
6077 |
new file mode 100644 |
6078 |
index 0000000..d81de9c |
6079 |
--- /dev/null |
6080 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0023-ffmpegcolorspace-support-for-rowstride.patch |
6081 |
@@ -0,0 +1,410 @@ |
6082 |
+From 379447918aafc7f38a79219511764f6c04a2cbf9 Mon Sep 17 00:00:00 2001 |
6083 |
+From: Rob Clark <rob@××.com> |
6084 |
+Date: Fri, 24 Dec 2010 20:55:43 -0600 |
6085 |
+Subject: [PATCH 23/24] ffmpegcolorspace: support for rowstride |
6086 |
+ |
6087 |
+--- |
6088 |
+ gst/ffmpegcolorspace/avcodec.h | 2 +- |
6089 |
+ gst/ffmpegcolorspace/gstffmpegcodecmap.c | 85 +++++++++++++++++++-------- |
6090 |
+ gst/ffmpegcolorspace/gstffmpegcodecmap.h | 1 + |
6091 |
+ gst/ffmpegcolorspace/gstffmpegcolorspace.c | 30 ++++++++-- |
6092 |
+ gst/ffmpegcolorspace/gstffmpegcolorspace.h | 1 + |
6093 |
+ gst/ffmpegcolorspace/imgconvert.c | 12 ++-- |
6094 |
+ 6 files changed, 93 insertions(+), 38 deletions(-) |
6095 |
+ |
6096 |
+diff --git a/gst/ffmpegcolorspace/avcodec.h b/gst/ffmpegcolorspace/avcodec.h |
6097 |
+index 57f551c..a4928ee 100644 |
6098 |
+--- a/gst/ffmpegcolorspace/avcodec.h |
6099 |
++++ b/gst/ffmpegcolorspace/avcodec.h |
6100 |
+@@ -217,7 +217,7 @@ typedef struct AVPaletteControl { |
6101 |
+ |
6102 |
+ } AVPaletteControl; |
6103 |
+ |
6104 |
+-int avpicture_get_size(int pix_fmt, int width, int height); |
6105 |
++int avpicture_get_size(int pix_fmt, int width, int height, int stride); |
6106 |
+ |
6107 |
+ void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift); |
6108 |
+ const char *avcodec_get_pix_fmt_name(int pix_fmt); |
6109 |
+diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.c b/gst/ffmpegcolorspace/gstffmpegcodecmap.c |
6110 |
+index 318a90e..9c6a123 100644 |
6111 |
+--- a/gst/ffmpegcolorspace/gstffmpegcodecmap.c |
6112 |
++++ b/gst/ffmpegcolorspace/gstffmpegcodecmap.c |
6113 |
+@@ -619,7 +619,8 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps, |
6114 |
+ if (!raw) |
6115 |
+ return; |
6116 |
+ |
6117 |
+- if (gst_structure_has_name (structure, "video/x-raw-yuv")) { |
6118 |
++ if (gst_structure_has_name (structure, "video/x-raw-yuv") || |
6119 |
++ gst_structure_has_name (structure, "video/x-raw-yuv-strided")) { |
6120 |
+ guint32 fourcc; |
6121 |
+ |
6122 |
+ if (gst_structure_get_fourcc (structure, "format", &fourcc)) { |
6123 |
+@@ -828,10 +829,10 @@ gst_ffmpegcsp_caps_with_codectype (enum CodecType type, |
6124 |
+ int |
6125 |
+ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6126 |
+ uint8_t * ptr, enum PixelFormat pix_fmt, int width, int height, |
6127 |
+- int interlaced) |
6128 |
++ int stride, int interlaced) |
6129 |
+ { |
6130 |
+ int size, w2, h2, size2; |
6131 |
+- int stride, stride2; |
6132 |
++ int stride2; |
6133 |
+ PixFmtInfo *pinfo; |
6134 |
+ |
6135 |
+ pinfo = get_pix_fmt_info (pix_fmt); |
6136 |
+@@ -847,11 +848,15 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6137 |
+ case PIX_FMT_YUVJ420P: |
6138 |
+ case PIX_FMT_YUVJ422P: |
6139 |
+ case PIX_FMT_YUVJ444P: |
6140 |
+- stride = GST_ROUND_UP_4 (width); |
6141 |
+ h2 = ROUND_UP_X (height, pinfo->y_chroma_shift); |
6142 |
+- size = stride * h2; |
6143 |
+ w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift); |
6144 |
+- stride2 = GST_ROUND_UP_4 (w2); |
6145 |
++ if (stride) { |
6146 |
++ stride2 = stride; |
6147 |
++ } else { |
6148 |
++ stride = GST_ROUND_UP_4 (width); |
6149 |
++ stride2 = GST_ROUND_UP_4 (w2); |
6150 |
++ } |
6151 |
++ size = stride * h2; |
6152 |
+ h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift); |
6153 |
+ size2 = stride2 * h2; |
6154 |
+ picture->data[0] = ptr; |
6155 |
+@@ -864,11 +869,15 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6156 |
+ /* PIX_FMT_YVU420P = YV12: same as PIX_FMT_YUV420P, but |
6157 |
+ * with U and V plane swapped. Strides as in videotestsrc */ |
6158 |
+ case PIX_FMT_YUVA420P: |
6159 |
+- stride = GST_ROUND_UP_4 (width); |
6160 |
+ h2 = ROUND_UP_X (height, pinfo->y_chroma_shift); |
6161 |
+- size = stride * h2; |
6162 |
+ w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift); |
6163 |
+- stride2 = GST_ROUND_UP_4 (w2); |
6164 |
++ if (stride) { |
6165 |
++ stride2 = stride; |
6166 |
++ } else { |
6167 |
++ stride = GST_ROUND_UP_4 (width); |
6168 |
++ stride2 = GST_ROUND_UP_4 (w2); |
6169 |
++ } |
6170 |
++ size = stride * h2; |
6171 |
+ h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift); |
6172 |
+ size2 = stride2 * h2; |
6173 |
+ picture->data[0] = ptr; |
6174 |
+@@ -882,11 +891,15 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6175 |
+ return 2 * size + 2 * size2; |
6176 |
+ case PIX_FMT_YVU410P: |
6177 |
+ case PIX_FMT_YVU420P: |
6178 |
+- stride = GST_ROUND_UP_4 (width); |
6179 |
+ h2 = ROUND_UP_X (height, pinfo->y_chroma_shift); |
6180 |
+- size = stride * h2; |
6181 |
+ w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift); |
6182 |
+- stride2 = GST_ROUND_UP_4 (w2); |
6183 |
++ if (stride) { |
6184 |
++ stride2 = stride; |
6185 |
++ } else { |
6186 |
++ stride = GST_ROUND_UP_4 (width); |
6187 |
++ stride2 = GST_ROUND_UP_4 (w2); |
6188 |
++ } |
6189 |
++ size = stride * h2; |
6190 |
+ h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift); |
6191 |
+ size2 = stride2 * h2; |
6192 |
+ picture->data[0] = ptr; |
6193 |
+@@ -898,11 +911,15 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6194 |
+ return size + 2 * size2; |
6195 |
+ case PIX_FMT_NV12: |
6196 |
+ case PIX_FMT_NV21: |
6197 |
+- stride = GST_ROUND_UP_4 (width); |
6198 |
+ h2 = ROUND_UP_X (height, pinfo->y_chroma_shift); |
6199 |
+- size = stride * h2; |
6200 |
+ w2 = 2 * DIV_ROUND_UP_X (width, pinfo->x_chroma_shift); |
6201 |
+- stride2 = GST_ROUND_UP_4 (w2); |
6202 |
++ if (stride) { |
6203 |
++ stride2 = stride; |
6204 |
++ } else { |
6205 |
++ stride = GST_ROUND_UP_4 (width); |
6206 |
++ stride2 = GST_ROUND_UP_4 (w2); |
6207 |
++ } |
6208 |
++ size = stride * h2; |
6209 |
+ h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift); |
6210 |
+ size2 = stride2 * h2; |
6211 |
+ picture->data[0] = ptr; |
6212 |
+@@ -914,7 +931,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6213 |
+ return size + size2; |
6214 |
+ case PIX_FMT_RGB24: |
6215 |
+ case PIX_FMT_BGR24: |
6216 |
+- stride = GST_ROUND_UP_4 (width * 3); |
6217 |
++ if (!stride) { |
6218 |
++ stride = GST_ROUND_UP_4 (width * 3); |
6219 |
++ } |
6220 |
+ size = stride * height; |
6221 |
+ picture->data[0] = ptr; |
6222 |
+ picture->data[1] = NULL; |
6223 |
+@@ -930,7 +949,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6224 |
+ case PIX_FMT_ABGR32: |
6225 |
+ case PIX_FMT_xRGB32: |
6226 |
+ case PIX_FMT_BGRx32: |
6227 |
+- stride = width * 4; |
6228 |
++ if (!stride) { |
6229 |
++ stride = width * 4; |
6230 |
++ } |
6231 |
+ size = stride * height; |
6232 |
+ picture->data[0] = ptr; |
6233 |
+ picture->data[1] = NULL; |
6234 |
+@@ -942,7 +963,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6235 |
+ case PIX_FMT_YUV422: |
6236 |
+ case PIX_FMT_UYVY422: |
6237 |
+ case PIX_FMT_YVYU422: |
6238 |
+- stride = GST_ROUND_UP_4 (width * 2); |
6239 |
++ if (!stride) { |
6240 |
++ stride = GST_ROUND_UP_4 (width * 2); |
6241 |
++ } |
6242 |
+ size = stride * height; |
6243 |
+ picture->data[0] = ptr; |
6244 |
+ picture->data[1] = NULL; |
6245 |
+@@ -950,7 +973,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6246 |
+ picture->linesize[0] = stride; |
6247 |
+ return size; |
6248 |
+ case PIX_FMT_V308: |
6249 |
+- stride = GST_ROUND_UP_4 (width * 3); |
6250 |
++ if (!stride) { |
6251 |
++ stride = GST_ROUND_UP_4 (width * 3); |
6252 |
++ } |
6253 |
+ size = stride * height; |
6254 |
+ picture->data[0] = ptr; |
6255 |
+ picture->data[1] = NULL; |
6256 |
+@@ -958,8 +983,10 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6257 |
+ picture->linesize[0] = stride; |
6258 |
+ return size; |
6259 |
+ case PIX_FMT_UYVY411: |
6260 |
+- stride = |
6261 |
+- GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) + GST_ROUND_UP_4 (width) / 2); |
6262 |
++ if (!stride) { |
6263 |
++ stride = GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) + |
6264 |
++ GST_ROUND_UP_4 (width) / 2); |
6265 |
++ } |
6266 |
+ size = stride * height; |
6267 |
+ picture->data[0] = ptr; |
6268 |
+ picture->data[1] = NULL; |
6269 |
+@@ -968,7 +995,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6270 |
+ return size; |
6271 |
+ case PIX_FMT_Y800: |
6272 |
+ case PIX_FMT_GRAY8: |
6273 |
+- stride = GST_ROUND_UP_4 (width); |
6274 |
++ if (!stride) { |
6275 |
++ stride = GST_ROUND_UP_4 (width); |
6276 |
++ } |
6277 |
+ size = stride * height; |
6278 |
+ picture->data[0] = ptr; |
6279 |
+ picture->data[1] = NULL; |
6280 |
+@@ -978,7 +1007,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6281 |
+ case PIX_FMT_Y16: |
6282 |
+ case PIX_FMT_GRAY16_L: |
6283 |
+ case PIX_FMT_GRAY16_B: |
6284 |
+- stride = GST_ROUND_UP_4 (width * 2); |
6285 |
++ if (!stride) { |
6286 |
++ stride = GST_ROUND_UP_4 (width * 2); |
6287 |
++ } |
6288 |
+ size = stride * height; |
6289 |
+ picture->data[0] = ptr; |
6290 |
+ picture->data[1] = NULL; |
6291 |
+@@ -987,7 +1018,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6292 |
+ return size; |
6293 |
+ case PIX_FMT_MONOWHITE: |
6294 |
+ case PIX_FMT_MONOBLACK: |
6295 |
+- stride = GST_ROUND_UP_4 ((width + 7) >> 3); |
6296 |
++ if (!stride) { |
6297 |
++ stride = GST_ROUND_UP_4 ((width + 7) >> 3); |
6298 |
++ } |
6299 |
+ size = stride * height; |
6300 |
+ picture->data[0] = ptr; |
6301 |
+ picture->data[1] = NULL; |
6302 |
+@@ -996,7 +1029,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6303 |
+ return size; |
6304 |
+ case PIX_FMT_PAL8: |
6305 |
+ /* already forced to be with stride, so same result as other function */ |
6306 |
+- stride = GST_ROUND_UP_4 (width); |
6307 |
++ if (!stride) { |
6308 |
++ stride = GST_ROUND_UP_4 (width); |
6309 |
++ } |
6310 |
+ size = stride * height; |
6311 |
+ picture->data[0] = ptr; |
6312 |
+ picture->data[1] = ptr + size; /* palette is stored here as 256 32 bit words */ |
6313 |
+diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.h b/gst/ffmpegcolorspace/gstffmpegcodecmap.h |
6314 |
+index 515f530..bcd212a 100644 |
6315 |
+--- a/gst/ffmpegcolorspace/gstffmpegcodecmap.h |
6316 |
++++ b/gst/ffmpegcolorspace/gstffmpegcodecmap.h |
6317 |
+@@ -52,6 +52,7 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, |
6318 |
+ enum PixelFormat pix_fmt, |
6319 |
+ int width, |
6320 |
+ int height, |
6321 |
++ int stride, |
6322 |
+ int interlaced); |
6323 |
+ |
6324 |
+ #endif /* __GST_FFMPEG_CODECMAP_H__ */ |
6325 |
+diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c |
6326 |
+index 4ba0204..63430a0 100644 |
6327 |
+--- a/gst/ffmpegcolorspace/gstffmpegcolorspace.c |
6328 |
++++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.c |
6329 |
+@@ -48,6 +48,10 @@ GST_DEBUG_CATEGORY (ffmpegcolorspace_performance); |
6330 |
+ "video/x-raw-yuv, width = "GST_VIDEO_SIZE_RANGE" , " \ |
6331 |
+ "height="GST_VIDEO_SIZE_RANGE",framerate="GST_VIDEO_FPS_RANGE"," \ |
6332 |
+ "format= (fourcc) { I420 , NV12 , NV21 , YV12 , YUY2 , Y42B , Y444 , YUV9 , YVU9 , Y41B , Y800 , Y8 , GREY , Y16 , UYVY , YVYU , IYU1 , v308 , AYUV, A420} ;" \ |
6333 |
++ "video/x-raw-yuv-strided, width = "GST_VIDEO_SIZE_RANGE" , " \ |
6334 |
++ "height="GST_VIDEO_SIZE_RANGE",framerate="GST_VIDEO_FPS_RANGE"," \ |
6335 |
++ "rowstride="GST_VIDEO_SIZE_RANGE"," \ |
6336 |
++ "format= (fourcc) { I420 , NV12 , NV21 , YV12 , YUY2 , Y42B , Y444 , YUV9 , YVU9 , Y41B , Y800 , Y8 , GREY , Y16 , UYVY , YVYU , IYU1 , v308 , AYUV, A420} ;" \ |
6337 |
+ GST_VIDEO_CAPS_RGB";" \ |
6338 |
+ GST_VIDEO_CAPS_BGR";" \ |
6339 |
+ GST_VIDEO_CAPS_RGBx";" \ |
6340 |
+@@ -205,8 +209,8 @@ gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps, |
6341 |
+ { |
6342 |
+ GstFFMpegCsp *space; |
6343 |
+ GstStructure *structure; |
6344 |
+- gint in_height, in_width; |
6345 |
+- gint out_height, out_width; |
6346 |
++ gint in_height, in_width, in_stride = 0; |
6347 |
++ gint out_height, out_width, out_stride = 0; |
6348 |
+ const GValue *in_framerate = NULL; |
6349 |
+ const GValue *out_framerate = NULL; |
6350 |
+ const GValue *in_par = NULL; |
6351 |
+@@ -225,6 +229,10 @@ gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps, |
6352 |
+ if (!res) |
6353 |
+ goto no_width_height; |
6354 |
+ |
6355 |
++ /* stride is optional: */ |
6356 |
++ if (gst_structure_has_name (structure, "video/x-raw-yuv-strided")) |
6357 |
++ gst_structure_get_int (structure, "rowstride", &in_stride); |
6358 |
++ |
6359 |
+ /* and framerate */ |
6360 |
+ in_framerate = gst_structure_get_value (structure, "framerate"); |
6361 |
+ if (in_framerate == NULL || !GST_VALUE_HOLDS_FRACTION (in_framerate)) |
6362 |
+@@ -241,6 +249,10 @@ gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps, |
6363 |
+ if (!res) |
6364 |
+ goto no_width_height; |
6365 |
+ |
6366 |
++ /* stride is optional: */ |
6367 |
++ if (gst_structure_has_name (structure, "video/x-raw-yuv-strided")) |
6368 |
++ gst_structure_get_int (structure, "rowstride", &out_stride); |
6369 |
++ |
6370 |
+ /* and framerate */ |
6371 |
+ out_framerate = gst_structure_get_value (structure, "framerate"); |
6372 |
+ if (out_framerate == NULL || !GST_VALUE_HOLDS_FRACTION (out_framerate)) |
6373 |
+@@ -263,6 +275,8 @@ gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps, |
6374 |
+ |
6375 |
+ space->width = ctx->width = in_width; |
6376 |
+ space->height = ctx->height = in_height; |
6377 |
++ space->in_stride = in_stride; |
6378 |
++ space->out_stride = out_stride; |
6379 |
+ |
6380 |
+ space->interlaced = FALSE; |
6381 |
+ gst_structure_get_boolean (structure, "interlaced", &space->interlaced); |
6382 |
+@@ -401,7 +415,7 @@ gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, |
6383 |
+ GstStructure *structure = NULL; |
6384 |
+ AVCodecContext *ctx = NULL; |
6385 |
+ gboolean ret = TRUE; |
6386 |
+- gint width, height; |
6387 |
++ gint width, height, stride = 0; |
6388 |
+ |
6389 |
+ g_assert (size); |
6390 |
+ |
6391 |
+@@ -409,6 +423,10 @@ gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, |
6392 |
+ gst_structure_get_int (structure, "width", &width); |
6393 |
+ gst_structure_get_int (structure, "height", &height); |
6394 |
+ |
6395 |
++ /* stride is optional: */ |
6396 |
++ if (gst_structure_has_name (structure, "video/x-raw-yuv-strided")) |
6397 |
++ gst_structure_get_int (structure, "rowstride", &stride); |
6398 |
++ |
6399 |
+ ctx = avcodec_alloc_context (); |
6400 |
+ |
6401 |
+ g_assert (ctx != NULL); |
6402 |
+@@ -422,7 +440,7 @@ gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, |
6403 |
+ goto beach; |
6404 |
+ } |
6405 |
+ |
6406 |
+- *size = avpicture_get_size (ctx->pix_fmt, width, height); |
6407 |
++ *size = avpicture_get_size (ctx->pix_fmt, width, height, stride); |
6408 |
+ |
6409 |
+ /* ffmpeg frames have the palette after the frame data, whereas |
6410 |
+ * GStreamer currently puts it into the caps as 'palette_data' field, |
6411 |
+@@ -460,7 +478,7 @@ gst_ffmpegcsp_transform (GstBaseTransform * btrans, GstBuffer * inbuf, |
6412 |
+ /* fill from with source data */ |
6413 |
+ gst_ffmpegcsp_avpicture_fill (&space->from_frame, |
6414 |
+ GST_BUFFER_DATA (inbuf), space->from_pixfmt, space->width, space->height, |
6415 |
+- space->interlaced); |
6416 |
++ space->in_stride, space->interlaced); |
6417 |
+ |
6418 |
+ /* fill optional palette */ |
6419 |
+ if (space->palette) |
6420 |
+@@ -469,7 +487,7 @@ gst_ffmpegcsp_transform (GstBaseTransform * btrans, GstBuffer * inbuf, |
6421 |
+ /* fill target frame */ |
6422 |
+ gst_ffmpegcsp_avpicture_fill (&space->to_frame, |
6423 |
+ GST_BUFFER_DATA (outbuf), space->to_pixfmt, space->width, space->height, |
6424 |
+- space->interlaced); |
6425 |
++ space->out_stride, space->interlaced); |
6426 |
+ |
6427 |
+ /* and convert */ |
6428 |
+ result = img_convert (&space->to_frame, space->to_pixfmt, |
6429 |
+diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.h b/gst/ffmpegcolorspace/gstffmpegcolorspace.h |
6430 |
+index 198ab8a..bd5e01c 100644 |
6431 |
+--- a/gst/ffmpegcolorspace/gstffmpegcolorspace.h |
6432 |
++++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.h |
6433 |
+@@ -46,6 +46,7 @@ struct _GstFFMpegCsp { |
6434 |
+ GstVideoFilter element; |
6435 |
+ |
6436 |
+ gint width, height; |
6437 |
++ gint in_stride, out_stride; |
6438 |
+ gboolean interlaced; |
6439 |
+ gfloat fps; |
6440 |
+ enum PixelFormat from_pixfmt, to_pixfmt; |
6441 |
+diff --git a/gst/ffmpegcolorspace/imgconvert.c b/gst/ffmpegcolorspace/imgconvert.c |
6442 |
+index cb145bb..414c4a0 100644 |
6443 |
+--- a/gst/ffmpegcolorspace/imgconvert.c |
6444 |
++++ b/gst/ffmpegcolorspace/imgconvert.c |
6445 |
+@@ -594,12 +594,12 @@ avpicture_layout (const AVPicture * src, int pix_fmt, int width, int height, |
6446 |
+ #endif |
6447 |
+ |
6448 |
+ int |
6449 |
+-avpicture_get_size (int pix_fmt, int width, int height) |
6450 |
++avpicture_get_size (int pix_fmt, int width, int height, int stride) |
6451 |
+ { |
6452 |
+ AVPicture dummy_pict; |
6453 |
+ |
6454 |
+ return gst_ffmpegcsp_avpicture_fill (&dummy_pict, NULL, pix_fmt, width, |
6455 |
+- height, FALSE); |
6456 |
++ height, stride, FALSE); |
6457 |
+ } |
6458 |
+ |
6459 |
+ /** |
6460 |
+@@ -3518,16 +3518,16 @@ get_convert_table_entry (int src_pix_fmt, int dst_pix_fmt) |
6461 |
+ |
6462 |
+ static int |
6463 |
+ avpicture_alloc (AVPicture * picture, int pix_fmt, int width, int height, |
6464 |
+- int interlaced) |
6465 |
++ int stride, int interlaced) |
6466 |
+ { |
6467 |
+ unsigned int size; |
6468 |
+ void *ptr; |
6469 |
+ |
6470 |
+- size = avpicture_get_size (pix_fmt, width, height); |
6471 |
++ size = avpicture_get_size (pix_fmt, width, height, stride); |
6472 |
+ ptr = av_malloc (size); |
6473 |
+ if (!ptr) |
6474 |
+ goto fail; |
6475 |
+- gst_ffmpegcsp_avpicture_fill (picture, ptr, pix_fmt, width, height, |
6476 |
++ gst_ffmpegcsp_avpicture_fill (picture, ptr, pix_fmt, width, height, stride, |
6477 |
+ interlaced); |
6478 |
+ return 0; |
6479 |
+ fail: |
6480 |
+@@ -3775,7 +3775,7 @@ no_chroma_filter: |
6481 |
+ else |
6482 |
+ int_pix_fmt = PIX_FMT_RGB24; |
6483 |
+ } |
6484 |
+- if (avpicture_alloc (tmp, int_pix_fmt, dst_width, dst_height, |
6485 |
++ if (avpicture_alloc (tmp, int_pix_fmt, dst_width, dst_height, 0, |
6486 |
+ dst->interlaced) < 0) |
6487 |
+ return -1; |
6488 |
+ ret = -1; |
6489 |
+-- |
6490 |
+1.7.1 |
6491 |
+ |
6492 |
|
6493 |
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0024-discoverer-rowstride-support.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0024-discoverer-rowstride-support.patch |
6494 |
new file mode 100644 |
6495 |
index 0000000..ebe1b6f |
6496 |
--- /dev/null |
6497 |
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0024-discoverer-rowstride-support.patch |
6498 |
@@ -0,0 +1,45 @@ |
6499 |
+From 3bb025f5ba20aeb5d2fa575e4a78ea61e3bf5c1b Mon Sep 17 00:00:00 2001 |
6500 |
+From: Rob Clark <rob@××.com> |
6501 |
+Date: Wed, 5 Jan 2011 11:40:03 -0600 |
6502 |
+Subject: [PATCH 24/24] discoverer: rowstride support |
6503 |
+ |
6504 |
+--- |
6505 |
+ gst-libs/gst/pbutils/gstdiscoverer.c | 8 ++++---- |
6506 |
+ 1 files changed, 4 insertions(+), 4 deletions(-) |
6507 |
+ |
6508 |
+diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c |
6509 |
+index 8422d8f..2176196 100644 |
6510 |
+--- a/gst-libs/gst/pbutils/gstdiscoverer.c |
6511 |
++++ b/gst-libs/gst/pbutils/gstdiscoverer.c |
6512 |
+@@ -558,7 +558,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, |
6513 |
+ GstCaps *caps; |
6514 |
+ GstStructure *caps_st, *tags_st; |
6515 |
+ const gchar *name; |
6516 |
+- int tmp, tmp2; |
6517 |
++ int tmp, tmp2, tmp3; |
6518 |
+ guint utmp; |
6519 |
+ gboolean btmp; |
6520 |
+ |
6521 |
+@@ -626,7 +626,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, |
6522 |
+ info->parent.caps = caps; |
6523 |
+ } |
6524 |
+ |
6525 |
+- if (gst_video_format_parse_caps (caps, &format, &tmp, &tmp2)) { |
6526 |
++ if (gst_video_format_parse_caps_strided (caps, &format, &tmp, &tmp2, &tmp3)) { |
6527 |
+ info->width = (guint) tmp; |
6528 |
+ info->height = (guint) tmp2; |
6529 |
+ } |
6530 |
+@@ -930,8 +930,8 @@ discoverer_collect (GstDiscoverer * dc) |
6531 |
+ gst_caps_get_structure (dc->priv->current_info->stream_info->caps, 0); |
6532 |
+ |
6533 |
+ if (g_str_has_prefix (gst_structure_get_name (st), "image/")) |
6534 |
+- ((GstDiscovererVideoInfo *) dc->priv->current_info-> |
6535 |
+- stream_info)->is_image = TRUE; |
6536 |
++ ((GstDiscovererVideoInfo *) dc->priv->current_info->stream_info)-> |
6537 |
++ is_image = TRUE; |
6538 |
+ } |
6539 |
+ } |
6540 |
+ |
6541 |
+-- |
6542 |
+1.7.1 |
6543 |
+ |
6544 |
|
6545 |
diff --git a/media-libs/gst-plugins-base/gst-plugins-base-0.10.32_p20110127.ebuild b/media-libs/gst-plugins-base/gst-plugins-base-0.10.32_p20110127.ebuild |
6546 |
new file mode 100644 |
6547 |
index 0000000..93160d5 |
6548 |
--- /dev/null |
6549 |
+++ b/media-libs/gst-plugins-base/gst-plugins-base-0.10.32_p20110127.ebuild |
6550 |
@@ -0,0 +1,78 @@ |
6551 |
+# Copyright 1999-2011 Gentoo Foundation |
6552 |
+# Distributed under the terms of the GNU General Public License v2 |
6553 |
+# $Header: $ |
6554 |
+ |
6555 |
+EAPI=1 |
6556 |
+ |
6557 |
+# order is important, gnome2 after gst-plugins |
6558 |
+inherit gst-plugins-base gst-plugins10 gnome2 flag-o-matic autotools eutils |
6559 |
+# libtool |
6560 |
+ |
6561 |
+DESCRIPTION="Basepack of plugins for gstreamer" |
6562 |
+HOMEPAGE="http://gstreamer.sourceforge.net" |
6563 |
+MY_P=${P%%_*} |
6564 |
+SRC_URI="http://gstreamer.freedesktop.org/src/${PN}/${MY_P}.tar.bz2" |
6565 |
+S="${WORKDIR}/${MY_P}" |
6566 |
+ |
6567 |
+LICENSE="GPL-2" |
6568 |
+KEYWORDS="~alpha ~amd64 arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris" |
6569 |
+IUSE="+introspection +orc" |
6570 |
+ |
6571 |
+RDEPEND=">=dev-libs/glib-2.20 |
6572 |
+ =media-libs/gstreamer-0.10.32_p20110127 |
6573 |
+ dev-libs/libxml2 |
6574 |
+ app-text/iso-codes |
6575 |
+ orc? ( >=dev-lang/orc-0.4.5 ) |
6576 |
+ !<media-libs/gst-plugins-bad-0.10.10" |
6577 |
+DEPEND="${RDEPEND} |
6578 |
+ dev-util/pkgconfig |
6579 |
+ dev-util/gtk-doc-am" |
6580 |
+ |
6581 |
+GST_PLUGINS_BUILD="" |
6582 |
+ |
6583 |
+DOCS="AUTHORS NEWS README RELEASE" |
6584 |
+ |
6585 |
+src_unpack() { |
6586 |
+ unpack ${A} |
6587 |
+ cd "${S}" |
6588 |
+ epatch "${FILESDIR}"/gst-0.10.32-0001-add-rowstride-support-to-video-utility-functions.patch |
6589 |
+ epatch "${FILESDIR}"/gst-0.10.32-0002-stridetransform-skeletal-implementation-of-stridetra.patch |
6590 |
+ epatch "${FILESDIR}"/gst-0.10.32-0003-stridetransform-implement-caps-negotiation-and-relat.patch |
6591 |
+ epatch "${FILESDIR}"/gst-0.10.32-0004-stridetransform-implement-transform-function.patch |
6592 |
+ epatch "${FILESDIR}"/gst-0.10.32-0005-add-gst_stride_transform_transform_size.patch |
6593 |
+ epatch "${FILESDIR}"/gst-0.10.32-0006-fix-a-small-typo.-need-to-use-the-smaller-of-new_wid.patch |
6594 |
+ epatch "${FILESDIR}"/gst-0.10.32-0007-Add-NV12-support-in-stridetransform.patch |
6595 |
+ epatch "${FILESDIR}"/gst-0.10.32-0008-add-basic-support-for-I420-NV12-colorspace-conversio.patch |
6596 |
+ epatch "${FILESDIR}"/gst-0.10.32-0009-fix-to-avoid-parsing-caps-on-every-frame.patch |
6597 |
+ epatch "${FILESDIR}"/gst-0.10.32-0010-refactor-stridetransform-to-make-it-easier-to-add-ne.patch |
6598 |
+ epatch "${FILESDIR}"/gst-0.10.32-0011-add-some-neon.patch |
6599 |
+ epatch "${FILESDIR}"/gst-0.10.32-0012-add-support-to-convert-to-YUY2-YUYV-color-format.patch |
6600 |
+ epatch "${FILESDIR}"/gst-0.10.32-0013-Add-support-for-RGB565-to-stridetransform.patch |
6601 |
+ epatch "${FILESDIR}"/gst-0.10.32-0014-stridetransform-updates-for-new-extra-anal-compiler-.patch |
6602 |
+ epatch "${FILESDIR}"/gst-0.10.32-0015-stridetransform-fix-problem-transforming-caps-with-l.patch |
6603 |
+ epatch "${FILESDIR}"/gst-0.10.32-0016-modify-playbin-to-use-stridetransform.patch |
6604 |
+ epatch "${FILESDIR}"/gst-0.10.32-0017-playbin-disable-interlaced-support.patch |
6605 |
+ epatch "${FILESDIR}"/gst-0.10.32-0018-textoverlay-add-stride-support.patch |
6606 |
+ epatch "${FILESDIR}"/gst-0.10.32-0019-video-more-flexible-video-caps-utility.patch |
6607 |
+ epatch "${FILESDIR}"/gst-0.10.32-0020-video-fix-endianess-issue-for-16bit-RGB-formats.patch |
6608 |
+ epatch "${FILESDIR}"/gst-0.10.32-0021-stride-more-flexible-stride-color-conversion.patch |
6609 |
+ epatch "${FILESDIR}"/gst-0.10.32-0022-stride-support-for-32bit-RGB-formats.patch |
6610 |
+ epatch "${FILESDIR}"/gst-0.10.32-0023-ffmpegcolorspace-support-for-rowstride.patch |
6611 |
+ eautoreconf |
6612 |
+} |
6613 |
+ |
6614 |
+src_compile() { |
6615 |
+ # gst doesnt handle opts well, last tested with 0.10.15 |
6616 |
+ strip-flags |
6617 |
+ replace-flags "-O3" "-O2" |
6618 |
+ |
6619 |
+ gst-plugins-base_src_configure \ |
6620 |
+ --disable-nls \ |
6621 |
+ $(use_enable introspection) \ |
6622 |
+ $(use_enable orc) |
6623 |
+ emake || die "emake failed." |
6624 |
+} |
6625 |
+ |
6626 |
+src_install() { |
6627 |
+ gnome2_src_install |
6628 |
+} |