[FFmpeg-soc] [soc]: r5952 - wtvmuxer/wtvenc.c

spyfeng subversion at mplayerhq.hu
Sun Apr 17 15:22:40 CEST 2011


Author: spyfeng
Date: Sun Apr 17 15:22:39 2011
New Revision: 5952

Log:
calculate the correct nb_sectors for data.

Modified:
   wtvmuxer/wtvenc.c

Modified: wtvmuxer/wtvenc.c
==============================================================================
--- wtvmuxer/wtvenc.c	Sun Apr 17 11:13:06 2011	(r5951)
+++ wtvmuxer/wtvenc.c	Sun Apr 17 15:22:39 2011	(r5952)
@@ -84,9 +84,9 @@ static int wtv_write_header(AVFormatCont
     wtv_write_pad(pb, 4);
     avio_wl32(pb, 0); // root_sector, update it later.
 
-    wctx->timeline_start_pos = avio_tell(pb);
-    pad = (1 << WTV_SECTOR_BITS) - wctx->timeline_start_pos;
+    pad = (1 << WTV_BIGSECTOR_BITS) - avio_tell(pb);
     wtv_write_pad(pb, pad);
+    wctx->timeline_start_pos = avio_tell(pb);
     return 0;
 }
 
@@ -151,7 +151,7 @@ static int wtv_write_sector(AVFormatCont
 
         // write sector pointer
         for(; i < nb_sectors; i++) {
-            sector_pointer = sector_pos >> WTV_SECTOR_BITS;
+            sector_pointer = sector_pos >> WTV_BIGSECTOR_BITS;
             avio_wl32(pb, sector_pointer);
             sector_pos += 1 << WTV_BIGSECTOR_BITS;
         }
@@ -165,7 +165,7 @@ static int wtv_write_sector(AVFormatCont
         av_log(s, AV_LOG_ERROR, "unsupported file allocation table depth (0x%x)\n", wctx->depth);
     }
 
-    pad = (1<<WTV_SECTOR_BITS) - (avio_tell(pb) -  wctx->fat_table_pos);
+    pad = WTV_SECTOR_SIZE - (avio_tell(pb) % WTV_SECTOR_SIZE);
     wtv_write_pad(pb, pad);
 
     return 0;


More information about the FFmpeg-soc mailing list