コード例 #1
0
  /** Test the compatibility of the Playstation 3 with the MP3 format. */
  @Test
  public void testPlaystationAudioMp3Compatibility() {
    // This test is only useful if the MediaInfo library is available
    assumeTrue(mediaInfoParserIsValid);

    RendererConfiguration conf =
        RendererConfiguration.getRendererConfigurationByName("Playstation 3");
    assertNotNull("No renderer named \"Playstation 3\" found.", conf);

    // Construct regular two channel MP3 information
    DLNAMediaInfo info = new DLNAMediaInfo();
    info.setContainer("mp3");
    info.setMimeType(HTTPResource.AUDIO_MP3_TYPEMIME);
    DLNAMediaAudio audio = new DLNAMediaAudio();
    audio.setNrAudioChannels(2);
    ArrayList<DLNAMediaAudio> audioCodes = new ArrayList<DLNAMediaAudio>();
    audioCodes.add(audio);
    info.setAudioCodes(audioCodes);
    Format format = new MP3();
    format.match("test.mp3");
    assertEquals(
        "PS3 is reported to be incompatible with MP3", true, conf.isCompatible(info, format));

    // Construct five channel MP3 that the PS3 does not support natively
    audio.setNrAudioChannels(5);
    assertEquals(
        "PS3 is reported to be incompatible with MP3", false, conf.isCompatible(info, format));
  }
コード例 #2
0
  /** Test the compatibility of the Playstation 3 with the MPG format. */
  @Test
  public void testPlaystationVideoMpgCompatibility() {
    // This test is only useful if the MediaInfo library is available
    assumeTrue(mediaInfoParserIsValid);

    RendererConfiguration conf =
        RendererConfiguration.getRendererConfigurationByName("Playstation 3");
    assertNotNull("No renderer named \"Playstation 3\" found.", conf);

    // Construct regular two channel MPG information
    DLNAMediaInfo info = new DLNAMediaInfo();
    info.setContainer("avi");
    DLNAMediaAudio audio = new DLNAMediaAudio();
    audio.setCodecA("ac3");
    audio.setNrAudioChannels(5);
    ArrayList<DLNAMediaAudio> audioCodes = new ArrayList<DLNAMediaAudio>();
    audioCodes.add(audio);
    info.setAudioCodes(audioCodes);
    info.setCodecV("mp4");
    Format format = new MPG();
    format.match("test.avi");
    assertEquals(
        "PS3 is reported to be incompatible with MPG", true, conf.isCompatible(info, format));

    // Construct MPG with wmv codec that the PS3 does not support natively
    info.setCodecV("wmv");
    assertEquals(
        "PS3 is reported to be compatible with MPG with wmv codec",
        false,
        conf.isCompatible(info, format));
  }