Revision f7b9687c

View differences:

libavformat/matroskadec.c
461 461
 * The opposite isn't done - that's auto-done using master
462 462
 * element reading.
463 463
 */
464
static int
465
ebml_read_element_level_up (MatroskaDemuxContext *matroska)
464
static int ebml_read_element_level_up(MatroskaDemuxContext *matroska)
466 465
{
467 466
    ByteIOContext *pb = matroska->ctx->pb;
468 467
    offset_t pos = url_ftell(pb);
......
490 489
 * number.
491 490
 * Returns: num. of bytes read. < 0 on error.
492 491
 */
493
static int
494
ebml_read_num (MatroskaDemuxContext *matroska,
495
               int                   max_size,
496
               uint64_t             *number)
492
static int ebml_read_num(MatroskaDemuxContext *matroska,
493
                         int max_size, uint64_t *number)
497 494
{
498 495
    ByteIOContext *pb = matroska->ctx->pb;
499 496
    int len_mask = 0x80, read = 1, n = 1;
......
540 537
 * Read: the element content data ID.
541 538
 * Return: the number of bytes read or < 0 on error.
542 539
 */
543
static int
544
ebml_read_element_id (MatroskaDemuxContext *matroska,
545
                      uint32_t             *id)
540
static int ebml_read_element_id(MatroskaDemuxContext *matroska, uint32_t *id)
546 541
{
547 542
    int read;
548 543
    uint64_t total;
......
565 560
 * Read: element content length.
566 561
 * Return: the number of bytes read or < 0 on error.
567 562
 */
568
static int
569
ebml_read_element_length (MatroskaDemuxContext *matroska,
570
                          uint64_t             *length)
563
static int ebml_read_element_length(MatroskaDemuxContext *matroska,
564
                                    uint64_t *length)
571 565
{
572 566
    /* clear cache since we're now beyond that data point */
573 567
    matroska->peek_id = 0;
......
580 574
 * Seek to a given offset.
581 575
 * 0 is success, -1 is failure.
582 576
 */
583
static int
584
ebml_read_seek (MatroskaDemuxContext *matroska,
585
                offset_t              offset)
577
static int ebml_read_seek(MatroskaDemuxContext *matroska, offset_t offset)
586 578
{
587 579
    ByteIOContext *pb = matroska->ctx->pb;
588 580

  
......
596 588
 * Read the next element as an unsigned int.
597 589
 * 0 is success, < 0 is failure.
598 590
 */
599
static int
600
ebml_read_uint (ByteIOContext *pb,
601
                int            size,
602
                uint64_t             *num)
591
static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num)
603 592
{
604 593
    int n = 0;
605 594

  
......
618 607
 * Read the next element as a float.
619 608
 * 0 is success, < 0 is failure.
620 609
 */
621
static int
622
ebml_read_float (ByteIOContext *pb,
623
                 int            size,
624
                 double               *num)
610
static int ebml_read_float(ByteIOContext *pb, int size, double *num)
625 611
{
626 612
    if (size == 4) {
627 613
        *num= av_int2flt(get_be32(pb));
......
637 623
 * Read the next element as an ASCII string.
638 624
 * 0 is success, < 0 is failure.
639 625
 */
640
static int
641
ebml_read_ascii (ByteIOContext *pb,
642
                 int            size,
643
                 char                **str)
626
static int ebml_read_ascii(ByteIOContext *pb, int size, char **str)
644 627
{
645 628
    av_free(*str);
646 629
    /* ebml strings are usually not 0-terminated, so we allocate one
......
661 644
 * are supposed to be sub-elements which can be read separately.
662 645
 * 0 is success, < 0 is failure.
663 646
 */
664
static int
665
ebml_read_master (MatroskaDemuxContext *matroska,
666
                  int                   length)
647
static int ebml_read_master(MatroskaDemuxContext *matroska, int length)
667 648
{
668 649
    ByteIOContext *pb = matroska->ctx->pb;
669 650
    MatroskaLevel *level;
......
685 666
 * Read the next element as binary data.
686 667
 * 0 is success, < 0 is failure.
687 668
 */
688
static int
689
ebml_read_binary (ByteIOContext *pb,
690
                  int            length,
691
                  EbmlBin       *bin)
669
static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin)
692 670
{
693 671
    av_free(bin->data);
694 672
    if (!(bin->data = av_malloc(length)))
......
707 685
 * Return: number of bytes processed, < 0 on error.
708 686
 * XXX: use ebml_read_num().
709 687
 */
710
static int
711
matroska_ebmlnum_uint (uint8_t  *data,
712
                       uint32_t  size,
713
                       uint64_t *num)
688
static int matroska_ebmlnum_uint(uint8_t *data, uint32_t size, uint64_t *num)
714 689
{
715 690
    int len_mask = 0x80, read = 1, n = 1, num_ffs = 0;
716 691
    uint64_t total;
......
748 723
/*
749 724
 * Same as above, but signed.
750 725
 */
751
static int
752
matroska_ebmlnum_sint (uint8_t  *data,
753
                       uint32_t  size,
754
                       int64_t  *num)
726
static int matroska_ebmlnum_sint(uint8_t *data, uint32_t size, int64_t *num)
755 727
{
756 728
    uint64_t unum;
757 729
    int res;
......
770 742
}
771 743

  
772 744

  
773
static MatroskaTrack *
774
matroska_find_track_by_num (MatroskaDemuxContext *matroska,
775
                            int                   num)
745
static MatroskaTrack *matroska_find_track_by_num(MatroskaDemuxContext *matroska,
746
                                                 int num)
776 747
{
777 748
    MatroskaTrack *tracks = matroska->tracks.elem;
778 749
    int i;
......
790 761
 * Put one packet in an application-supplied AVPacket struct.
791 762
 * Returns 0 on success or -1 on failure.
792 763
 */
793
static int
794
matroska_deliver_packet (MatroskaDemuxContext *matroska,
795
                         AVPacket             *pkt)
764
static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
765
                                   AVPacket *pkt)
796 766
{
797 767
    if (matroska->num_packets > 0) {
798 768
        memcpy(pkt, matroska->packets[0], sizeof(AVPacket));
......
817 787
 * Put a packet into our internal queue. Will be delivered to the
818 788
 * user/application during the next get_packet() call.
819 789
 */
820
static void
821
matroska_queue_packet (MatroskaDemuxContext *matroska,
822
                       AVPacket             *pkt)
790
static void matroska_queue_packet(MatroskaDemuxContext *matroska, AVPacket *pkt)
823 791
{
824 792
    matroska->packets =
825 793
        av_realloc(matroska->packets, (matroska->num_packets + 1) *
......
831 799
/*
832 800
 * Free all packets in our internal queue.
833 801
 */
834
static void
835
matroska_clear_queue (MatroskaDemuxContext *matroska)
802
static void matroska_clear_queue(MatroskaDemuxContext *matroska)
836 803
{
837 804
    if (matroska->packets) {
838 805
        int n;
......
850 817
/*
851 818
 * Autodetecting...
852 819
 */
853
static int
854
matroska_probe (AVProbeData *p)
820
static int matroska_probe(AVProbeData *p)
855 821
{
856 822
    uint64_t total = 0;
857 823
    int len_mask = 0x80, size = 1, n = 1;
......
1009 975
    }
1010 976
}
1011 977

  
1012
static int
1013
matroska_decode_buffer(uint8_t** buf, int* buf_size, MatroskaTrack *track)
978
static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
979
                                  MatroskaTrack *track)
1014 980
{
1015 981
    MatroskaTrackEncoding *encodings = track->encodings.elem;
1016 982
    uint8_t* data = *buf;
......
1086 1052
    return -1;
1087 1053
}
1088 1054

  
1089
static void
1090
matroska_execute_seekhead(MatroskaDemuxContext *matroska)
1055
static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
1091 1056
{
1092 1057
    EbmlList *seekhead_list = &matroska->seekhead;
1093 1058
    MatroskaSeekhead *seekhead = seekhead_list->elem;
......
1138 1103
    matroska->level_up = level_up;
1139 1104
}
1140 1105

  
1141
static int
1142
matroska_aac_profile (char *codec_id)
1106
static int matroska_aac_profile(char *codec_id)
1143 1107
{
1144 1108
    static const char *aac_profiles[] = { "MAIN", "LC", "SSR" };
1145 1109
    int profile;
......
1150 1114
    return profile + 1;
1151 1115
}
1152 1116

  
1153
static int
1154
matroska_aac_sri (int samplerate)
1117
static int matroska_aac_sri(int samplerate)
1155 1118
{
1156 1119
    int sri;
1157 1120

  
......
1161 1124
    return sri;
1162 1125
}
1163 1126

  
1164
static int
1165
matroska_read_header (AVFormatContext    *s,
1166
                      AVFormatParameters *ap)
1127
static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
1167 1128
{
1168 1129
    MatroskaDemuxContext *matroska = s->priv_data;
1169 1130
    EbmlList *attachements_list = &matroska->attachments;
......
1468 1429
    return 0;
1469 1430
}
1470 1431

  
1471
static int
1472
matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size,
1473
                     int64_t pos, uint64_t cluster_time, uint64_t duration,
1474
                     int is_keyframe)
1432
static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
1433
                                int size, int64_t pos, uint64_t cluster_time,
1434
                                uint64_t duration, int is_keyframe)
1475 1435
{
1476 1436
    MatroskaTrack *track;
1477 1437
    int res = 0;
......
1679 1639
    return res;
1680 1640
}
1681 1641

  
1682
static int
1683
matroska_parse_cluster (MatroskaDemuxContext *matroska)
1642
static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
1684 1643
{
1685 1644
    MatroskaCluster cluster = { 0 };
1686 1645
    EbmlList *blocks_list;
......
1698 1657
    return res;
1699 1658
}
1700 1659

  
1701
static int
1702
matroska_read_packet (AVFormatContext *s,
1703
                      AVPacket        *pkt)
1660
static int matroska_read_packet(AVFormatContext *s, AVPacket *pkt)
1704 1661
{
1705 1662
    MatroskaDemuxContext *matroska = s->priv_data;
1706 1663

  
......
1714 1671
    return 0;
1715 1672
}
1716 1673

  
1717
static int
1718
matroska_read_seek (AVFormatContext *s, int stream_index, int64_t timestamp,
1719
                    int flags)
1674
static int matroska_read_seek(AVFormatContext *s, int stream_index,
1675
                              int64_t timestamp, int flags)
1720 1676
{
1721 1677
    MatroskaDemuxContext *matroska = s->priv_data;
1722 1678
    AVStream *st = s->streams[stream_index];
......
1736 1692
    return 0;
1737 1693
}
1738 1694

  
1739
static int
1740
matroska_read_close (AVFormatContext *s)
1695
static int matroska_read_close(AVFormatContext *s)
1741 1696
{
1742 1697
    MatroskaDemuxContext *matroska = s->priv_data;
1743 1698
    MatroskaTrack *tracks = matroska->tracks.elem;

Also available in: Unified diff