* Copyright (c) 2000 Fabrice Bellard
* Copyright (c) 2003 Tinic Uro
*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
*
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
SWFContext *swf = s->priv_data;
AVIOContext *pb = s->pb;
- swf->tag_pos = url_ftell(pb);
+ swf->tag_pos = avio_tell(pb);
swf->tag = tag;
/* reserve some room for the tag */
if (tag & TAG_LONG) {
int64_t pos;
int tag_len, tag;
- pos = url_ftell(pb);
+ pos = avio_tell(pb);
tag_len = pos - swf->tag_pos - 2;
tag = swf->tag;
- url_fseek(pb, swf->tag_pos, SEEK_SET);
+ avio_seek(pb, swf->tag_pos, SEEK_SET);
if (tag & TAG_LONG) {
tag &= ~TAG_LONG;
avio_wl16(pb, (tag << 6) | 0x3f);
assert(tag_len < 0x3f);
avio_wl16(pb, (tag << 6) | tag_len);
}
- url_fseek(pb, pos, SEEK_SET);
+ avio_seek(pb, pos, SEEK_SET);
}
static inline void max_nbits(int *nbits_ptr, int val)
else
swf->samples_per_frame = (swf->audio_enc->sample_rate * rate_base) / rate;
- put_tag(pb, "FWS");
+ avio_write(pb, "FWS", 3);
if (!strcmp("avm2", s->oformat->name))
version = 9;
put_swf_rect(pb, 0, width * 20, 0, height * 20);
avio_wl16(pb, (rate * 256) / rate_base); /* frame rate */
- swf->duration_pos = url_ftell(pb);
+ swf->duration_pos = avio_tell(pb);
avio_wl16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */
/* avm2/swf v9 (also v8?) files require a file attribute tag */
put_swf_end_tag(s);
}
- put_flush_packet(s->pb);
+ avio_flush(s->pb);
return 0;
}
/* create a new video object */
put_swf_tag(s, TAG_VIDEOSTREAM);
avio_wl16(pb, VIDEO_ID);
- swf->vframes_pos = url_ftell(pb);
+ swf->vframes_pos = avio_tell(pb);
avio_wl16(pb, 15000); /* hard flash player limit */
avio_wl16(pb, enc->width);
avio_wl16(pb, enc->height);
avio_wl16(pb, VIDEO_ID);
put_swf_matrix(pb, 1 << FRAC_BITS, 0, 0, 1 << FRAC_BITS, 0, 0);
avio_wl16(pb, swf->video_frame_number);
- put_tag(pb, "video");
+ avio_write(pb, "video", 5);
avio_w8(pb, 0x00);
put_swf_end_tag(s);
} else {
put_swf_tag(s, TAG_SHOWFRAME);
put_swf_end_tag(s);
- put_flush_packet(s->pb);
+ avio_flush(s->pb);
return 0;
}
put_swf_tag(s, TAG_END);
put_swf_end_tag(s);
- put_flush_packet(s->pb);
+ avio_flush(s->pb);
/* patch file size and number of frames if not streamed */
- if (!url_is_streamed(s->pb) && video_enc) {
- file_size = url_ftell(pb);
- url_fseek(pb, 4, SEEK_SET);
+ if (s->pb->seekable && video_enc) {
+ file_size = avio_tell(pb);
+ avio_seek(pb, 4, SEEK_SET);
avio_wl32(pb, file_size);
- url_fseek(pb, swf->duration_pos, SEEK_SET);
+ avio_seek(pb, swf->duration_pos, SEEK_SET);
avio_wl16(pb, swf->video_frame_number);
- url_fseek(pb, swf->vframes_pos, SEEK_SET);
+ avio_seek(pb, swf->vframes_pos, SEEK_SET);
avio_wl16(pb, swf->video_frame_number);
- url_fseek(pb, file_size, SEEK_SET);
+ avio_seek(pb, file_size, SEEK_SET);
}
return 0;
}
#if CONFIG_SWF_MUXER
AVOutputFormat ff_swf_muxer = {
- "swf",
- NULL_IF_CONFIG_SMALL("Flash format"),
- "application/x-shockwave-flash",
- "swf",
- sizeof(SWFContext),
- CODEC_ID_MP3,
- CODEC_ID_FLV1,
- swf_write_header,
- swf_write_packet,
- swf_write_trailer,
+ .name = "swf",
+ .long_name = NULL_IF_CONFIG_SMALL("Flash format"),
+ .mime_type = "application/x-shockwave-flash",
+ .extensions = "swf",
+ .priv_data_size = sizeof(SWFContext),
+ .audio_codec = CODEC_ID_MP3,
+ .video_codec = CODEC_ID_FLV1,
+ .write_header = swf_write_header,
+ .write_packet = swf_write_packet,
+ .write_trailer = swf_write_trailer,
};
#endif
#if CONFIG_AVM2_MUXER
AVOutputFormat ff_avm2_muxer = {
- "avm2",
- NULL_IF_CONFIG_SMALL("Flash 9 (AVM2) format"),
- "application/x-shockwave-flash",
- NULL,
- sizeof(SWFContext),
- CODEC_ID_MP3,
- CODEC_ID_FLV1,
- swf_write_header,
- swf_write_packet,
- swf_write_trailer,
+ .name = "avm2",
+ .long_name = NULL_IF_CONFIG_SMALL("Flash 9 (AVM2) format"),
+ .mime_type = "application/x-shockwave-flash",
+ .priv_data_size = sizeof(SWFContext),
+ .audio_codec = CODEC_ID_MP3,
+ .video_codec = CODEC_ID_FLV1,
+ .write_header = swf_write_header,
+ .write_packet = swf_write_packet,
+ .write_trailer = swf_write_trailer,
};
#endif