]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/genh.c
Merge commit '8edaf625f3c38c695c33745822182e94e17d6e1b'
[ffmpeg] / libavformat / genh.c
index 103912bf98361d5c4dd8ffa9fd47ac18445b9410..97068b448306c4350e52e40dd66b4ad4495855ad 100644 (file)
@@ -41,7 +41,7 @@ static int genh_read_header(AVFormatContext *s)
     unsigned start_offset, header_size, codec, coef_type, coef[2];
     GENHDemuxContext *c = s->priv_data;
     unsigned coef_splitted[2];
-    int align, ch;
+    int align, ch, ret;
     AVStream *st;
 
     avio_skip(s->pb, 4);
@@ -84,6 +84,12 @@ static int genh_read_header(AVFormatContext *s)
     case  5: st->codec->codec_id = st->codec->block_align > 0 ?
                                    AV_CODEC_ID_PCM_S8_PLANAR :
                                    AV_CODEC_ID_PCM_S8;           break;
+    case  6: st->codec->codec_id = AV_CODEC_ID_SDX2_DPCM;        break;
+    case  7: ret = ff_alloc_extradata(st->codec, 2);
+             if (ret < 0)
+                 return ret;
+             AV_WL16(st->codec->extradata, 3);
+             st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_WS;     break;
     case 12: st->codec->codec_id = AV_CODEC_ID_ADPCM_THP;        break;
     case 13: st->codec->codec_id = AV_CODEC_ID_PCM_U8;           break;
     case 17: st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_QT;     break;
@@ -153,7 +159,9 @@ static int genh_read_packet(AVFormatContext *s, AVPacket *pkt)
 
         if (avio_feof(s->pb))
             return AVERROR_EOF;
-        av_new_packet(pkt, 8 * codec->channels);
+        ret = av_new_packet(pkt, 8 * codec->channels);
+        if (ret < 0)
+            return ret;
         for (i = 0; i < 8 / c->interleave_size; i++) {
             for (ch = 0; ch < codec->channels; ch++) {
                 pkt->data[ch * 8 + i*c->interleave_size+0] = avio_r8(s->pb);
@@ -161,6 +169,9 @@ static int genh_read_packet(AVFormatContext *s, AVPacket *pkt)
             }
         }
         ret = 0;
+    } else if (codec->codec_id == AV_CODEC_ID_SDX2_DPCM) {
+        ret = av_get_packet(s->pb, pkt, codec->block_align * 1024);
+
     } else {
         ret = av_get_packet(s->pb, pkt, codec->block_align ? codec->block_align : 1024 * codec->channels);
     }