comparison swf.c @ 1623:bdb50e314f29 libavformat

priv_data is allocated/freed internally
author bcoudurier
date Mon, 08 Jan 2007 12:33:16 +0000
parents 11a1f416d393
children 59d2c40950ca
comparison
equal deleted inserted replaced
1622:ac2a299df031 1623:bdb50e314f29
304 } 304 }
305 305
306 /* */ 306 /* */
307 static int swf_write_header(AVFormatContext *s) 307 static int swf_write_header(AVFormatContext *s)
308 { 308 {
309 SWFContext *swf; 309 SWFContext *swf = s->priv_data;
310 ByteIOContext *pb = &s->pb; 310 ByteIOContext *pb = &s->pb;
311 AVCodecContext *enc, *audio_enc, *video_enc; 311 AVCodecContext *enc, *audio_enc, *video_enc;
312 PutBitContext p; 312 PutBitContext p;
313 uint8_t buf1[256]; 313 uint8_t buf1[256];
314 int i, width, height, rate, rate_base; 314 int i, width, height, rate, rate_base;
315
316 swf = av_malloc(sizeof(SWFContext));
317 if (!swf)
318 return -1;
319 s->priv_data = swf;
320 315
321 swf->ch_id = -1; 316 swf->ch_id = -1;
322 swf->audio_in_pos = 0; 317 swf->audio_in_pos = 0;
323 swf->audio_out_pos = 0; 318 swf->audio_out_pos = 0;
324 swf->audio_size = 0; 319 swf->audio_size = 0;
450 break; 445 break;
451 default: 446 default:
452 /* not supported */ 447 /* not supported */
453 av_log(s, AV_LOG_ERROR, "swf doesnt support that sample rate, choose from (44100, 22050, 11025)\n"); 448 av_log(s, AV_LOG_ERROR, "swf doesnt support that sample rate, choose from (44100, 22050, 11025)\n");
454 av_free(swf->audio_fifo); 449 av_free(swf->audio_fifo);
455 av_free(swf);
456 return -1; 450 return -1;
457 } 451 }
458 v |= 0x02; /* 16 bit playback */ 452 v |= 0x02; /* 16 bit playback */
459 if (audio_enc->channels == 2) 453 if (audio_enc->channels == 2)
460 v |= 0x01; /* stereo playback */ 454 v |= 0x01; /* stereo playback */