[FFmpeg-cvslog] r26091 - in trunk/libavformat: avidec.c riff.c riff.h

pross subversion
Sun Dec 26 02:23:45 CET 2010


Author: pross
Date: Sun Dec 26 02:23:44 2010
New Revision: 26091

Log:
add ff_get_bmp_header

Modified:
   trunk/libavformat/avidec.c
   trunk/libavformat/riff.c
   trunk/libavformat/riff.h

Modified: trunk/libavformat/avidec.c
==============================================================================
--- trunk/libavformat/avidec.c	Sat Dec 25 20:49:19 2010	(r26090)
+++ trunk/libavformat/avidec.c	Sun Dec 26 02:23:44 2010	(r26091)
@@ -570,17 +570,7 @@ static int avi_read_header(AVFormatConte
                         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;

Modified: trunk/libavformat/riff.c
==============================================================================
--- trunk/libavformat/riff.c	Sat Dec 25 20:49:19 2010	(r26090)
+++ trunk/libavformat/riff.c	Sun Dec 26 02:23:44 2010	(r26091)
@@ -440,6 +440,23 @@ int ff_put_wav_header(ByteIOContext *pb,
     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)
 {

Modified: trunk/libavformat/riff.h
==============================================================================
--- trunk/libavformat/riff.h	Sat Dec 25 20:49:19 2010	(r26090)
+++ trunk/libavformat/riff.h	Sun Dec 26 02:23:44 2010	(r26091)
@@ -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);



More information about the ffmpeg-cvslog mailing list