[FFmpeg-cvslog] ffmpeg: cosmetics -- move copy_chapters().

Anton Khirnov git at videolan.org
Tue Aug 30 18:15:00 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Aug 30 04:15:30 2011 +0200| [6f610fa144bbce199528e6199130e872cbc3691d] | committer: Michael Niedermayer

ffmpeg: cosmetics -- move copy_chapters().

It's only used in opt_output_file(), so move it right above
opt_output_file().

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6f610fa144bbce199528e6199130e872cbc3691d
---

 ffmpeg.c |   80 +++++++++++++++++++++++++++++++-------------------------------
 1 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 91fafa4..f33cd20 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1986,46 +1986,6 @@ static void print_sdp(AVFormatContext **avc, int n)
     fflush(stdout);
 }
 
-static int copy_chapters(int infile, int outfile)
-{
-    AVFormatContext *is = input_files[infile].ctx;
-    AVFormatContext *os = output_files[outfile];
-    int i;
-
-    for (i = 0; i < is->nb_chapters; i++) {
-        AVChapter *in_ch = is->chapters[i], *out_ch;
-        int64_t ts_off   = av_rescale_q(start_time - input_files[infile].ts_offset,
-                                      AV_TIME_BASE_Q, in_ch->time_base);
-        int64_t rt       = (recording_time == INT64_MAX) ? INT64_MAX :
-                           av_rescale_q(recording_time, AV_TIME_BASE_Q, in_ch->time_base);
-
-
-        if (in_ch->end < ts_off)
-            continue;
-        if (rt != INT64_MAX && in_ch->start > rt + ts_off)
-            break;
-
-        out_ch = av_mallocz(sizeof(AVChapter));
-        if (!out_ch)
-            return AVERROR(ENOMEM);
-
-        out_ch->id        = in_ch->id;
-        out_ch->time_base = in_ch->time_base;
-        out_ch->start     = FFMAX(0,  in_ch->start - ts_off);
-        out_ch->end       = FFMIN(rt, in_ch->end   - ts_off);
-
-        if (metadata_chapters_autocopy)
-            av_dict_copy(&out_ch->metadata, in_ch->metadata, 0);
-
-        os->nb_chapters++;
-        os->chapters = av_realloc(os->chapters, sizeof(AVChapter)*os->nb_chapters);
-        if (!os->chapters)
-            return AVERROR(ENOMEM);
-        os->chapters[os->nb_chapters - 1] = out_ch;
-    }
-    return 0;
-}
-
 /*
  * The following code is the main loop of the file converter
  */
@@ -3641,6 +3601,46 @@ static int opt_streamid(const char *opt, const char *arg)
     return 0;
 }
 
+static int copy_chapters(int infile, int outfile)
+{
+    AVFormatContext *is = input_files[infile].ctx;
+    AVFormatContext *os = output_files[outfile];
+    int i;
+
+    for (i = 0; i < is->nb_chapters; i++) {
+        AVChapter *in_ch = is->chapters[i], *out_ch;
+        int64_t ts_off   = av_rescale_q(start_time - input_files[infile].ts_offset,
+                                      AV_TIME_BASE_Q, in_ch->time_base);
+        int64_t rt       = (recording_time == INT64_MAX) ? INT64_MAX :
+                           av_rescale_q(recording_time, AV_TIME_BASE_Q, in_ch->time_base);
+
+
+        if (in_ch->end < ts_off)
+            continue;
+        if (rt != INT64_MAX && in_ch->start > rt + ts_off)
+            break;
+
+        out_ch = av_mallocz(sizeof(AVChapter));
+        if (!out_ch)
+            return AVERROR(ENOMEM);
+
+        out_ch->id        = in_ch->id;
+        out_ch->time_base = in_ch->time_base;
+        out_ch->start     = FFMAX(0,  in_ch->start - ts_off);
+        out_ch->end       = FFMIN(rt, in_ch->end   - ts_off);
+
+        if (metadata_chapters_autocopy)
+            av_dict_copy(&out_ch->metadata, in_ch->metadata, 0);
+
+        os->nb_chapters++;
+        os->chapters = av_realloc(os->chapters, sizeof(AVChapter)*os->nb_chapters);
+        if (!os->chapters)
+            return AVERROR(ENOMEM);
+        os->chapters[os->nb_chapters - 1] = out_ch;
+    }
+    return 0;
+}
+
 static int opt_output_file(const char *opt, const char *filename)
 {
     AVFormatContext *oc;



More information about the ffmpeg-cvslog mailing list