Browse code

asfdec: replace magic constant with DATA_HEADER_SIZE

Signed-off-by: Vladimir Pantelic <vladoman@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Vladimir Pantelic authored on 2013/09/20 00:50:35
Showing 1 changed files
... ...
@@ -182,6 +182,8 @@
182 182
      1 -         /* Payload Flags */                      \
183 183
      2 * PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS)
184 184
 
185
+#define DATA_HEADER_SIZE 50
186
+
185 187
 typedef struct {
186 188
     uint32_t seqno;
187 189
     int is_streamed;
... ...
@@ -517,14 +519,14 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
517 517
     cur_pos     = avio_tell(pb);
518 518
     header_size = cur_pos - header_offset;
519 519
     if (asf->is_streamed) {
520
-        header_size += 8 + 30 + 50;
520
+        header_size += 8 + 30 + DATA_HEADER_SIZE;
521 521
 
522 522
         avio_seek(pb, header_offset - 10 - 30, SEEK_SET);
523 523
         avio_wl16(pb, header_size);
524 524
         avio_seek(pb, header_offset - 2 - 30, SEEK_SET);
525 525
         avio_wl16(pb, header_size);
526 526
 
527
-        header_size -= 8 + 30 + 50;
527
+        header_size -= 8 + 30 + DATA_HEADER_SIZE;
528 528
     }
529 529
     header_size += 24 + 6;
530 530
     avio_seek(pb, header_offset - 14, SEEK_SET);
... ...
@@ -555,10 +557,10 @@ static int asf_write_header(AVFormatContext *s)
555 555
     asf->nb_index_count        = 0;
556 556
     asf->maximum_packet        = 0;
557 557
 
558
-    /* the data-chunk-size has to be 50, which is data_size - asf->data_offset
559
-     *  at the moment this function is done. It is needed to use asf as
560
-     *  streamable format. */
561
-    if (asf_write_header1(s, 0, 50) < 0) {
558
+    /* the data-chunk-size has to be 50 (DATA_HEADER_SIZE), which is
559
+     * data_size - asf->data_offset at the moment this function is done.
560
+     * It is needed to use asf as a streamable format. */
561
+    if (asf_write_header1(s, 0, DATA_HEADER_SIZE) < 0) {
562 562
         //av_free(asf);
563 563
         return -1;
564 564
     }