]> git.sesse.net Git - ffmpeg/blobdiff - ffmpeg.c
Replace SYS_DARWIN by the more correct __APPLE_CC__, these preprocessor
[ffmpeg] / ffmpeg.c
index f3e880920e29a7f859a8181007315a2d9398d8c8..711a18f4f59aa9fb907ac777c2c26fdf6e62b4dc 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1339,6 +1339,13 @@ static int output_packet(AVInputStream *ist, int ist_index,
     return -1;
 }
 
+static void print_sdp(AVFormatContext **avc, int n)
+{
+    char sdp[2048];
+
+    avf_sdp_create(avc, n, sdp, sizeof(sdp));
+    printf("SDP:\n%s\n", sdp);
+}
 
 /*
  * The following code is the main loop of the file converter
@@ -1356,6 +1363,7 @@ static int av_encode(AVFormatContext **output_files,
     AVInputStream *ist, **ist_table = NULL;
     AVInputFile *file_table;
     int key;
+    int want_sdp = 1;
 
     file_table= (AVInputFile*) av_mallocz(nb_input_files * sizeof(AVInputFile));
     if (!file_table)
@@ -1823,6 +1831,12 @@ static int av_encode(AVFormatContext **output_files,
             ret = AVERROR(EINVAL);
             goto fail;
         }
+        if (strcmp(output_files[i]->oformat->name, "rtp")) {
+            want_sdp = 0;
+        }
+    }
+    if (want_sdp) {
+        print_sdp(output_files, nb_output_files);
     }
 
     if ( !using_stdin && verbose >= 0) {
@@ -2499,6 +2513,7 @@ static void opt_input_ts_offset(const char *arg)
 
 static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
 {
+    char *codec_string = encoder ? "encoder" : "decoder";
     AVCodec *codec;
 
     if(!name)
@@ -2507,11 +2522,11 @@ static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
         avcodec_find_encoder_by_name(name) :
         avcodec_find_decoder_by_name(name);
     if(!codec) {
-        av_log(NULL, AV_LOG_ERROR, "Unknown codec '%s'\n", name);
+        av_log(NULL, AV_LOG_ERROR, "Unknown %s '%s'\n", codec_string, name);
         exit(1);
     }
     if(codec->type != type) {
-        av_log(NULL, AV_LOG_ERROR, "Invalid codec type '%s'\n", name);
+        av_log(NULL, AV_LOG_ERROR, "Invalid %s type '%s'\n", codec_string, name);
         exit(1);
     }
     return codec->id;
@@ -3544,7 +3559,7 @@ static void opt_show_version(void)
            "libavcodec  %d\n"
            "libavformat %d\n",
            LIBAVUTIL_BUILD, avcodec_build(), LIBAVFORMAT_BUILD);
-    exit(1);
+    exit(0);
 }
 
 static int opt_default(const char *opt, const char *arg){
@@ -3600,7 +3615,7 @@ const OptionDef options[] = {
     { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" },
     { "map", HAS_ARG | OPT_EXPERT, {(void*)opt_map}, "set input stream mapping", "file:stream[:syncfile:syncstream]" },
     { "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, "set meta data information of outfile from infile", "outfile:infile" },
-    { "t", HAS_ARG, {(void*)opt_recording_time}, "set the recording time", "duration" },
+    { "t", HAS_ARG, {(void*)opt_recording_time}, "record or transcode \"duration\" seconds of audio/video", "duration" },
     { "fs", HAS_ARG | OPT_INT64, {(void*)&limit_filesize}, "set the limit file size in bytes", "limit_size" }, //
     { "ss", HAS_ARG, {(void*)opt_start_time}, "set the start time offset", "time_off" },
     { "itsoffset", HAS_ARG, {(void*)opt_input_ts_offset}, "set the input ts offset", "time_off" },
@@ -3727,40 +3742,8 @@ static void show_banner(void)
 
 static void opt_show_license(void)
 {
-#ifdef CONFIG_GPL
-    printf(
-    "FFmpeg is free software; you can redistribute it and/or modify\n"
-    "it under the terms of the GNU General Public License as published by\n"
-    "the Free Software Foundation; either version 2 of the License, or\n"
-    "(at your option) any later version.\n"
-    "\n"
-    "FFmpeg is distributed in the hope that it will be useful,\n"
-    "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-    "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
-    "GNU General Public License for more details.\n"
-    "\n"
-    "You should have received a copy of the GNU General Public License\n"
-    "along with FFmpeg; if not, write to the Free Software\n"
-    "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n"
-    );
-#else
-    printf(
-    "FFmpeg is free software; you can redistribute it and/or\n"
-    "modify it under the terms of the GNU Lesser General Public\n"
-    "License as published by the Free Software Foundation; either\n"
-    "version 2.1 of the License, or (at your option) any later version.\n"
-    "\n"
-    "FFmpeg is distributed in the hope that it will be useful,\n"
-    "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-    "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"
-    "Lesser General Public License for more details.\n"
-    "\n"
-    "You should have received a copy of the GNU Lesser General Public\n"
-    "License along with FFmpeg; if not, write to the Free Software\n"
-    "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n"
-    );
-#endif
-    exit(1);
+    show_license();
+    exit(0);
 }
 
 /**
@@ -3806,11 +3789,6 @@ static void show_help(void)
     av_opt_show(sws_opts, NULL);
 }
 
-void parse_arg_file(const char *filename)
-{
-    opt_output_file(filename);
-}
-
 int main(int argc, char **argv)
 {
     int i;
@@ -3831,7 +3809,7 @@ int main(int argc, char **argv)
     }
 
     /* parse options */
-    parse_options(argc, argv, options);
+    parse_options(argc, argv, options, opt_output_file);
 
     /* file converter / grab */
     if (nb_output_files <= 0) {