summaryrefslogtreecommitdiff
path: root/libavformat/flvenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-13 04:55:40 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-13 06:00:03 +0200
commitf884ef00de362a5460a9c58318d009bcae440cc8 (patch)
tree955b7a1dc3f2bf89fb9332d0e732aac9e52b0e29 /libavformat/flvenc.c
parentc1847c932b1576e8224c38e112a5fd29fa8a6098 (diff)
parent47a1d794dba02239f9eeb37e9dfd4dfdb634c3b7 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (31 commits) tiffenc: initialize forgotten avctx. avplay: free the active audio packet at exit. avplay: free rdft data used for spectrogram analysis. log.h: make AVClass a named struct fix ac3 encoder documentation vc1: more prettyprinting cosmetics vc1: prettyprint some tables vc1: K&R formatting cosmetics AVOptions: bump minor and add APIchanges entry. cmdutils/avtools: simplify show_help() by using av_opt_child_class_next() AVOptions: rename FF_OPT_TYPE_* => AV_OPT_TYPE_* Remove all uses of deprecated AVOptions API. AVOptions: add av_opt_next, deprecate av_next_option. AVOptions: add functions for evaluating option strings. AVOptions: split get_number(). AVOptions: add av_opt_get*, deprecate av_get*. AVOptions: add av_opt_set*(). AVOptions: add new API for enumerating children. rv34: move inverse transform functions to DSP context flvenc: Write the right metadata entry count ... Conflicts: avconv.c cmdutils.c doc/APIchanges ffplay.c ffprobe.c libavcodec/ac3dec.c libavcodec/h264.c libavcodec/libvpxenc.c libavcodec/libx264.c libavcodec/mpeg12enc.c libavcodec/options.c libavdevice/libdc1394.c libavdevice/v4l2.c libavfilter/vf_drawtext.c libavformat/flvdec.c libavformat/mpegtsenc.c libavformat/options.c libavutil/avutil.h libavutil/opt.c libswscale/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/flvenc.c')
-rw-r--r--libavformat/flvenc.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index fe866f10c8..143c58ca50 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -180,9 +180,9 @@ static int flv_write_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
FLVContext *flv = s->priv_data;
AVCodecContext *audio_enc = NULL, *video_enc = NULL;
- int i;
+ int i, metadata_count = 0;
double framerate = 0.0;
- int64_t metadata_size_pos, data_size;
+ int64_t metadata_size_pos, data_size, metadata_count_pos;
AVDictionaryEntry *tag = NULL;
for(i=0; i<s->nb_streams; i++){
@@ -240,7 +240,9 @@ static int flv_write_header(AVFormatContext *s)
/* mixed array (hash) with size and string/type/data tuples */
avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY);
- avio_wb32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size
+ metadata_count_pos = avio_tell(pb);
+ metadata_count = 5*!!video_enc + 5*!!audio_enc + 2; // +2 for duration and file size
+ avio_wb32(pb, metadata_count);
put_amf_string(pb, "duration");
flv->duration_offset= avio_tell(pb);
@@ -300,6 +302,7 @@ static int flv_write_header(AVFormatContext *s)
put_amf_string(pb, tag->key);
avio_w8(pb, AMF_DATA_TYPE_STRING);
put_amf_string(pb, tag->value);
+ metadata_count++;
}
put_amf_string(pb, "filesize");
@@ -311,6 +314,10 @@ static int flv_write_header(AVFormatContext *s)
/* write total size of tag */
data_size= avio_tell(pb) - metadata_size_pos - 10;
+
+ avio_seek(pb, metadata_count_pos, SEEK_SET);
+ avio_wb32(pb, metadata_count);
+
avio_seek(pb, metadata_size_pos, SEEK_SET);
avio_wb24(pb, data_size);
avio_skip(pb, data_size + 10 - 3);