| Author |
Message |
smith
Guest
|
Posted:
Tue Oct 05, 2004 8:05 pm Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
Would it be any eaiser for folks to get rolling if instead of
Lyrics_Synchronised we tried the struct for the image first?
As to the conversion of the sdk C# sample structures to VB.net a starter can
be had from http://www.smithvoice.com/downs/svmedia.zip
For a quick look at what that does without a download, just click on
http://www.smithvoice.com/wmediaattrib.htm
This does the simple types (Strings, Bools, Ints) and the question, as I
understand it, is how to use Set or Add/Modify on the binary types.
-smith
|
|
| Back to top |
|
 |
Vincas Stepankevicius
Guest
|
Posted:
Tue Oct 05, 2004 9:24 pm Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
Nice to see you here again, Robert :)
There is absolutely no difference, which attr you'll examine. Having
clearness with pic, you'll be done with slyr too and vice versa.
After visiting your site site thought that it would be nice to show you a
screenshot of my app I've told you about.
Unfortunately, I haven't any public website to publish it for you, so if you
agree, I'll send it by e-mail.
What app's doing:
Attribute view/update (view - all attrs/update- all but those we are
talking about);
displays all embeded pics, lyrics, synched lyrics;
scrolls synched lyrics in a karaoke-style while playing;
plus has a very simple & handy lyrics synchronising interface (in
contrast to awkward WMP10 one)
So, the only thing I'm missing - binary attrs update (with simple ones, as
I've told, I had no problems).
That's why I'm here :)
Vincas
"smith" <rcsTAKEOUT@smithvoiceTAKEOUT.com> wrote in message
news:DDz8d.3343$UP1.809@newsread1.news.pas.earthlink.net...
| Quote: | Would it be any eaiser for folks to get rolling if instead of
Lyrics_Synchronised we tried the struct for the image first?
As to the conversion of the sdk C# sample structures to VB.net a starter
can
be had from http://www.smithvoice.com/downs/svmedia.zip
For a quick look at what that does without a download, just click on
http://www.smithvoice.com/wmediaattrib.htm
This does the simple types (Strings, Bools, Ints) and the question, as I
understand it, is how to use Set or Add/Modify on the binary types.
-smith
|
|
|
| Back to top |
|
 |
Alessandro Angeli [MVP::D
Guest
|
Posted:
Tue Oct 05, 2004 11:19 pm Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
Vincas Stepankevicius wrote:
| Quote: | If I got it right, I can use your spelled e-mail for
sending such file. Correct me if I'm wrong.
|
Here is the sample code that dumps the synchronized lyrics:
---------------------------------------------
using System;
using System.IO;
using System.Runtime.InteropServices;
using WMFSDKWrapper;
public class slyr
{
public static void Main(string[] args)
{
try {
IWMMetadataEditor pEditor = null;
WMFSDKFunctions.WMCreateEditor(out pEditor);
pEditor.Open("x.wma");
IWMHeaderInfo3 pHeader = (IWMHeaderInfo3)pEditor;
ushort wStream = 0;
ushort wCount = 0;
pHeader.GetAttributeCountEx(wStream,out wCount);
for(ushort i = 0; i < wCount; i++) {
WMT_ATTR_DATATYPE dtType = 0;
ushort wLang = 0;
string szName = null;
byte[] pbData = null;
ushort wName = 0;
uint dwData = 0;
pHeader.GetAttributeByIndexEx(wStream,i,szName,ref
wName,out dtType,out wLang,pbData,ref dwData);
szName = new string('\0',wName-1);
pbData = new byte[dwData];
pHeader.GetAttributeByIndexEx(wStream,i,szName,ref
wName,out dtType,out wLang,pbData,ref dwData);
if(szName != "WM/Lyrics_Synchronised") continue;
MemoryStream pStream = new MemoryStream(pbData);
BinaryReader pReader = new BinaryReader(pStream);
uint ptr, end; string line; uint time;
Console.WriteLine(">>> bTimeStampFormat .... =
{0}",pReader.ReadByte());
Console.WriteLine(">>> bContentType ........ =
{0}",pReader.ReadByte());
Console.WriteLine(">>> pwszContentDescriptor =
L\"{0}\"",Marshal.PtrToStringUni(new
IntPtr(pReader.ReadUInt32())));
Console.WriteLine(">>> dwLyricsLen ......... = {0}",end
= pReader.ReadUInt32());
Console.WriteLine(">>> pbLyrics ............ =
${0:X8}",ptr = pReader.ReadUInt32());
for(end += ptr; ptr < end; ) {
line = Marshal.PtrToStringUni(new IntPtr(ptr)); ptr +=
(uint)(2*(1+line.Length));
time = (uint)Marshal.ReadInt32(new IntPtr(ptr)); ptr +=
4;
Console.WriteLine(">>>\t [{0:d}:{1:d2}:{2:d2}.{3:d3}]
L\"{4}\"",time/1000/60/60,(time/1000/60)%60,(time/1000)%60,t
ime%1000,line);
}
}
} catch(COMException ex) {
Console.WriteLine(ex.ToString());
}
}
}
---------------------------------------------
--
// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net
|
|
| Back to top |
|
 |
Vincas Stepankevicius
Guest
|
Posted:
Tue Oct 05, 2004 11:30 pm Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
I'm glad about my English and Alessandro - I consider you being indebted him
$10 ;-)
Vincas
"Neil Smith [MVP Digital Media]" <neil@nospam.com> wrote in message
news:cmd5m0hm53phv4m3510fk57s4rk05n5qjf@4ax.com...
| Quote: | Not at all - I wasn't being nasty ! I'm a web developer so I'm more or
less clueless about what you were asking ;-)
The English was fine, it was the technical content that baffled me.
It's probably a very interesting question, I just have no idea what
the answer will be !
Hopefully, Alessandro has a few clues he can offer.
Kind regards - Neil
On Tue, 5 Oct 2004 13:03:44 +0300, "Vincas Stepankevicius"
vstepankevicius@vilnius.vmi.lt> wrote:
Hi, Neil,
Of cource, you may be not so savy as I expected, but please be at least
more
well-meant :)
If my terrible English (I'm Lithanian) is the only reason you can't
answer
this question - it's not so bad ;)
In the simplest terms I just asked for a sample of VB.NET code for
updating
extended binary attributes of media files...
If you are still hazy about purport of my request - please, be so kind -
don't waste your time :)
thanks,
Vincas
"Neil Smith [MVP Digital Media]" <neil@nospam.com> wrote in message
news:o2n4m056oedn8v3bsausukcbtdngg5pe75@4ax.com...
I'll consider giving $10 to anybody who understands and can explain to
me a word he's on about Hehe. ;-)))
Cheers - Neil |
|
|
| Back to top |
|
 |
Vincas Stepankevicius
Guest
|
Posted:
Tue Oct 05, 2004 11:50 pm Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
Thanx, Alessandro, I must rush now to study & test your sample (regrettably,
I need some time to convert it Into VB)
But now I see some "light in the end of tunnel" :)
I'll be back tomorow,
regards,
Vincas
"Alessandro Angeli [MVP::DigitalMedia]" <nobody@nowhere.in.the.net> wrote in
message news:u$$JOBxqEHA.3504@TK2MSFTNGP14.phx.gbl...
| Quote: | Vincas Stepankevicius wrote:
If I got it right, I can use your spelled e-mail for
sending such file. Correct me if I'm wrong.
Here is the sample code that dumps the synchronized lyrics:
---------------------------------------------
using System;
using System.IO;
using System.Runtime.InteropServices;
using WMFSDKWrapper;
public class slyr
{
public static void Main(string[] args)
{
try {
IWMMetadataEditor pEditor = null;
WMFSDKFunctions.WMCreateEditor(out pEditor);
pEditor.Open("x.wma");
IWMHeaderInfo3 pHeader = (IWMHeaderInfo3)pEditor;
ushort wStream = 0;
ushort wCount = 0;
pHeader.GetAttributeCountEx(wStream,out wCount);
for(ushort i = 0; i < wCount; i++) {
WMT_ATTR_DATATYPE dtType = 0;
ushort wLang = 0;
string szName = null;
byte[] pbData = null;
ushort wName = 0;
uint dwData = 0;
pHeader.GetAttributeByIndexEx(wStream,i,szName,ref
wName,out dtType,out wLang,pbData,ref dwData);
szName = new string('\0',wName-1);
pbData = new byte[dwData];
pHeader.GetAttributeByIndexEx(wStream,i,szName,ref
wName,out dtType,out wLang,pbData,ref dwData);
if(szName != "WM/Lyrics_Synchronised") continue;
MemoryStream pStream = new MemoryStream(pbData);
BinaryReader pReader = new BinaryReader(pStream);
uint ptr, end; string line; uint time;
Console.WriteLine(">>> bTimeStampFormat .... =
{0}",pReader.ReadByte());
Console.WriteLine(">>> bContentType ........ =
{0}",pReader.ReadByte());
Console.WriteLine(">>> pwszContentDescriptor =
L\"{0}\"",Marshal.PtrToStringUni(new
IntPtr(pReader.ReadUInt32())));
Console.WriteLine(">>> dwLyricsLen ......... = {0}",end
= pReader.ReadUInt32());
Console.WriteLine(">>> pbLyrics ............ =
${0:X8}",ptr = pReader.ReadUInt32());
for(end += ptr; ptr < end; ) {
line = Marshal.PtrToStringUni(new IntPtr(ptr)); ptr +=
(uint)(2*(1+line.Length));
time = (uint)Marshal.ReadInt32(new IntPtr(ptr)); ptr +=
4;
Console.WriteLine(">>>\t [{0:d}:{1:d2}:{2:d2}.{3:d3}]
L\"{4}\"",time/1000/60/60,(time/1000/60)%60,(time/1000)%60,t
ime%1000,line);
}
}
} catch(COMException ex) {
Console.WriteLine(ex.ToString());
}
}
}
---------------------------------------------
--
// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net
|
|
|
| Back to top |
|
 |
smith
Guest
|
Posted:
Tue Oct 05, 2004 11:54 pm Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
That's a nice looking app, Vincas.
I threw together a fast page so others can see what you're up to and maybe
get more help on this.
Here's your page:
http://www.smithvoice.com/vincas.htm
You'll have to let me know when you get a winner here, I don't have the
resources to make a redundant thread on my sitelett and keeping it to this
group will help far more people.
-robert smith
kirkland, wa |
|
| Back to top |
|
 |
Alessandro Angeli [MVP::D
Guest
|
Posted:
Wed Oct 06, 2004 12:27 am Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
Vincas Stepankevicius wrote:
| Quote: | Thanx, Alessandro, I must rush now to study & test your
sample (regrettably, I need some time to convert it Into
VB)
But now I see some "light in the end of tunnel" :)
I'll be back tomorow,
|
Unfortunately, I don't enough VB.NET to provide samples in
that language in a short time. Here you are a better sample
which also supports WM/Picture:
--------------------------------------
using System;
using System.IO;
using System.Runtime.InteropServices;
using WMFSDKWrapper;
public class slyr
{
public static void Main(string[] args)
{
try {
IWMMetadataEditor pEditor = null;
WMFSDKFunctions.WMCreateEditor(out pEditor);
pEditor.Open("x.wma");
IWMHeaderInfo3 pHeader = (IWMHeaderInfo3)pEditor;
ushort wStream = 0;
ushort wCount = 0;
pHeader.GetAttributeCountEx(wStream,out wCount);
for(ushort i = 0; i < wCount; i++) {
WMT_ATTR_DATATYPE dtType = 0;
ushort wLang = 0;
string szName = null;
byte[] pbData = null;
ushort wName = 0;
uint dwData = 0;
pHeader.GetAttributeByIndexEx(wStream,i,szName,ref
wName,out dtType,out wLang,pbData,ref dwData);
szName = new string('\0',wName-1);
pbData = new byte[dwData];
pHeader.GetAttributeByIndexEx(wStream,i,szName,ref
wName,out dtType,out wLang,pbData,ref dwData);
Console.WriteLine(">>> \"{0}\"",szName);
MemoryStream pStream = new MemoryStream(pbData);
BinaryReader pReader = new BinaryReader(pStream);
uint ptr, end;
if(szName == "WM/Lyrics_Synchronised") {
Console.WriteLine(">>>\t bTimeStampFormat .... =
{0}",pReader.ReadByte());
Console.WriteLine(">>>\t bContentType ........ =
{0}",pReader.ReadByte());
Console.WriteLine(">>>\t pwszContentDescriptor =
L\"{0}\"",Marshal.PtrToStringUni(new
IntPtr(pReader.ReadUInt32())));
Console.WriteLine(">>>\t dwLyricsLen ......... =
{0}",end = pReader.ReadUInt32());
Console.WriteLine(">>>\t pbLyrics ............ =
${0:X8}",ptr = pReader.ReadUInt32());
for(end += ptr; ptr < end; ) {
string line; uint time;
line = Marshal.PtrToStringUni(new IntPtr(ptr)); ptr +=
(uint)(2*(1+line.Length));
time = (uint)Marshal.ReadInt32(new IntPtr(ptr)); ptr
+= 4;
Console.WriteLine(">>>\t\t
[{0:d}:{1:d2}:{2:d2}.{3:d3}]
L\"{4}\"",time/1000/60/60,(time/1000/60)%60,(time/1000)%60,t
ime%1000,line);
}
} else if(szName == "WM/Picture") {
Console.WriteLine(">>>\t pwszMIMEType .. =
{0}",Marshal.PtrToStringUni(new
IntPtr(pReader.ReadUInt32())));
Console.WriteLine(">>>\t bPictureType .. =
{0}",pReader.ReadByte());
Console.WriteLine(">>>\t pwszDescription =
L\"{0}\"",Marshal.PtrToStringUni(new
IntPtr(pReader.ReadUInt32())));
Console.WriteLine(">>>\t dwDataLen ..... = {0}",end =
pReader.ReadUInt32());
Console.WriteLine(">>>\t pbData ........ = ${0:X8}",ptr
= pReader.ReadUInt32());
FileStream pFile = new
FileStream("picture"+i+".img",FileMode.OpenOrCreate,FileAcce
ss.Write);
IntPtr bas = new IntPtr(ptr);
for(int off = 0; off < end; off++)
pFile.WriteByte(Marshal.ReadByte(bas,off));
}
}
} catch(COMException ex) {
Console.WriteLine(ex.ToString());
}
}
}
--------------------------------------
--
// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net |
|
| Back to top |
|
 |
Neil Smith [MVP Digital M
Guest
|
Posted:
Wed Oct 06, 2004 12:50 am Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
On Tue, 5 Oct 2004 22:30:50 +0300, "Vincas Stepankevicius"
<vstepankevicius@vilnius.vmi.lt> wrote:
| Quote: | I'm glad about my English and Alessandro - I consider you being indebted him
$10 ;-)
|
Damn !
Oh, yeah I see what you;re doing from the screenshots now. I had some
similar problems to do an 'Export to Excel' (which was only partly
tested) but I did it in javascript. It mostly falls down on the XML
processing, and really needs to go client side :
http://www.windowsmediatv.com/wmprocessor/medialibrarytoexcel.html
The problem is, AFAIK the Excel ("Office Web Components") you can put
into a web page, don't read *native* OfficeXML format files :-P
Anyway - cheers & good luck with this.
========================================================
CaptionKit http://www.captionkit.com : Produce subtitled
internet media, transcripts and searchable video. Supports
Real Player, Quicktime and Windows Media Player.
VideoChat with friends online, get Freshly Toasted every
day at http://www.fresh-toast.net : NetMeeting solutions
for a connected world. |
|
| Back to top |
|
 |
Alessandro Angeli [MVP::D
Guest
|
Posted:
Wed Oct 06, 2004 1:32 am Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
Vincas Stepankevicius wrote:
| Quote: | (regrettably, I need some time to convert it Into VB)
|
Well, I couldn't sleep, so here you are the VB.NET version:
----------vb.bat------------
csc /debug+ /target:module WMFSDKFunctions.cs
vbc /debug+ /addmodule:WMFSDKFunctions.netmodule *.vb
----------------------------
----------slyr.vb-----------
IMPORTS System
IMPORTS System.IO
IMPORTS System.Runtime.InteropServices
IMPORTS WMFSDKWrapper
PUBLIC MODULE slyr
SUB Main()
TRY
DIM pEditor AS IWMMetadataEditor
WMFSDKFunctions.WMCreateEditor(pEditor)
pEditor.Open("x.wma")
DIM pHeader AS IWMHeaderInfo3 = pEditor
DIM wStream AS UInt16
DIM wCount AS UInt16
pHeader.GetAttributeCountEx(wStream,wCount)
FOR i AS Integer = 0 TO Convert.ToInt32(wCount)-1
DIM dtType AS WMT_ATTR_DATATYPE
DIM wLang AS UInt16
DIM szName AS String = Nothing
DIM pbData() AS Byte = Nothing
DIM wName AS UInt16
DIM dwData AS UInt32
pHeader.GetAttributeByIndexEx(wStream,Convert.ToUInt16(i),sz
Name,wName,dtType,wLang,pbData,dwData)
szName = NEW String("0",Convert.ToInt32(wName)-1)
REDIM pbData(Convert.ToInt32(dwData))
pHeader.GetAttributeByIndexEx(wStream,Convert.ToUInt16(i),sz
Name,wName,dtType,wLang,pbData,dwData)
Console.WriteLine(">>> ""{0}""",szName)
DIM pStream AS MemoryStream = NEW MemoryStream(pbData)
DIM pReader AS BinaryReader = NEW BinaryReader(pStream)
DIM _ptr, _end AS Integer
IF szName = "WM/Lyrics_Synchronised" THEN
Console.WriteLine(">>> bTimeStampFormat .... =
{0}",pReader.ReadByte())
Console.WriteLine(">>> bContentType ........ =
{0}",pReader.ReadByte())
Console.WriteLine(">>> pwszContentDescriptor =
L""{0}""",Marshal.PtrToStringUni(NEW
IntPtr(pReader.ReadInt32())))
_end = pReader.ReadInt32()
Console.WriteLine(">>> dwLyricsLen ......... =
{0}",_end)
_ptr = pReader.ReadInt32()
Console.WriteLine(">>> pbLyrics ............ =
${0:X8}",_ptr)
_end = _end + _ptr
WHILE _ptr < _end
DIM line AS String
DIM time As Integer
line = Marshal.PtrToStringUni(NEW IntPtr(_ptr))
_ptr = _ptr + 2 * (1 + line.Length)
time = Marshal.ReadInt32(NEW IntPtr(_ptr))
_ptr = _ptr + 4
Console.WriteLine(">>>
[{0:d}:{1:d2}:{2:d2}.{3:d3}]
L""{4}""",time\1000\60\60,(time\1000\60) mod 60,(time\1000)
mod 60,time mod 1000,line)
END WHILE
ELSE IF szName = "WM/Picture" THEN
Console.WriteLine(">>> pwszMIMEType .. =
{0}",Marshal.PtrToStringUni(NEW
IntPtr(pReader.ReadInt32())))
Console.WriteLine(">>> bPictureType .. =
{0}",pReader.ReadByte())
Console.WriteLine(">>> pwszDescription =
L""{0}""",Marshal.PtrToStringUni(NEW
IntPtr(pReader.ReadInt32())))
_end = pReader.ReadInt32()
Console.WriteLine(">>> dwDataLen ..... = {0}",_end)
_ptr = pReader.ReadInt32()
Console.WriteLine(">>> pbData ........ =
${0:X8}",_ptr)
DIM pFile AS FileStream = NEW FileStream("picture" & i
& ".jpg",FileMode.OpenOrCreate,FileAccess.Write)
DIM bas AS IntPtr = NEW IntPtr(_ptr)
FOR off AS Integer = 0 TO _end-1
pFile.WriteByte(Marshal.ReadByte(bas,off))
NEXT off
END IF
NEXT i
CATCH ex AS COMException
Console.WriteLine(ex.ToString())
END TRY
END SUB
END MODULE
--------------------------------
--
// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net |
|
| Back to top |
|
 |
Vincas Stepankevicius
Guest
|
Posted:
Wed Oct 06, 2004 2:27 am Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
Yep!
Great job, Alessandro!
Now it's too late(1:30) to check your code but it seems for me that you
have allredy $20 from two Smith's - 10 from Robert + 10 from Neil ;)
Forgive me, that I cant propose you nothing else but my respect and
gratitude :)
I see now how my problems can be solved but I'd appreciate if you find time
to make an experiment with updating attrs ;)
My best regards,
Vincas
"Alessandro Angeli [MVP::DigitalMedia]" <nobody@nowhere.in.the.net> wrote in
message news:OSqWTLyqEHA.3428@TK2MSFTNGP11.phx.gbl...
| Quote: | Vincas Stepankevicius wrote:
(regrettably, I need some time to convert it Into VB)
Well, I couldn't sleep, so here you are the VB.NET version:
----------vb.bat------------
csc /debug+ /target:module WMFSDKFunctions.cs
vbc /debug+ /addmodule:WMFSDKFunctions.netmodule *.vb
----------------------------
----------slyr.vb-----------
IMPORTS System
IMPORTS System.IO
IMPORTS System.Runtime.InteropServices
IMPORTS WMFSDKWrapper
PUBLIC MODULE slyr
SUB Main()
TRY
DIM pEditor AS IWMMetadataEditor
WMFSDKFunctions.WMCreateEditor(pEditor)
pEditor.Open("x.wma")
DIM pHeader AS IWMHeaderInfo3 = pEditor
DIM wStream AS UInt16
DIM wCount AS UInt16
pHeader.GetAttributeCountEx(wStream,wCount)
FOR i AS Integer = 0 TO Convert.ToInt32(wCount)-1
DIM dtType AS WMT_ATTR_DATATYPE
DIM wLang AS UInt16
DIM szName AS String = Nothing
DIM pbData() AS Byte = Nothing
DIM wName AS UInt16
DIM dwData AS UInt32
pHeader.GetAttributeByIndexEx(wStream,Convert.ToUInt16(i),sz
Name,wName,dtType,wLang,pbData,dwData)
szName = NEW String("0",Convert.ToInt32(wName)-1)
REDIM pbData(Convert.ToInt32(dwData))
pHeader.GetAttributeByIndexEx(wStream,Convert.ToUInt16(i),sz
Name,wName,dtType,wLang,pbData,dwData)
Console.WriteLine(">>> ""{0}""",szName)
DIM pStream AS MemoryStream = NEW MemoryStream(pbData)
DIM pReader AS BinaryReader = NEW BinaryReader(pStream)
DIM _ptr, _end AS Integer
IF szName = "WM/Lyrics_Synchronised" THEN
Console.WriteLine(">>> bTimeStampFormat .... =
{0}",pReader.ReadByte())
Console.WriteLine(">>> bContentType ........ =
{0}",pReader.ReadByte())
Console.WriteLine(">>> pwszContentDescriptor =
L""{0}""",Marshal.PtrToStringUni(NEW
IntPtr(pReader.ReadInt32())))
_end = pReader.ReadInt32()
Console.WriteLine(">>> dwLyricsLen ......... =
{0}",_end)
_ptr = pReader.ReadInt32()
Console.WriteLine(">>> pbLyrics ............ =
${0:X8}",_ptr)
_end = _end + _ptr
WHILE _ptr < _end
DIM line AS String
DIM time As Integer
line = Marshal.PtrToStringUni(NEW IntPtr(_ptr))
_ptr = _ptr + 2 * (1 + line.Length)
time = Marshal.ReadInt32(NEW IntPtr(_ptr))
_ptr = _ptr + 4
Console.WriteLine("
[{0:d}:{1:d2}:{2:d2}.{3:d3}]
L""{4}""",time\1000\60\60,(time\1000\60) mod 60,(time\1000)
mod 60,time mod 1000,line)
END WHILE
ELSE IF szName = "WM/Picture" THEN
Console.WriteLine(">>> pwszMIMEType .. =
{0}",Marshal.PtrToStringUni(NEW
IntPtr(pReader.ReadInt32())))
Console.WriteLine(">>> bPictureType .. =
{0}",pReader.ReadByte())
Console.WriteLine(">>> pwszDescription =
L""{0}""",Marshal.PtrToStringUni(NEW
IntPtr(pReader.ReadInt32())))
_end = pReader.ReadInt32()
Console.WriteLine(">>> dwDataLen ..... = {0}",_end)
_ptr = pReader.ReadInt32()
Console.WriteLine(">>> pbData ........ =
${0:X8}",_ptr)
DIM pFile AS FileStream = NEW FileStream("picture" & i
& ".jpg",FileMode.OpenOrCreate,FileAccess.Write)
DIM bas AS IntPtr = NEW IntPtr(_ptr)
FOR off AS Integer = 0 TO _end-1
pFile.WriteByte(Marshal.ReadByte(bas,off))
NEXT off
END IF
NEXT i
CATCH ex AS COMException
Console.WriteLine(ex.ToString())
END TRY
END SUB
END MODULE
--------------------------------
--
// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net
|
|
|
| Back to top |
|
 |
smith
Guest
|
Posted:
Wed Oct 06, 2004 2:43 am Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
So that's the winner? You sure? You positive that's what you want? That
VB.Net code works? :)
I'll need to be emailed by Alessandro, then.
*Great* job everyone!. And a bit of fun, too.
Robert Smith
Kirkland, WA
http://www.smithvoice.com
"Vincas Stepankevicius" <vstepankevicius@vilnius.vmi.lt> wrote in message
news:%238U9UqyqEHA.3712@TK2MSFTNGP15.phx.gbl...
| Quote: | Yep!
Great job, Alessandro!
Now it's too late(1:30) to check your code but it seems for me that you
have allredy $20 from two Smith's - 10 from Robert + 10 from Neil ;)
Forgive me, that I cant propose you nothing else but my respect and
gratitude :)
I see now how my problems can be solved but I'd appreciate if you find
time
to make an experiment with updating attrs ;)
My best regards,
Vincas
"Alessandro Angeli [MVP::DigitalMedia]" <nobody@nowhere.in.the.net> wrote
in
message news:OSqWTLyqEHA.3428@TK2MSFTNGP11.phx.gbl...
Vincas Stepankevicius wrote:
(regrettably, I need some time to convert it Into VB)
Well, I couldn't sleep, so here you are the VB.NET version:
----------vb.bat------------
csc /debug+ /target:module WMFSDKFunctions.cs
vbc /debug+ /addmodule:WMFSDKFunctions.netmodule *.vb
----------------------------
----------slyr.vb-----------
IMPORTS System
IMPORTS System.IO
IMPORTS System.Runtime.InteropServices
IMPORTS WMFSDKWrapper
PUBLIC MODULE slyr
SUB Main()
TRY
DIM pEditor AS IWMMetadataEditor
WMFSDKFunctions.WMCreateEditor(pEditor)
pEditor.Open("x.wma")
DIM pHeader AS IWMHeaderInfo3 = pEditor
DIM wStream AS UInt16
DIM wCount AS UInt16
pHeader.GetAttributeCountEx(wStream,wCount)
FOR i AS Integer = 0 TO Convert.ToInt32(wCount)-1
DIM dtType AS WMT_ATTR_DATATYPE
DIM wLang AS UInt16
DIM szName AS String = Nothing
DIM pbData() AS Byte = Nothing
DIM wName AS UInt16
DIM dwData AS UInt32
pHeader.GetAttributeByIndexEx(wStream,Convert.ToUInt16(i),sz
Name,wName,dtType,wLang,pbData,dwData)
szName = NEW String("0",Convert.ToInt32(wName)-1)
REDIM pbData(Convert.ToInt32(dwData))
pHeader.GetAttributeByIndexEx(wStream,Convert.ToUInt16(i),sz
Name,wName,dtType,wLang,pbData,dwData)
Console.WriteLine(">>> ""{0}""",szName)
DIM pStream AS MemoryStream = NEW MemoryStream(pbData)
DIM pReader AS BinaryReader = NEW BinaryReader(pStream)
DIM _ptr, _end AS Integer
IF szName = "WM/Lyrics_Synchronised" THEN
Console.WriteLine(">>> bTimeStampFormat .... =
{0}",pReader.ReadByte())
Console.WriteLine(">>> bContentType ........ =
{0}",pReader.ReadByte())
Console.WriteLine(">>> pwszContentDescriptor =
L""{0}""",Marshal.PtrToStringUni(NEW
IntPtr(pReader.ReadInt32())))
_end = pReader.ReadInt32()
Console.WriteLine(">>> dwLyricsLen ......... =
{0}",_end)
_ptr = pReader.ReadInt32()
Console.WriteLine(">>> pbLyrics ............ =
${0:X8}",_ptr)
_end = _end + _ptr
WHILE _ptr < _end
DIM line AS String
DIM time As Integer
line = Marshal.PtrToStringUni(NEW IntPtr(_ptr))
_ptr = _ptr + 2 * (1 + line.Length)
time = Marshal.ReadInt32(NEW IntPtr(_ptr))
_ptr = _ptr + 4
Console.WriteLine("
[{0:d}:{1:d2}:{2:d2}.{3:d3}]
L""{4}""",time\1000\60\60,(time\1000\60) mod 60,(time\1000)
mod 60,time mod 1000,line)
END WHILE
ELSE IF szName = "WM/Picture" THEN
Console.WriteLine(">>> pwszMIMEType .. =
{0}",Marshal.PtrToStringUni(NEW
IntPtr(pReader.ReadInt32())))
Console.WriteLine(">>> bPictureType .. =
{0}",pReader.ReadByte())
Console.WriteLine(">>> pwszDescription =
L""{0}""",Marshal.PtrToStringUni(NEW
IntPtr(pReader.ReadInt32())))
_end = pReader.ReadInt32()
Console.WriteLine(">>> dwDataLen ..... = {0}",_end)
_ptr = pReader.ReadInt32()
Console.WriteLine(">>> pbData ........ =
${0:X8}",_ptr)
DIM pFile AS FileStream = NEW FileStream("picture" & i
& ".jpg",FileMode.OpenOrCreate,FileAccess.Write)
DIM bas AS IntPtr = NEW IntPtr(_ptr)
FOR off AS Integer = 0 TO _end-1
pFile.WriteByte(Marshal.ReadByte(bas,off))
NEXT off
END IF
NEXT i
CATCH ex AS COMException
Console.WriteLine(ex.ToString())
END TRY
END SUB
END MODULE
--------------------------------
--
// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net
|
|
|
| Back to top |
|
 |
Vincas Stepankevicius
Guest
|
Posted:
Wed Oct 06, 2004 3:00 am Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
Yes, R, code is working, I tested it - and Alessandro is *shoo-in*!
Updating I hope should not be a big problem after that...
Thank all you ever so much for help & fun, and good night (oh my God -
2:00!)
Vincas
"smith" <rcsTAKEOUT@smithvoiceTAKEOUT.com> wrote in message
news:LsF8d.3738$M05.3312@newsread3.news.pas.earthlink.net...
| Quote: | So that's the winner? You sure? You positive that's what you want? That
VB.Net code works? :)
I'll need to be emailed by Alessandro, then.
*Great* job everyone!. And a bit of fun, too.
Robert Smith
Kirkland, WA
http://www.smithvoice.com
"Vincas Stepankevicius" <vstepankevicius@vilnius.vmi.lt> wrote in message
news:%238U9UqyqEHA.3712@TK2MSFTNGP15.phx.gbl...
Yep!
Great job, Alessandro!
Now it's too late(1:30) to check your code but it seems for me that you
have allredy $20 from two Smith's - 10 from Robert + 10 from Neil ;)
Forgive me, that I cant propose you nothing else but my respect and
gratitude :)
I see now how my problems can be solved but I'd appreciate if you find
time
to make an experiment with updating attrs ;)
My best regards,
Vincas
"Alessandro Angeli [MVP::DigitalMedia]" <nobody@nowhere.in.the.net
wrote
in
message news:OSqWTLyqEHA.3428@TK2MSFTNGP11.phx.gbl...
Vincas Stepankevicius wrote:
(regrettably, I need some time to convert it Into VB)
Well, I couldn't sleep, so here you are the VB.NET version:
----------vb.bat------------
csc /debug+ /target:module WMFSDKFunctions.cs
vbc /debug+ /addmodule:WMFSDKFunctions.netmodule *.vb
----------------------------
----------slyr.vb-----------
IMPORTS System
IMPORTS System.IO
IMPORTS System.Runtime.InteropServices
IMPORTS WMFSDKWrapper
PUBLIC MODULE slyr
SUB Main()
TRY
DIM pEditor AS IWMMetadataEditor
WMFSDKFunctions.WMCreateEditor(pEditor)
pEditor.Open("x.wma")
DIM pHeader AS IWMHeaderInfo3 = pEditor
DIM wStream AS UInt16
DIM wCount AS UInt16
pHeader.GetAttributeCountEx(wStream,wCount)
FOR i AS Integer = 0 TO Convert.ToInt32(wCount)-1
DIM dtType AS WMT_ATTR_DATATYPE
DIM wLang AS UInt16
DIM szName AS String = Nothing
DIM pbData() AS Byte = Nothing
DIM wName AS UInt16
DIM dwData AS UInt32
pHeader.GetAttributeByIndexEx(wStream,Convert.ToUInt16(i),sz
Name,wName,dtType,wLang,pbData,dwData)
szName = NEW String("0",Convert.ToInt32(wName)-1)
REDIM pbData(Convert.ToInt32(dwData))
pHeader.GetAttributeByIndexEx(wStream,Convert.ToUInt16(i),sz
Name,wName,dtType,wLang,pbData,dwData)
Console.WriteLine(">>> ""{0}""",szName)
DIM pStream AS MemoryStream = NEW MemoryStream(pbData)
DIM pReader AS BinaryReader = NEW BinaryReader(pStream)
DIM _ptr, _end AS Integer
IF szName = "WM/Lyrics_Synchronised" THEN
Console.WriteLine(">>> bTimeStampFormat .... =
{0}",pReader.ReadByte())
Console.WriteLine(">>> bContentType ........ =
{0}",pReader.ReadByte())
Console.WriteLine(">>> pwszContentDescriptor =
L""{0}""",Marshal.PtrToStringUni(NEW
IntPtr(pReader.ReadInt32())))
_end = pReader.ReadInt32()
Console.WriteLine(">>> dwLyricsLen ......... =
{0}",_end)
_ptr = pReader.ReadInt32()
Console.WriteLine(">>> pbLyrics ............ =
${0:X8}",_ptr)
_end = _end + _ptr
WHILE _ptr < _end
DIM line AS String
DIM time As Integer
line = Marshal.PtrToStringUni(NEW IntPtr(_ptr))
_ptr = _ptr + 2 * (1 + line.Length)
time = Marshal.ReadInt32(NEW IntPtr(_ptr))
_ptr = _ptr + 4
Console.WriteLine("
[{0:d}:{1:d2}:{2:d2}.{3:d3}]
L""{4}""",time\1000\60\60,(time\1000\60) mod 60,(time\1000)
mod 60,time mod 1000,line)
END WHILE
ELSE IF szName = "WM/Picture" THEN
Console.WriteLine(">>> pwszMIMEType .. =
{0}",Marshal.PtrToStringUni(NEW
IntPtr(pReader.ReadInt32())))
Console.WriteLine(">>> bPictureType .. =
{0}",pReader.ReadByte())
Console.WriteLine(">>> pwszDescription =
L""{0}""",Marshal.PtrToStringUni(NEW
IntPtr(pReader.ReadInt32())))
_end = pReader.ReadInt32()
Console.WriteLine(">>> dwDataLen ..... = {0}",_end)
_ptr = pReader.ReadInt32()
Console.WriteLine(">>> pbData ........ =
${0:X8}",_ptr)
DIM pFile AS FileStream = NEW FileStream("picture" & i
& ".jpg",FileMode.OpenOrCreate,FileAccess.Write)
DIM bas AS IntPtr = NEW IntPtr(_ptr)
FOR off AS Integer = 0 TO _end-1
pFile.WriteByte(Marshal.ReadByte(bas,off))
NEXT off
END IF
NEXT i
CATCH ex AS COMException
Console.WriteLine(ex.ToString())
END TRY
END SUB
END MODULE
--------------------------------
--
// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net
|
|
|
| Back to top |
|
 |
Alessandro Angeli [MVP::D
Guest
|
Posted:
Wed Oct 06, 2004 1:24 pm Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
"Vincas Stepankevicius" <vstepankevicius@vilnius.vmi.lt> wrote:
| Quote: | Updating I hope should not be a big problem after that...
|
A sample about updating will have to wait until this evening, since I'm
quite busy at work today.
--
Alessandro Angeli
MVP::DigitalMedia
a dot angeli at biosys dot net |
|
| Back to top |
|
 |
Vincas Stepankevicius
Guest
|
Posted:
Wed Oct 06, 2004 2:15 pm Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
Thanks in advance, Alessandro, I'll be eager waiting for evening :)
Meanwhile I'm remastering my app applying new knowledge I've bought from you
for Robert's money ;)
Vincas |
|
| Back to top |
|
 |
smith
Guest
|
Posted:
Wed Oct 06, 2004 8:18 pm Post subject:
Re: About obscurity of some extended attributes structures d |
|
|
I'm sure he did it just to be helpful, but when he contacts me he'll get the
token ;)
I'll be waiting, but back to work today.
-s
"Vincas Stepankevicius" <vstepankevicius@vilnius.vmi.lt> wrote in message
news:%23yYhh14qEHA.628@TK2MSFTNGP09.phx.gbl...
| Quote: | Thanks in advance, Alessandro, I'll be eager waiting for evening :)
Meanwhile I'm remastering my app applying new knowledge I've bought from
you
for Robert's money ;)
Vincas
|
|
|
| Back to top |
|
 |
|
|
|
|