TagsEditor.ID3V2_PrivateFrameMemoryFileGet method |
|
Remarks
Obtains a copy in memory of the file stored inside an ID3V2 private frame (PRIV).
For further details about methods related to tags reading refer to the TagsReaderMan class.
For details about the reading of tags see the How to read TAG information in sound files tutorial.
Syntax
[Visual Basic] Public Function ID3V2_PrivateFrameMemoryFileGet ( nIndex as Int32, pBuffer() as Byte, nBufferLength as Int32 ) as enumErrorCodes |
[C#] public string ID3V2_PrivateFrameMemoryFileGet ( Int32 nIndex, byte[] pBuffer, Int32 nBufferLength ); |
[C++] public: string ID3V2_PrivateFrameMemoryFileGet ( Int32 nIndex, unsigned char __gc[] pBuffer, Int32 nBufferLength ); |
Parameter |
Description |
|
|
nIndex |
Zero-based index of the general object frame. The total number of private frames available inside the ID3V2 tag can be obtained through a call to the TagsReader.ID3V2_FrameCountGet method with the strFrameId parameter set to "PRIV". |
pBuffer |
Output buffer that, on return from the method call, will contain the file data |
nBufferLength |
Length of the buffer expressed in bytes. The size for the memory buffer can be obtained through the TagsReader.ID3V2_PrivateFrameSizeGet method. |
Return value
Value |
Meaning |
|
|
Negative value |
An error occurred (see the LastError property for further error details) |
enumErrorCodes.NOERROR (0) |
The method call was successful. |
Below you can find a couple of samples that demonstrate how to retrieve a general object and store it inside a memory buffer in Visual Basic.NET and Visual C#:
Visual Basic.NET
Private Sub buttonGetObject_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles buttonGetObject.Click
{
' get the size of the picture in bytes
Dim nSizeInBytes As Int32
AudioSoundEditor1.TagsReader.ID3V2_GeneralObjectFrameSizeGet (0, nSizeInBytes)
if nSizeInBytes = 0 then Exit Sub
' allocate the receiving buffer
Dim byteBuffer As Byte() = Nothing
byteBuffer = New Byte(nSizeInBytes)
' read picture data
AudioSoundEditor1.TagsReader.ID3V2_GeneralObjectFrameMemoryFileGet (0, byteBuffer, nSizeInBytes)
...
use the buffer
...
}
Visual C#
private void buttonGetObject_Click(object sender, System.EventArgs e)
{
// get the size of the picture in bytes
Int32 nSizeInBytes = 0;
AudioSoundEditor1.TagsReader.ID3V2_GeneralObjectFrameSizeGet (0, ref nSizeInBytes);
if (nSizeInBytes == 0)
return;
// allocate the receiving buffer
byte[] byteBuffer = new byte[nSizeInBytes];
// read picture data
AudioSoundEditor1.TagsReader.ID3V2_GeneralObjectFrameMemoryFileGet (0, byteBuffer, nSizeInBytes);
...
use the buffer
...
}