diff options
author | waker <wakeroid@gmail.com> | 2013-07-07 22:50:54 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2013-07-07 22:50:54 +0200 |
commit | 1282b9029aba4b2a903c7dfe35b154dd262b7aeb (patch) | |
tree | 52cdb0b0a590a28fa80a392296b10c815bfa9bf1 /plugins/wma | |
parent | 362c82591f489696d804bad3cab37e5a3184d4da (diff) |
wma: fixed asf_seek
Diffstat (limited to 'plugins/wma')
-rw-r--r-- | plugins/wma/libasf/asf.c | 12 | ||||
-rw-r--r-- | plugins/wma/libwma/wmadeci.c | 4 | ||||
-rw-r--r-- | plugins/wma/wma_plugin.c | 1 |
3 files changed, 10 insertions, 7 deletions
diff --git a/plugins/wma/libasf/asf.c b/plugins/wma/libasf/asf.c index 1e4c734c..6a3700fb 100644 --- a/plugins/wma/libasf/asf.c +++ b/plugins/wma/libasf/asf.c @@ -435,7 +435,6 @@ int asf_seek(int ms, asf_waveformatex_t* wfx, DB_FILE *fp, int64_t first_frame_o /*seek to estimated packet*/ deadbeef->fseek (fp, first_frame_offset+packet_offset, SEEK_SET); - int64_t pos = deadbeef->ftell (fp); temp = ms; while (1) { @@ -443,6 +442,7 @@ int asf_seek(int ms, asf_waveformatex_t* wfx, DB_FILE *fp, int64_t first_frame_o count++; /*check the time stamp of our packet*/ + int64_t pos = deadbeef->ftell (fp); time = asf_get_timestamp(&duration, fp); // DEBUGF("time %d ms with duration %d\n", time, duration); @@ -456,10 +456,14 @@ int asf_seek(int ms, asf_waveformatex_t* wfx, DB_FILE *fp, int64_t first_frame_o } DEBUGF("time: %d, duration: %d (ms: %d)\n", time, duration, ms); - if ((time+duration>=ms && time<=ms) || count > 10) { - DEBUGF("Found our packet! Now at %d packet, time %d, requested %d\n", packet_num, time, ms); + if (time <= ms && (time+duration>=ms || count > 10)) { + int mn = (int)(ms * 0.001f / 60); + int sc = ms * 0.001f - mn * 60; + int pmn = (int)(time * 0.001f / 60); + int psc = time * 0.001f - pmn * 60; + DEBUGF("Found our packet! Now at %d packet, time %d (%d:%d), ms %d (%d:%d), duration %d, count %d\n", packet_num, time, pmn, psc, ms, mn, sc, duration, count); deadbeef->fseek (fp, pos, SEEK_SET); - *skip_ms = ms - time; + *skip_ms = ms > time ? ms - time : 0; return time; } else { /*seek again*/ diff --git a/plugins/wma/libwma/wmadeci.c b/plugins/wma/libwma/wmadeci.c index 3b93be10..921e7688 100644 --- a/plugins/wma/libwma/wmadeci.c +++ b/plugins/wma/libwma/wmadeci.c @@ -27,8 +27,8 @@ #include "wmafixed.h" #include "wmadata.h" -#define trace(...) { fprintf (stderr, __VA_ARGS__); } -//#define trace(fmt,...) +//#define trace(...) { fprintf (stderr, __VA_ARGS__); } +#define trace(fmt,...) #define DEBUGF trace static void wma_lsp_to_curve_init(WMADecodeContext *s, int frame_len); diff --git a/plugins/wma/wma_plugin.c b/plugins/wma/wma_plugin.c index aa1f691a..c41f113b 100644 --- a/plugins/wma/wma_plugin.c +++ b/plugins/wma/wma_plugin.c @@ -340,7 +340,6 @@ wmaplug_seek_sample (DB_fileinfo_t *_info, int sample) { info->currentsample = 0; } else { - printf ("skip_samples: %d\n", (int)((int64_t)skip_ms * info->wfx.rate / 1000)); info->skipsamples = (int64_t)skip_ms * info->wfx.rate / 1000; info->currentsample = sample; } |