comparison swf.c @ 65:a58a8a53eb46 libavformat

* UINTX -> uintx_t INTX -> intx_t
author kabi
date Tue, 11 Feb 2003 16:35:48 +0000
parents 39c4c4336486
children 25062c9b1f86
comparison
equal deleted inserted replaced
64:b0e0eb595e29 65:a58a8a53eb46
105 105
106 static void put_swf_rect(ByteIOContext *pb, 106 static void put_swf_rect(ByteIOContext *pb,
107 int xmin, int xmax, int ymin, int ymax) 107 int xmin, int xmax, int ymin, int ymax)
108 { 108 {
109 PutBitContext p; 109 PutBitContext p;
110 UINT8 buf[256]; 110 uint8_t buf[256];
111 int nbits, mask; 111 int nbits, mask;
112 112
113 init_put_bits(&p, buf, sizeof(buf), NULL, NULL); 113 init_put_bits(&p, buf, sizeof(buf), NULL, NULL);
114 114
115 nbits = 0; 115 nbits = 0;
162 /* put matrix (not size optimized */ 162 /* put matrix (not size optimized */
163 static void put_swf_matrix(ByteIOContext *pb, 163 static void put_swf_matrix(ByteIOContext *pb,
164 int a, int b, int c, int d, int tx, int ty) 164 int a, int b, int c, int d, int tx, int ty)
165 { 165 {
166 PutBitContext p; 166 PutBitContext p;
167 UINT8 buf[256]; 167 uint8_t buf[256];
168 168
169 init_put_bits(&p, buf, sizeof(buf), NULL, NULL); 169 init_put_bits(&p, buf, sizeof(buf), NULL, NULL);
170 170
171 put_bits(&p, 1, 1); /* a, d present */ 171 put_bits(&p, 1, 1); /* a, d present */
172 put_bits(&p, 5, 20); /* nb bits */ 172 put_bits(&p, 5, 20); /* nb bits */
191 { 191 {
192 SWFContext *swf; 192 SWFContext *swf;
193 ByteIOContext *pb = &s->pb; 193 ByteIOContext *pb = &s->pb;
194 AVCodecContext *enc, *audio_enc, *video_enc; 194 AVCodecContext *enc, *audio_enc, *video_enc;
195 PutBitContext p; 195 PutBitContext p;
196 UINT8 buf1[256]; 196 uint8_t buf1[256];
197 int i, width, height, rate; 197 int i, width, height, rate;
198 198
199 swf = av_malloc(sizeof(SWFContext)); 199 swf = av_malloc(sizeof(SWFContext));
200 if (!swf) 200 if (!swf)
201 return -1; 201 return -1;
228 (will be patched if not streamed) */ 228 (will be patched if not streamed) */
229 229
230 put_swf_rect(pb, 0, width, 0, height); 230 put_swf_rect(pb, 0, width, 0, height);
231 put_le16(pb, (rate * 256) / FRAME_RATE_BASE); /* frame rate */ 231 put_le16(pb, (rate * 256) / FRAME_RATE_BASE); /* frame rate */
232 swf->duration_pos = url_ftell(pb); 232 swf->duration_pos = url_ftell(pb);
233 put_le16(pb, (UINT16)(DUMMY_DURATION * (INT64)rate / FRAME_RATE_BASE)); /* frame count */ 233 put_le16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / FRAME_RATE_BASE)); /* frame count */
234 234
235 /* define a shape with the jpeg inside */ 235 /* define a shape with the jpeg inside */
236 236
237 put_swf_tag(s, TAG_DEFINESHAPE); 237 put_swf_tag(s, TAG_DEFINESHAPE);
238 238
314 put_flush_packet(&s->pb); 314 put_flush_packet(&s->pb);
315 return 0; 315 return 0;
316 } 316 }
317 317
318 static int swf_write_video(AVFormatContext *s, 318 static int swf_write_video(AVFormatContext *s,
319 AVCodecContext *enc, UINT8 *buf, int size) 319 AVCodecContext *enc, uint8_t *buf, int size)
320 { 320 {
321 ByteIOContext *pb = &s->pb; 321 ByteIOContext *pb = &s->pb;
322 static int tag_id = 0; 322 static int tag_id = 0;
323 323
324 if (enc->frame_number > 1) { 324 if (enc->frame_number > 1) {
362 362
363 put_flush_packet(&s->pb); 363 put_flush_packet(&s->pb);
364 return 0; 364 return 0;
365 } 365 }
366 366
367 static int swf_write_audio(AVFormatContext *s, UINT8 *buf, int size) 367 static int swf_write_audio(AVFormatContext *s, uint8_t *buf, int size)
368 { 368 {
369 ByteIOContext *pb = &s->pb; 369 ByteIOContext *pb = &s->pb;
370 370
371 put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG); 371 put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG);
372 372
376 put_flush_packet(&s->pb); 376 put_flush_packet(&s->pb);
377 return 0; 377 return 0;
378 } 378 }
379 379
380 static int swf_write_packet(AVFormatContext *s, int stream_index, 380 static int swf_write_packet(AVFormatContext *s, int stream_index,
381 UINT8 *buf, int size, int force_pts) 381 uint8_t *buf, int size, int force_pts)
382 { 382 {
383 AVCodecContext *codec = &s->streams[stream_index]->codec; 383 AVCodecContext *codec = &s->streams[stream_index]->codec;
384 if (codec->codec_type == CODEC_TYPE_AUDIO) 384 if (codec->codec_type == CODEC_TYPE_AUDIO)
385 return swf_write_audio(s, buf, size); 385 return swf_write_audio(s, buf, size);
386 else 386 else