]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/xwma.c
pixfmt: support more yuva formats
[ffmpeg] / libavformat / xwma.c
index 9a1a6b62b9db81a3218b146a892be3428b55a515..46ca0b80f1c6e0a203b7aa528ec72972c6284de5 100644 (file)
@@ -22,6 +22,7 @@
 #include <inttypes.h>
 
 #include "avformat.h"
+#include "internal.h"
 #include "riff.h"
 
 /*
@@ -39,7 +40,7 @@ static int xwma_probe(AVProbeData *p)
     return 0;
 }
 
-static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int xwma_read_header(AVFormatContext *s)
 {
     int64_t size, av_uninit(data_size);
     int ret;
@@ -83,7 +84,7 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap)
      * extradata for that. Thus, ask the user for feedback, but try to go on
      * anyway.
      */
-    if (st->codec->codec_id != CODEC_ID_WMAV2) {
+    if (st->codec->codec_id != AV_CODEC_ID_WMAV2) {
         av_log(s, AV_LOG_WARNING, "unexpected codec (tag 0x04%x; id %d)\n",
                               st->codec->codec_tag, st->codec->codec_id);
         av_log_ask_for_sample(s, NULL);
@@ -114,8 +115,19 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap)
         }
     }
 
+    if (!st->codec->channels) {
+        av_log(s, AV_LOG_WARNING, "Invalid channel count: %d\n",
+               st->codec->channels);
+        return AVERROR_INVALIDDATA;
+    }
+    if (!st->codec->bits_per_coded_sample) {
+        av_log(s, AV_LOG_WARNING, "Invalid bits_per_coded_sample: %d\n",
+               st->codec->bits_per_coded_sample);
+        return AVERROR_INVALIDDATA;
+    }
+
     /* set the sample rate */
-    av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+    avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
 
     /* parse the remaining RIFF chunks */
     for (;;) {