comparison mmf.c @ 3973:549a09cf23fe libavformat

Remove offset_t typedef and use int64_t directly instead. The name offset_t is easily confused with the standard off_t type and *_t is POSIX reserved namespace if any POSIX header is included.
author diego
date Fri, 03 Oct 2008 10:16:29 +0000
parents 1d3d17de20ba
children c3102b189cb6
comparison
equal deleted inserted replaced
3972:c7a831579a13 3973:549a09cf23fe
21 #include "avformat.h" 21 #include "avformat.h"
22 #include "raw.h" 22 #include "raw.h"
23 #include "riff.h" 23 #include "riff.h"
24 24
25 typedef struct { 25 typedef struct {
26 offset_t atrpos, atsqpos, awapos; 26 int64_t atrpos, atsqpos, awapos;
27 offset_t data_size; 27 int64_t data_size;
28 } MMFContext; 28 } MMFContext;
29 29
30 static const int mmf_rates[] = { 4000, 8000, 11025, 22050, 44100 }; 30 static const int mmf_rates[] = { 4000, 8000, 11025, 22050, 44100 };
31 31
32 static int mmf_rate(int code) 32 static int mmf_rate(int code)
45 return i; 45 return i;
46 return -1; 46 return -1;
47 } 47 }
48 48
49 /* Copy of end_tag() from avienc.c, but for big-endian chunk size */ 49 /* Copy of end_tag() from avienc.c, but for big-endian chunk size */
50 static void end_tag_be(ByteIOContext *pb, offset_t start) 50 static void end_tag_be(ByteIOContext *pb, int64_t start)
51 { 51 {
52 offset_t pos; 52 int64_t pos;
53 53
54 pos = url_ftell(pb); 54 pos = url_ftell(pb);
55 url_fseek(pb, start - 4, SEEK_SET); 55 url_fseek(pb, start - 4, SEEK_SET);
56 put_be32(pb, (uint32_t)(pos - start)); 56 put_be32(pb, (uint32_t)(pos - start));
57 url_fseek(pb, pos, SEEK_SET); 57 url_fseek(pb, pos, SEEK_SET);
59 59
60 static int mmf_write_header(AVFormatContext *s) 60 static int mmf_write_header(AVFormatContext *s)
61 { 61 {
62 MMFContext *mmf = s->priv_data; 62 MMFContext *mmf = s->priv_data;
63 ByteIOContext *pb = s->pb; 63 ByteIOContext *pb = s->pb;
64 offset_t pos; 64 int64_t pos;
65 int rate; 65 int rate;
66 66
67 rate = mmf_rate_code(s->streams[0]->codec->sample_rate); 67 rate = mmf_rate_code(s->streams[0]->codec->sample_rate);
68 if(rate < 0) { 68 if(rate < 0) {
69 av_log(s, AV_LOG_ERROR, "Unsupported sample rate %d\n", s->streams[0]->codec->sample_rate); 69 av_log(s, AV_LOG_ERROR, "Unsupported sample rate %d\n", s->streams[0]->codec->sample_rate);
127 127
128 static int mmf_write_trailer(AVFormatContext *s) 128 static int mmf_write_trailer(AVFormatContext *s)
129 { 129 {
130 ByteIOContext *pb = s->pb; 130 ByteIOContext *pb = s->pb;
131 MMFContext *mmf = s->priv_data; 131 MMFContext *mmf = s->priv_data;
132 offset_t pos, size; 132 int64_t pos, size;
133 int gatetime; 133 int gatetime;
134 134
135 if (!url_is_streamed(s->pb)) { 135 if (!url_is_streamed(s->pb)) {
136 /* Fill in length fields */ 136 /* Fill in length fields */
137 end_tag_be(pb, mmf->awapos); 137 end_tag_be(pb, mmf->awapos);
183 { 183 {
184 MMFContext *mmf = s->priv_data; 184 MMFContext *mmf = s->priv_data;
185 unsigned int tag; 185 unsigned int tag;
186 ByteIOContext *pb = s->pb; 186 ByteIOContext *pb = s->pb;
187 AVStream *st; 187 AVStream *st;
188 offset_t file_size, size; 188 int64_t file_size, size;
189 int rate, params; 189 int rate, params;
190 190
191 tag = get_le32(pb); 191 tag = get_le32(pb);
192 if (tag != MKTAG('M', 'M', 'M', 'D')) 192 if (tag != MKTAG('M', 'M', 'M', 'D'))
193 return -1; 193 return -1;