]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/wtvenc.c
wtvenc: indent fixup
[ffmpeg] / libavformat / wtvenc.c
index 5bed51e3c09d12b0100a73819abb42deaefeaf14..e86bfeb779741f3749b1b3cb3af3f224ad615df5 100644 (file)
@@ -52,12 +52,6 @@ static const uint8_t legacy_attrib[] =
 
 static const ff_asf_guid sub_wtv_guid =
     {0x8C,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
-static const ff_asf_guid stream1_guid =
-    {0xA1,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
-static const ff_asf_guid sync_guid =
-    {0x97,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
-static const ff_asf_guid index_guid =
-    {0x96,0xc3,0xd2,0xc2,0x7e,0x9a,0xda,0x11,0x8b,0xf7,0x00,0x07,0xe9,0x5e,0xad,0x8d};
 
 enum WtvFileIndex {
     WTV_TIMELINE_TABLE_0_HEADER_EVENTS = 0,
@@ -137,7 +131,7 @@ static void write_chunk_header(AVFormatContext *s, const ff_asf_guid *guid, int
     avio_wl32(pb, stream_id);
     avio_wl64(pb, wctx->serial);
 
-    if ((stream_id & 0x80000000) && guid != &index_guid) {
+    if ((stream_id & 0x80000000) && guid != &ff_index_guid) {
         WtvChunkEntry *t = wctx->index + wctx->nb_index;
         av_assert0(wctx->nb_index < MAX_NB_INDEX);
         t->pos       = wctx->last_chunk_pos;
@@ -179,7 +173,7 @@ static void write_index(AVFormatContext *s)
     WtvContext *wctx = s->priv_data;
     int i;
 
-    write_chunk_header2(s, &index_guid, 0x80000000);
+    write_chunk_header2(s, &ff_index_guid, 0x80000000);
     avio_wl32(pb, 0);
     avio_wl32(pb, 0);
 
@@ -263,7 +257,7 @@ static int write_stream_codec(AVFormatContext *s, AVStream * st)
 {
     AVIOContext *pb = s->pb;
     int ret;
-    write_chunk_header2(s, &stream1_guid, 0x80000000 | 0x01);
+    write_chunk_header2(s, &ff_stream1_guid, 0x80000000 | 0x01);
 
     avio_wl32(pb,  0x01);
     write_pad(pb, 4);
@@ -286,7 +280,7 @@ static void write_sync(AVFormatContext *s)
     int64_t last_chunk_pos = wctx->last_chunk_pos;
     wctx->sync_pos = avio_tell(pb) - wctx->timeline_start_pos;
 
-    write_chunk_header(s, &sync_guid, 0x18, 0);
+    write_chunk_header(s, &ff_sync_guid, 0x18, 0);
     write_pad(pb, 24);
 
     finish_chunk(s);
@@ -294,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_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);
-    }
+    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);
 
     ret = write_stream_codec_info(s, st);
     if (ret < 0) {
@@ -370,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);
 
@@ -439,7 +409,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-static int write_table0_header_envents(AVIOContext *pb)
+static int write_table0_header_events(AVIOContext *pb)
 {
     avio_wl32(pb, 0x10);
     write_pad(pb, 84);
@@ -468,7 +438,7 @@ static int write_table0_header_time(AVIOContext *pb)
 }
 
 static const WTVRootEntryTable wtv_root_entry_table[] = {
-    { timeline_table_0_header_events,          sizeof(timeline_table_0_header_events),          write_table0_header_envents},
+    { timeline_table_0_header_events,          sizeof(timeline_table_0_header_events),          write_table0_header_events},
     { ff_timeline_table_0_entries_Events_le16, sizeof(ff_timeline_table_0_entries_Events_le16), NULL},
     { ff_timeline_le16,                        sizeof(ff_timeline_le16),                        NULL},
     { table_0_header_legacy_attrib,            sizeof(table_0_header_legacy_attrib),            write_table0_header_legacy_attrib},