diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/codecs/libffmpegFLAC/shndec.c | 5 | ||||
-rw-r--r-- | apps/codecs/shorten.c | 21 | ||||
-rw-r--r-- | apps/metadata.c | 10 |
3 files changed, 28 insertions, 8 deletions
diff --git a/apps/codecs/libffmpegFLAC/shndec.c b/apps/codecs/libffmpegFLAC/shndec.c index 7f5f5f4767..6dde8f7a70 100644 --- a/apps/codecs/libffmpegFLAC/shndec.c +++ b/apps/codecs/libffmpegFLAC/shndec.c | |||
@@ -24,11 +24,6 @@ | |||
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "../codec.h" | ||
28 | #include "../lib/codeclib.h" | ||
29 | extern struct codec_api* ci; | ||
30 | #define DEBUGF ci->debugf | ||
31 | |||
32 | #include "bitstream.h" | 27 | #include "bitstream.h" |
33 | #include "golomb.h" | 28 | #include "golomb.h" |
34 | #include "shndec.h" | 29 | #include "shndec.h" |
diff --git a/apps/codecs/shorten.c b/apps/codecs/shorten.c index c64615665f..50d72997ce 100644 --- a/apps/codecs/shorten.c +++ b/apps/codecs/shorten.c | |||
@@ -78,6 +78,12 @@ next_track: | |||
78 | /* Shorten decoder initialization */ | 78 | /* Shorten decoder initialization */ |
79 | ci->memset(&sc, 0, sizeof(ShortenContext)); | 79 | ci->memset(&sc, 0, sizeof(ShortenContext)); |
80 | 80 | ||
81 | /* Skip id3v2 tags */ | ||
82 | if (ci->id3->first_frame_offset) { | ||
83 | buf = ci->request_buffer(&bytesleft, ci->id3->first_frame_offset); | ||
84 | ci->advance_buffer(ci->id3->first_frame_offset); | ||
85 | } | ||
86 | |||
81 | /* Read the shorten & wave headers */ | 87 | /* Read the shorten & wave headers */ |
82 | buf = ci->request_buffer(&bytesleft, MAX_FRAMESIZE); | 88 | buf = ci->request_buffer(&bytesleft, MAX_FRAMESIZE); |
83 | res = shorten_init(&sc, buf, bytesleft); | 89 | res = shorten_init(&sc, buf, bytesleft); |
@@ -86,9 +92,18 @@ next_track: | |||
86 | return CODEC_ERROR; | 92 | return CODEC_ERROR; |
87 | } | 93 | } |
88 | 94 | ||
89 | ci->configure(DSP_SET_FREQUENCY, (long *)(sc.sample_rate)); | ||
90 | ci->id3->frequency = sc.sample_rate; | 95 | ci->id3->frequency = sc.sample_rate; |
91 | ci->id3->length = (sc.totalsamples / sc.sample_rate) * 1000; | 96 | ci->configure(DSP_SET_FREQUENCY, (long *)(sc.sample_rate)); |
97 | |||
98 | if (sc.sample_rate) { | ||
99 | ci->id3->length = (sc.totalsamples / sc.sample_rate) * 1000; | ||
100 | } else { | ||
101 | ci->id3->length = 0; | ||
102 | } | ||
103 | |||
104 | if (ci->id3->length) { | ||
105 | ci->id3->bitrate = (ci->id3->filesize * 8) / ci->id3->length; | ||
106 | } | ||
92 | 107 | ||
93 | consumed = sc.gb.index/8; | 108 | consumed = sc.gb.index/8; |
94 | ci->advance_buffer(consumed); | 109 | ci->advance_buffer(consumed); |
@@ -112,7 +127,7 @@ seek_start: | |||
112 | 127 | ||
113 | /* Seek to start of track */ | 128 | /* Seek to start of track */ |
114 | if (ci->seek_time == 1) { | 129 | if (ci->seek_time == 1) { |
115 | if (ci->seek_buffer(sc.header_bits/8)) { | 130 | if (ci->seek_buffer(sc.header_bits/8 + ci->id3->first_frame_offset)) { |
116 | sc.bitindex = sc.header_bits - 8*(sc.header_bits/8); | 131 | sc.bitindex = sc.header_bits - 8*(sc.header_bits/8); |
117 | ci->set_elapsed(0); | 132 | ci->set_elapsed(0); |
118 | ci->seek_complete(); | 133 | ci->seek_complete(); |
diff --git a/apps/metadata.c b/apps/metadata.c index d0557b13f9..5ed16e5847 100644 --- a/apps/metadata.c +++ b/apps/metadata.c | |||
@@ -1520,6 +1520,16 @@ bool get_metadata(struct track_info* track, int fd, const char* trackname, | |||
1520 | 1520 | ||
1521 | break; | 1521 | break; |
1522 | 1522 | ||
1523 | case AFMT_SHN: | ||
1524 | track->id3.vbr = true; | ||
1525 | track->id3.filesize = filesize(fd); | ||
1526 | if (!skip_id3v2(fd, &(track->id3))) | ||
1527 | { | ||
1528 | return false; | ||
1529 | } | ||
1530 | /* TODO: read the id3v2 header if it exists */ | ||
1531 | break; | ||
1532 | |||
1523 | /* If we don't know how to read the metadata, just store the filename */ | 1533 | /* If we don't know how to read the metadata, just store the filename */ |
1524 | default: | 1534 | default: |
1525 | break; | 1535 | break; |