]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/txd.c
vmdaudio: output audio samples for standalone silent blocks.
[ffmpeg] / libavformat / txd.c
index bf62ac67df44faf55ecd14b5037870d66971aac8..92a0c094aa29fa94d27cbf64454d9e364cbca0f5 100644 (file)
@@ -43,7 +43,7 @@ static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) {
     st = av_new_stream(s, 0);
     if (!st)
         return AVERROR(ENOMEM);
-    st->codec->codec_type = CODEC_TYPE_VIDEO;
+    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     st->codec->codec_id = CODEC_ID_TXD;
     st->codec->time_base.den = 5;
     st->codec->time_base.num = 1;
@@ -52,20 +52,20 @@ static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) {
 }
 
 static int txd_read_packet(AVFormatContext *s, AVPacket *pkt) {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int id, chunk_size, marker;
     int ret;
 
 next_chunk:
-    id         = get_le32(pb);
-    chunk_size = get_le32(pb);
-    marker     = get_le32(pb);
+    id         = avio_rl32(pb);
+    chunk_size = avio_rl32(pb);
+    marker     = avio_rl32(pb);
 
     if (url_feof(s->pb))
-        return AVERROR(EIO);
+        return AVERROR_EOF;
     if (marker != TXD_MARKER && marker != TXD_MARKER2) {
-        av_log(NULL, AV_LOG_ERROR, "marker does not match\n");
-        return AVERROR(EIO);
+        av_log(s, AV_LOG_ERROR, "marker does not match\n");
+        return AVERROR_INVALIDDATA;
     }
 
     switch (id) {
@@ -78,17 +78,19 @@ next_chunk:
         case TXD_TEXTURE:
             goto next_chunk;
         default:
-            av_log(NULL, AV_LOG_ERROR, "unknown chunk id %i\n", id);
-            return AVERROR(EIO);
+            av_log(s, AV_LOG_ERROR, "unknown chunk id %i\n", id);
+            return AVERROR_INVALIDDATA;
     }
 
     ret = av_get_packet(s->pb, pkt, chunk_size);
+    if (ret < 0)
+        return ret;
     pkt->stream_index = 0;
 
-    return ret <= 0 ? AVERROR(EIO) : ret;
+    return 0;
 }
 
-AVInputFormat txd_demuxer =
+AVInputFormat ff_txd_demuxer =
 {
     "txd",
     NULL_IF_CONFIG_SMALL("Renderware TeXture Dictionary"),