diff options
author | 2013-01-25 22:07:00 +0100 | |
---|---|---|
committer | 2013-01-25 22:07:00 +0100 | |
commit | 2b2ab15d0022b302e651318ad45aa6a85889a864 (patch) | |
tree | f410dceccf9b94af42441a5ead937adc6a025a56 /plugins/wma/wma_plugin.c | |
parent | 1bceb2657b2e2e426c3fc1c96e668e8612fec490 (diff) |
wma: seeking WIP
Diffstat (limited to 'plugins/wma/wma_plugin.c')
-rw-r--r-- | plugins/wma/wma_plugin.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/plugins/wma/wma_plugin.c b/plugins/wma/wma_plugin.c index 6a141dd1..923b384a 100644 --- a/plugins/wma/wma_plugin.c +++ b/plugins/wma/wma_plugin.c @@ -39,8 +39,8 @@ #define min(x,y) ((x)<(y)?(x):(y)) #define max(x,y) ((x)>(y)?(x):(y)) -//#define trace(...) { fprintf(stderr, __VA_ARGS__); } -#define trace(fmt,...) +#define trace(...) { fprintf(stderr, __VA_ARGS__); } +//#define trace(fmt,...) static DB_decoder_t plugin; DB_functions_t *deadbeef; @@ -321,9 +321,17 @@ wmaplug_seek_sample (DB_fileinfo_t *_info, int sample) { info->skipsamples = sample - frame * info->wmadec.frame_len * n_subframes; info->currentsample = sample; #else - int res = asf_seek ((int64_t)sample * 1000 / info->wfx.rate, &info->wfx, info->fp, info->first_frame_offset); - info->skipsamples = 0; - info->currentsample = (int64_t)res * info->wfx.rate / 1000; + int skip_ms; + int res = asf_seek ((int64_t)sample * 1000 / info->wfx.rate, &info->wfx, info->fp, info->first_frame_offset, &skip_ms); + if (res < 0) { + info->skipsamples = 0; + 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; + } #endif |