I''ve tried for a while now to delete and/or replace some comments in a file. I''m using the vcedit.c code here''s what I try: // open the file and get access to comments vcedit_open(i_vcStateP, i_fileP); i_commentsP = vcedit_comments(i_vcStateP); // now delete all existing comments vorbis_comment_clear(i_commentsP); vorbis_comment_init(i_commentsP); // now in here add some new comments vorbis_comment_add_tag( i_commentsP, const_cast<char *>(Key_CommonToCustom(common)), const_cast<char *>(str.utf8Z())); // now update the changes vcedit_write(i_vcStateP, i_fileP); vcedit_clear(i_vcStateP); however, all this seems to do is APPEND comments, rather that delete and create new ones. how the heck do I delete the old comments??
pretty, pretty, *pretty* please, wish sugar on top, and a free Mac Karaoke app for good measure, does *anybody* have a clue or a tip or an idea on this? On Jan 29, 2007, at 9:21 PM, David M. Cotter wrote:> I''ve tried for a while now to delete and/or replace some comments > in a file. > I''m using the vcedit.c code > > here''s what I try: > > // open the file and get access to comments > vcedit_open(i_vcStateP, i_fileP); > i_commentsP = vcedit_comments(i_vcStateP); > > // now delete all existing comments > vorbis_comment_clear(i_commentsP); > vorbis_comment_init(i_commentsP); > > // now in here add some new comments > vorbis_comment_add_tag( > i_commentsP, > const_cast<char *>(Key_CommonToCustom(common)), > const_cast<char *>(str.utf8Z())); > > // now update the changes > vcedit_write(i_vcStateP, i_fileP); > vcedit_clear(i_vcStateP); > > however, all this seems to do is APPEND comments, rather that > delete and create new ones. > > how the heck do I delete the old comments??
On Wed, Jan 31, 2007 at 01:52:17PM -0800, David M. Cotter wrote:> pretty, pretty, *pretty* please, wish sugar on top, and a free Mac > Karaoke app for good measure, does *anybody* have a clue or a tip or > an idea on this?No idea unfortunately. Your code matches the equiv part of vcomment.c. General debugging ideas: * start tracing though after you call vcedit_comments() checking the contents if i_commentsP. See that it changes as it should. * run under valgrind in case you''re clobbering the heap somewhere else in your code. HTH, -r> > On Jan 29, 2007, at 9:21 PM, David M. Cotter wrote: > > >I''ve tried for a while now to delete and/or replace some comments > >in a file. > >I''m using the vcedit.c code > > > >here''s what I try: > > > >// open the file and get access to comments > >vcedit_open(i_vcStateP, i_fileP); > >i_commentsP = vcedit_comments(i_vcStateP); > > > >// now delete all existing comments > >vorbis_comment_clear(i_commentsP); > >vorbis_comment_init(i_commentsP); > > > >// now in here add some new comments > >vorbis_comment_add_tag( > > i_commentsP, > > const_cast<char *>(Key_CommonToCustom(common)), > > const_cast<char *>(str.utf8Z())); > > > >// now update the changes > >vcedit_write(i_vcStateP, i_fileP); > >vcedit_clear(i_vcStateP); > > > >however, all this seems to do is APPEND comments, rather that > >delete and create new ones. > > > >how the heck do I delete the old comments?? > > _______________________________________________ > Vorbis-dev mailing list > Vorbis-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/vorbis-dev