[Matroska-devel] problems with Read() and tags!

Moritz Bunkus moritz at bunkus.org
Thu Jul 24 23:55:36 CEST 2003


Hi.

Me again.

There's a bug/problem in the libs when using Read() to read the KaxTags.

Here's the test scenario: Modify test9.cpp like this:

    KaxTagTargets &targets = GetChild<KaxTagTargets>(tag);
    *(static_cast<EbmlUInteger *>(&GetChild<KaxTagTrackUID>(targets))) =
      1;

      // comment of the Targets
//      KaxTagMultiComment &mcomB =
GetChild<KaxTagMultiComment>(targets);
//     *(static_cast<EbmlString *>
//       (&GetChild<KaxTagMultiCommentName>(mcomB))) =
//       "Comment Level 5";

//     *(static_cast<EbmlUInteger
*>(&GetChild<KaxTagChapterUID>(targets))) =
//       5678;

//      KaxTagMultiComment &mcomA = GetChild<KaxTagMultiComment>(tag);
//     *(static_cast<EbmlString *>
//       (&GetChild<KaxTagMultiCommentName>(mcomA))) =
//       "Comment Level 3";

The changes only disable some MultiComments and the ChapterUID. This is
test8's output:

- Tags found
  * All mandatory elements found *
   Tag
    Targets
     Track UID
    General
     Subject
     Bibliography
     Language
    MultiCommercial
     Commercial
      Type
      Prices
       Currency
       Amount
    MultiDate

Looks fine to me.

Repeat this excercise, but set the TrackUID to 0, its default value, so
it won't be written to the file. This leaves Targets empty in the
file. Now fire up test8 and look at the output:

- Tags found
  * All mandatory elements found *
   Tag
    Targets
    General
    General
    MultiCommercial
    MultiCommercial
    MultiDate
    MultiDate

There's definitely something wrong here...

BTW: Here's a nice little dumper function for such purposes:

static void dumpsizes(EbmlElement *e, int level) {
  int i;

  for (i = 0; i < level; i++)
    printf(" ");
  printf("%s", typeid(*e).name());

  try {
    EbmlMaster *m = &dynamic_cast<EbmlMaster &>(*e);
    if (m != NULL) {
      printf(" (size: %u)\n", m->ListSize());
      for (i = 0; i < m->ListSize(); i++)
        dumpsizes((*m)[i], level + 1);
    } else
      printf("\n");
  } catch (...) {
      printf("\n");
  }
}

Its output for the 'TrackUID = 1' case is:

N11libmatroska7KaxTagsE (size: 1)
 N11libmatroska6KaxTagE (size: 11)
  N11libmatroska13KaxTagTargetsE (size: 1)
   N11libmatroska14KaxTagTrackUIDE
  N11libmatroska13KaxTagGeneralE (size: 19)
   N11libmatroska13KaxTagSubjectE
   N11libmatroska18KaxTagBibliographyE
   N11libmatroska14KaxTagLanguageE
   N11libmatroska12KaxTagRatingE
   N11libmatroska13KaxTagEncoderE
   N11libmatroska20KaxTagEncodeSettingsE
   N11libmatroska10KaxTagFileE
   N11libmatroska22KaxTagArchivalLocationE
   N11libmatroska14KaxTagKeywordsE
   N11libmatroska14KaxTagKeywordsE
   N11libmatroska10KaxTagMoodE
   N11libmatroska20KaxTagRecordLocationE
   N11libmatroska20KaxTagRecordLocationE
   N11libmatroska12KaxTagSourceE
   N11libmatroska16KaxTagSourceFormE
   N11libmatroska13KaxTagProductE
   N11libmatroska23KaxTagOriginalMediaTypeE
   N11libmatroska17KaxTagPlayCounterE
   N11libmatroska19KaxTagPopularimeterE
  N11libmatroska12KaxTagGenresE (size: 3)
   N11libmatroska16KaxTagAudioGenreE
   N11libmatroska16KaxTagVideoGenreE
   N11libmatroska14KaxTagSubGenreE
  N11libmatroska19KaxTagAudioSpecificE (size: 10)
   N11libmatroska21KaxTagAudioEncryptionE
   N11libmatroska15KaxTagAudioGainE
   N11libmatroska15KaxTagAudioPeakE
   N11libmatroska9KaxTagBPME
   N11libmatroska18KaxTagEqualisationE
   N11libmatroska15KaxTagDiscTrackE
   N11libmatroska13KaxTagSetPartE
   N11libmatroska16KaxTagInitialKeyE
   N11libmatroska26KaxTagOfficialAudioFileURLE
   N11libmatroska28KaxTagOfficialAudioSourceURLE
  N11libmatroska19KaxTagImageSpecificE (size: 6)
   N11libmatroska16KaxTagCaptureDPIE
   N11libmatroska22KaxTagCaptureLightnessE
   N11libmatroska27KaxTagCapturePaletteSettingE
   N11libmatroska22KaxTagCaptureSharpnessE
   N11libmatroska13KaxTagCroppedE
   N11libmatroska24KaxTagOriginalDimensionsE
  N11libmatroska21KaxTagMultiCommercialE (size: 1)
   N11libmatroska16KaxTagCommercialE (size: 5)
    N11libmatroska25KaxTagMultiCommercialTypeE
    N11libmatroska28KaxTagMultiCommercialAddressE
    N11libmatroska24KaxTagMultiCommercialURLE
    N11libmatroska26KaxTagMultiCommercialEmailE
    N11libmatroska16KaxTagMultiPriceE (size: 3)
     N11libmatroska24KaxTagMultiPriceCurrencyE
     N11libmatroska22KaxTagMultiPriceAmountE
     N11libmatroska25KaxTagMultiPricePriceDateE
  N11libmatroska15KaxTagMultiDateE (size: 1)
   N11libmatroska10KaxTagDateE (size: 3)
    N11libmatroska19KaxTagMultiDateTypeE
    N11libmatroska24KaxTagMultiDateDateBeginE
    N11libmatroska22KaxTagMultiDateDateEndE
  N11libmatroska17KaxTagMultiEntityE (size: 1)
   N11libmatroska12KaxTagEntityE (size: 5)
    N11libmatroska21KaxTagMultiEntityTypeE
    N11libmatroska21KaxTagMultiEntityNameE
    N11libmatroska20KaxTagMultiEntityURLE
    N11libmatroska22KaxTagMultiEntityEmailE
    N11libmatroska24KaxTagMultiEntityAddressE
  N11libmatroska21KaxTagMultiIdentifierE (size: 1)
   N11libmatroska16KaxTagIdentifierE (size: 3)
    N11libmatroska25KaxTagMultiIdentifierTypeE
    N11libmatroska27KaxTagMultiIdentifierBinaryE
    N11libmatroska27KaxTagMultiIdentifierStringE
  N11libmatroska16KaxTagMultiLegalE (size: 1)
   N11libmatroska11KaxTagLegalE (size: 3)
    N11libmatroska20KaxTagMultiLegalTypeE
    N11libmatroska19KaxTagMultiLegalURLE
    N11libmatroska23KaxTagMultiLegalAddressE
  N11libmatroska16KaxTagMultiTitleE (size: 1)
   N11libmatroska11KaxTagTitleE (size: 8)
    N11libmatroska20KaxTagMultiTitleTypeE
    N11libmatroska20KaxTagMultiTitleNameE
    N11libmatroska24KaxTagMultiTitleSubTitleE
    N11libmatroska23KaxTagMultiTitleEditionE
    N11libmatroska23KaxTagMultiTitleAddressE
    N11libmatroska19KaxTagMultiTitleURLE
    N11libmatroska21KaxTagMultiTitleEmailE
    N11libmatroska24KaxTagMultiTitleLanguageE

Now the output for the 'TrackUID = 0' case:

N11libmatroska7KaxTagsE (size: 1)
 N11libmatroska6KaxTagE (size: 21)
  N11libmatroska13KaxTagTargetsE (size: 0)
  N11libmatroska13KaxTagGeneralE (size: 0)
  N11libmatroska13KaxTagGeneralE (size: 0)
  N11libmatroska12KaxTagGenresE (size: 0)
  N11libmatroska12KaxTagGenresE (size: 0)
  N11libmatroska19KaxTagAudioSpecificE (size: 0)
  N11libmatroska19KaxTagAudioSpecificE (size: 0)
  N11libmatroska19KaxTagImageSpecificE (size: 0)
  N11libmatroska19KaxTagImageSpecificE (size: 0)
  N11libmatroska21KaxTagMultiCommercialE (size: 0)
  N11libmatroska21KaxTagMultiCommercialE (size: 0)
  N11libmatroska15KaxTagMultiDateE (size: 0)
  N11libmatroska15KaxTagMultiDateE (size: 0)
  N11libmatroska17KaxTagMultiEntityE (size: 0)
  N11libmatroska17KaxTagMultiEntityE (size: 0)
  N11libmatroska21KaxTagMultiIdentifierE (size: 0)
  N11libmatroska21KaxTagMultiIdentifierE (size: 0)
  N11libmatroska16KaxTagMultiLegalE (size: 0)
  N11libmatroska16KaxTagMultiLegalE (size: 0)
  N11libmatroska16KaxTagMultiTitleE (size: 0)
  N11libmatroska16KaxTagMultiTitleE (size: 0)

-- 
 ==> Ciao, Mosu (Moritz Bunkus)



More information about the Matroska-devel mailing list