]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/wc3movie.c
Support raw TrueHD files
[ffmpeg] / libavformat / wc3movie.c
index df207ef9d9371d03d0cdb5d271d8e4a2679f398c..59b11ae2b232b165e24702ffd0eafd550e1f60f3 100644 (file)
  */
 
 /**
- * @file wc3movie.c
+ * @file libavformat/wc3movie.c
  * Wing Commander III Movie file demuxer
  * by Mike Melanson (melanson@pcisys.net)
  * for more information on the WC3 .mve file format, visit:
  *   http://www.pcisys.net/~melanson/codecs/
  */
 
+#include "libavutil/intreadwrite.h"
 #include "avformat.h"
 
 #define WC3_PREAMBLE_SIZE 8
@@ -131,6 +132,7 @@ static int wc3_read_header(AVFormatContext *s,
     unsigned int size;
     AVStream *st;
     unsigned char preamble[WC3_PREAMBLE_SIZE];
+    char buffer[513];
     int ret = 0;
     int current_palette = 0;
     int bytes_to_read;
@@ -184,8 +186,10 @@ static int wc3_read_header(AVFormatContext *s,
                 bytes_to_read = size;
             else
                 bytes_to_read = 512;
-            if ((ret = get_buffer(pb, s->title, bytes_to_read)) != bytes_to_read)
+            if ((ret = get_buffer(pb, buffer, bytes_to_read)) != bytes_to_read)
                 return AVERROR(EIO);
+            buffer[bytes_to_read] = 0;
+            av_metadata_set(&s->metadata, "title", buffer);
             break;
 
         case SIZE_TAG:
@@ -289,7 +293,7 @@ static int wc3_read_packet(AVFormatContext *s,
         /* get the next chunk preamble */
         if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
             WC3_PREAMBLE_SIZE)
-            ret = AVERROR(EIO);
+            return AVERROR(EIO);
 
         fourcc_tag = AV_RL32(&preamble[0]);
         /* chunk sizes are 16-bit aligned */