commit 3b069f77a5022a4779ee7e473656b9c7938c1be6
Author: phantomjinx <p.g.richard...@phantomjinx.co.uk>
Date:   Mon Aug 6 09:58:02 2012 +0100

    fix m4a track length value
    
    * The duration value read by atomic parsley is stored in the mp4 in its
      moov->mdia->timescale atom. The duration must be divided by this value
      to get the duration in seconds. In addition, gtkpod stores the track
      length in ms so the duration must be multiplied by 1000.
    
    * Fixes #3537899
      
https://sourceforge.net/tracker/?func=detail&atid=519273&aid=3537899&group_id=67873

 libs/atomic-parsley/AtomicParsleyBridge.cpp |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/libs/atomic-parsley/AtomicParsleyBridge.cpp 
b/libs/atomic-parsley/AtomicParsleyBridge.cpp
index 4fe40f5..052f47f 100644
--- a/libs/atomic-parsley/AtomicParsleyBridge.cpp
+++ b/libs/atomic-parsley/AtomicParsleyBridge.cpp
@@ -156,13 +156,18 @@ void AP_read_metadata(const char *filePath, Track *track) 
{
                 && ((info->track_type & AUDIO_TRACK) || (info->track_type & 
VIDEO_TRACK)
                         || (info->track_type & DRM_PROTECTED_TRACK))) {
 
-            track->tracklen = info->duration;
+            /*
+             * the info->duration is in the track's timescale units so must be 
divided by that
+             * value to get seconds, while track->tracklen in gtkpod is in ms
+             */
+            float duration = ((float) info->duration / (float) 
info->parent->movie_info->timescale) * 1000;
+            track->tracklen = (gint32) duration;
+
             track->bitrate = APar_calculate_bitrate(info);
             track->samplerate = info->media_sample_rate;
         }
 
         audio_or_video_found = TRUE;
-
     }
 
     if (prefs_get_int("readtags")) {
@@ -661,7 +666,7 @@ void AP_write_metadata(Track *track, const char *filePath, 
GError **error) {
                 g_remove(tmp_file);
             }
             else {
-                gtkpod_log_error(error, g_strdup_printf(_("ERROR failed to 
change track file's artwork.")));
+                gtkpod_log_error(error, g_strdup_printf(_("ERROR failed to 
change track file's artwork.") ));
                 g_error_free(pixbuf_err);
                 return;
             }

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to