diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2008-03-07 19:25:09 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2008-03-07 19:25:09 +0000 |
commit | 90c2295b24e9fa0c857e459088d18945a6681ef0 (patch) | |
tree | 682f689f79fb24ab9cf3277aadaf71c8af625231 /libavformat/nutenc.c | |
parent | b049ad505478a099535a796306f619a4365ee707 (diff) | |
download | ffmpeg-90c2295b24e9fa0c857e459088d18945a6681ef0.tar.gz |
Add 'disposition' bitfield to AVStream and use it for both muxing and demuxing
of matroska and nut.
Originally committed as revision 12358 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/nutenc.c')
-rw-r--r-- | libavformat/nutenc.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index de5ae6b2c3..0ec4b1fb33 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -472,6 +472,37 @@ static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){ return 0; } +static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){ + AVFormatContext *s= nut->avf; + AVStream* st = s->streams[stream_id]; + ByteIOContext *dyn_bc; + uint8_t *dyn_buf=NULL; + int count=0, dyn_size, i; + int ret = url_open_dyn_buf(&dyn_bc); + if(ret < 0) + return ret; + + for (i=0; ff_nut_dispositions[i].flag; ++i) { + if (st->disposition & ff_nut_dispositions[i].flag) + count += add_info(dyn_bc, "Disposition", ff_nut_dispositions[i].str); + } + dyn_size = url_close_dyn_buf(dyn_bc, &dyn_buf); + + if (count) { + put_v(bc, stream_id + 1); //stream_id_plus1 + put_v(bc, 0); //chapter_id + put_v(bc, 0); //timestamp_start + put_v(bc, 0); //length + + put_v(bc, count); + + put_buffer(bc, dyn_buf, dyn_size); + } + + av_free(dyn_buf); + return count; +} + static int write_headers(NUTContext *nut, ByteIOContext *bc){ ByteIOContext *dyn_bc; int i, ret; @@ -498,6 +529,22 @@ static int write_headers(NUTContext *nut, ByteIOContext *bc){ write_globalinfo(nut, dyn_bc); put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE); + for (i = 0; i < nut->avf->nb_streams; i++) { + ret = url_open_dyn_buf(&dyn_bc); + if(ret < 0) + return ret; + ret = write_streaminfo(nut, dyn_bc, i); + if (ret < 0) + return ret; + if (ret > 0) + put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE); + else { + uint8_t* buf; + url_close_dyn_buf(dyn_bc, &buf); + av_free(buf); + } + } + nut->last_syncpoint_pos= INT_MIN; nut->header_count++; return 0; |