]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/ipmovie.c
Move doxygen documentation from lzo.c to lzo.h
[ffmpeg] / libavformat / ipmovie.c
index f2dbb9ae1e082e015dc11fb9cb37a40977542501..2b0d955df965dbedddc53b37911be3c98c8aca13 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 /**
- * @file ipmovie.c
+ * @file libavformat/ipmovie.c
  * Interplay MVE file demuxer
  * by Mike Melanson (melanson@pcisys.net)
  * For more information regarding the Interplay MVE file format, visit:
@@ -32,6 +32,7 @@
  * up and sending out the chunks.
  */
 
+#include "libavutil/intreadwrite.h"
 #include "avformat.h"
 
 /* debugging support: #define DEBUG_IPMOVIE as non-zero to see extremely
@@ -101,20 +102,20 @@ typedef struct IPMVEContext {
     unsigned int audio_bits;
     unsigned int audio_channels;
     unsigned int audio_sample_rate;
-    unsigned int audio_type;
+    enum CodecID audio_type;
     unsigned int audio_frame_count;
 
     int video_stream_index;
     int audio_stream_index;
 
-    offset_t audio_chunk_offset;
+    int64_t audio_chunk_offset;
     int audio_chunk_size;
-    offset_t video_chunk_offset;
+    int64_t video_chunk_offset;
     int video_chunk_size;
-    offset_t decode_map_chunk_offset;
+    int64_t decode_map_chunk_offset;
     int decode_map_chunk_size;
 
-    offset_t next_chunk_offset;
+    int64_t next_chunk_offset;
 
     AVPaletteControl palette_control;
 
@@ -446,7 +447,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
             last_color = first_color + AV_RL16(&scratch[2]) - 1;
             /* sanity check (since they are 16 bit values) */
             if ((first_color > 0xFF) || (last_color > 0xFF)) {
-                debug_ipmovie("demux_ipmovie: set_palette indices out of range (%d -> %d)\n",
+                debug_ipmovie("demux_ipmovie: set_palette indexes out of range (%d -> %d)\n",
                     first_color, last_color);
                 chunk_type = CHUNK_BAD;
                 break;
@@ -517,7 +518,7 @@ static int ipmovie_read_header(AVFormatContext *s,
                                AVFormatParameters *ap)
 {
     IPMVEContext *ipmovie = s->priv_data;
-    ByteIOContext *pb = &s->pb;
+    ByteIOContext *pb = s->pb;
     AVPacket pkt;
     AVStream *st;
     unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE];
@@ -539,12 +540,12 @@ static int ipmovie_read_header(AVFormatContext *s,
      * it; if it is the first video chunk, this is a silent file */
     if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
         CHUNK_PREAMBLE_SIZE)
-        return AVERROR_IO;
+        return AVERROR(EIO);
     chunk_type = AV_RL16(&chunk_preamble[2]);
     url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
 
     if (chunk_type == CHUNK_VIDEO)
-        ipmovie->audio_type = 0;  /* no audio */
+        ipmovie->audio_type = CODEC_ID_NONE;  /* no audio */
     else if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_AUDIO)
         return AVERROR_INVALIDDATA;
 
@@ -574,12 +575,12 @@ static int ipmovie_read_header(AVFormatContext *s,
         st->codec->codec_tag = 0;  /* no tag */
         st->codec->channels = ipmovie->audio_channels;
         st->codec->sample_rate = ipmovie->audio_sample_rate;
-        st->codec->bits_per_sample = ipmovie->audio_bits;
+        st->codec->bits_per_coded_sample = ipmovie->audio_bits;
         st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
-            st->codec->bits_per_sample;
+            st->codec->bits_per_coded_sample;
         if (st->codec->codec_id == CODEC_ID_INTERPLAY_DPCM)
             st->codec->bit_rate /= 2;
-        st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
+        st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
     }
 
     return 0;
@@ -589,14 +590,14 @@ static int ipmovie_read_packet(AVFormatContext *s,
                                AVPacket *pkt)
 {
     IPMVEContext *ipmovie = s->priv_data;
-    ByteIOContext *pb = &s->pb;
+    ByteIOContext *pb = s->pb;
     int ret;
 
     ret = process_ipmovie_chunk(ipmovie, pb, pkt);
     if (ret == CHUNK_BAD)
         ret = AVERROR_INVALIDDATA;
     else if (ret == CHUNK_EOF)
-        ret = AVERROR_IO;
+        ret = AVERROR(EIO);
     else if (ret == CHUNK_NOMEM)
         ret = AVERROR(ENOMEM);
     else if (ret == CHUNK_VIDEO)
@@ -607,19 +608,11 @@ static int ipmovie_read_packet(AVFormatContext *s,
     return ret;
 }
 
-static int ipmovie_read_close(AVFormatContext *s)
-{
-//    IPMVEContext *ipmovie = s->priv_data;
-
-    return 0;
-}
-
 AVInputFormat ipmovie_demuxer = {
     "ipmovie",
-    "Interplay MVE format",
+    NULL_IF_CONFIG_SMALL("Interplay MVE format"),
     sizeof(IPMVEContext),
     ipmovie_probe,
     ipmovie_read_header,
     ipmovie_read_packet,
-    ipmovie_read_close,
 };