diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-03-05 21:06:46 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-04-03 22:46:40 +0200 |
commit | 8978fedaeefdff50ed4deefbfe822ad07f19f616 (patch) | |
tree | ffa8b7680649f418f83b1e833e0221749fbb6bdd /libavformat/matroskaenc.c | |
parent | 79997def65fd2313b48a5f3c3a884c6149ae9b5d (diff) | |
download | ffmpeg-8978fedaeefdff50ed4deefbfe822ad07f19f616.tar.gz |
avio: introduce an AVIOContext.seekable field
Use it instead of url_is_streamed and AVIOContext.is_streamed.
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 4f9bf0a723..a06891d8b8 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -848,7 +848,7 @@ static int mkv_write_header(AVFormatContext *s) if (ret < 0) return ret; } - if (url_is_streamed(s->pb)) + if (!s->pb->seekable) mkv_write_seekhead(pb, mkv->main_seekhead); mkv->cues = mkv_start_cues(mkv->segment_offset); @@ -1024,7 +1024,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt) return AVERROR(EINVAL); } - if (url_is_streamed(s->pb)) { + if (!s->pb->seekable) { if (!mkv->dyn_bc) url_open_dyn_buf(&mkv->dyn_bc); pb = mkv->dyn_bc; @@ -1076,16 +1076,16 @@ static int mkv_copy_packet(MatroskaMuxContext *mkv, const AVPacket *pkt) static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt) { MatroskaMuxContext *mkv = s->priv_data; - AVIOContext *pb = url_is_streamed(s->pb) ? mkv->dyn_bc : s->pb; + AVIOContext *pb = s->pb->seekable ? s->pb : mkv->dyn_bc; AVCodecContext *codec = s->streams[pkt->stream_index]->codec; int ret, keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY); int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; - int cluster_size = avio_tell(pb) - (url_is_streamed(s->pb) ? 0 : mkv->cluster_pos); + int cluster_size = avio_tell(pb) - (s->pb->seekable ? mkv->cluster_pos : 0); // start a new cluster every 5 MB or 5 sec, or 32k / 1 sec for streaming or // after 4k and on a keyframe if (mkv->cluster_pos && - ((url_is_streamed(s->pb) && (cluster_size > 32*1024 || ts > mkv->cluster_pts + 1000)) + ((!s->pb->seekable && (cluster_size > 32*1024 || ts > mkv->cluster_pts + 1000)) || cluster_size > 5*1024*1024 || ts > mkv->cluster_pts + 5000 || (codec->codec_type == AVMEDIA_TYPE_VIDEO && keyframe && cluster_size > 4*1024))) { av_log(s, AV_LOG_DEBUG, "Starting new cluster at offset %" PRIu64 @@ -1139,7 +1139,7 @@ static int mkv_write_trailer(AVFormatContext *s) end_ebml_master(pb, mkv->cluster); } - if (!url_is_streamed(pb)) { + if (pb->seekable) { cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams); ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES , cuespos); |