]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/eacdata.c
Replace some commented-out debug printf() / av_log() messages with av_dlog().
[ffmpeg] / libavformat / eacdata.c
index f4ea2f2e98942e0eec70d6237188d9bee8f8a12f..5c89559ed19bcaa3ac5a0601f9205fef9ee5faa1 100644 (file)
@@ -2,27 +2,27 @@
  * Electronic Arts .cdata file Demuxer
  * Copyright (c) 2007 Peter Ross
  *
- * 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 libavformat/eacdata.c
+ * @file
  * Electronic Arts cdata Format Demuxer
- * by Peter Ross (suxen_drol at hotmail dot com)
+ * by Peter Ross (pross@xvid.org)
  *
  * Technical details here:
  *  http://wiki.multimedia.cx/index.php?title=EA_Command_And_Conquer_3_Audio_Codec
@@ -47,11 +47,11 @@ static int cdata_probe(AVProbeData *p)
 static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     CdataDemuxContext *cdata = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int sample_rate, header;
     AVStream *st;
 
-    header = get_be16(pb);
+    header = avio_rb16(pb);
     switch (header) {
         case 0x0400: cdata->channels = 1; break;
         case 0x0404: cdata->channels = 2; break;
@@ -61,13 +61,13 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
             return -1;
     };
 
-    sample_rate = get_be16(pb);
-    url_fskip(pb, 12);
+    sample_rate = avio_rb16(pb);
+    avio_skip(pb, 12);
 
     st = av_new_stream(s, 0);
     if (!st)
         return AVERROR(ENOMEM);
-    st->codec->codec_type = CODEC_TYPE_AUDIO;
+    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
     st->codec->codec_tag = 0; /* no fourcc */
     st->codec->codec_id = CODEC_ID_ADPCM_EA_XAS;
     st->codec->channels = cdata->channels;
@@ -83,13 +83,14 @@ static int cdata_read_packet(AVFormatContext *s, AVPacket *pkt)
     CdataDemuxContext *cdata = s->priv_data;
     int packet_size = 76*cdata->channels;
 
-    if (av_get_packet(s->pb, pkt, packet_size) != packet_size)
-        return AVERROR(EIO);
+    int ret = av_get_packet(s->pb, pkt, packet_size);
+    if (ret < 0)
+        return ret;
     pkt->pts = cdata->audio_pts++;
-    return 1;
+    return 0;
 }
 
-AVInputFormat ea_cdata_demuxer = {
+AVInputFormat ff_ea_cdata_demuxer = {
     "ea_cdata",
     NULL_IF_CONFIG_SMALL("Electronic Arts cdata"),
     sizeof(CdataDemuxContext),