diff options
Diffstat (limited to 'lib/rbcodec/codecs/wmavoice.c')
-rw-r--r-- | lib/rbcodec/codecs/wmavoice.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/rbcodec/codecs/wmavoice.c b/lib/rbcodec/codecs/wmavoice.c index 214e0737e7..4c89c6dc96 100644 --- a/lib/rbcodec/codecs/wmavoice.c +++ b/lib/rbcodec/codecs/wmavoice.c | |||
@@ -67,7 +67,6 @@ enum codec_status codec_run(void) | |||
67 | { | 67 | { |
68 | uint32_t elapsedtime; | 68 | uint32_t elapsedtime; |
69 | asf_waveformatex_t wfx; /* Holds the stream properties */ | 69 | asf_waveformatex_t wfx; /* Holds the stream properties */ |
70 | size_t resume_offset; | ||
71 | int res; /* Return values from asf_read_packet() and decode_packet() */ | 70 | int res; /* Return values from asf_read_packet() and decode_packet() */ |
72 | uint8_t* audiobuf; /* Pointer to the payload of one wma pro packet */ | 71 | uint8_t* audiobuf; /* Pointer to the payload of one wma pro packet */ |
73 | int audiobufsize; /* Payload size */ | 72 | int audiobufsize; /* Payload size */ |
@@ -76,8 +75,8 @@ enum codec_status codec_run(void) | |||
76 | int pktcnt = 0; /* Count of the packets played */ | 75 | int pktcnt = 0; /* Count of the packets played */ |
77 | intptr_t param; | 76 | intptr_t param; |
78 | 77 | ||
79 | /* Remember the resume position */ | 78 | elapsedtime = ci->id3->elapsed; |
80 | resume_offset = ci->id3->offset; | 79 | |
81 | restart_track: | 80 | restart_track: |
82 | if (codec_init()) { | 81 | if (codec_init()) { |
83 | LOGF("(WMA Voice) Error: Error initialising codec\n"); | 82 | LOGF("(WMA Voice) Error: Error initialising codec\n"); |
@@ -105,13 +104,17 @@ restart_track: | |||
105 | return CODEC_ERROR; | 104 | return CODEC_ERROR; |
106 | } | 105 | } |
107 | 106 | ||
108 | /* Now advance the file position to the first frame */ | 107 | if (elapsedtime) { |
109 | ci->seek_buffer(ci->id3->first_frame_offset); | 108 | elapsedtime = asf_seek(elapsedtime, &wfx); |
110 | 109 | if (elapsedtime < 1) | |
111 | elapsedtime = 0; | 110 | return CODEC_OK; |
112 | ci->set_elapsed(0); | 111 | } |
112 | else { | ||
113 | /* Now advance the file position to the first frame */ | ||
114 | ci->seek_buffer(ci->id3->first_frame_offset); | ||
115 | } | ||
113 | 116 | ||
114 | resume_offset = 0; | 117 | ci->set_elapsed(elapsedtime); |
115 | 118 | ||
116 | /* The main decoding loop */ | 119 | /* The main decoding loop */ |
117 | 120 | ||
@@ -129,6 +132,7 @@ restart_track: | |||
129 | if (param == 0) { | 132 | if (param == 0) { |
130 | ci->set_elapsed(0); | 133 | ci->set_elapsed(0); |
131 | ci->seek_complete(); | 134 | ci->seek_complete(); |
135 | elapsedtime = 0; | ||
132 | goto restart_track; /* Pretend you never saw this... */ | 136 | goto restart_track; /* Pretend you never saw this... */ |
133 | } | 137 | } |
134 | 138 | ||
@@ -136,7 +140,7 @@ restart_track: | |||
136 | if (elapsedtime < 1){ | 140 | if (elapsedtime < 1){ |
137 | ci->set_elapsed(0); | 141 | ci->set_elapsed(0); |
138 | ci->seek_complete(); | 142 | ci->seek_complete(); |
139 | goto next_track; | 143 | break; |
140 | } | 144 | } |
141 | 145 | ||
142 | ci->set_elapsed(elapsedtime); | 146 | ci->set_elapsed(elapsedtime); |