[FFmpeg-devel] [PATCH 2/2] avformat/flvenc: add no_sequence_end flags for flvflags
Steven Liu
lingjiujianke at gmail.com
Tue Sep 13 17:10:40 EEST 2016
when split flv file by flv format at first, and cat flvs file
into one flv file, the flv sequence end is be used,
then the whole flv have many flv sequence end TAG.
this flags can give user an option to ignore write sequence end TAG
Signed-off-by: Steven Liu <lingjiujianke at gmail.com>
---
libavformat/flvenc.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index a3623f8..9e95b8d 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -63,6 +63,7 @@ static const AVCodecTag flv_audio_codec_ids[] = {
typedef enum {
FLV_AAC_SEQ_HEADER_DETECT = (1 << 0),
+ FLV_NO_SEQUENCE_END = (1 << 1),
} FLVFlags;
typedef struct FLVContext {
@@ -527,13 +528,15 @@ static int flv_write_trailer(AVFormatContext *s)
FLVContext *flv = s->priv_data;
int i;
- /* Add EOS tag */
- for (i = 0; i < s->nb_streams; i++) {
- AVCodecParameters *par = s->streams[i]->codecpar;
- FLVStreamContext *sc = s->streams[i]->priv_data;
- if (par->codec_type == AVMEDIA_TYPE_VIDEO &&
- (par->codec_id == AV_CODEC_ID_H264 || par->codec_id ==
AV_CODEC_ID_MPEG4))
- put_avc_eos_tag(pb, sc->last_ts);
+ if (flv->flags & FLV_NO_SEQUENCE_END == 0) {
+ /* Add EOS tag */
+ for (i = 0; i < s->nb_streams; i++) {
+ AVCodecParameters *par = s->streams[i]->codecpar;
+ FLVStreamContext *sc = s->streams[i]->priv_data;
+ if (par->codec_type == AVMEDIA_TYPE_VIDEO &&
+ (par->codec_id == AV_CODEC_ID_H264 || par->codec_id ==
AV_CODEC_ID_MPEG4))
+ put_avc_eos_tag(pb, sc->last_ts);
+ }
}
file_size = avio_tell(pb);
@@ -723,6 +726,7 @@ static int flv_write_packet(AVFormatContext *s,
AVPacket *pkt)
static const AVOption options[] = {
{ "flvflags", "FLV muxer flags", offsetof(FLVContext, flags),
AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX,
AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
{ "aac_seq_header_detect", "Put AAC sequence header based on stream
data", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_AAC_SEQ_HEADER_DETECT}, INT_MIN,
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
+ { "no_sequence_end", "disable sequence end for FLV", 0,
AV_OPT_TYPE_CONST, {.i64 = FLV_NO_SEQUENCE_END}, INT_MIN, INT_MAX,
AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
{ NULL },
};
--
2.7.4 (Apple Git-66)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-avformat-flvenc-add-no_sequence_end-flags-for-flvfla.patch
Type: application/octet-stream
Size: 2665 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160913/d06416cb/attachment.obj>
More information about the ffmpeg-devel
mailing list