Chinaunix首页 | 论坛 | 博客
  • 博客访问: 133618
  • 博文数量: 46
  • 博客积分: 3010
  • 博客等级: 中校
  • 技术积分: 450
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-12 15:54
文章分类
文章存档

2010年(2)

2009年(14)

2008年(30)

我的朋友

分类:

2009-04-01 17:51:04

wm/picture的内容是存放在 Extended Content Description Object中。

Extended Content Description Object的结构如下图所示:

Field name

Field type

Size (bits)

Object ID

GUID

128

Object Size

QWORD

64

Content Descriptors Count

WORD

16

Content Descriptors

See text

varies

Extended Content Description Object中保存了很多个Descriptors。而wm/picture是这许多Descriptors中的一个,每一个Descriptors的结构如下图所示:


Field Name Field Type Size (bits)
Descriptor Name Length WORD 16
Descriptor Name WCHAR varies
Descriptor Value Data Type WORD 16
Descriptor Value Length WORD 16
Descriptor Value See text varie

上图中字段的具体定义:

Descriptor Name Length

存储Descriptor名字的长度,它占用16 bits,即2 bytes。

Descriptor Name

存储Descriptor的名字,是一个Unicode的字符数组,其长度由上一项的值表示。varies表示长度不固定。

Descriptor Value Data Type

存储Descriptor值的数据类型,它占用16 bits,即2 bytes。

具体类型如下图所示:

Value

Type

Descriptor value length

0x0000

Unicode string

varies

0x0001

BYTE array

varies

0x0002

BOOL

32

0x0003

DWORD

32

0x0004

QWORD

64

0x0005

WORD

16

Descriptor Value Length

      存储Descriptor值的长度,其长度可以在上图中的Descriptor value length字段中找到。

      Descriptor Value

                  存储Descriptor的值,它的类型,长度在前面已经定义。


在wm/picture这个Descriptor中,它的值,即Descriptor Value,其内容与其它的Descriptor是不太一样的.具体内容依次如下:

1. 图片类型 ID(0-20): 占用 1 byte
2. 图片数据长度: 占用 4 bytes
3. 图片 mime type: varies (end with 0x 00 00)
4. 图片描述(pic description): 占用 2 bytes
5. 实际图片数据
需要注意的是,
图片数据长度读出来是二进制的字符,实质上是16进制的数据,我看的资料上写的是little endian,
但是我的测试结果是big endian。按照big endian规则读出数据,然后二进制转十六进制,十六进制转十进制,
就可以得到数据长度了。直接从二进制转十进制不行,为什么不行我不是太清楚,可能因为它本身是16进制的
数据。
图片 mime type是以"00 00"(16进制)结尾,一般的内容为"image/jpeg"这样的内容。
图片描述(pic description),同样是以“00 00”结尾,通常里面不含描述信息,而是直接“00 00”结束。
要得到需要的图片picture,只需要得到实际图片数据就可以了。

附:
图片类型ID:
0 Picture of a type not specifically listed in this table
1 32 pixel by 32 pixel file icon. Use only with portable network graphics (PNG) format
2 File icon not conforming to type 1 above
3 Front album cover
4 Back album cover
5 Leaflet page
6 Media. Typically this type of image is of the label side of a CD
7 Picture of the lead artist, lead performer, or soloist
8 Picture of one of the artists or performers
9 Picture of the conductor
10 Picture of the band or orchestra
11 Picture of the composer
12 Picture of the lyricist or writer
13 Picture of the recording studio or location
14 Picture taken during a recording session
15 Picture taken during a performance
16 Screen capture from a movie or video
17 A bright colored fish
18 Illustration
19 Logo of the band or artist
20 Logo of the publisher or studio
阅读(941) | 评论(4) | 转发(0) |
给主人留下些什么吧!~~

ethan_chen2010-02-05 10:17:51

写应该是没有长度限制的,只不过是读数据的时候,一般都按照规定的长度读,你也可以根据自己的需要读写。

chinaunix网友2010-01-08 16:38:02

呵呵,刚发现另外一个就是: 4. 图片描述(pic description): 占用 2 bytes 这个好像不太对,我也不知道该是多少,因为我写程序测试可以写入超过 2 bytes 的数据长度,而且写入后用 UE 检查是 Unicode 字符。

ethan_chen2010-01-07 14:06:40

谢谢这位朋友的补充。 “图片 mime type是以"00 00"(16进制)结尾,一般的内容为"image/jpeg"这样的内容。” 这句话有点歧义,呵呵,其实我只是想举一个例子,说明一下这部分内容的格式。

chinaunix网友2010-01-07 08:56:41

jpeg 对应 image/jpeg bitmap 对应 image/bmp gif 对应 image/gif png 对应 image/png 而不是你所说的“一般的内容为"image/jpeg"这样的”