]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/raw.c
split rm muxer and demuxer in their own files
[ffmpeg] / libavformat / raw.c
index f61d87b65e94bf8f507f6c5bc120fe0be6cec091..1332928e60a52878deb1610a582d9f428fd46de3 100644 (file)
@@ -20,7 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
-#include "parser.h"
+#include "ac3_parser.h"
 
 #ifdef CONFIG_MUXERS
 /* simple formats */
@@ -43,6 +43,19 @@ static int flac_write_header(struct AVFormatContext *s)
     return 0;
 }
 
+
+static int roq_write_header(struct AVFormatContext *s)
+{
+    static const uint8_t header[] = {
+        0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00
+    };
+
+    put_buffer(&s->pb, header, 8);
+    put_flush_packet(&s->pb);
+
+    return 0;
+}
+
 static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 {
     put_buffer(&s->pb, pkt->data, pkt->size);
@@ -218,7 +231,7 @@ static int ac3_read_header(AVFormatContext *s,
 
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_AC3;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
     /* the parameters will be extracted from the compressed bitstream */
     return 0;
 }
@@ -233,7 +246,7 @@ static int shorten_read_header(AVFormatContext *s,
         return AVERROR_NOMEM;
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_SHORTEN;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
     /* the parameters will be extracted from the compressed bitstream */
     return 0;
 }
@@ -249,7 +262,7 @@ static int flac_read_header(AVFormatContext *s,
         return AVERROR_NOMEM;
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_FLAC;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
     /* the parameters will be extracted from the compressed bitstream */
     return 0;
 }
@@ -266,7 +279,7 @@ static int dts_read_header(AVFormatContext *s,
 
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_DTS;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
     /* the parameters will be extracted from the compressed bitstream */
     return 0;
 }
@@ -283,7 +296,7 @@ static int aac_read_header(AVFormatContext *s,
 
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_AAC;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
     /* the parameters will be extracted from the compressed bitstream */
     return 0;
 }
@@ -300,7 +313,7 @@ static int video_read_header(AVFormatContext *s,
 
     st->codec->codec_type = CODEC_TYPE_VIDEO;
     st->codec->codec_id = s->iformat->value;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
 
     /* for mjpeg, specify frame rate */
     /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
@@ -347,15 +360,13 @@ static int mpegvideo_probe(AVProbeData *p)
     return 0;
 }
 
-#define VIDEO_OBJECT_START_CODE        0x00000100
-#define VIDEO_OBJECT_LAYER_START_CODE  0x00000120
 #define VISUAL_OBJECT_START_CODE       0x000001b5
 #define VOP_START_CODE                 0x000001b6
 
 static int mpeg4video_probe(AVProbeData *probe_packet)
 {
     uint32_t temp_buffer= -1;
-    int VO=0, VOL=0, VOP = 0, VISO = 0;
+    int VO=0, VOL=0, VOP = 0, VISO = 0, res=0;
     int i;
 
     for(i=0; i<probe_packet->buf_size; i++){
@@ -364,15 +375,16 @@ static int mpeg4video_probe(AVProbeData *probe_packet)
             switch(temp_buffer){
             case VOP_START_CODE:             VOP++; break;
             case VISUAL_OBJECT_START_CODE:  VISO++; break;
-            }
-            switch(temp_buffer & 0xfffffff0){
-            case VIDEO_OBJECT_START_CODE:            VO++; break;
-            case VIDEO_OBJECT_LAYER_START_CODE:     VOL++; break;
+            case 0x100 ... 0x11F:             VO++; break;
+            case 0x120 ... 0x12F:            VOL++; break;
+            case 0x130 ... 0x1AF:
+            case 0x1B7 ... 0x1B9:
+            case 0x1C4 ... 0x1FF:            res++; break;
             }
         }
     }
 
-    if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0)
+    if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0)
         return AVPROBE_SCORE_MAX/2;
     return 0;
 }
@@ -528,6 +540,22 @@ AVInputFormat aac_demuxer = {
     .extensions = "aac",
 };
 
+#ifdef CONFIG_ROQ_MUXER
+AVOutputFormat roq_muxer =
+{
+    "RoQ",
+    "Id RoQ format",
+    NULL,
+    "roq",
+    0,
+    CODEC_ID_ROQ_DPCM,
+    CODEC_ID_ROQ,
+    roq_write_header,
+    raw_write_packet,
+    raw_write_trailer,
+};
+#endif //CONFIG_ROQ_MUXER
+
 AVInputFormat h261_demuxer = {
     "h261",
     "raw h261",
@@ -853,7 +881,7 @@ AVInputFormat rawvideo_demuxer = {
     rawvideo_read_packet,
     raw_read_close,
     .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "yuv,cif,qcif",
+    .extensions = "yuv,cif,qcif,rgb",
     .value = CODEC_ID_RAWVIDEO,
 };
 
@@ -862,7 +890,7 @@ AVOutputFormat rawvideo_muxer = {
     "rawvideo",
     "raw video format",
     NULL,
-    "yuv",
+    "yuv,rgb",
     0,
     CODEC_ID_NONE,
     CODEC_ID_RAWVIDEO,