 |
|
 |
Hi don't know if anyone still reading this, but anyone noticed that if adding an image to an flac file it will reduce the size of the image file by half. Any one has a solution for this? Or is that ok?
|
|
|
|
 |
|
 |
The library save the picture using that code:
var image = new MemoryStream();
BitmapEncoder be = BitmapEncoder.Create(bitmap.Decoder.CodecInfo.ContainerFormat);
be.Frames.Add(bitmap);
be.Save(image);
byte[] binPicture = image.ToArray();
|
|
|
|
 |
|
|
 |
|
 |
trying to create a cover for the song (cover.jpg), but fails. flac native file
If I understand correctly that there is only one opportunity to add a tag - it is using the method .... AddTag (String, String),
looked at the property .... Arts [0]. Picture but it's how I understood read-only
as you can change \ add cover with this library?
Apologize for my English, I'm from Russia
|
|
|
|
 |
|
 |
Have you tried to call Arts.Add method?
|
|
|
|
 |
|
 |
yeah.
that's what I wrote.
Stream jpgStream = new FileStream(pathImage, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
var jpgDecoder = new JpegBitmapDecoder(jpgStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); // создаем обьект декодер
var jpgFrame = jpgDecoder.Frames[0];
var id3PicFrame = new ID3PictureFrame(jpgFrame,ID3PictureType.Other);
target.Arts.Add(id3PicFrame);
target.SaveMetadata();
everything turned out!
picture added, many thanks for the tip, and excellent library modified on Tuesday, February 9, 2010 11:41 AM
|
|
|
|
 |
|
 |
When I use the following code:
DateTime time = new DateTime(0);
time = time.AddSeconds(ogg.Duration);
And try to get the duration of a "ogg" file with a duration of "5:59" I get the following.
"12:05:59 AM"
Am I doing something wrong?
|
|
|
|
 |
|
 |
Try :
string d = time.ToString("mm:ss");
|
|
|
|
 |
|
 |
I should have asked this in my first post. How do I get the "BPM, Composer, Encoded By, Publisher" tags?
Thanks for your help btw.
|
|
|
|
 |
|
 |
SortedList<string, List<string>> tags = ogg.GetAllTags();
After checking if your tag exists in the collection:
string bpm = tags["BPM"][0];
|
|
|
|
 |
|
 |
I want to write more than 65535 bytes as comment. The lib is calculating (correctly) more than 255 segments.
bw.Write((byte)(numberTotalSegment - numberOldCommentSegment + numberNewCommentSegment)); // write page segments
where
numberTotalSegment - numberOldCommentSegment + numberNewCommentSegment = 282
The comment byte array with a size >0xFFFF is written to the stream without fragmenting.
|
|
|
|
 |
|
 |
Hi,
This problem of Ogg page fragmentation has been resolved in the version 2.0 of Luminescence.Xiph.
The new library (.NET 3.5) now supports picture tags in OggFLAC and native FLAC.
New classes are: ID3PictureFrame, OggPage, OggPageReader,...
The version 2.0 will be uploaded to Code Project soon. But, you can download it immediatly at :
http://www.luminescence-software.org/download/Luminescence.Xiph.zip
Tell me if your problem is solved.
Cyber Sinh
|
|
|
|
 |
|
 |
Wow - fast Support ) Thank you for fixing!
I'll post the result asap. You have some breaking changes i need to fixin my code.
|
|
|
|
 |
|
 |
Hi,
The updated version of my article has been sent to Code Project.
I am waiting for your feedback...
|
|
|
|
 |
|
 |
Hy,
I just found a bug in your library, it crashes with small ogg files.
Here is the code to fix it(Oggtagger.cs):
private long GetSamples(BinaryReader br)
{
long pos = br.BaseStream.Length - 65307;
if(pos<0) pos=0;
br.BaseStream.Position = pos;
int bufferlength = (int)(br.BaseStream.Length) < 65307 ? (int)(br.BaseStream.Length) : 65307;
byte[] buffer = br.ReadBytes(bufferlength); // max page size = max data size (65025) + max header size (282) = 65307 bytes
for (int i = bufferlength-28; i >= 0; i--) // max page size (65307) - min page size (28) = 65279
[...]
|
|
|
|
 |
|
 |
Thanks a lot!
This bug is now corrected.
|
|
|
|
 |
|
 |
Thanks for sharing the code. I hope to use soon the SDK inside the site[^]
Good job Cyber i've give my 5 stars.
Dr.Luiji
Trust and you'll be trusted.
|
|
|
|
 |
|
 |
Hi,
In OggTagger.cs
in private void ReadVorbisComment(BinaryReader br)
{
...
string[] temp = comment2.Split(new char[] { '=' });
...
}
there is a bug.
COMMENT=rating=5 for example will result in a comment value of "rating" instead of "rating=5" which would be the desired behaviour.
I'll try to fix it.
Regards,
Gregor
|
|
|
|
 |
|
 |
Here is the fix:
replace the line:
string[] temp = comment2.Split(new char[] { '=' });
with:
int sepindex = comment2.IndexOf('=');
string[] temp = new string[2];
temp[0] = comment2.Substring(0, sepindex);
temp[1] = comment2.Substring(sepindex + 1);
and it will work correctly.
Thanks for the great library,
Gregor
|
|
|
|
 |
|
 |
This bug has been corrected in the last version.
Thanks!
|
|
|
|
 |
|
 |
It is spoiled by the lack of any sample code. Download this and there is no project file or sample code and I couldn't figure out how to build or run anything. A simple console application that reads and writes a tag on an included sample .flac for, for example, would have made all the difference. Maybe this is included more in order to promote the attached .exe sample app rather than to allow us to develop our own simple tag reader / writer applications.
Has anyone used this code and if so how? I tried adding a reference to the dll in the release directory to a c# project and got an error message.
I need to read and write flac tags in c#. I see there is a C DLL called TagLib. Couldn't see a c# wrapper... is my best option to use that and write one myself?
|
|
|
|
 |
|
 |
Hi,
This assembly permits only to read and write tags in Ogg stream (Ogg FLAC, Ogg Vorbis, Ogg Speex), not native FLAC tags.
|
|
|
|
 |
|
 |
New version of Luminescence.Xiph assembly now supports native FLAC.
Have fun
|
|
|
|
 |