]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/c93.c
Make rtp_write_header() fail in case of unsupported payload type
[ffmpeg] / libavformat / c93.c
index 89838d5398549381ef9d63825e4e6b401a22292d..11a0314c74d3d618967ec7b843c09f987ba2d2f9 100644 (file)
@@ -16,8 +16,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avformat.h"
@@ -30,7 +29,7 @@ typedef struct {
 } C93BlockRecord;
 
 typedef struct {
-    voc_dec_context_t voc;
+    VocDecContext voc;
 
     C93BlockRecord block_records[512];
     int current_block;
@@ -44,9 +43,6 @@ typedef struct {
 
 static int probe(AVProbeData *p)
 {
-    if (p->buf_size < 13)
-        return 0;
-
     if (p->buf[0] == 0x01 && p->buf[1] == 0x00 &&
         p->buf[4] == 0x01 + p->buf[2] &&
         p->buf[8] == p->buf[4] + p->buf[6] &&
@@ -60,7 +56,7 @@ static int read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {
     AVStream *video;
-    ByteIOContext *pb = &s->pb;
+    ByteIOContext *pb = s->pb;
     C93DemuxContext *c93 = s->priv_data;
     int i;
     int framecount = 0;
@@ -81,14 +77,14 @@ static int read_header(AVFormatContext *s,
 
     video = av_new_stream(s, 0);
     if (!video)
-        return AVERROR_NOMEM;
+        return AVERROR(ENOMEM);
 
     video->codec->codec_type = CODEC_TYPE_VIDEO;
     video->codec->codec_id = CODEC_ID_C93;
     video->codec->width = 320;
     video->codec->height = 192;
     /* 4:3 320x200 with 8 empty lines */
-    video->codec->sample_aspect_ratio = (AVRational) { 5, 6 };
+    video->sample_aspect_ratio = (AVRational) { 5, 6 };
     video->time_base = (AVRational) { 2, 25 };
     video->nb_frames = framecount;
     video->duration = framecount;
@@ -105,7 +101,7 @@ static int read_header(AVFormatContext *s,
 
 static int read_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    ByteIOContext *pb = &s->pb;
+    ByteIOContext *pb = s->pb;
     C93DemuxContext *c93 = s->priv_data;
     C93BlockRecord *br = &c93->block_records[c93->current_block];
     int datasize;
@@ -119,7 +115,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
             if (!c93->audio) {
                 c93->audio = av_new_stream(s, 1);
                 if (!c93->audio)
-                    return AVERROR_NOMEM;
+                    return AVERROR(ENOMEM);
                 c93->audio->codec->codec_type = CODEC_TYPE_AUDIO;
             }
             url_fskip(pb, 26); /* VOC header */
@@ -133,7 +129,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     }
     if (c93->current_frame >= br->frames) {
         if (c93->current_block >= 511 || !br[1].length)
-            return AVERROR_IO;
+            return AVERROR(EIO);
         br++;
         c93->current_block++;
         c93->current_frame = 0;
@@ -158,7 +154,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
 
     ret = get_buffer(pb, pkt->data + 1, datasize);
     if (ret < datasize) {
-        ret = AVERROR_IO;
+        ret = AVERROR(EIO);
         goto fail;
     }
 
@@ -172,7 +168,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
         pkt->data[0] |= C93_HAS_PALETTE;
         ret = get_buffer(pb, pkt->data + pkt->size, datasize);
         if (ret < datasize) {
-            ret = AVERROR_IO;
+            ret = AVERROR(EIO);
             goto fail;
         }
         pkt->size += 768;
@@ -194,7 +190,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
 
 AVInputFormat c93_demuxer = {
     "c93",
-    "Interplay C93",
+    NULL_IF_CONFIG_SMALL("Interplay C93"),
     sizeof(C93DemuxContext),
     probe,
     read_header,