• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavformat/4xm.c

Go to the documentation of this file.
00001 /*
00002  * 4X Technologies .4xm File Demuxer (no muxer)
00003  * Copyright (c) 2003  The ffmpeg Project
00004  *
00005  * This file is part of FFmpeg.
00006  *
00007  * FFmpeg is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * FFmpeg is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with FFmpeg; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00030 #include "libavutil/intreadwrite.h"
00031 #include "avformat.h"
00032 
00033 #define     RIFF_TAG MKTAG('R', 'I', 'F', 'F')
00034 #define  FOURXMV_TAG MKTAG('4', 'X', 'M', 'V')
00035 #define     LIST_TAG MKTAG('L', 'I', 'S', 'T')
00036 #define     HEAD_TAG MKTAG('H', 'E', 'A', 'D')
00037 #define     TRK__TAG MKTAG('T', 'R', 'K', '_')
00038 #define     MOVI_TAG MKTAG('M', 'O', 'V', 'I')
00039 #define     VTRK_TAG MKTAG('V', 'T', 'R', 'K')
00040 #define     STRK_TAG MKTAG('S', 'T', 'R', 'K')
00041 #define     std__TAG MKTAG('s', 't', 'd', '_')
00042 #define     name_TAG MKTAG('n', 'a', 'm', 'e')
00043 #define     vtrk_TAG MKTAG('v', 't', 'r', 'k')
00044 #define     strk_TAG MKTAG('s', 't', 'r', 'k')
00045 #define     ifrm_TAG MKTAG('i', 'f', 'r', 'm')
00046 #define     pfrm_TAG MKTAG('p', 'f', 'r', 'm')
00047 #define     cfrm_TAG MKTAG('c', 'f', 'r', 'm')
00048 #define     ifr2_TAG MKTAG('i', 'f', 'r', '2')
00049 #define     pfr2_TAG MKTAG('p', 'f', 'r', '2')
00050 #define     cfr2_TAG MKTAG('c', 'f', 'r', '2')
00051 #define     snd__TAG MKTAG('s', 'n', 'd', '_')
00052 
00053 #define vtrk_SIZE 0x44
00054 #define strk_SIZE 0x28
00055 
00056 #define GET_LIST_HEADER() \
00057     fourcc_tag = get_le32(pb); \
00058     size = get_le32(pb); \
00059     if (fourcc_tag != LIST_TAG) \
00060         return AVERROR_INVALIDDATA; \
00061     fourcc_tag = get_le32(pb);
00062 
00063 typedef struct AudioTrack {
00064     int sample_rate;
00065     int bits;
00066     int channels;
00067     int stream_index;
00068     int adpcm;
00069     int64_t audio_pts;
00070 } AudioTrack;
00071 
00072 typedef struct FourxmDemuxContext {
00073     int width;
00074     int height;
00075     int video_stream_index;
00076     int track_count;
00077     AudioTrack *tracks;
00078 
00079     int64_t video_pts;
00080     float fps;
00081 } FourxmDemuxContext;
00082 
00083 static int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((AV_RL32(&p->int fourxm_probe(AVProbeData *p)
00084 {
00085     if ((