diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-03-03 22:11:45 +0300 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-03-04 19:26:57 +0300 |
commit | a2704c9712ad35cc22e7e0d8a79b581c07fa383b (patch) | |
tree | ebf5a27a98dbd52d983e38e901661f7525b38e9a /libavformat/movenc.c | |
parent | e16ead0716c2f988d1e26369a4c67b354ff86134 (diff) |
avio: add avio_tell macro as a replacement for url_ftell
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 231976b0c6..e1fd79d6ec 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -39,7 +39,7 @@ //FIXME support 64 bit variant with wide placeholders static int64_t updateSize(AVIOContext *pb, int64_t pos) { - int64_t curpos = url_ftell(pb); + int64_t curpos = avio_tell(pb); avio_seek(pb, pos, SEEK_SET); avio_wb32(pb, curpos - pos); /* rewrite size */ avio_seek(pb, curpos, SEEK_SET); @@ -52,7 +52,7 @@ static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track) { int i; int mode64 = 0; // use 32 bit size variant if possible - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ if (pos > UINT32_MAX) { mode64 = 1; @@ -76,7 +76,7 @@ static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track) int equalChunks = 1; int i, j, entries = 0, tst = -1, oldtst = -1; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "stsz"); avio_wb32(pb, 0); /* version & flags */ @@ -113,11 +113,11 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track) int index = 0, oldval = -1, i; int64_t entryPos, curpos; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "stsc"); avio_wb32(pb, 0); // version & flags - entryPos = url_ftell(pb); + entryPos = avio_tell(pb); avio_wb32(pb, track->entry); // entry count for (i=0; i<track->entry; i++) { if(oldval != track->cluster[i].samplesInChunk) @@ -129,7 +129,7 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track) index++; } } - curpos = url_ftell(pb); + curpos = avio_tell(pb); avio_seek(pb, entryPos, SEEK_SET); avio_wb32(pb, index); // rewrite size avio_seek(pb, curpos, SEEK_SET); @@ -142,11 +142,11 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) { int64_t curpos, entryPos; int i, index = 0; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); // size ffio_wfourcc(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps"); avio_wb32(pb, 0); // version & flags - entryPos = url_ftell(pb); + entryPos = avio_tell(pb); avio_wb32(pb, track->entry); // entry count for (i=0; i<track->entry; i++) { if (track->cluster[i].flags & flag) { @@ -154,7 +154,7 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) index++; } } - curpos = url_ftell(pb); + curpos = avio_tell(pb); avio_seek(pb, entryPos, SEEK_SET); avio_wb32(pb, index); // rewrite size avio_seek(pb, curpos, SEEK_SET); @@ -255,7 +255,7 @@ static void putDescr(AVIOContext *pb, int tag, unsigned int size) static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0; avio_wb32(pb, 0); // size @@ -317,7 +317,7 @@ static int mov_pcm_le_gt16(enum CodecID codec_id) static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); avio_wl32(pb, track->tag); // store it byteswapped track->enc->codec_tag = av_bswap16(track->tag >> 16); @@ -327,7 +327,7 @@ static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "wave"); @@ -400,7 +400,7 @@ static int mov_get_lpcm_flags(enum CodecID codec_id) static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); int version = 0; uint32_t tag = track->tag; @@ -518,7 +518,7 @@ static int mov_write_svq3_tag(AVIOContext *pb) static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); ffio_wfourcc(pb, "avcC"); @@ -764,7 +764,7 @@ static int mov_write_uuid_tag_ipod(AVIOContext *pb) static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ avio_wl32(pb, track->tag); // store it byteswapped avio_wb32(pb, 0); /* Reserved */ @@ -792,7 +792,7 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); char compressor_name[32]; avio_wb32(pb, 0); /* size */ @@ -861,7 +861,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "rtp "); avio_wb32(pb, 0); /* Reserved */ @@ -881,7 +881,7 @@ static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "stsd"); avio_wb32(pb, 0); /* version & flags */ @@ -988,7 +988,7 @@ static int mov_write_dref_tag(AVIOContext *pb) static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "stbl"); mov_write_stsd_tag(pb, track); @@ -1010,7 +1010,7 @@ static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_dinf_tag(AVIOContext *pb) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "dinf"); mov_write_dref_tag(pb); @@ -1063,7 +1063,7 @@ static int mov_write_vmhd_tag(AVIOContext *pb) static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track) { const char *hdlr, *descr = NULL, *hdlr_type = NULL; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); if (!track) { /* no media --> data handler */ hdlr = "dhlr"; @@ -1120,7 +1120,7 @@ static int mov_write_hmhd_tag(AVIOContext *pb) static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "minf"); if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO) @@ -1172,7 +1172,7 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "mdia"); mov_write_mdhd_tag(pb, track); @@ -1249,7 +1249,7 @@ static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track) int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width, track->enc->sample_aspect_ratio.den); - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "tapt"); @@ -1338,7 +1338,7 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVCodecContext *ctx, int index) static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "trak"); mov_write_tkhd_tag(pb, track, st); @@ -1475,7 +1475,7 @@ static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *value, int lang, int long_style){ int size = 0; if (value && value[0]) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, name); mov_write_string_data_tag(pb, value, lang, long_style); @@ -1534,7 +1534,7 @@ static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov, static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "ilst"); mov_write_string_metadata(s, pb, "\251nam", "title" , 1); @@ -1563,7 +1563,7 @@ static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int size = 0; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "meta"); avio_wb32(pb, 0); @@ -1603,7 +1603,7 @@ static uint16_t language_code(const char *str) static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, const char *tag, const char *str) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0); if (!t || !utf8len(t->value)) return 0; @@ -1624,7 +1624,7 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); int i, nb_chapters = FFMIN(s->nb_chapters, 255); avio_wb32(pb, 0); // size @@ -1720,7 +1720,7 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) int64_t pos, pos2; if (title) { - pos = url_ftell(pb); + pos = avio_tell(pb); avio_wb32(pb, 0); /* size placeholder*/ ffio_wfourcc(pb, "uuid"); ffio_wfourcc(pb, "USMT"); @@ -1728,7 +1728,7 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) avio_wb32(pb, 0xbb88695c); avio_wb32(pb, 0xfac9c740); - pos2 = url_ftell(pb); + pos2 = avio_tell(pb); avio_wb32(pb, 0); /* size placeholder*/ ffio_wfourcc(pb, "MTDT"); avio_wb16(pb, 4); @@ -1756,7 +1756,7 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int i; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size placeholder*/ ffio_wfourcc(pb, "moov"); @@ -1801,7 +1801,7 @@ static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov) avio_wb32(pb, 8); // placeholder for extended size field (64 bit) ffio_wfourcc(pb, mov->mode == MODE_MOV ? "wide" : "free"); - mov->mdat_pos = url_ftell(pb); + mov->mdat_pos = avio_tell(pb); avio_wb32(pb, 0); /* size placeholder*/ ffio_wfourcc(pb, "mdat"); return 0; @@ -1811,7 +1811,7 @@ static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov) static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); int has_h264 = 0, has_video = 0; int minor = 0x200; int i; @@ -2011,7 +2011,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) return -1; } - trk->cluster[trk->entry].pos = url_ftell(pb) - size; + trk->cluster[trk->entry].pos = avio_tell(pb) - size; trk->cluster[trk->entry].samplesInChunk = samplesInChunk; trk->cluster[trk->entry].size = size; trk->cluster[trk->entry].entries = samplesInChunk; @@ -2242,7 +2242,7 @@ static int mov_write_trailer(AVFormatContext *s) int res = 0; int i; - int64_t moov_pos = url_ftell(pb); + int64_t moov_pos = avio_tell(pb); /* Write size of mdat tag */ if (mov->mdat_size+8 <= UINT32_MAX) { |