]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/iss.c
resample: remove unused #define
[ffmpeg] / libavformat / iss.c
index c722f62d2bf79562f80474bc22155628a65695b8..845e07ba0c464247a177b803f595198b72d85e72 100644 (file)
@@ -2,29 +2,28 @@
  * ISS (.iss) file demuxer
  * Copyright (c) 2008 Jaikrishnan Menon <realityman@gmx.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
- * @file iss.c
+ * @file
  * Funcom ISS file demuxer
  * @author Jaikrishnan Menon
- * for more information on the .iss file format, visit:
- * http://wiki.multimedia.cx/index.php?title=FunCom_ISS
+ * @see http://wiki.multimedia.cx/index.php?title=FunCom_ISS
  */
 
 #include "avformat.h"
@@ -39,12 +38,12 @@ typedef struct {
     int sample_start_pos;
 } IssDemuxContext;
 
-static void get_token(ByteIOContext *s, char *buf, int maxlen)
+static void get_token(AVIOContext *s, char *buf, int maxlen)
 {
     int i = 0;
     char c;
 
-    while ((c = get_byte(s))) {
+    while ((c = avio_r8(s))) {
         if(c == ' ')
             break;
         if (i < maxlen-1)
@@ -52,7 +51,7 @@ static void get_token(ByteIOContext *s, char *buf, int maxlen)
     }
 
     if(!c)
-        get_byte(s);
+        avio_r8(s);
 
     buf[i] = 0; /* Ensure null terminated, but may be truncated */
 }
@@ -68,7 +67,7 @@ static int iss_probe(AVProbeData *p)
 static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     IssDemuxContext *iss = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     char token[MAX_TOKEN_SIZE];
     int stereo, rate_divisor;
@@ -87,12 +86,12 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
     get_token(pb, token, sizeof(token)); //Version ID
     get_token(pb, token, sizeof(token)); //Size
 
-    iss->sample_start_pos = url_ftell(pb);
+    iss->sample_start_pos = avio_tell(pb);
 
-    st = av_new_stream(s, 0);
+    st = avformat_new_stream(s, NULL);
     if (!st)
         return AVERROR(ENOMEM);
-    st->codec->codec_type = CODEC_TYPE_AUDIO;
+    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_ADPCM_IMA_ISS;
     st->codec->channels = stereo ? 2 : 1;
     st->codec->sample_rate = 44100;
@@ -112,22 +111,22 @@ static int iss_read_packet(AVFormatContext *s, AVPacket *pkt)
     IssDemuxContext *iss = s->priv_data;
     int ret = av_get_packet(s->pb, pkt, iss->packet_size);
 
-    if(ret < 0)
-        return ret;
+    if(ret != iss->packet_size)
+        return AVERROR(EIO);
 
     pkt->stream_index = 0;
-    pkt->pts = url_ftell(s->pb) - iss->sample_start_pos;
+    pkt->pts = avio_tell(s->pb) - iss->sample_start_pos;
     if(s->streams[0]->codec->channels > 0)
         pkt->pts /= s->streams[0]->codec->channels*2;
     return 0;
 }
 
-AVInputFormat iss_demuxer = {
-    "ISS",
-    NULL_IF_CONFIG_SMALL("Funcom ISS format"),
-    sizeof(IssDemuxContext),
-    iss_probe,
-    iss_read_header,
-    iss_read_packet,
+AVInputFormat ff_iss_demuxer = {
+    .name           = "ISS",
+    .long_name      = NULL_IF_CONFIG_SMALL("Funcom ISS format"),
+    .priv_data_size = sizeof(IssDemuxContext),
+    .read_probe     = iss_probe,
+    .read_header    = iss_read_header,
+    .read_packet    = iss_read_packet,
 };