【WMA 文件的研究结果一】WM/Lyrics_Synchronised 标签属性(同步显示歌词)

这里需要说明的是:一般的播放器用的是 Lyric 文件格式,对应的标签是 WM/Lyrics.
WM/Lyrics 是属于 WMT_TYPE_STRING

而这里说的并非这个。
在WMF SDK 11中:

typedef struct _WMSynchronisedLyrics{
   BYTE    bTimeStampFormat;
   BYTE    bContentType;
   LPWSTR pwszContentDescriptor;
   DWORD   dwLyricsLen;
   BYTE*   pbLyrics;
} WM_SYNCHRONISED_LYRICS;

 

所属类型是:WMT_TYPE_BINARY
其中:
bTimeStampFormat: (时间戳标识)

Value Description
1Time stamps are 32-bit values containing the absolute time of the lyric in frame numbers.
2Time stamps are 32-bit values containing the absolute time of the lyric in milliseconds.

bContentType: (内容类型)
BYTE specifying the type of synchronized strings that are in the lyrics data. Set to one of the following values.

Value Description
0Synchronized strings other than the types listed in this table
1Song lyrics
2Text transcription
3Names of parts of the content. For example, movements of classical pieces, like "Adagio"
4Events, such as stage directions in operas
5Chord notations
6Trivia information
7URLs to Web pages
8URLs to images

pwszContentDescriptor :(内容说明)
指针,指向宽字符,以 null 结尾。
dwLyricsLen :(歌词内容的长度)
pbLyrics: (歌词)

调用函数取得所返回值得到如图所示:
  http://hi.csdn.net/attachment/201001/21/1188217_1264044160PNpl.jpg

其他的很清楚,不多说,这里只说其中 pwszContentDescriptor 的长度的计算:
假设其长度为:Len
Len = 70 27 AD 00 (转为十进制整数) - 5E 27 AD 00 (转为十进制整数)
就是pwszContentDescriptor 长度了。这里的值是:
Len = 11347824 - 11347806
结果为:18 , 与图正确对应!
类推直接得出dwLyricsLen 的数值。

下面说 pbLyrics ,如图所示:
  http://hi.csdn.net/attachment/201001/21/1188217_1264044160NSkk.jpg

浅黄色代表的是歌词,
红色是时间:
bTimeStampFormat=2 的话 毫秒为单位,
bTimeStampFormat=1 的话,帧数号为单位,
如此不断的依次排列,只要得到这两个值就可以得到同步歌词了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值