Skip to content

Commit da4e88b

Browse files
Fix ElementFactory.ListType.DECODABLE, comment out listFilter() for now.
1 parent 0ccb139 commit da4e88b

File tree

2 files changed

+63
-63
lines changed

2 files changed

+63
-63
lines changed

src/org/freedesktop/gstreamer/ElementFactory.java

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -179,47 +179,47 @@ public static ElementFactory find(String name) {
179179
return factory;
180180
}
181181

182-
/**
183-
* Filter out all the elementfactories in list that can handle caps in the
184-
* given direction.
185-
*
186-
* If subsetonly is true, then only the elements whose pads templates are a
187-
* complete superset of caps will be returned. Else any element whose pad
188-
* templates caps can intersect with caps will be returned.
189-
*
190-
* @param list a {@link List} of {@link ElementFactory} to filter
191-
* @param caps a {@link Caps}
192-
* @param direction a {@link PadDirection} to filter on
193-
* @param subsetonly whether to filter on caps subsets or not.
194-
* @return a {@link List} of {@link ElementFactory} elements that match the
195-
* given requisits.
196-
*/
197-
public static List<ElementFactory> listFilter(List<ElementFactory> list, Caps caps,
198-
PadDirection direction, boolean subsetonly) {
199-
GList glist = null;
200-
List<ElementFactory> filterList = new ArrayList<ElementFactory>();
201-
202-
for (ElementFactory fact : list) {
203-
fact.ref();
204-
glist = GLIB_API.g_list_append(glist, fact.handle());
205-
}
206-
207-
GList gFilterList = GSTELEMENTFACTORY_API.gst_element_factory_list_filter(glist, caps, direction, subsetonly);
208-
209-
GList next = gFilterList;
210-
while (next != null) {
211-
if (next.data != null) {
212-
ElementFactory fact = new ElementFactory(initializer(next.data, true, true));
213-
filterList.add(fact);
214-
}
215-
next = next.next();
216-
}
217-
218-
GSTPLUGIN_API.gst_plugin_list_free(glist);
219-
GSTPLUGIN_API.gst_plugin_list_free(gFilterList);
220-
221-
return filterList;
222-
}
182+
// /**
183+
// * Filter out all the elementfactories in list that can handle caps in the
184+
// * given direction.
185+
// *
186+
// * If subsetonly is true, then only the elements whose pads templates are a
187+
// * complete superset of caps will be returned. Else any element whose pad
188+
// * templates caps can intersect with caps will be returned.
189+
// *
190+
// * @param list a {@link List} of {@link ElementFactory} to filter
191+
// * @param caps a {@link Caps}
192+
// * @param direction a {@link PadDirection} to filter on
193+
// * @param subsetonly whether to filter on caps subsets or not.
194+
// * @return a {@link List} of {@link ElementFactory} elements that match the
195+
// * given requisits.
196+
// */
197+
// public static List<ElementFactory> listFilter(List<ElementFactory> list, Caps caps,
198+
// PadDirection direction, boolean subsetonly) {
199+
// GList glist = null;
200+
// List<ElementFactory> filterList = new ArrayList<ElementFactory>();
201+
//
202+
// for (ElementFactory fact : list) {
203+
// fact.ref();
204+
// glist = GLIB_API.g_list_append(glist, fact.handle());
205+
// }
206+
//
207+
// GList gFilterList = GSTELEMENTFACTORY_API.gst_element_factory_list_filter(glist, caps, direction, subsetonly);
208+
//
209+
// GList next = gFilterList;
210+
// while (next != null) {
211+
// if (next.data != null) {
212+
// ElementFactory fact = new ElementFactory(initializer(next.data, true, true));
213+
// filterList.add(fact);
214+
// }
215+
// next = next.next();
216+
// }
217+
//
218+
// GSTPLUGIN_API.gst_plugin_list_free(glist);
219+
// GSTPLUGIN_API.gst_plugin_list_free(gFilterList);
220+
//
221+
// return filterList;
222+
// }
223223

224224
/**
225225
* Get a list of factories that match the given type. Only elements with a
@@ -230,7 +230,7 @@ public static List<ElementFactory> listFilter(List<ElementFactory> list, Caps ca
230230
* @param minrank Minimum rank
231231
* @return a List of ElementFactory elements.
232232
*/
233-
public static List<ElementFactory> listGetElement(ListType type, Rank minrank) {
233+
public static List<ElementFactory> listGetElements(ListType type, Rank minrank) {
234234
GList glist = GSTELEMENTFACTORY_API.gst_element_factory_list_get_elements(type.getValue(), minrank.intValue());
235235
List<ElementFactory> list = new ArrayList<ElementFactory>();
236236

@@ -265,7 +265,7 @@ public static List<ElementFactory> listGetElement(ListType type, Rank minrank) {
265265
* @return a {@link List} of {@link ElementFactory} elements that match the
266266
* given requisits.
267267
*/
268-
public static List<ElementFactory> listGetElementFilter(ListType type, Rank minrank,
268+
public static List<ElementFactory> listGetElementsFilter(ListType type, Rank minrank,
269269
Caps caps, PadDirection direction, boolean subsetonly) {
270270
List<ElementFactory> filterList = new ArrayList<ElementFactory>();
271271

@@ -388,7 +388,7 @@ public enum ListType {
388388
/** All sinks handling audio, video or image media types */
389389
AUDIOVIDEO_SINKS(SINK.getValue() | MEDIA_AUDIO.getValue() | MEDIA_VIDEO.getValue() | MEDIA_IMAGE.getValue()),
390390
/** All elements used to 'decode' streams (decoders, demuxers, parsers, depayloaders) */
391-
DECODABLE(ENCODER.getValue() | DEMUXER.getValue() | DEPAYLOADER.getValue() | PARSER.getValue());
391+
DECODABLE(DECODER.getValue() | DEMUXER.getValue() | DEPAYLOADER.getValue() | PARSER.getValue());
392392

393393
private final long value;
394394

test/org/freedesktop/gstreamer/ElementFactoryTest.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public void getStaticPadTemplates() {
193193

194194
@Test
195195
public void listGetElement() {
196-
List<ElementFactory> list = ElementFactory.listGetElement(ListType.ANY,
196+
List<ElementFactory> list = ElementFactory.listGetElements(ListType.ANY,
197197
Rank.NONE);
198198
assertNotNull("List of factories is null", list);
199199
assertTrue("No factories found", !list.isEmpty());
@@ -204,27 +204,27 @@ public void listGetElement() {
204204
// System.out.println("<<<");
205205
}
206206

207-
@Test
208-
public void filterList() {
209-
List<ElementFactory> list = ElementFactory.listGetElement(ListType.ENCODER,
210-
Rank.NONE);
211-
assertNotNull("List of factories is null", list);
212-
assertTrue("No factories found", !list.isEmpty());
213-
List<ElementFactory> filterList = ElementFactory.listFilter(list, new Caps("video/x-h263"),
214-
PadDirection.SRC, false);
215-
216-
assertNotNull("List of factories is null", filterList);
217-
assertTrue("No factories found", !filterList.isEmpty());
218-
// System.out.println("Filtered factories >>>");
219-
// for (ElementFactory fact : filterList) {
220-
// System.out.println(fact.getName());
221-
// }
222-
// System.out.println("<<<");
223-
}
207+
// @Test
208+
// public void filterList() {
209+
// List<ElementFactory> list = ElementFactory.listGetElements(ListType.ENCODER,
210+
// Rank.NONE);
211+
// assertNotNull("List of factories is null", list);
212+
// assertTrue("No factories found", !list.isEmpty());
213+
// List<ElementFactory> filterList = ElementFactory.listFilter(list, new Caps("video/x-h263"),
214+
// PadDirection.SRC, false);
215+
//
216+
// assertNotNull("List of factories is null", filterList);
217+
// assertTrue("No factories found", !filterList.isEmpty());
218+
//// System.out.println("Filtered factories >>>");
219+
//// for (ElementFactory fact : filterList) {
220+
//// System.out.println(fact.getName());
221+
//// }
222+
//// System.out.println("<<<");
223+
// }
224224

225225
@Test
226226
public void filterList2() {
227-
List<ElementFactory> list = ElementFactory.listGetElementFilter(ListType.ENCODER, Rank.NONE, new Caps("video/x-h263"),
227+
List<ElementFactory> list = ElementFactory.listGetElementsFilter(ListType.ENCODER, Rank.NONE, new Caps("video/x-h263"),
228228
PadDirection.SRC, false);
229229
assertNotNull("List of factories is null", list);
230230
assertTrue("No factories found", !list.isEmpty());

0 commit comments

Comments
 (0)