Browse code

segafilm: add support for raw videos

Signed-off-by: Martin Storsjö <martin@martin.st>

Matthew Hoops authored on 2011/11/15 10:08:50
Showing 1 changed files
... ...
@@ -34,6 +34,7 @@
34 34
 #define FDSC_TAG MKBETAG('F', 'D', 'S', 'C')
35 35
 #define STAB_TAG MKBETAG('S', 'T', 'A', 'B')
36 36
 #define CVID_TAG MKBETAG('c', 'v', 'i', 'd')
37
+#define RAW_TAG  MKBETAG('r', 'a', 'w', ' ')
37 38
 
38 39
 typedef struct {
39 40
   int stream;
... ...
@@ -129,8 +130,11 @@ static int film_read_header(AVFormatContext *s,
129 129
 
130 130
     if (AV_RB32(&scratch[8]) == CVID_TAG) {
131 131
         film->video_type = CODEC_ID_CINEPAK;
132
-    } else
132
+    } else if (AV_RB32(&scratch[8]) == RAW_TAG) {
133
+        film->video_type = CODEC_ID_RAWVIDEO;
134
+    } else {
133 135
         film->video_type = CODEC_ID_NONE;
136
+    }
134 137
 
135 138
     /* initialize the decoder streams */
136 139
     if (film->video_type) {
... ...
@@ -143,6 +147,15 @@ static int film_read_header(AVFormatContext *s,
143 143
         st->codec->codec_tag = 0;  /* no fourcc */
144 144
         st->codec->width = AV_RB32(&scratch[16]);
145 145
         st->codec->height = AV_RB32(&scratch[12]);
146
+
147
+        if (film->video_type == CODEC_ID_RAWVIDEO) {
148
+            if (scratch[20] == 24) {
149
+                st->codec->pix_fmt = PIX_FMT_RGB24;
150
+            } else {
151
+                av_log(s, AV_LOG_ERROR, "raw video is using unhandled %dbpp\n", scratch[20]);
152
+                return -1;
153
+            }
154
+        }
146 155
     }
147 156
 
148 157
     if (film->audio_type) {