Skip to content

Mpeg4 AppleTag SetDashBoxes creates duplicates when trying to add a string array #379

@james-m-gremlinx

Description

@james-m-gremlinx

ilst_box.AddChild (whole_box);

When adding a multi value field to an Apple Dash Box "----" the array is duplicated when using the Appletag.SetDashboxes method.
Line 517 of AppleTag.cs adds the newly created AppleAnnotationBox to the ilist within the loop that adds the string array entries.
This causes the duplicate dash box entries.

Moving line 517 after the loop fixes this problem.
I have tested this change in a local copy of the code, but am unfamiliar with the proper github procedures to fork and pull.

Existing Code

504             var whole_box = new AppleAnnotationBox (BoxType.DASH);
505             foreach (var text in datastring)
506             {
507                 //Create the new boxes, should use 1 for text as a flag
508                 var amean_box = new AppleAdditionalInfoBox (BoxType.Mean, 0, 1);
509                 var aname_box = new AppleAdditionalInfoBox (BoxType.Name, 0, 1);
510                 var adata_box = new AppleDataBox (BoxType.Data, 1);
511                 amean_box.Text = meanstring;
512                 aname_box.Text = namestring;
513                 adata_box.Text = text;
514                 whole_box.AddChild (amean_box);
515                 whole_box.AddChild (aname_box);
516                 whole_box.AddChild (adata_box);
517                 ilst_box.AddChild (whole_box);
518             }

Changed Code

504             var whole_box = new AppleAnnotationBox (BoxType.DASH);
505             foreach (var text in datastring)
506             {
507                 //Create the new boxes, should use 1 for text as a flag
508                 var amean_box = new AppleAdditionalInfoBox (BoxType.Mean, 0, 1);
509                 var aname_box = new AppleAdditionalInfoBox (BoxType.Name, 0, 1);
510                 var adata_box = new AppleDataBox (BoxType.Data, 1);
511                 amean_box.Text = meanstring;
512                 aname_box.Text = namestring;
513                 adata_box.Text = text;
514                 whole_box.AddChild (amean_box);
515                 whole_box.AddChild (aname_box);
516                 whole_box.AddChild (adata_box);
517             }
518 
519             ilst_box.AddChild (whole_box);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions