void
BitStreamFilterTest::testMakeByType () {
  const char* name = "noise";
  RefPointer<BitStreamFilterType> t = BitStreamFilterType::getBitStreamFilterType(name);
  TS_ASSERT(strcmp(name, t->getName())==0);
  RefPointer<BitStreamFilter> f = BitStreamFilter::make(t.value());
  TS_ASSERT(strcmp(name, f->getName())==0);
}
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
PropertyTest :: testIteration()
{
  LoggerStack stack;
  stack.setGlobalLevel(Logger::LEVEL_WARN, false);

  RefPointer<Configurable> c = Demuxer::make();

  int32_t numProperties = c->getNumProperties();
  TSM_ASSERT("", numProperties > 0);

  for(int32_t i = 0; i < numProperties; i++)
  {
    RefPointer <Property> property =  c->getPropertyMetaData(i);
    const char* name = property->getName();
    VS_LOG_DEBUG("Name: %s", name);
    VS_LOG_DEBUG("Description: %s", property->getHelp());
    VS_LOG_DEBUG("Default: %lld", property->getDefault());
    if (strcmp(name, "cryptokey")==0)
      continue;
    VS_LOG_DEBUG("Current value (boolean) : %d", (int32_t)c->getPropertyAsBoolean(name));
    VS_LOG_DEBUG("Current value (double)  : %f", c->getPropertyAsDouble(name));
    VS_LOG_DEBUG("Current value (long)    : %lld", c->getPropertyAsLong(name));
    RefPointer<Rational> rational = c->getPropertyAsRational(name);
    VS_LOG_DEBUG("Current value (rational): %f", rational->getValue());
    char* value=c->getPropertyAsString(name);
    VS_LOG_DEBUG("Current value (string)  : %s", value);
    if (value) free(value);
  }
}
void
MuxerFormatTest::testInstallation() {
  int32_t n = MuxerFormat::getNumFormats();
  TSM_ASSERT("", n > 0);

  for(int32_t i = 0; i < n; i++) {
    RefPointer<MuxerFormat> f = MuxerFormat::getFormat(i);
    VS_LOG_DEBUG("Name: %s; Description: %s", f->getName(), f->getLongName());
  }
}
void
PropertyTest :: testCreation()
{
  LoggerStack stack;
  stack.setGlobalLevel(Logger::LEVEL_WARN, false);
  RefPointer<Configurable> c = Demuxer::make();
  RefPointer<Property> property =  c->getPropertyMetaData("packetsize");
  VS_LOG_DEBUG("Name: %s", property->getName());
  VS_LOG_DEBUG("Description: %s", property->getHelp());
  TSM_ASSERT("should exist", property);
}
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);
}
Exemple #7
0
void
CodecTest::testGetSupportedProfiles()
{
  LoggerStack stack;
  stack.setGlobalLevel(Logger::LEVEL_INFO, false);

  codec = Codec::findDecodingCodec(Codec::CODEC_ID_MPEG4);
  TS_ASSERT(codec);
  int32_t num = codec->getNumSupportedProfiles();
  TS_ASSERT(num > 0);
  for (int i = 0; i < num; i++) {
    RefPointer<CodecProfile> p = codec->getSupportedProfile(i);
    TS_ASSERT(p);
    VS_LOG_DEBUG("Profile: %s", p->getName());
  }
  TS_ASSERT(!codec->getSupportedProfile(-1));
  TS_ASSERT(!codec->getSupportedProfile(0x7FFFFFFF));
}