[PATCH] Add support for 16bit video files and IMA_WS_V3 codec

Adam Iglewski none szwagros
Wed May 6 22:27:33 CEST 2009


---
 libavformat/westwood.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavformat/westwood.c b/libavformat/westwood.c
index 7b016fd..8726385 100644
--- a/libavformat/westwood.c
+++ b/libavformat/westwood.c
@@ -48,6 +48,7 @@
 #define SND1_TAG MKBETAG('S', 'N', 'D', '1')
 #define SND2_TAG MKBETAG('S', 'N', 'D', '2')
 #define VQFR_TAG MKBETAG('V', 'Q', 'F', 'R')
+#define VQFL_TAG MKBETAG('V', 'Q', 'F', 'L')
 
 /* don't know what these tags are for, but acknowledge their existence */
 #define CINF_TAG MKBETAG('C', 'I', 'N', 'F')
@@ -57,6 +58,9 @@
 #define PINH_TAG MKBETAG('P', 'I', 'N', 'H')
 #define PIND_TAG MKBETAG('P', 'I', 'N', 'D')
 #define CMDS_TAG MKBETAG('C', 'M', 'D', 'S')
+#define SN2J_TAG MKBETAG('S', 'N', '2', 'J')
+#define VIEW_TAG MKBETAG('V', 'I', 'E', 'W')
+#define ZBUF_TAG MKBETAG('Z', 'B', 'U', 'F')
 
 #define VQA_HEADER_SIZE 0x2A
 #define VQA_FRAMERATE 15
@@ -254,8 +258,10 @@ static int wsvqa_read_header(AVFormatContext *s,
         st->codec->codec_type = CODEC_TYPE_AUDIO;
         if (AV_RL16(&header[0]) == 1)
             st->codec->codec_id = CODEC_ID_WESTWOOD_SND1;
-        else
+        else if(AV_RL16(&header[14]))
             st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;
+        else
+            st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS_V3;
         st->codec->codec_tag = 0;  /* no tag */
         st->codec->sample_rate = AV_RL16(&header[24]);
         if (!st->codec->sample_rate)
@@ -294,6 +300,8 @@ static int wsvqa_read_header(AVFormatContext *s,
         case PIND_TAG:
         case FINF_TAG:
         case CMDS_TAG:
+        case VIEW_TAG:
+        case ZBUF_TAG:
             break;
 
         default:
@@ -325,7 +333,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
         chunk_size = AV_RB32(&preamble[4]);
         skip_byte = chunk_size & 0x01;
 
-        if ((chunk_type == SND1_TAG) || (chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) {
+        if ((chunk_type == SND1_TAG) || (chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG) || (chunk_type == VQFL_TAG)) {
 
             if (av_new_packet(pkt, chunk_size))
                 return AVERROR(EIO);
@@ -355,6 +363,9 @@ static int wsvqa_read_packet(AVFormatContext *s,
             switch(chunk_type){
             case CMDS_TAG:
             case SND0_TAG:
+            case SN2J_TAG:
+            case VIEW_TAG:
+            case ZBUF_TAG:
                 break;
             default:
                 av_log(s, AV_LOG_INFO, "Skipping unknown chunk 0x%08X\n", chunk_type);
-- 
1.6.0.4


--------------010706080102070000040602
Content-Type: text/x-diff;
 name="0004-Add-IMS_WS_V3-codec.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="0004-Add-IMS_WS_V3-codec.patch"




More information about the ffmpeg-devel mailing list