static int write_stream_data(AVFormatContext *s, AVStream *st, int flag) { AVIOContext *pb = s->pb; int ret; if (!flag) { write_chunk_header2(s, &ff_stream_guid, 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) { av_log(s, AV_LOG_ERROR, "write stream codec info failed codec_type(0x%x)\n", st->codec->codec_type); return -1; } finish_chunk(s); avpriv_set_pts_info(st, 64, 1, 10000000); return 0; }
static int write_stream_codec(AVFormatContext *s, AVStream * st) { AVIOContext *pb = s->pb; int ret; write_chunk_header2(s, &ff_stream1_guid, 0x80000000 | 0x01); avio_wl32(pb, 0x01); write_pad(pb, 4); write_pad(pb, 4); ret = write_stream_codec_info(s, st); if (ret < 0) { av_log(s, AV_LOG_ERROR, "write stream codec info failed codec_type(0x%x)\n", st->codec->codec_type); return -1; } finish_chunk(s); return 0; }