Lines Matching defs:swf

30 #include "swf.h"
50 SWFEncContext *swf = s->priv_data;
53 swf->tag_pos = avio_tell(pb);
54 swf->tag = tag;
66 SWFEncContext *swf = s->priv_data;
72 tag_len = pos - swf->tag_pos - 2;
73 tag = swf->tag;
74 avio_seek(pb, swf->tag_pos, SEEK_SET);
196 SWFEncContext *swf = s->priv_data;
203 swf->sound_samples = 0;
204 swf->swf_frame_number = 0;
205 swf->video_frame_number = 0;
210 if (swf->audio_par) {
215 swf->audio_par = par;
216 swf->audio_fifo = av_fifo_alloc2(AUDIO_FIFO_SIZE, 1, 0);
217 if (!swf->audio_fifo)
224 if (swf->video_par) {
231 swf->video_st = s->streams[i];
232 swf->video_par = par;
240 if (!swf->video_par) {
247 width = swf->video_par->width;
248 height = swf->video_par->height;
250 rate = swf->video_st->time_base.den;
251 rate_base = swf->video_st->time_base.num;
254 if (!swf->audio_par)
255 swf->samples_per_frame = (44100LL * rate_base) / rate;
257 swf->samples_per_frame = (swf->audio_par->sample_rate * rate_base) / rate;
263 else if (swf->video_par && (swf->video_par->codec_id == AV_CODEC_ID_VP6A ||
264 swf->video_par->codec_id == AV_CODEC_ID_VP6F ||
265 swf->video_par->codec_id == AV_CODEC_ID_PNG))
267 else if (swf->video_par && swf->video_par->codec_id == AV_CODEC_ID_FLASHSV)
269 else if (swf->video_par && swf->video_par->codec_id == AV_CODEC_ID_FLV1)
284 swf->duration_pos = avio_tell(pb);
287 /* swf v8 and later files require a file attribute tag */
295 if (swf->video_par && (swf->video_par->codec_id == AV_CODEC_ID_MJPEG || swf->video_par->codec_id == AV_CODEC_ID_PNG)) {
338 if (swf->audio_par && swf->audio_par->codec_id == AV_CODEC_ID_MP3) {
343 switch(swf->audio_par->sample_rate) {
349 av_log(s, AV_LOG_ERROR, "swf does not support that sample rate, choose from (44100, 22050, 11025).\n");
353 if (swf->audio_par->ch_layout.nb_channels == 2)
358 avio_wl16(s->pb, swf->samples_per_frame); /* avg samples per frame */
376 SWFEncContext *swf = s->priv_data;
381 if (swf->swf_frame_number == 16000)
385 if (swf->video_frame_number == 0) {
389 swf->vframes_pos = avio_tell(pb);
403 avio_wl16(pb, swf->video_frame_number);
412 avio_wl16(pb, swf->video_frame_number);
419 avio_wl16(pb, swf->video_frame_number++);
428 if (swf->swf_frame_number > 0) {
462 swf->swf_frame_number++;
465 if (swf->audio_par && av_fifo_can_read(swf->audio_fifo)) {
466 size_t frame_size = av_fifo_can_read(swf->audio_fifo);
468 avio_wl16(pb, swf->sound_samples);
470 av_fifo_read_to_cb(swf->audio_fifo, fifo_avio_wrapper, pb, &frame_size);
474 swf->sound_samples = 0;
487 SWFEncContext *swf = s->priv_data;
490 if (swf->swf_frame_number == 16000)
493 if (av_fifo_can_write(swf->audio_fifo) < size) {
498 av_fifo_write(swf->audio_fifo, buf, size);
499 swf->sound_samples += av_get_audio_frame_duration2(par, size);
501 /* if audio only stream make sure we add swf frames */
502 if (!swf->video_par)
519 SWFEncContext *swf = s->priv_data;
527 if ((s->pb->seekable & AVIO_SEEKABLE_NORMAL) && swf->video_par) {
531 avio_seek(pb, swf->duration_pos, SEEK_SET);
532 avio_wl16(pb, swf->video_frame_number);
533 if (swf->vframes_pos) {
534 avio_seek(pb, swf->vframes_pos, SEEK_SET);
535 avio_wl16(pb, swf->video_frame_number);
544 SWFEncContext *swf = s->priv_data;
546 av_fifo_freep2(&swf->audio_fifo);
551 .name = "swf",
554 .extensions = "swf",