|
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);
For better compatibility with many media players, create ONE named DASH box, and add multiple DATA boxes
504 var whole_box = new AppleAnnotationBox (BoxType.DASH);
505 var amean_box = new AppleAdditionalInfoBox (BoxType.Mean, 0, 1);
506 var aname_box = new AppleAdditionalInfoBox (BoxType.Name, 0, 1);
507 amean_box.Text = meanstring;
508 aname_box.Text = namestring;
509 whole_box.AddChild (amean_box);
510 whole_box.AddChild (aname_box);
511 foreach (var text in datastring)
512 {
513 //Create the new boxes, should use 1 for text as a flag
514 var adata_box = new AppleDataBox (BoxType.Data, 1);
515 adata_box.Text = text;
516 whole_box.AddChild (adata_box);
517 }
518
519 ilst_box.AddChild (whole_box);
taglib-sharp/src/TaglibSharp/Mpeg4/AppleTag.cs
Line 517 in da41dc3
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
Changed Code
For better compatibility with many media players, create ONE named DASH box, and add multiple DATA boxes