[SCM] libav/experimental: add ff_get_bmp_header

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 17:20:49 UTC 2013


The following commit has been merged in the experimental branch:
commit 456a70aeb826b7b84d30cc3cc279fa7c65fc7d4e
Author: Peter Ross <pross at xvid.org>
Date:   Sun Dec 26 01:23:44 2010 +0000

    add ff_get_bmp_header
    
    Originally committed as revision 26091 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index d31af67..15f48e8 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -570,17 +570,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
                         url_fskip(pb, size);
                         break;
                     }
-                    get_le32(pb); /* size */
-                    st->codec->width = get_le32(pb);
-                    st->codec->height = (int32_t)get_le32(pb);
-                    get_le16(pb); /* panes */
-                    st->codec->bits_per_coded_sample= get_le16(pb); /* depth */
-                    tag1 = get_le32(pb);
-                    get_le32(pb); /* ImageSize */
-                    get_le32(pb); /* XPelsPerMeter */
-                    get_le32(pb); /* YPelsPerMeter */
-                    get_le32(pb); /* ClrUsed */
-                    get_le32(pb); /* ClrImportant */
+                    tag1 = ff_get_bmp_header(pb, st);
 
                     if (tag1 == MKTAG('D', 'X', 'S', 'B') || tag1 == MKTAG('D','X','S','A')) {
                         st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 0fb2fd6..3d584a3 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -440,6 +440,23 @@ int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
     return hdrsize;
 }
 
+int ff_get_bmp_header(ByteIOContext *pb, AVStream *st)
+{
+    int tag1;
+    get_le32(pb); /* size */
+    st->codec->width = get_le32(pb);
+    st->codec->height = (int32_t)get_le32(pb);
+    get_le16(pb); /* planes */
+    st->codec->bits_per_coded_sample= get_le16(pb); /* depth */
+    tag1 = get_le32(pb);
+    get_le32(pb); /* ImageSize */
+    get_le32(pb); /* XPelsPerMeter */
+    get_le32(pb); /* YPelsPerMeter */
+    get_le32(pb); /* ClrUsed */
+    get_le32(pb); /* ClrImportant */
+    return tag1;
+}
+
 /* BITMAPINFOHEADER header */
 void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf)
 {
diff --git a/libavformat/riff.h b/libavformat/riff.h
index 64d9eb6..5045abc 100644
--- a/libavformat/riff.h
+++ b/libavformat/riff.h
@@ -35,6 +35,13 @@
 int64_t ff_start_tag(ByteIOContext *pb, const char *tag);
 void ff_end_tag(ByteIOContext *pb, int64_t start);
 
+/**
+ * Read BITMAPINFOHEADER structure and set AVStream codec width, height and
+ * bits_per_encoded_sample fields. Does not read extradata.
+ * @return codec tag
+ */
+int ff_get_bmp_header(ByteIOContext *pb, AVStream *st);
+
 void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf);
 int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc);
 enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps);

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list