[libav-devel] [PATCH 040/264] ff_put_bmp_header: switch to codecpar

Anton Khirnov anton at khirnov.net
Sat Dec 12 21:49:13 CET 2015


---
 libavformat/asfenc.c      |  2 +-
 libavformat/avienc.c      |  2 +-
 libavformat/matroskaenc.c |  2 +-
 libavformat/riff.h        |  2 +-
 libavformat/riffenc.c     | 18 +++++++++---------
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 8b65768..9c76646 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -544,7 +544,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
             avio_wl16(pb, 40 + enc->extradata_size); /* size */
 
             /* BITMAPINFOHEADER header */
-            ff_put_bmp_header(pb, enc, ff_codec_bmp_tags, 1);
+            ff_put_bmp_header(pb, par, ff_codec_bmp_tags, 1);
         }
         end_header(pb, hpos);
     }
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 3980bf6..2b6be81 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -291,7 +291,7 @@ static int avi_write_header(AVFormatContext *s)
                 if (enc->codec_id != AV_CODEC_ID_XSUB)
                     break;
             case AVMEDIA_TYPE_VIDEO:
-                ff_put_bmp_header(pb, enc, ff_codec_bmp_tags, 0);
+                ff_put_bmp_header(pb, par, ff_codec_bmp_tags, 0);
                 break;
             case AVMEDIA_TYPE_AUDIO:
                 if (ff_put_wav_header(s, pb, par) < 0)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 1606bfa..8cc90c1 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -604,7 +604,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb,
                 ret = -1;
             }
 
-            ff_put_bmp_header(dyn_cp, codec, ff_codec_bmp_tags, 0);
+            ff_put_bmp_header(dyn_cp, par, ff_codec_bmp_tags, 0);
         }
     } else if (codec->codec_type == AVMEDIA_TYPE_AUDIO) {
         unsigned int tag;
diff --git a/libavformat/riff.h b/libavformat/riff.h
index 8ccf4db..a45c7f3 100644
--- a/libavformat/riff.h
+++ b/libavformat/riff.h
@@ -45,7 +45,7 @@ void ff_end_tag(AVIOContext *pb, int64_t start);
  */
 int ff_get_bmp_header(AVIOContext *pb, AVStream *st);
 
-void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf);
+void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, const AVCodecTag *tags, int for_asf);
 int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par);
 enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps);
 int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int size);
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index d31b1a2..92b76d4 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -180,29 +180,29 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb,
 }
 
 /* BITMAPINFOHEADER header */
-void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
+void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par,
                        const AVCodecTag *tags, int for_asf)
 {
     /* size */
-    avio_wl32(pb, 40 + enc->extradata_size);
-    avio_wl32(pb, enc->width);
+    avio_wl32(pb, 40 + par->extradata_size);
+    avio_wl32(pb, par->width);
     //We always store RGB TopDown
-    avio_wl32(pb, enc->codec_tag ? enc->height : -enc->height);
+    avio_wl32(pb, par->codec_tag ? par->height : -par->height);
     /* planes */
     avio_wl16(pb, 1);
     /* depth */
-    avio_wl16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24);
+    avio_wl16(pb, par->bits_per_coded_sample ? par->bits_per_coded_sample : 24);
     /* compression type */
-    avio_wl32(pb, enc->codec_tag);
-    avio_wl32(pb, enc->width * enc->height * 3);
+    avio_wl32(pb, par->codec_tag);
+    avio_wl32(pb, par->width * par->height * 3);
     avio_wl32(pb, 0);
     avio_wl32(pb, 0);
     avio_wl32(pb, 0);
     avio_wl32(pb, 0);
 
-    avio_write(pb, enc->extradata, enc->extradata_size);
+    avio_write(pb, par->extradata, par->extradata_size);
 
-    if (!for_asf && enc->extradata_size & 1)
+    if (!for_asf && par->extradata_size & 1)
         avio_w8(pb, 0);
 }
 
-- 
2.0.0



More information about the libav-devel mailing list