void
MuxerFormatTest::testCreateMuxerFormat() {
  RefPointer<MuxerFormat> format;
  format = MuxerFormat::guessFormat("flv", 0, 0);
  VS_LOG_DEBUG("Pointer: %p", format.value());
  VS_LOG_DEBUG("Name: %s", format->getName());
  VS_LOG_DEBUG("Long Name: %s", format->getLongName());
  VS_LOG_DEBUG("Extensions: %s", format->getExtensions());
  VS_LOG_DEBUG("MimeType: %s", format->getMimeType());
  int32_t n = format->getNumSupportedCodecs();
  VS_LOG_DEBUG("# Supported Codecs: %d", n);
  for(int32_t i = 0; i < n; i++) {
    Codec::ID id = format->getSupportedCodecId(i);
    RefPointer<CodecDescriptor> d = CodecDescriptor::make(id);
    VS_LOG_DEBUG("  ID: %d, Tag: %d",
        id,
        format->getSupportedCodecTag(i));
    VS_LOG_DEBUG("    Name: %s", d->getName());
    VS_LOG_DEBUG("    Type: %d", d->getType());
    VS_LOG_DEBUG("    Long Name: %s", d->getLongName());
    VS_LOG_DEBUG("    Properties: %d", d->getProperties());
  }
  TSM_ASSERT("", strcmp("flv", format->getName()) == 0);
  format = MuxerFormat::guessFormat(0, "foo.flv", 0);
  TSM_ASSERT("", strcmp("flv", format->getName()) == 0);
  format = MuxerFormat::guessFormat(0, 0, "video/x-flv");
  TSM_ASSERT("", strcmp("flv", format->getName()) == 0);

  /** make sure default codec stuff works */
  format = MuxerFormat::guessFormat("mp4", 0, 0);
  TSM_ASSERT("", format);

  Codec::ID id = Codec::CODEC_ID_NONE;

  id = format->getDefaultAudioCodecId();
  TSM_ASSERT_EQUALS("", id, Codec::CODEC_ID_AAC);

  id = format->getDefaultVideoCodecId();
  TSM_ASSERT_EQUALS("", id, Codec::CODEC_ID_H264);

  id = format->getDefaultSubtitleCodecId();
  TSM_ASSERT_EQUALS("", id, Codec::CODEC_ID_NONE);

  id = format->guessCodec("mp4", 0, 0, MediaDescriptor::MEDIA_AUDIO);
  TSM_ASSERT_EQUALS("", id, Codec::CODEC_ID_AAC);

  id = format->guessCodec("mp4", 0, 0, MediaDescriptor::MEDIA_VIDEO);
  TSM_ASSERT_EQUALS("", id, Codec::CODEC_ID_H264);

  id = format->guessCodec("mp4", 0, 0, MediaDescriptor::MEDIA_SUBTITLE);
  TSM_ASSERT_EQUALS("", id, Codec::CODEC_ID_NONE);

}
void
DemuxerFormatTest::testCreateDemuxerFormat() {
  RefPointer<DemuxerFormat> format;
  format = DemuxerFormat::findFormat("mp4");
  VS_LOG_DEBUG("Pointer: %p", format.value());
  VS_LOG_DEBUG("Name: %s", format->getName());
  VS_LOG_DEBUG("Long Name: %s", format->getLongName());
  VS_LOG_DEBUG("Extensions: %s", format->getExtensions());
  int32_t n = format->getNumSupportedCodecs();
  VS_LOG_DEBUG("# Supported Codecs: %d", n);
  for(int32_t i = 0; i < n; i++) {
    Codec::ID id = format->getSupportedCodecId(i);
    RefPointer<CodecDescriptor> d = CodecDescriptor::make(id);
    VS_LOG_DEBUG("  ID: %d, Tag: %d",
        id,
        format->getSupportedCodecTag(i));
    VS_LOG_DEBUG("    Name: %s", d->getName());
    VS_LOG_DEBUG("    Type: %d", d->getType());
    VS_LOG_DEBUG("    Long Name: %s", d->getLongName());
    VS_LOG_DEBUG("    Properties: %d", d->getProperties());
  }
  TSM_ASSERT("", strcmp("mov,mp4,m4a,3gp,3g2,mj2", format->getName()) == 0);
}