2 * Windows Television (WTV) muxer
3 * Copyright (c) 2011 Zhentan Feng <spyfeng at gmail dot com>
4 * Copyright (c) 2011 Peter Ross <pross@xvid.org>
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 * Windows Television (WTV) demuxer
25 * @author Zhentan Feng <spyfeng at gmail dot com>
28 #include "libavutil/intreadwrite.h"
29 #include "libavutil/avassert.h"
35 #define WTV_BIGSECTOR_SIZE (1 << WTV_BIGSECTOR_BITS)
36 #define INDEX_BASE 0x2
37 #define MAX_NB_INDEX 10
39 /* declare utf16le strings */
41 static const uint8_t timeline_table_0_header_events[] =
42 {'t'_'i'_'m'_'e'_'l'_'i'_'n'_'e'_'.'_'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'h'_'e'_'a'_'d'_'e'_'r'_'.'_'E'_'v'_'e'_'n'_'t'_'s', 0};
43 static const uint8_t table_0_header_legacy_attrib[] =
44 {'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'h'_'e'_'a'_'d'_'e'_'r'_'.'_'l'_'e'_'g'_'a'_'c'_'y'_'_'_'a'_'t'_'t'_'r'_'i'_'b', 0};
45 static const uint8_t table_0_redirector_legacy_attrib[] =
46 {'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'r'_'e'_'d'_'i'_'r'_'e'_'c'_'t'_'o'_'r'_'.'_'l'_'e'_'g'_'a'_'c'_'y'_'_'_'a'_'t'_'t'_'r'_'i'_'b', 0};
47 static const uint8_t table_0_header_time[] =
48 {'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'h'_'e'_'a'_'d'_'e'_'r'_'.'_'t'_'i'_'m'_'e', 0};
49 static const uint8_t legacy_attrib[] =
50 {'l'_'e'_'g'_'a'_'c'_'y'_'_'_'a'_'t'_'t'_'r'_'i'_'b', 0};
53 static const ff_asf_guid sub_wtv_guid =
54 {0x8C,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
55 static const ff_asf_guid stream1_guid =
56 {0xA1,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
57 static const ff_asf_guid sync_guid =
58 {0x97,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
59 static const ff_asf_guid index_guid =
60 {0x96,0xc3,0xd2,0xc2,0x7e,0x9a,0xda,0x11,0x8b,0xf7,0x00,0x07,0xe9,0x5e,0xad,0x8d};
63 WTV_TIMELINE_TABLE_0_HEADER_EVENTS = 0,
64 WTV_TIMELINE_TABLE_0_ENTRIES_EVENTS,
66 WTV_TABLE_0_HEADER_LEGACY_ATTRIB,
67 WTV_TABLE_0_ENTRIES_LEGACY_ATTRIB,
68 WTV_TABLE_0_REDIRECTOR_LEGACY_ATTRIB,
69 WTV_TABLE_0_HEADER_TIME,
70 WTV_TABLE_0_ENTRIES_TIME,
84 const ff_asf_guid * guid;
89 int64_t timeline_start_pos;
90 WtvFile file[WTV_FILES];
91 int64_t serial; /** chunk serial number */
92 int64_t last_chunk_pos; /** last chunk position */
95 WtvChunkEntry index[MAX_NB_INDEX];
101 typedef int WTVHeaderWriteFunc(AVIOContext *pb);
104 const uint8_t *header;
106 WTVHeaderWriteFunc *write_header;
109 static int write_pad(AVIOContext *pb, int size)
111 for (; size > 0; size--)
116 static const ff_asf_guid *get_codec_guid(enum CodecID id, const AVCodecGuid *av_guid)
119 for (i = 0; av_guid[i].id != CODEC_ID_NONE; i++) {
120 if (id == av_guid[i].id)
121 return &(av_guid[i].guid);
127 * Write chunk header. If header chunk (0x80000000 set) then add to list of header chunks
129 static void write_chunk_header(AVFormatContext *s, const ff_asf_guid *guid, int length, int stream_id)
131 WtvContext *wctx = s->priv_data;
132 AVIOContext *pb = s->pb;
134 wctx->last_chunk_pos = avio_tell(pb) - wctx->timeline_start_pos;
135 ff_put_guid(pb, guid);
136 avio_wl32(pb, 32 + length);
137 avio_wl32(pb, stream_id);
138 avio_wl64(pb, wctx->serial);
140 if ((stream_id & 0x80000000) && guid != &index_guid) {
141 WtvChunkEntry *t = wctx->index + wctx->nb_index;
142 av_assert0(wctx->nb_index < MAX_NB_INDEX);
143 t->pos = wctx->last_chunk_pos;
144 t->serial = wctx->serial;
146 t->stream_id = stream_id & 0x3FFFFFFF;
151 static void write_chunk_header2(AVFormatContext *s, const ff_asf_guid *guid, int stream_id)
153 WtvContext *wctx = s->priv_data;
154 AVIOContext *pb = s->pb;
156 int64_t last_chunk_pos = wctx->last_chunk_pos;
157 write_chunk_header(s, guid, 0, stream_id); // length updated later
158 avio_wl64(pb, last_chunk_pos);
161 static void finish_chunk_noindex(AVFormatContext *s)
163 WtvContext *wctx = s->priv_data;
164 AVIOContext *pb = s->pb;
166 // update the chunk_len field and pad.
167 int64_t chunk_len = avio_tell(pb) - (wctx->last_chunk_pos + wctx->timeline_start_pos);
168 avio_seek(pb, -(chunk_len - 16), SEEK_CUR);
169 avio_wl32(pb, chunk_len);
170 avio_seek(pb, chunk_len - (16 + 4), SEEK_CUR);
172 write_pad(pb, WTV_PAD8(chunk_len) - chunk_len);
176 static void write_index(AVFormatContext *s)
178 AVIOContext *pb = s->pb;
179 WtvContext *wctx = s->priv_data;
182 write_chunk_header2(s, &index_guid, 0x80000000);
186 for (i = 0; i < wctx->nb_index; i++) {
187 WtvChunkEntry *t = wctx->index + i;
188 ff_put_guid(pb, t->guid);
189 avio_wl64(pb, t->pos);
190 avio_wl32(pb, t->stream_id);
191 avio_wl32(pb, 0); // checksum?
192 avio_wl64(pb, t->serial);
194 wctx->nb_index = 0; // reset index
195 finish_chunk_noindex(s);
198 static void finish_chunk(AVFormatContext *s)
200 WtvContext *wctx = s->priv_data;
201 finish_chunk_noindex(s);
202 if (wctx->nb_index == MAX_NB_INDEX)
206 static int write_stream_codec_info(AVFormatContext *s, AVStream *st)
208 WtvContext *wctx = s->priv_data;
209 const ff_asf_guid *g, *media_type, *format_type;
210 AVIOContext *pb = s->pb;
211 int64_t hdr_pos_start;
214 if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
215 g = get_codec_guid(st->codec->codec_id, ff_video_guids);
216 media_type = &ff_mediatype_video;
217 format_type = &ff_format_mpeg2_video;
218 } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
219 g = get_codec_guid(st->codec->codec_id, ff_codec_wav_guids);
220 media_type = &ff_mediatype_audio;
221 format_type = &ff_format_waveformatex;
223 av_log(s, AV_LOG_ERROR, "unknown codec_type (0x%x)\n", st->codec->codec_type);
228 av_log(s, AV_LOG_ERROR, "can't get video codec_id (0x%x) guid.\n", st->codec->codec_id);
232 ff_put_guid(pb, media_type); // mediatype
233 ff_put_guid(pb, &ff_mediasubtype_cpfilters_processed); // subtype
235 ff_put_guid(pb,&ff_format_cpfilters_processed); // format type
236 avio_wl32(pb, 0); // size
238 hdr_pos_start = avio_tell(pb);
239 if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
240 if (wctx->first_video_flag) {
241 write_pad(pb, 216); //The size is sensitive.
242 wctx->first_video_flag = 0;
244 write_pad(pb, 72); // aspect ratio
245 ff_put_bmp_header(pb, st->codec, ff_codec_bmp_tags, 0);
248 ff_put_wav_header(pb, st->codec);
250 hdr_size = avio_tell(pb) - hdr_pos_start;
252 // seek back write hdr_size
253 avio_seek(pb, -(hdr_size + 4), SEEK_CUR);
254 avio_wl32(pb, hdr_size + 32);
255 avio_seek(pb, hdr_size, SEEK_CUR);
256 ff_put_guid(pb, g); // actual_subtype
257 ff_put_guid(pb, format_type); // actual_formattype
262 static int write_stream_codec(AVFormatContext *s, AVStream * st)
264 AVIOContext *pb = s->pb;
266 write_chunk_header2(s, &stream1_guid, 0x80000000 | 0x01);
272 ret = write_stream_codec_info(s, st);
274 av_log(s, AV_LOG_ERROR, "write stream codec info failed codec_type(0x%x)\n", st->codec->codec_type);
282 static void write_sync(AVFormatContext *s)
284 AVIOContext *pb = s->pb;
285 WtvContext *wctx = s->priv_data;
286 int64_t last_chunk_pos = wctx->last_chunk_pos;
287 wctx->sync_pos = avio_tell(pb) - wctx->timeline_start_pos;
289 write_chunk_header(s, &sync_guid, 0x18, 0);
294 wctx->last_chunk_pos = last_chunk_pos;
297 static void write_DSATTRIB_TRANSPORT_PROPERTIES_init(AVFormatContext *s, int stream_index)
299 AVIOContext *pb = s->pb;
300 write_chunk_header2(s, &ff_DSATTRIB_TRANSPORT_PROPERTIES, 0x80000000 | stream_index);
301 avio_wl64(pb, stream_index);
307 static int write_stream_data(AVFormatContext *s, AVStream *st, int flag)
309 AVIOContext *pb = s->pb;
313 write_chunk_header2(s, &ff_stream_guid, 0x80000000 | (st->index + INDEX_BASE));
314 avio_wl32(pb, 0x00000001);
315 avio_wl32(pb, st->index + INDEX_BASE); //stream_id
316 avio_wl32(pb, 0x00000001);
319 write_chunk_header2(s, &ff_stream2_guid, 0x80000000 | (st->index + INDEX_BASE));
323 ret = write_stream_codec_info(s, st);
325 av_log(s, AV_LOG_ERROR, "write stream codec info failed codec_type(0x%x)\n", st->codec->codec_type);
330 av_set_pts_info(st, 64, 1, 10000000);
335 static int write_header(AVFormatContext *s)
337 AVIOContext *pb = s->pb;
338 WtvContext *wctx = s->priv_data;
342 ff_put_guid(pb, &ff_wtv_guid);
343 ff_put_guid(pb, &sub_wtv_guid);
347 avio_wl32(pb, 1 << WTV_SECTOR_BITS);
348 avio_wl32(pb, 1 << WTV_BIGSECTOR_BITS);
350 //write initial root fields
351 avio_wl32(pb, 0); // root_size, update later
353 avio_wl32(pb, 0); // root_sector, update it later.
356 avio_wl32(pb, 0); // file ends pointer, update it later.
358 pad = (1 << WTV_SECTOR_BITS) - avio_tell(pb);
360 wctx->timeline_start_pos = avio_tell(pb);
363 wctx->last_chunk_pos = -1;
364 wctx->first_video_flag = 1;
366 for (i = 0; i < s->nb_streams; i++) {
368 ret = write_stream_codec(s, st);
370 av_log(s, AV_LOG_ERROR, "write stream codec failed codec_type(0x%x)\n", st->codec->codec_type);
373 if (i + 1 < s->nb_streams) {
378 for (i = 0; i < s->nb_streams; i++) {
380 ret = write_stream_data(s, st, 0);
382 av_log(s, AV_LOG_ERROR, "write stream data failed codec_type(0x%x)\n", st->codec->codec_type);
385 ret = write_stream_data(s, st, 1);
387 av_log(s, AV_LOG_ERROR, "write stream2 data failed codec_type(0x%x)\n", st->codec->codec_type);
392 for (i = 0; i < s->nb_streams; i++)
393 write_DSATTRIB_TRANSPORT_PROPERTIES_init(s, INDEX_BASE + i);
401 static void write_timestamp(AVFormatContext *s, AVPacket *pkt)
403 AVIOContext *pb = s->pb;
404 WtvContext *wctx = s->priv_data;
405 AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
407 int64_t frame_number = 0;
409 if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
411 frame_number = wctx->frame_nb;
412 flag = pkt->flags & AV_PKT_FLAG_KEY ? 1 : 0;
414 write_chunk_header(s, &ff_timestamp_guid, 56, 0x40000000 | (INDEX_BASE + pkt->stream_index));
416 avio_wl64(pb, pkt->pts == AV_NOPTS_VALUE ? -1 : pkt->pts);
417 avio_wl64(pb, pkt->pts == AV_NOPTS_VALUE ? -1 : pkt->pts);
419 avio_wl64(pb, frame_number);
425 static int write_packet(AVFormatContext *s, AVPacket *pkt)
427 AVIOContext *pb = s->pb;
428 WtvContext *wctx = s->priv_data;
430 // write timestamp chunk
431 write_timestamp(s, pkt);
433 write_chunk_header(s, &ff_data_guid, pkt->size, INDEX_BASE + pkt->stream_index);
434 avio_write(pb, pkt->data, pkt->size);
435 write_pad(pb, WTV_PAD8(pkt->size) - pkt->size);
442 static int write_table0_header_envents(AVIOContext *pb)
450 static int write_table0_header_legacy_attrib(AVIOContext *pb)
453 avio_wl32(pb, 0xFFFFFFFF);
455 avio_write(pb, legacy_attrib, sizeof(legacy_attrib));
456 pad = WTV_PAD8(sizeof(legacy_attrib)) - sizeof(legacy_attrib);
459 return 48 + WTV_PAD8(sizeof(legacy_attrib));
462 static int write_table0_header_time(AVIOContext *pb)
470 static const WTVRootEntryTable wtv_root_entry_table[] = {
471 { timeline_table_0_header_events, sizeof(timeline_table_0_header_events), write_table0_header_envents},
472 { ff_timeline_table_0_entries_Events_le16, sizeof(ff_timeline_table_0_entries_Events_le16), NULL},
473 { ff_timeline_le16, sizeof(ff_timeline_le16), NULL},
474 { table_0_header_legacy_attrib, sizeof(table_0_header_legacy_attrib), write_table0_header_legacy_attrib},
475 { ff_table_0_entries_legacy_attrib_le16, sizeof(ff_table_0_entries_legacy_attrib_le16), NULL},
476 { table_0_redirector_legacy_attrib, sizeof(table_0_redirector_legacy_attrib), NULL},
477 { table_0_header_time, sizeof(table_0_header_time), write_table0_header_time},
478 { ff_table_0_entries_time_le16, sizeof(ff_table_0_entries_time_le16), NULL},
481 static int write_root_table(AVFormatContext *s, int64_t sector_pos)
483 AVIOContext *pb = s->pb;
484 WtvContext *wctx = s->priv_data;
488 const WTVRootEntryTable *h = wtv_root_entry_table;
489 for (i = 0; i < sizeof(wtv_root_entry_table)/sizeof(WTVRootEntryTable); i++, h++) {
490 WtvFile *w = &wctx->file[i];
491 int filename_padding = WTV_PAD8(h->header_size) - h->header_size;
492 WTVHeaderWriteFunc *write = h->write_header;
496 ff_put_guid(pb, &ff_dir_entry_guid);
497 len_pos = avio_tell(pb);
498 avio_wl16(pb, 40 + h->header_size + filename_padding + 8); // maybe updated later
500 avio_wl64(pb, write ? 0 : w->length);// maybe update later
501 avio_wl32(pb, (h->header_size + filename_padding) >> 1);
504 avio_write(pb, h->header, h->header_size);
505 write_pad(pb, filename_padding);
509 // update length field
510 avio_seek(pb, len_pos, SEEK_SET);
511 avio_wl64(pb, 40 + h->header_size + filename_padding + len);
512 avio_wl64(pb, len |(1ULL<<62) | (1ULL<<60));
513 avio_seek(pb, 8 + h->header_size + filename_padding + len, SEEK_CUR);
515 avio_wl32(pb, w->first_sector);
516 avio_wl32(pb, w->depth);
520 // caculate root table size
521 size = avio_tell(pb) - sector_pos;
522 pad = WTV_SECTOR_SIZE- size;
528 static void write_fat(AVIOContext *pb, int start_sector, int nb_sectors, int shift)
531 for (i = 0; i < nb_sectors; i++) {
532 avio_wl32(pb, start_sector + (i << shift));
534 // pad left sector pointer size
535 write_pad(pb, WTV_SECTOR_SIZE - ((nb_sectors << 2) % WTV_SECTOR_SIZE));
538 static int write_fat_sector(AVFormatContext *s, int64_t start_pos, int nb_sectors, int sector_bits, int depth)
540 int64_t start_sector = start_pos >> WTV_SECTOR_BITS;
541 int shift = sector_bits - WTV_SECTOR_BITS;
543 int64_t fat = avio_tell(s->pb);
544 write_fat(s->pb, start_sector, nb_sectors, shift);
547 int64_t start_sector1 = fat >> WTV_SECTOR_BITS;
548 int nb_sectors1 = ((nb_sectors << 2) + WTV_SECTOR_SIZE - 1) / WTV_SECTOR_SIZE;
549 int64_t fat1 = avio_tell(s->pb);
551 write_fat(s->pb, start_sector1, nb_sectors1, 0);
558 static void write_table_entries_events(AVFormatContext *s)
560 AVIOContext *pb = s->pb;
561 WtvContext *wctx = s->priv_data;
563 //FIXME: output frame_nb, position pairs.
564 //We only set the first sync_chunk position here.
565 avio_wl64(pb, 0x2); avio_wl64(pb, wctx->sync_pos);
568 static void write_tag(AVIOContext *pb, const char *key, const char *value)
570 ff_put_guid(pb, &ff_metadata_guid);
572 avio_wl32(pb, strlen(value)*2 + 2);
573 avio_put_str16le(pb, key);
574 avio_put_str16le(pb, value);
577 static void write_table_entries_attrib(AVFormatContext *s)
579 AVDictionaryEntry *tag = 0;
581 //FIXME: translate special tags (e.g. WM/Bitrate) to binary representation
582 ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL);
583 while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
584 write_tag(s->pb, tag->key, tag->value);
587 static void write_table_redirector_legacy_attrib(AVFormatContext *s)
589 AVIOContext *pb = s->pb;
590 AVDictionaryEntry *tag = 0;
593 //FIXME: translate special tags to binary representation
594 while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
596 pos += 16 + 4 + 4 + strlen(tag->key)*2 + 2 + strlen(tag->value)*2 + 2;
601 * Pad the remainder of a file
602 * Write out fat table
603 * @return <0 on error
605 static int finish_file(AVFormatContext *s, enum WtvFileIndex index, int64_t start_pos)
607 WtvContext *wctx = s->priv_data;
608 AVIOContext *pb = s->pb;
609 WtvFile *w = &wctx->file[index];
610 int64_t end_pos = avio_tell(pb);
611 int sector_bits, nb_sectors, pad;
613 av_assert0(index < WTV_FILES);
615 w->length = (end_pos - start_pos);
617 // determine optimal fat table depth, sector_bits, nb_sectors
618 if (w->length <= WTV_SECTOR_SIZE) {
620 sector_bits = WTV_SECTOR_BITS;
621 } else if (w->length <= (WTV_SECTOR_SIZE / 4) * WTV_SECTOR_SIZE) {
623 sector_bits = WTV_SECTOR_BITS;
624 } else if (w->length <= (WTV_SECTOR_SIZE / 4) * WTV_BIGSECTOR_SIZE) {
626 sector_bits = WTV_BIGSECTOR_BITS;
627 } else if (w->length <= (int64_t)(WTV_SECTOR_SIZE / 4) * (WTV_SECTOR_SIZE / 4) * WTV_SECTOR_SIZE) {
629 sector_bits = WTV_SECTOR_BITS;
630 } else if (w->length <= (int64_t)(WTV_SECTOR_SIZE / 4) * (WTV_SECTOR_SIZE / 4) * WTV_BIGSECTOR_SIZE) {
632 sector_bits = WTV_BIGSECTOR_BITS;
634 av_log(s, AV_LOG_ERROR, "unsupported file allocation table depth (%"PRIi64" bytes)\n", w->length);
638 // determine the nb_sectors
639 nb_sectors = (int)(w->length >> sector_bits);
641 // pad sector of timeline
642 pad = (1 << sector_bits) - (w->length % (1 << sector_bits));
650 w->first_sector = write_fat_sector(s, start_pos, nb_sectors, sector_bits, w->depth);
652 w->first_sector = start_pos;
654 w->first_sector >>= WTV_SECTOR_BITS;
656 w->length |= 1ULL<<60;
657 if (sector_bits == WTV_SECTOR_BITS)
658 w->length |= 1ULL<<63;
663 static int write_trailer(AVFormatContext *s)
665 WtvContext *wctx = s->priv_data;
666 AVIOContext *pb = s->pb;
669 int64_t start_pos, file_end_pos;
671 if (finish_file(s, WTV_TIMELINE, wctx->timeline_start_pos) < 0)
674 start_pos = avio_tell(pb);
675 write_table_entries_events(s);
676 if (finish_file(s, WTV_TIMELINE_TABLE_0_ENTRIES_EVENTS, start_pos) < 0)
679 start_pos = avio_tell(pb);
680 write_table_entries_attrib(s);
681 if (finish_file(s, WTV_TABLE_0_ENTRIES_LEGACY_ATTRIB, start_pos) < 0)
684 start_pos = avio_tell(pb);
685 write_table_redirector_legacy_attrib(s);
686 if (finish_file(s, WTV_TABLE_0_REDIRECTOR_LEGACY_ATTRIB, start_pos) < 0)
689 start_pos = avio_tell(pb);
690 //FIXME: output timestamp, frame_nb pairs here.
691 if (finish_file(s, WTV_TABLE_0_ENTRIES_TIME, start_pos) < 0)
695 sector_pos = avio_tell(pb);
696 root_size = write_root_table(s, sector_pos);
698 file_end_pos = avio_tell(pb);
700 avio_seek(pb, 0x30, SEEK_SET);
701 avio_wl32(pb, root_size);
702 avio_seek(pb, 4, SEEK_CUR);
703 avio_wl32(pb, sector_pos >> WTV_SECTOR_BITS);
704 avio_seek(pb, 0x5c, SEEK_SET);
705 avio_wl32(pb, file_end_pos >> WTV_SECTOR_BITS);
711 AVOutputFormat ff_wtv_muxer = {
713 .long_name = NULL_IF_CONFIG_SMALL("Windows Television (WTV)"),
715 .priv_data_size = sizeof(WtvContext),
716 .audio_codec = CODEC_ID_AC3,
717 .video_codec = CODEC_ID_MPEG2VIDEO,
718 .write_header = write_header,
719 .write_packet = write_packet,
720 .write_trailer = write_trailer,
721 .codec_tag = (const AVCodecTag* const []){ ff_codec_bmp_tags,
722 ff_codec_wav_tags, 0 },