c.setPlugInName("abc");
assertEquals(c.getName(), "abc");
{
VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
//assertEquals(c.checkFormat(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f)), true);
VideoFormat[] fs = new VideoFormat[] {f};
c.setSupportedInputFormats(fs);
assertTrue(c.getSupportedInputFormats() == fs);
}
// only works once setSupportedInputFormats is called
c.getSupportedOutputFormats(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f));
{
Format f = new Format("xyz");
VideoFormat result = (VideoFormat) c.setInputFormat(f); // this calls matches
assertTrue(null == result);
}
{
VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
VideoFormat result = (VideoFormat) c.setInputFormat(f); // this calls matches
assertTrue(f == result);
}
assertTrue(c.accessSupportedOutputFormats() == null);
{
VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), -1, null, 2.f);
VideoFormat result = (VideoFormat) c.setInputFormat(f); // this calls matches
assertTrue(f == result);
}
{
VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, int[].class, 2.f);
VideoFormat result = (VideoFormat) c.setInputFormat(f); // this calls matches
assertTrue(null == result);
}
c.getSupportedOutputFormats(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f));
// TODO: need to set default output formats?
{
VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
VideoFormat result = (VideoFormat) c.setOutputFormat(f);
assertTrue(null == result);
}
c.getSupportedOutputFormats(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f));
{
VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
//assertEquals(c.checkFormat(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f)), true);
VideoFormat[] fs = new VideoFormat[] {f};
c.setSupportedOutputFormats(fs);
assertFalse(c.getSupportedOutputFormats(f) == fs);
assertEquals(c.accessMatchingOutputFormats(f).length, 0);
}
{
VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
VideoFormat result = (VideoFormat) c.setOutputFormat(f);
assertTrue(null == result);
}
{
VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
VideoFormat[] fs = new VideoFormat[] {f};
c.setDefaultOutputFormats(fs);
assertTrue(c.accessDefaultOutputFormats() == fs);
}
assertTrue(c.accessDefaultOutputFormats() != null);
assertTrue(c.accessSupportedInputFormats() != null);
assertTrue(c.accessSupportedOutputFormats() != null);
assertTrue(c.accessInputFormat() != null);
assertTrue(c.accessOutputFormat() == null);
{
VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
VideoFormat result = (VideoFormat) c.setOutputFormat(f);
assertTrue(null == result);
assertTrue(c.accessOutputFormat() == null);
c.forceSetOutputFormat(f);
assertTrue(c.accessOutputFormat() == f);
assertTrue(c.checkFormat(new VideoFormat("ayz", new Dimension(1, 2), 2000, null, 3.f)));
//assertTrue(c.checkFormat(new VideoFormat("ayz", null, 2000, int[].class, 3.f))); // NPE
//assertTrue(c.checkFormat(new Format("ayz"))); // class cast except
assertTrue(c.checkFormat(f));
{
VideoFormat f2 = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
assertTrue(c.checkFormat(f2));
}
{
VideoFormat f2 = new VideoFormat("xyc", new Dimension(1, 2), 1000, byte[].class, 2.f);
assertTrue(c.checkFormat(f2));
}
// {
// VideoFormat f2 = new VideoFormat("xyc", new Dimension(1, 3), 1000, byte[].class, 2.f);
// assertTrue(c.checkFormat(f2)); // calls videoResized
// }
assertTrue(c.accessOutputFormat() == f);
}
if (false)
{
TracingVideoCodec c2 = new TracingVideoCodec();
{
VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
//assertEquals(c.checkFormat(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f)), true);
VideoFormat[] fs = new VideoFormat[] {f};
c2.setSupportedInputFormats(fs);
assertTrue(c2.getSupportedInputFormats() == fs);
}
System.out.println("-->");
VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
c2.getSupportedOutputFormats(f);
System.out.println("-->");
c2.setInputFormat(f);
System.out.println("-->");