mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-19 00:04:04 +01:00
LOOPSTART, LOOPLENGTH tag pair for ogg
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@298 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
0bf566d602
commit
2b44d289cf
@ -83,6 +83,8 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
|
||||
|
||||
int loop_flag = 0;
|
||||
int32_t loop_start = 0;
|
||||
int loop_length_found = 0;
|
||||
int32_t loop_length = 0;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
@ -146,12 +148,20 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
|
||||
strstr(comment->user_comments[i],"LOOP_START=")==
|
||||
comment->user_comments[i] ||
|
||||
strstr(comment->user_comments[i],"COMMENT=LOOPPOINT=")==
|
||||
comment->user_comments[i] ||
|
||||
strstr(comment->user_comments[i],"LOOPSTART=")==
|
||||
comment->user_comments[i]
|
||||
) {
|
||||
loop_start=atol(strrchr(comment->user_comments[i],'=')+1);
|
||||
loop_flag=1;
|
||||
break;
|
||||
}
|
||||
else if (strstr(comment->user_comments[i],"LOOPLENGTH=")==
|
||||
comment->user_comments[i]) {
|
||||
loop_length=atol(strrchr(comment->user_comments[i],'=')+1);
|
||||
loop_length_found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +181,10 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
|
||||
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = loop_start;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
if (loop_length_found)
|
||||
vgmstream->loop_end_sample = loop_start+loop_length;
|
||||
else
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
vgmstream->loop_flag = loop_flag;
|
||||
}
|
||||
vgmstream->coding_type = coding_ogg_vorbis;
|
||||
|
Loading…
x
Reference in New Issue
Block a user