]> git.sesse.net Git - ffmpeg/blobdiff - cmdutils.c
doc/Makefile: Add missing $(HOSTEXESUF) to print_options
[ffmpeg] / cmdutils.c
index bce87a6eed7a7b57203190d8361e1fd371739502..e90a9ee6fb9d0204c1d3d92e2643c46ea9f848b7 100644 (file)
@@ -190,6 +190,7 @@ static const OptionDef *find_option(const OptionDef *po, const char *name)
 
 #if defined(_WIN32) && !defined(__MINGW32CE__)
 #include <windows.h>
+#include <shellapi.h>
 /* Will be leaked on exit */
 static char** win32_argv_utf8 = NULL;
 static int win32_argc = 0;
@@ -812,17 +813,20 @@ int opt_codecs(const char *opt, const char *arg)
     AVCodec *p = NULL, *p2;
     const char *last_name;
     printf("Codecs:\n"
-           " D...... = Decoding supported\n"
-           " .E..... = Encoding supported\n"
-           " ..V.... = Video codec\n"
-           " ..A.... = Audio codec\n"
-           " ..S.... = Subtitle codec\n"
-           " ...S... = Supports draw_horiz_band\n"
-           " ....D.. = Supports direct rendering method 1\n"
-           " .....T. = Supports weird frame truncation\n"
-           " ......F = Supports frame-based multi-threading\n"
-           " ......S = Supports slice-based multi-threading\n"
-           " ......B = Supports both frame-based and slice-based multi-threading\n"
+           " D....... = Decoding supported\n"
+           " .E...... = Encoding supported\n"
+           " ..V..... = Video codec\n"
+           " ..A..... = Audio codec\n"
+           " ..S..... = Subtitle codec\n"
+           " ...S.... = Supports draw_horiz_band\n"
+           " ....D... = Supports direct rendering method 1\n"
+           " .....T.. = Supports weird frame truncation\n"
+           " ......F. = Supports frame-based multi-threaded decoding\n"
+           " ......S. = Supports slice-based multi-threaded decoding\n"
+           " ......B. = Supports both frame-based and slice-based multi-threaded decoding\n"
+           " .......F = Supports frame-based multi-threaded encoding\n"
+           " .......S = Supports slice-based multi-threaded encoding\n"
+           " .......B = Supports both frame-based and slice-based multi-threaded encoding\n"
            " --------\n");
     last_name= "000";
     for (;;) {
@@ -849,15 +853,21 @@ int opt_codecs(const char *opt, const char *arg)
             break;
         last_name = p2->name;
 
-        printf(" %s%s%c%s%s%s%s %-15s %s",
+        printf(" %s%s%c%s%s%s%s%s %-15s %s",
                decode ? "D" : (/* p2->decoder ? "d" : */ " "),
                encode ? "E" : " ",
                get_media_type_char(p2->type),
                cap & CODEC_CAP_DRAW_HORIZ_BAND ? "S" : " ",
                cap & CODEC_CAP_DR1 ? "D" : " ",
                cap & CODEC_CAP_TRUNCATED ? "T" : " ",
+               decode ?
                cap & CODEC_CAP_FRAME_THREADS ? cap & CODEC_CAP_SLICE_THREADS ? "B" : "F" :
-                                               cap & CODEC_CAP_SLICE_THREADS ? "S" : " ",
+                                               cap & CODEC_CAP_SLICE_THREADS ? "S" : " "
+               : " ",
+               encode ?
+               cap & CODEC_CAP_FRAME_THREADS ? cap & CODEC_CAP_SLICE_THREADS ? "B" : "F" :
+                                               cap & CODEC_CAP_SLICE_THREADS ? "S" : " "
+               : " ",
                p2->name,
                p2->long_name ? p2->long_name : "");
 #if 0
@@ -1135,8 +1145,8 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
     return AVERROR(EINVAL);
 }
 
-AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec,
-                                AVFormatContext *s, AVStream *st)
+AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id,
+                                AVFormatContext *s, AVStream *st, AVCodec *codec)
 {
     AVDictionary    *ret = NULL;
     AVDictionaryEntry *t = NULL;
@@ -1145,6 +1155,9 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec,
     char          prefix = 0;
     const AVClass    *cc = avcodec_get_class();
 
+    if (!codec)
+        codec            = s->oformat ? avcodec_find_encoder(codec_id)
+                                      : avcodec_find_decoder(codec_id);
     if (!codec)
         return NULL;
 
@@ -1205,8 +1218,8 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
         return NULL;
     }
     for (i = 0; i < s->nb_streams; i++)
-        opts[i] = filter_codec_opts(codec_opts, avcodec_find_decoder(s->streams[i]->codec->codec_id),
-                                    s, s->streams[i]);
+        opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codec->codec_id,
+                                    s, s->streams[i], NULL);
     return opts;
 }
 
@@ -1251,6 +1264,7 @@ static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbu
     if ((ret = av_image_alloc(buf->base, buf->linesize, w, h,
                               s->pix_fmt, 32)) < 0) {
         av_freep(&buf);
+        av_log(s, AV_LOG_ERROR, "alloc_buffer: av_image_alloc() failed\n");
         return ret;
     }
     /* XXX this shouldn't be needed, but some tests break without this line
@@ -1286,8 +1300,10 @@ int codec_get_buffer(AVCodecContext *s, AVFrame *frame)
     FrameBuffer *buf;
     int ret, i;
 
-    if(av_image_check_size(s->width, s->height, 0, s) || s->pix_fmt<0)
+    if(av_image_check_size(s->width, s->height, 0, s) || s->pix_fmt<0) {
+        av_log(s, AV_LOG_ERROR, "codec_get_buffer: image parameters invalid\n");
         return -1;
+    }
 
     if (!*pool && (ret = alloc_buffer(pool, s, pool)) < 0)
         return ret;
@@ -1343,8 +1359,10 @@ void codec_release_buffer(AVCodecContext *s, AVFrame *frame)
     FrameBuffer *buf = frame->opaque;
     int i;
 
-    if(frame->type!=FF_BUFFER_TYPE_USER)
+    if(frame->type!=FF_BUFFER_TYPE_USER) {
         avcodec_default_release_buffer(s, frame);
+        return;
+    }
 
     for (i = 0; i < FF_ARRAY_ELEMS(frame->data); i++)
         frame->data[i] = NULL;