comparison movenc.c @ 6011:97fdefab56cd libavformat

Move the mov muxer structures to a separate header
author mstorsjo
date Tue, 18 May 2010 19:38:37 +0000
parents 51b194d7393f
children 8298cc054242
comparison
equal deleted inserted replaced
6010:01f2dce260eb 6011:97fdefab56cd
19 * You should have received a copy of the GNU Lesser General Public 19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software 20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */ 22 */
23 23
24 #include "movenc.h"
24 #include "avformat.h" 25 #include "avformat.h"
25 #include "riff.h" 26 #include "riff.h"
26 #include "avio.h" 27 #include "avio.h"
27 #include "isom.h" 28 #include "isom.h"
28 #include "avc.h" 29 #include "avc.h"
29 #include "libavcodec/get_bits.h" 30 #include "libavcodec/get_bits.h"
30 #include "libavcodec/put_bits.h" 31 #include "libavcodec/put_bits.h"
31 32
32 #undef NDEBUG 33 #undef NDEBUG
33 #include <assert.h> 34 #include <assert.h>
34
35 #define MOV_INDEX_CLUSTER_SIZE 16384
36 #define MOV_TIMESCALE 1000
37
38 #define MODE_MP4 0x01
39 #define MODE_MOV 0x02
40 #define MODE_3GP 0x04
41 #define MODE_PSP 0x08 // example working PSP command line:
42 // ffmpeg -i testinput.avi -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 M4V00001.MP4
43 #define MODE_3G2 0x10
44 #define MODE_IPOD 0x20
45
46 typedef struct MOVIentry {
47 unsigned int size;
48 uint64_t pos;
49 unsigned int samplesInChunk;
50 unsigned int entries;
51 int cts;
52 int64_t dts;
53 #define MOV_SYNC_SAMPLE 0x0001
54 #define MOV_PARTIAL_SYNC_SAMPLE 0x0002
55 uint32_t flags;
56 } MOVIentry;
57
58 typedef struct MOVIndex {
59 int mode;
60 int entry;
61 unsigned timescale;
62 uint64_t time;
63 int64_t trackDuration;
64 long sampleCount;
65 long sampleSize;
66 int hasKeyframes;
67 #define MOV_TRACK_CTTS 0x0001
68 #define MOV_TRACK_STPS 0x0002
69 uint32_t flags;
70 int language;
71 int trackID;
72 int tag; ///< stsd fourcc
73 AVCodecContext *enc;
74
75 int vosLen;
76 uint8_t *vosData;
77 MOVIentry *cluster;
78 int audio_vbr;
79 int height; ///< active picture (w/o VBI) height for D-10/IMX
80 uint32_t tref_tag;
81 int tref_id; ///< trackID of the referenced track
82 } MOVTrack;
83
84 typedef struct MOVMuxContext {
85 int mode;
86 int64_t time;
87 int nb_streams;
88 int chapter_track; ///< qt chapter track number
89 int64_t mdat_pos;
90 uint64_t mdat_size;
91 MOVTrack *tracks;
92 } MOVMuxContext;
93 35
94 //FIXME support 64 bit variant with wide placeholders 36 //FIXME support 64 bit variant with wide placeholders
95 static int64_t updateSize(ByteIOContext *pb, int64_t pos) 37 static int64_t updateSize(ByteIOContext *pb, int64_t pos)
96 { 38 {
97 int64_t curpos = url_ftell(pb); 39 int64_t curpos = url_ftell(pb);