changeset 8661:94f7aca055d5 libavcodec

flacdec: get total number of samples from STREAMINFO
author jbr
date Sun, 25 Jan 2009 02:27:02 +0000
parents 4f1525c698e9
children 31bdc2da2e80
files flac.h flacdec.c
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flac.h	Sun Jan 25 00:34:32 2009 +0000
+++ b/flac.h	Sun Jan 25 02:27:02 2009 +0000
@@ -53,6 +53,7 @@
     int samplerate;         /**< sample rate                             */\
     int channels;           /**< number of channels                      */\
     int bps;                /**< bits-per-sample                         */\
+    int64_t samples;        /**< total number of samples                 */\
 
 typedef struct FLACStreaminfo {
     FLACSTREAMINFO
--- a/flacdec.c	Sun Jan 25 00:34:32 2009 +0000
+++ b/flacdec.c	Sun Jan 25 02:27:02 2009 +0000
@@ -169,7 +169,8 @@
     avctx->channels = s->channels;
     avctx->sample_rate = s->samplerate;
 
-    skip_bits(&gb, 36); /* total num of samples */
+    s->samples  = get_bits_long(&gb, 32) << 4;
+    s->samples |= get_bits_long(&gb, 4);
 
     skip_bits(&gb, 64); /* md5 sum */
     skip_bits(&gb, 64); /* md5 sum */