]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/flic.c
add common codecs uls
[ffmpeg] / libavformat / flic.c
index d53168dc98d68f4f2afb86beb742ac319a85f094..894fd0f18807b564784929f39f832ddfd6ea940f 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
@@ -33,6 +33,8 @@
 
 #define FLIC_FILE_MAGIC_1 0xAF11
 #define FLIC_FILE_MAGIC_2 0xAF12
+#define FLIC_FILE_MAGIC_3 0xAF44  /* Flic Type for Extended FLX Format which
+                                     originated in Dave's Targa Animator (DTA) */
 #define FLIC_CHUNK_MAGIC_1 0xF1FA
 #define FLIC_CHUNK_MAGIC_2 0xF5FA
 #define FLIC_MC_PTS_INC 6000  /* pts increment for Magic Carpet game FLIs */
@@ -56,7 +58,8 @@ static int flic_probe(AVProbeData *p)
 
     magic_number = LE_16(&p->buf[4]);
     if ((magic_number != FLIC_FILE_MAGIC_1) &&
-        (magic_number != FLIC_FILE_MAGIC_2))
+        (magic_number != FLIC_FILE_MAGIC_2) &&
+        (magic_number != FLIC_FILE_MAGIC_3))
         return 0;
 
     return AVPROBE_SCORE_MAX;
@@ -129,7 +132,8 @@ static int flic_read_header(AVFormatContext *s,
          *  therefore, the frame pts increment = n * 1285.7
          */
         flic->frame_pts_inc = speed * 1285.7;
-    } else if (magic_number == FLIC_FILE_MAGIC_2) {
+    } else if ((magic_number == FLIC_FILE_MAGIC_2) ||
+               (magic_number == FLIC_FILE_MAGIC_3)) {
         /*
          * in this case, the speed (n) is number of milliseconds between frames:
          *
@@ -178,9 +182,9 @@ static int flic_read_packet(AVFormatContext *s,
             }
             pkt->stream_index = flic->video_stream_index;
             pkt->pts = flic->pts;
-            pkt->pos = url_ftell(pb); 
+            pkt->pos = url_ftell(pb);
             memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE);
-            ret = get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE, 
+            ret = get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE,
                 size - FLIC_PREAMBLE_SIZE);
             if (ret != size - FLIC_PREAMBLE_SIZE) {
                 av_free_packet(pkt);
@@ -204,18 +208,12 @@ static int flic_read_close(AVFormatContext *s)
     return 0;
 }
 
-static AVInputFormat flic_iformat = {
+AVInputFormat flic_demuxer = {
     "flic",
-    "FLI/FLC animation format",
+    "FLI/FLC/FLX animation format",
     sizeof(FlicDemuxContext),
     flic_probe,
     flic_read_header,
     flic_read_packet,
     flic_read_close,
 };
-
-int flic_init(void)
-{
-    av_register_input_format(&flic_iformat);
-    return 0;
-}