MediaPlayer中文件的时间长度问题

songfen123 2005-05-09 01:43:09
用什么办法能准确获得MediaPlayer内文件的准确时长 我先采用的办法是MediaPlayer1->TrackLength[1]来获取 可后来发现 当文件是MP3时转换后能得到正常的时长 但当MediaPlayer的文件指向MPG后其换算出来的时间就很有问题 一个50分钟的MPG的length竟然小于5分钟MP3的length 哪位老大帮我解决一下啊
...全文
232 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
songfen123 2005-05-10
  • 打赏
  • 举报
回复
没人能继续帮忙了吗?
icwin 2005-05-09
  • 打赏
  • 举报
回复
up
songfen123 2005-05-09
  • 打赏
  • 举报
回复
一首4:05的MP3
MediaPlayer->TimeFormat=tfTMSF;
RETURN(inttostr(LOBYTE(LOWORD(Thelength))))为199
RETURN(inttostr(LOBYTE(HILOWORD(Thelength))))为3
有点越来越糊涂了
试了不管我用什么样的TimeFormat
MediaPlayer->length的值始终为245447
这样用length/1000倒是能得出要得时间 但在指向一个50多分钟得DAT文件时MediaPlayer->length却只有84586
constantine 2005-05-09
  • 打赏
  • 举报
回复
int Thelength;
MediaPlayer->TimeFormat=tfTMSF; //还有SMPTE,不过要设置成你的系统支持的才行
thelength=Mediaplayer->length;
//这里显示的是曲目
label1->caption=inttostr(LOBYTE(LOWORD(Thelength)));
//显示分钟数
label2->caption=inttostr(HIBYTE(LOWORD(Thelength)));
//显示秒数
label3->caption=inttostr(LOBYTE(HIWORD(Thelength)));
///还可以显示出帧,不过不是所有的都有

大概这样了,其他的自己改改应该就可以运行了
constantine 2005-05-09
  • 打赏
  • 举报
回复
要跟tiemformat一起用,根据TimeFormat设置不一样,length也不一样
songfen123 2005-05-09
  • 打赏
  • 举报
回复
我希望靠MediaPlayer1->Length计算文件的播放时间 可现在时间长的MediaPlayer1->Length反而短怎么办
songfen123 2005-05-09
  • 打赏
  • 举报
回复
MediaPlayer1->Length试了不行啊 当MediaPlayer1的filename指向一个4分钟的MP3时MediaPlayer1->Length为245447 但MediaPlayer1的filename指向一个56分钟的DAT(vcd文件)时MediaPlayer1->Length为84586 怎么解决啊?
happyct 2005-05-09
  • 打赏
  • 举报
回复
MediaPlayer1->Length

604

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder VCL组件使用和开发
社区管理员
  • VCL组件使用和开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧