Revision fbb878ce

View differences:

libavformat/matroskadec.c
35 35
#include "libavcodec/mpeg4audio.h"
36 36
#include "libavutil/intfloat_readwrite.h"
37 37
#include "libavutil/lzo.h"
38
#ifdef CONFIG_ZLIB
39
#include <zlib.h>
40
#endif
38 41

  
39 42
typedef struct Track {
40 43
    MatroskaTrackType type;
......
1500 1503
                                                    if ((res = ebml_read_uint(matroska, &id, &num)) < 0)
1501 1504
                                                        break;
1502 1505
                                                    if (num != MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP &&
1506
#ifdef CONFIG_ZLIB
1507
                                                        num != MATROSKA_TRACK_ENCODING_COMP_ZLIB &&
1508
#endif
1503 1509
                                                        num != MATROSKA_TRACK_ENCODING_COMP_LZO)
1504 1510
                                                        av_log(matroska->ctx, AV_LOG_ERROR,
1505 1511
                                                               "Unsupported compression algo");
......
2720 2726
                        }
2721 2727
                        pkt_size -= olen;
2722 2728
                        break;
2729
#ifdef CONFIG_ZLIB
2730
                    case MATROSKA_TRACK_ENCODING_COMP_ZLIB: {
2731
                        z_stream zstream = {0};
2732
                        pkt_data = NULL;
2733
                        if (inflateInit(&zstream) != Z_OK)
2734
                            continue;
2735
                        zstream.next_in = data;
2736
                        zstream.avail_in = lace_size[n];
2737
                        do {
2738
                            pkt_size *= 3;
2739
                            pkt_data = av_realloc(pkt_data, pkt_size);
2740
                            zstream.avail_out = pkt_size - zstream.total_out;
2741
                            zstream.next_out = pkt_data + zstream.total_out;
2742
                            result = inflate(&zstream, Z_NO_FLUSH);
2743
                        } while (result==Z_OK && pkt_size<10000000);
2744
                        pkt_size = zstream.total_out;
2745
                        inflateEnd(&zstream);
2746
                        if (result != Z_STREAM_END) {
2747
                            av_free(pkt_data);
2748
                            continue;
2749
                        }
2750
                        break;
2751
                    }
2752
#endif
2723 2753
                    }
2724 2754
                }
2725 2755

  

Also available in: Unified diff