summaryrefslogtreecommitdiff
path: root/lib/rbcodec/metadata/vgm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/metadata/vgm.c')
-rw-r--r--lib/rbcodec/metadata/vgm.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/rbcodec/metadata/vgm.c b/lib/rbcodec/metadata/vgm.c
index 7d3f45e204..03afb15a92 100644
--- a/lib/rbcodec/metadata/vgm.c
+++ b/lib/rbcodec/metadata/vgm.c
@@ -113,6 +113,8 @@ static long check_gd3_header( byte* h, long remain )
113static void get_vgm_length( struct header_t* h, struct mp3entry* id3 ) 113static void get_vgm_length( struct header_t* h, struct mp3entry* id3 )
114{ 114{
115 long length = get_long_le( h->track_duration ) * 10 / 441; 115 long length = get_long_le( h->track_duration ) * 10 / 441;
116 id3->tail_trim = 4 * 1000; /* assume fade */
117
116 if ( length > 0 ) 118 if ( length > 0 )
117 { 119 {
118 long loop_length = 0, intro_length = 0; 120 long loop_length = 0, intro_length = 0;
@@ -126,13 +128,15 @@ static void get_vgm_length( struct header_t* h, struct mp3entry* id3 )
126 { 128 {
127 intro_length = length; /* make it clear that track is no longer than length */ 129 intro_length = length; /* make it clear that track is no longer than length */
128 loop_length = 0; 130 loop_length = 0;
131 id3->tail_trim = 0;
129 } 132 }
130 133
131 id3->length = intro_length + 2 * loop_length; /* intro + 2 loops */ 134 /* intro + 2 loops + fade */
132 return; 135 id3->length = intro_length + 2 * loop_length + id3->tail_trim;
136 return;
133 } 137 }
134 138
135 id3->length = 150 * 1000; /* 2.5 minutes */ 139 id3->length = 150 * 1000 + id3->tail_trim; /* 2.5 minutes + fade */
136} 140}
137 141
138bool get_vgm_metadata(int fd, struct mp3entry* id3) 142bool get_vgm_metadata(int fd, struct mp3entry* id3)
@@ -151,7 +155,7 @@ bool get_vgm_metadata(int fd, struct mp3entry* id3)
151 id3->vbr = false; 155 id3->vbr = false;
152 id3->filesize = filesize(fd); 156 id3->filesize = filesize(fd);
153 157
154 id3->bitrate = 706; 158 id3->bitrate = 1411;
155 id3->frequency = 44100; 159 id3->frequency = 44100;
156 160
157 /* If file is gzipped, will get metadata later */ 161 /* If file is gzipped, will get metadata later */