ios - Write ID3 Tags with OBJC -
so need write new id3 tags audio file. try use 2 methods.
first.
i used core audio, , read tags,
-(void)getinformationaudiofile { //get title , artist information audio file //read raw id3tag size uint32 id3datasize = 0; char *rawid3tag = null; audiofilegetpropertyinfo(inputfile, kaudiofilepropertyid3tag, &id3datasize, null); rawid3tag = (char *)malloc(id3datasize); //read raw id3tag audiofilegetproperty(inputfile, kaudiofilepropertyid3tag, &id3datasize, rawid3tag); cfdictionaryref pidict = nil; uint32 pidatasize = sizeof(pidict); //this key returns other dictionary, works in ipod library audioformatgetproperty(kaudioformatproperty_id3tagtodictionary, id3datasize, rawid3tag, &pidatasize, &pidict); free(rawid3tag); nsdictionary *tagsdictionary = (__bridge nsdictionary*)pidict; nslog (@"dictionary: %@", tagsdictionary); self->_title = [tagsdictionary objectforkey:@"tit2"]; if(!self.title) self->_title = self.url.path.lastpathcomponent.stringbydeletingpathextension; self->_artist = [tagsdictionary objectforkey:@"tpe1"]; if(!self.artist) self->_artist = @"unknown artist"; self->_album = [tagsdictionary objectforkey:@"talb"]; if(!self.album) self->_album = @"unknown album"; self->_genre = [tagsdictionary objectforkey:@"tcon"]; if(!self.genre) self->_genre = @"unknown genre"; self->_year = [tagsdictionary objectforkey:@"tyer"]; if(!self.year) self->_year = @"unknown year"; cfrelease(pidict); }
and dont know how change tag of file.
second.
so found method using taglib , found examples, guys using library , objc read files. , didnt find examples how write tags.
so want know how can write id3 tags?
sorry english.
Comments
Post a Comment