]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/riffenc.c
avfilter: Remove deprecated resample_lavr_opts
[ffmpeg] / libavformat / riffenc.c
index c04d55c4230dcc85889785b023da58fd707e64d3..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. */
@@ -207,11 +213,12 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb,
 
 /* BITMAPINFOHEADER header */
 void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par,
-                       int for_asf, int ignore_extradata)
+                       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);
-    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;