]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/wc3movie.c
id3v2 writer
[ffmpeg] / libavformat / wc3movie.c
index 2eafd9f3d18286f0db06f47559c689ea46b6869d..c87007050a0d36d5b4490cf223bd6d7e00725da7 100644 (file)
@@ -2,18 +2,20 @@
  * Wing Commander III Movie (.mve) File Demuxer
  * Copyright (c) 2003 The ffmpeg Project
  *
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg 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 this library; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -113,8 +115,8 @@ static int wc3_probe(AVProbeData *p)
     if (p->buf_size < 12)
         return 0;
 
-    if ((LE_32(&p->buf[0]) != FORM_TAG) ||
-        (LE_32(&p->buf[8]) != MOVE_TAG))
+    if ((AV_RL32(&p->buf[0]) != FORM_TAG) ||
+        (AV_RL32(&p->buf[8]) != MOVE_TAG))
         return 0;
 
     return AVPROBE_SCORE_MAX;
@@ -123,7 +125,7 @@ static int wc3_probe(AVProbeData *p)
 static int wc3_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {
-    Wc3DemuxContext *wc3 = (Wc3DemuxContext *)s->priv_data;
+    Wc3DemuxContext *wc3 = s->priv_data;
     ByteIOContext *pb = &s->pb;
     unsigned int fourcc_tag;
     unsigned int size;
@@ -151,8 +153,8 @@ static int wc3_read_header(AVFormatContext *s,
     if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
         WC3_PREAMBLE_SIZE)
         return AVERROR_IO;
-    fourcc_tag = LE_32(&preamble[0]);
-    size = (BE_32(&preamble[4]) + 1) & (~1);
+    fourcc_tag = AV_RL32(&preamble[0]);
+    size = (AV_RB32(&preamble[4]) + 1) & (~1);
 
     do {
         switch (fourcc_tag) {
@@ -168,7 +170,7 @@ static int wc3_read_header(AVFormatContext *s,
             url_fseek(pb, 8, SEEK_CUR);
             if ((ret = get_buffer(pb, preamble, 4)) != 4)
                 return AVERROR_IO;
-            wc3->palette_count = LE_32(&preamble[0]);
+            wc3->palette_count = AV_RL32(&preamble[0]);
             if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){
                 wc3->palette_count= 0;
                 return -1;
@@ -191,8 +193,8 @@ static int wc3_read_header(AVFormatContext *s,
             if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
                 WC3_PREAMBLE_SIZE)
                 return AVERROR_IO;
-            wc3->width = LE_32(&preamble[0]);
-            wc3->height = LE_32(&preamble[4]);
+            wc3->width = AV_RL32(&preamble[0]);
+            wc3->height = AV_RL32(&preamble[4]);
             break;
 
         case PALT_TAG:
@@ -227,9 +229,9 @@ static int wc3_read_header(AVFormatContext *s,
         if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
             WC3_PREAMBLE_SIZE)
             return AVERROR_IO;
-        fourcc_tag = LE_32(&preamble[0]);
+        fourcc_tag = AV_RL32(&preamble[0]);
         /* chunk sizes are 16-bit aligned */
-        size = (BE_32(&preamble[4]) + 1) & (~1);
+        size = (AV_RB32(&preamble[4]) + 1) & (~1);
 
     } while (fourcc_tag != BRCH_TAG);
 
@@ -269,7 +271,7 @@ static int wc3_read_header(AVFormatContext *s,
 static int wc3_read_packet(AVFormatContext *s,
                            AVPacket *pkt)
 {
-    Wc3DemuxContext *wc3 = (Wc3DemuxContext *)s->priv_data;
+    Wc3DemuxContext *wc3 = s->priv_data;
     ByteIOContext *pb = &s->pb;
     unsigned int fourcc_tag;
     unsigned int size;
@@ -289,9 +291,9 @@ static int wc3_read_packet(AVFormatContext *s,
             WC3_PREAMBLE_SIZE)
             ret = AVERROR_IO;
 
-        fourcc_tag = LE_32(&preamble[0]);
+        fourcc_tag = AV_RL32(&preamble[0]);
         /* chunk sizes are 16-bit aligned */
-        size = (BE_32(&preamble[4]) + 1) & (~1);
+        size = (AV_RB32(&preamble[4]) + 1) & (~1);
 
         switch (fourcc_tag) {
 
@@ -303,7 +305,7 @@ static int wc3_read_packet(AVFormatContext *s,
             /* load up new palette */
             if ((ret = get_buffer(pb, preamble, 4)) != 4)
                 return AVERROR_IO;
-            palette_number = LE_32(&preamble[0]);
+            palette_number = AV_RL32(&preamble[0]);
             if (palette_number >= wc3->palette_count)
                 return AVERROR_INVALIDDATA;
             base_palette_index = palette_number * PALETTE_COUNT * 3;
@@ -374,14 +376,14 @@ static int wc3_read_packet(AVFormatContext *s,
 
 static int wc3_read_close(AVFormatContext *s)
 {
-    Wc3DemuxContext *wc3 = (Wc3DemuxContext *)s->priv_data;
+    Wc3DemuxContext *wc3 = s->priv_data;
 
     av_free(wc3->palettes);
 
     return 0;
 }
 
-static AVInputFormat wc3_demuxer = {
+AVInputFormat wc3_demuxer = {
     "wc3movie",
     "Wing Commander III movie format",
     sizeof(Wc3DemuxContext),
@@ -390,9 +392,3 @@ static AVInputFormat wc3_demuxer = {
     wc3_read_packet,
     wc3_read_close,
 };
-
-int wc3_init(void)
-{
-    av_register_input_format(&wc3_demuxer);
-    return 0;
-}