]> git.sesse.net Git - ffmpeg/blobdiff - ffmpeg.c
avconv: Factorize combining auto vsync with format.
[ffmpeg] / ffmpeg.c
index cbbd3e7b1e565a5ba25e15a19b90ccde5d409818..c4ac3f9f62b8e5cdc84c66c4a25c0cd2cc9cf4a9 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -683,7 +683,7 @@ static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx, AVCode
     ost->st    = st;
     ost->enc   = codec;
     if (codec)
-        ost->opts  = filter_codec_opts(codec_opts, codec->id, 1);
+        ost->opts  = filter_codec_opts(codec_opts, codec->id, oc, st);
 
     avcodec_get_context_defaults3(st->codec, codec);
 
@@ -691,11 +691,10 @@ static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx, AVCode
     return ost;
 }
 
-static int read_ffserver_streams(AVFormatContext *s, const char *filename)
+static int read_avserver_streams(AVFormatContext *s, const char *filename)
 {
     int i, err;
     AVFormatContext *ic = NULL;
-    int nopts = 0;
 
     err = avformat_open_input(&ic, filename, NULL, NULL);
     if (err < 0)
@@ -726,9 +725,6 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename)
             } else
                 choose_pixel_fmt(st, codec);
         }
-
-        if(st->codec->flags & CODEC_FLAG_BITEXACT)
-            nopts = 1;
     }
 
     av_close_input_file(ic);
@@ -2219,6 +2215,12 @@ static int transcode(AVFormatContext **output_files,
                     fprintf(stderr, "Video pixel format is unknown, stream cannot be encoded\n");
                     ffmpeg_exit(1);
                 }
+
+                if (!codec->width || !codec->height) {
+                    codec->width  = icodec->width;
+                    codec->height = icodec->height;
+                }
+
                 ost->video_resample = codec->width   != icodec->width  ||
                                       codec->height  != icodec->height ||
                                       codec->pix_fmt != icodec->pix_fmt;
@@ -2226,18 +2228,18 @@ static int transcode(AVFormatContext **output_files,
 #if !CONFIG_AVFILTER
                     avcodec_get_frame_defaults(&ost->pict_tmp);
                     if(avpicture_alloc((AVPicture*)&ost->pict_tmp, codec->pix_fmt,
-                                         codec->width, codec->height)) {
+                                       codec->width, codec->height)) {
                         fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n");
                         ffmpeg_exit(1);
                     }
                     ost->img_resample_ctx = sws_getContext(
                         icodec->width,
                         icodec->height,
-                            icodec->pix_fmt,
-                            codec->width,
-                            codec->height,
-                            codec->pix_fmt,
-                            ost->sws_flags, NULL, NULL, NULL);
+                        icodec->pix_fmt,
+                        codec->width,
+                        codec->height,
+                        codec->pix_fmt,
+                        ost->sws_flags, NULL, NULL, NULL);
                     if (ost->img_resample_ctx == NULL) {
                         fprintf(stderr, "Cannot get resampling context\n");
                         ffmpeg_exit(1);
@@ -2245,10 +2247,7 @@ static int transcode(AVFormatContext **output_files,
 #endif
                     codec->bits_per_raw_sample= 0;
                 }
-                if (!codec->width || !codec->height) {
-                    codec->width  = icodec->width;
-                    codec->height = icodec->height;
-                }
+
                 ost->resample_height = icodec->height;
                 ost->resample_width  = icodec->width;
                 ost->resample_pix_fmt= icodec->pix_fmt;
@@ -2388,8 +2387,6 @@ static int transcode(AVFormatContext **output_files,
             }
             assert_codec_experimental(ist->st->codec, 0);
             assert_avoptions(ost->opts);
-            //if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
-            //    ist->st->codec->flags |= CODEC_FLAG_REPEAT_FIELD;
         }
     }
 
@@ -3249,7 +3246,7 @@ static int opt_input_file(const char *opt, const char *filename)
     }
 
     /* Set AVCodecContext options for avformat_find_stream_info */
-    opts = setup_find_stream_info_opts(ic);
+    opts = setup_find_stream_info_opts(ic, codec_opts);
     orig_nb_streams = ic->nb_streams;
 
     /* If not enough info to get the stream parameters, we decode the
@@ -3290,7 +3287,7 @@ static int opt_input_file(const char *opt, const char *filename)
         ist->st = st;
         ist->file_index = nb_input_files;
         ist->discard = 1;
-        ist->opts = filter_codec_opts(codec_opts, ist->st->codec->codec_id, 0);
+        ist->opts = filter_codec_opts(codec_opts, ist->st->codec->codec_id, ic, st);
 
         if (i < nb_ts_scale)
             ist->ts_scale = ts_scale[i];
@@ -3763,9 +3760,9 @@ static void opt_output_file(const char *filename)
 
     if (!strcmp(file_oformat->name, "ffm") &&
         av_strstart(filename, "http:", NULL)) {
-        /* special case for files sent to ffserver: we get the stream
-           parameters from ffserver */
-        int err = read_ffserver_streams(oc, filename);
+        /* special case for files sent to avserver: we get the stream
+           parameters from avserver */
+        int err = read_avserver_streams(oc, filename);
         if (err < 0) {
             print_error(filename, err);
             ffmpeg_exit(1);
@@ -4391,6 +4388,10 @@ int main(int argc, char **argv)
 
     show_banner();
 
+    av_log(NULL, AV_LOG_WARNING, "This program is not developed anymore and is only "
+                                 "provided for compatibility. Use avconv instead "
+                                 "(see Changelog for the list of incompatible changes).\n");
+
     /* parse options */
     parse_options(argc, argv, options, opt_output_file);