wtvenc: do not emit stream2 and DSATTRIB_TRANSPORT_PROPERTY chunks; these are not required for playback

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Peter Ross 2012-11-07 16:51:51 +11:00 committed by Michael Niedermayer
parent fdfbb793c3
commit b50759cd6b
3 changed files with 19 additions and 43 deletions

View File

@ -288,31 +288,16 @@ static void write_sync(AVFormatContext *s)
wctx->last_chunk_pos = last_chunk_pos;
}
static void write_DSATTRIB_TRANSPORT_PROPERTIES_init(AVFormatContext *s, int stream_index)
{
AVIOContext *pb = s->pb;
write_chunk_header2(s, &ff_DSATTRIB_TRANSPORT_PROPERTIES, 0x80000000 | stream_index);
avio_wl64(pb, stream_index);
avio_wl64(pb, -1);
avio_wl64(pb, 0);
finish_chunk(s);
}
static int write_stream_data(AVFormatContext *s, AVStream *st, int flag)
static int write_stream_data(AVFormatContext *s, AVStream *st)
{
AVIOContext *pb = s->pb;
int ret;
if (!flag) {
write_chunk_header2(s, &ff_SBE2_STREAM_DESC_EVENT, 0x80000000 | (st->index + INDEX_BASE));
avio_wl32(pb, 0x00000001);
avio_wl32(pb, st->index + INDEX_BASE); //stream_id
avio_wl32(pb, 0x00000001);
write_pad(pb, 8);
} else {
write_chunk_header2(s, &ff_stream2_guid, 0x80000000 | (st->index + INDEX_BASE));
write_pad(pb, 4);
}
ret = write_stream_codec_info(s, st);
if (ret < 0) {
@ -364,28 +349,19 @@ static int write_header(AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "write stream codec failed codec_type(0x%x)\n", st->codec->codec_type);
return -1;
}
if (i + 1 < s->nb_streams) {
if (!i)
write_sync(s);
}
}
for (i = 0; i < s->nb_streams; i++) {
st = s->streams[i];
ret = write_stream_data(s, st, 0);
ret = write_stream_data(s, st);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "write stream data failed codec_type(0x%x)\n", st->codec->codec_type);
return -1;
}
ret = write_stream_data(s, st, 1);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "write stream2 data failed codec_type(0x%x)\n", st->codec->codec_type);
return -1;
}
}
for (i = 0; i < s->nb_streams; i++)
write_DSATTRIB_TRANSPORT_PROPERTIES_init(s, INDEX_BASE + i);
if (wctx->nb_index)
write_index(s);

View File

@ -1,3 +1,3 @@
05aff2517b5bd436ec26c736b4b8372c *./tests/data/lavf/lavf.wtv
accf6a5131e2eba81c9aa9fa8f0eb69a *./tests/data/lavf/lavf.wtv
413696 ./tests/data/lavf/lavf.wtv
./tests/data/lavf/lavf.wtv CRC=0xcc2dc628

View File

@ -1,41 +1,41 @@
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 27072 size: 208
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 26344 size: 208
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 27072 size: 208
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 26344 size: 208
ret:-1 st:-1 flags:1 ts: 1.894167
ret: 0 st: 0 flags:0 ts: 0.788334
ret: 0 st: 1 flags:1 dts: 0.772766 pts: 0.772766 pos: 321528 size: 209
ret: 0 st: 1 flags:1 dts: 0.772766 pts: 0.772766 pos: 320800 size: 209
ret: 0 st: 0 flags:1 ts:-0.317499
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 27072 size: 208
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 26344 size: 208
ret:-1 st: 1 flags:0 ts: 2.576668
ret:-1 st: 1 flags:1 ts: 1.470835
ret: 0 st:-1 flags:0 ts: 0.365002
ret: 0 st: 1 flags:1 dts: 0.380930 pts: 0.380930 pos: 167728 size: 209
ret: 0 st: 1 flags:1 dts: 0.380930 pts: 0.380930 pos: 167000 size: 209
ret: 0 st:-1 flags:1 ts:-0.740831
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 27072 size: 208
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 26344 size: 208
ret:-1 st: 0 flags:0 ts: 2.153336
ret:-1 st: 0 flags:1 ts: 1.047503
ret: 0 st: 1 flags:0 ts:-0.058330
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 27072 size: 208
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 26344 size: 208
ret:-1 st: 1 flags:1 ts: 2.835837
ret:-1 st:-1 flags:0 ts: 1.730004
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 1 flags:1 dts: 0.616032 pts: 0.616032 pos: 266872 size: 209
ret: 0 st: 1 flags:1 dts: 0.616032 pts: 0.616032 pos: 266144 size: 209
ret: 0 st: 0 flags:0 ts:-0.481662
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 27072 size: 208
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 26344 size: 208
ret:-1 st: 0 flags:1 ts: 2.412505
ret:-1 st: 1 flags:0 ts: 1.306672
ret: 0 st: 1 flags:1 ts: 0.200839
ret: 0 st: 1 flags:1 dts: 0.224195 pts: 0.224195 pos: 113632 size: 209
ret: 0 st: 1 flags:1 dts: 0.224195 pts: 0.224195 pos: 112904 size: 209
ret: 0 st:-1 flags:0 ts:-0.904994
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 27072 size: 208
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 26344 size: 208
ret:-1 st:-1 flags:1 ts: 1.989173
ret: 0 st: 0 flags:0 ts: 0.883340
ret: 0 st: 1 flags:1 dts: 0.903379 pts: 0.903379 pos: 358360 size: 209
ret: 0 st: 1 flags:1 dts: 0.903379 pts: 0.903379 pos: 357632 size: 209
ret: 0 st: 0 flags:1 ts:-0.222493
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 27072 size: 208
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 26344 size: 208
ret:-1 st: 1 flags:0 ts: 2.671674
ret:-1 st: 1 flags:1 ts: 1.565841
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 1 flags:1 dts: 0.459297 pts: 0.459297 pos: 206056 size: 209
ret: 0 st: 1 flags:1 dts: 0.459297 pts: 0.459297 pos: 205328 size: 209
ret: 0 st:-1 flags:1 ts:-0.645825
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 27072 size: 208
ret: 0 st: 1 flags:1 dts:-0.010907 pts:-0.010907 pos: 26344 size: 208