[xiph-commits] r16364 - trunk/ffmpeg2theora/src

j at svn.xiph.org j at svn.xiph.org
Fri Jul 31 01:56:18 PDT 2009


Author: j
Date: 2009-07-31 01:56:18 -0700 (Fri, 31 Jul 2009)
New Revision: 16364

Modified:
   trunk/ffmpeg2theora/src/ffmpeg2theora.c
   trunk/ffmpeg2theora/src/theorautils.c
Log:
output right duration if start or end time are specified

Modified: trunk/ffmpeg2theora/src/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/src/ffmpeg2theora.c	2009-07-30 12:42:24 UTC (rev 16363)
+++ trunk/ffmpeg2theora/src/ffmpeg2theora.c	2009-07-31 08:56:18 UTC (rev 16364)
@@ -2474,7 +2474,10 @@
                     return(1);
                 }
                 if (convert->context->duration != AV_NOPTS_VALUE) {
-                    info.duration = (double)convert->context->duration / AV_TIME_BASE;
+                    info.duration = (double)convert->context->duration / AV_TIME_BASE - \
+                                            convert->start_time;
+                    if (convert->end_time)
+                        info.duration = convert->end_time - convert->start_time;
                 }
                 for(info.passno=(info.twopass==3?1:info.twopass);info.passno<=(info.twopass==3?2:info.twopass);info.passno++){
                     ff2theora_output(convert);

Modified: trunk/ffmpeg2theora/src/theorautils.c
===================================================================
--- trunk/ffmpeg2theora/src/theorautils.c	2009-07-30 12:42:24 UTC (rev 16363)
+++ trunk/ffmpeg2theora/src/theorautils.c	2009-07-31 08:56:18 UTC (rev 16364)
@@ -720,7 +720,7 @@
             last = timebase;
             if (info->frontend) {
                 fprintf(info->frontend, "{\"duration\": %lf, \"position\": %.02lf, \"remaining\": %.02lf}\n",
-                    (double)info->duration,
+                    info->duration,
                     timebase,
                     remaining
                 );
@@ -738,7 +738,7 @@
         last = timebase;
         if (info->frontend) {
             fprintf(info->frontend, "{\"duration\": %lf, \"position\": %.02lf, \"audio_kbps\":  %d, \"video_kbps\": %d, \"remaining\": %.02lf}\n",
-                (double)info->duration,
+                info->duration,
                 timebase,
                 info->akbps, info->vkbps,
                 remaining



More information about the commits mailing list