]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/raw.c
Remove unused variables, fixes the following warnings:
[ffmpeg] / libavformat / raw.c
index 7d1fafda81ad907a32366f98c9e20b56caf7d955..bd9380315ca6b54b1234a48967a8c8ec2fa31fdc 100644 (file)
  */
 #include "avformat.h"
 #include "ac3_parser.h"
+#include "raw.h"
 
 #ifdef CONFIG_MUXERS
 /* simple formats */
-static int raw_write_header(struct AVFormatContext *s)
-{
-    return 0;
-}
-
 static int flac_write_header(struct AVFormatContext *s)
 {
     static const uint8_t header[8] = {
@@ -72,7 +68,7 @@ static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
     st = av_new_stream(s, 0);
     if (!st)
-        return AVERROR_NOMEM;
+        return AVERROR(ENOMEM);
 
         id = s->iformat->value;
         if (id == CODEC_ID_RAWVIDEO) {
@@ -115,7 +111,7 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     pkt->stream_index = 0;
     if (ret <= 0) {
-        return AVERROR_IO;
+        return AVERROR(EIO);
     }
     /* note: we need to modify the packet size here to handle the last
        packet */
@@ -130,14 +126,14 @@ static int raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
     size = RAW_PACKET_SIZE;
 
     if (av_new_packet(pkt, size) < 0)
-        return AVERROR_IO;
+        return AVERROR(EIO);
 
     pkt->pos= url_ftell(&s->pb);
     pkt->stream_index = 0;
     ret = get_partial_buffer(&s->pb, pkt->data, size);
     if (ret <= 0) {
         av_free_packet(pkt);
-        return AVERROR_IO;
+        return AVERROR(EIO);
     }
     pkt->size = ret;
     return ret;
@@ -149,7 +145,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
     int ret, size, w, h, unk1, unk2;
 
     if (get_le32(&s->pb) != MKTAG('M', 'J', 'P', 'G'))
-        return AVERROR_IO; // FIXME
+        return AVERROR(EIO); // FIXME
 
     size = get_le32(&s->pb);
 
@@ -166,14 +162,14 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
         size, w, h, unk1, unk2);
 
     if (av_new_packet(pkt, size) < 0)
-        return AVERROR_IO;
+        return AVERROR(EIO);
 
     pkt->pos = url_ftell(&s->pb);
     pkt->stream_index = 0;
     ret = get_buffer(&s->pb, pkt->data, size);
     if (ret <= 0) {
         av_free_packet(pkt);
-        return AVERROR_IO;
+        return AVERROR(EIO);
     }
     pkt->size = ret;
     return ret;
@@ -222,7 +218,7 @@ static int ac3_read_header(AVFormatContext *s,
 
     st = av_new_stream(s, 0);
     if (!st)
-        return AVERROR_NOMEM;
+        return AVERROR(ENOMEM);
 
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_AC3;
@@ -238,7 +234,7 @@ static int shorten_read_header(AVFormatContext *s,
 
     st = av_new_stream(s, 0);
     if (!st)
-        return AVERROR_NOMEM;
+        return AVERROR(ENOMEM);
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_SHORTEN;
     st->need_parsing = AVSTREAM_PARSE_FULL;
@@ -254,7 +250,7 @@ static int flac_read_header(AVFormatContext *s,
 
     st = av_new_stream(s, 0);
     if (!st)
-        return AVERROR_NOMEM;
+        return AVERROR(ENOMEM);
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_FLAC;
     st->need_parsing = AVSTREAM_PARSE_FULL;
@@ -270,7 +266,7 @@ static int dts_read_header(AVFormatContext *s,
 
     st = av_new_stream(s, 0);
     if (!st)
-        return AVERROR_NOMEM;
+        return AVERROR(ENOMEM);
 
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_DTS;
@@ -287,7 +283,7 @@ static int aac_read_header(AVFormatContext *s,
 
     st = av_new_stream(s, 0);
     if (!st)
-        return AVERROR_NOMEM;
+        return AVERROR(ENOMEM);
 
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_AAC;
@@ -304,7 +300,7 @@ static int video_read_header(AVFormatContext *s,
 
     st = av_new_stream(s, 0);
     if (!st)
-        return AVERROR_NOMEM;
+        return AVERROR(ENOMEM);
 
     st->codec->codec_type = CODEC_TYPE_VIDEO;
     st->codec->codec_id = s->iformat->value;
@@ -414,12 +410,9 @@ static int ac3_probe(AVProbeData *p)
     uint8_t *buf, *buf2, *end;
     AC3HeaderInfo hdr;
 
-    if(p->buf_size < 7)
-        return 0;
-
     max_frames = 0;
     buf = p->buf;
-    end = buf + FFMIN(4096, p->buf_size - 7);
+    end = buf + p->buf_size;
 
     for(; buf < end; buf++) {
         buf2 = buf;
@@ -439,6 +432,12 @@ static int ac3_probe(AVProbeData *p)
     else                   return 0;
 }
 
+static int flac_probe(AVProbeData *p)
+{
+    if(memcmp(p->buf, "fLaC", 4)) return 0;
+    else                          return AVPROBE_SCORE_MAX / 2;
+}
+
 AVInputFormat shorten_demuxer = {
     "shn",
     "raw shorten",
@@ -455,7 +454,7 @@ AVInputFormat flac_demuxer = {
     "flac",
     "raw flac",
     0,
-    NULL,
+    flac_probe,
     flac_read_header,
     raw_read_partial_packet,
     raw_read_close,
@@ -501,7 +500,7 @@ AVOutputFormat ac3_muxer = {
     0,
     CODEC_ID_AC3,
     0,
-    raw_write_header,
+    NULL,
     raw_write_packet,
     .flags= AVFMT_NOTIMESTAMPS,
 };
@@ -568,7 +567,7 @@ AVOutputFormat h261_muxer = {
     0,
     0,
     CODEC_ID_H261,
-    raw_write_header,
+    NULL,
     raw_write_packet,
     .flags= AVFMT_NOTIMESTAMPS,
 };
@@ -596,7 +595,7 @@ AVOutputFormat h263_muxer = {
     0,
     0,
     CODEC_ID_H263,
-    raw_write_header,
+    NULL,
     raw_write_packet,
     .flags= AVFMT_NOTIMESTAMPS,
 };
@@ -624,7 +623,7 @@ AVOutputFormat m4v_muxer = {
     0,
     CODEC_ID_NONE,
     CODEC_ID_MPEG4,
-    raw_write_header,
+    NULL,
     raw_write_packet,
     .flags= AVFMT_NOTIMESTAMPS,
 };
@@ -652,7 +651,7 @@ AVOutputFormat h264_muxer = {
     0,
     CODEC_ID_NONE,
     CODEC_ID_H264,
-    raw_write_header,
+    NULL,
     raw_write_packet,
     .flags= AVFMT_NOTIMESTAMPS,
 };
@@ -679,7 +678,7 @@ AVOutputFormat mpeg1video_muxer = {
     0,
     0,
     CODEC_ID_MPEG1VIDEO,
-    raw_write_header,
+    NULL,
     raw_write_packet,
     .flags= AVFMT_NOTIMESTAMPS,
 };
@@ -694,7 +693,7 @@ AVOutputFormat mpeg2video_muxer = {
     0,
     0,
     CODEC_ID_MPEG2VIDEO,
-    raw_write_header,
+    NULL,
     raw_write_packet,
     .flags= AVFMT_NOTIMESTAMPS,
 };
@@ -735,7 +734,7 @@ AVOutputFormat mjpeg_muxer = {
     0,
     0,
     CODEC_ID_MJPEG,
-    raw_write_header,
+    NULL,
     raw_write_packet,
     .flags= AVFMT_NOTIMESTAMPS,
 };
@@ -779,7 +778,7 @@ AVOutputFormat pcm_ ## name ## _muxer = {\
     0,\
     codec,\
     0,\
-    raw_write_header,\
+    NULL,\
     raw_write_packet,\
     .flags= AVFMT_NOTIMESTAMPS,\
 };
@@ -848,7 +847,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     pkt->stream_index = 0;
     if (ret != packet_size) {
-        return AVERROR_IO;
+        return AVERROR(EIO);
     } else {
         return 0;
     }
@@ -876,7 +875,7 @@ AVOutputFormat rawvideo_muxer = {
     0,
     CODEC_ID_NONE,
     CODEC_ID_RAWVIDEO,
-    raw_write_header,
+    NULL,
     raw_write_packet,
     .flags= AVFMT_NOTIMESTAMPS,
 };
@@ -900,7 +899,7 @@ AVOutputFormat null_muxer = {
     CODEC_ID_PCM_S16LE,
 #endif
     CODEC_ID_RAWVIDEO,
-    raw_write_header,
+    NULL,
     null_write_packet,
     .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE | AVFMT_NOTIMESTAMPS,
 };