]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/riffenc.c
avcodec/nvenc: reduce automated use of deprecated modes
[ffmpeg] / libavformat / riffenc.c
index d0ee98bfcccaf080ddf717ff93debbafd87abd82..df04b318932a6ce8236c0ee4aa08945f5625c86b 100644 (file)
@@ -65,6 +65,12 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb,
     if (!par->codec_tag || par->codec_tag > 0xffff)
         return -1;
 
+    if (par->codec_id == AV_CODEC_ID_ADPCM_SWF && par->block_align == 0) {
+        av_log(s, AV_LOG_ERROR, "%s can only be written to WAVE with a constant frame size\n",
+               avcodec_get_name(par->codec_id));
+        return AVERROR(EINVAL);
+    }
+
     /* We use the known constant frame size for the codec if known, otherwise
      * fall back on using AVCodecContext.frame_size, which is not as reliable
      * for indicating packet duration. */
@@ -209,10 +215,10 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb,
 void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par,
                        int for_asf, int ignore_extradata, int rgb_frame_is_flipped)
 {
-    int keep_height = (par->extradata_size >= 9 &&
-                      !memcmp(par->extradata + par->extradata_size - 9, "BottomUp", 9)) ||
-                      rgb_frame_is_flipped;
-    int extradata_size = par->extradata_size - 9*keep_height;
+    int flipped_extradata = (par->extradata_size >= 9 &&
+                            !memcmp(par->extradata + par->extradata_size - 9, "BottomUp", 9));
+    int keep_height = flipped_extradata || rgb_frame_is_flipped;
+    int extradata_size = par->extradata_size - 9*flipped_extradata;
     enum AVPixelFormat pix_fmt = par->format;
     int pal_avi;