| OLD | NEW |
| (Empty) | |
| 1 diff -wurp -N orig/libavformat/matroskadec.c ffmpeg/libavformat/matroskadec.c |
| 2 --- orig/libavformat/matroskadec.c 2011-07-12 20:48:14.532933135 -0700 |
| 3 +++ ffmpeg/libavformat/matroskadec.c 2011-07-12 20:48:14.583029843 -0700 |
| 4 @@ -35,13 +35,17 @@ |
| 5 /* For ff_codec_get_id(). */ |
| 6 #include "riff.h" |
| 7 #include "isom.h" |
| 8 +#if CONFIG_SIPR_DECODER |
| 9 #include "rm.h" |
| 10 +#endif |
| 11 #include "matroska.h" |
| 12 #include "libavcodec/mpeg4audio.h" |
| 13 #include "libavutil/intfloat_readwrite.h" |
| 14 #include "libavutil/intreadwrite.h" |
| 15 #include "libavutil/avstring.h" |
| 16 +#if HAVE_LZO1X_999_COMPRESS |
| 17 #include "libavutil/lzo.h" |
| 18 +#endif |
| 19 #include "libavutil/dict.h" |
| 20 #if CONFIG_ZLIB |
| 21 #include <zlib.h> |
| 22 @@ -971,6 +980,7 @@ static int matroska_decode_buffer(uint8_ |
| 23 switch (encodings[0].compression.algo) { |
| 24 case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP: |
| 25 return encodings[0].compression.settings.size; |
| 26 +#if HAVE_LZO1X_999_COMPRESS |
| 27 case MATROSKA_TRACK_ENCODING_COMP_LZO: |
| 28 do { |
| 29 olen = pkt_size *= 3; |
| 30 @@ -981,6 +991,7 @@ static int matroska_decode_buffer(uint8_ |
| 31 goto failed; |
| 32 pkt_size -= olen; |
| 33 break; |
| 34 +#endif |
| 35 #if CONFIG_ZLIB |
| 36 case MATROSKA_TRACK_ENCODING_COMP_ZLIB: { |
| 37 z_stream zstream = {0}; |
| 38 @@ -1308,6 +1319,7 @@ static int matroska_read_header(AVFormat |
| 39 "(EBML version %"PRIu64", doctype %s, doc version %"PRIu64")\n", |
| 40 ebml.version, ebml.doctype, ebml.doctype_version); |
| 41 } |
| 42 + av_metadata_set2(&s->metadata, "doctype", ebml.doctype, 0); |
| 43 for (i = 0; i < FF_ARRAY_ELEMS(matroska_doctypes); i++) |
| 44 if (!strcmp(ebml.doctype, matroska_doctypes[i])) |
| 45 break; |
| 46 @@ -1370,14 +1382,17 @@ static int matroska_read_header(AVFormat |
| 47 "Multiple combined encodings no supported"); |
| 48 } else if (encodings_list->nb_elem == 1) { |
| 49 if (encodings[0].type || |
| 50 - (encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_
HEADERSTRIP && |
| 51 + (encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_
HEADERSTRIP |
| 52 #if CONFIG_ZLIB |
| 53 - encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_
ZLIB && |
| 54 + && encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_CO
MP_ZLIB |
| 55 #endif |
| 56 #if CONFIG_BZLIB |
| 57 - encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_
BZLIB && |
| 58 + && encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_CO
MP_BZLIB |
| 59 #endif |
| 60 - encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_
LZO)) { |
| 61 +#if HAVE_LZO1X_999_COMPRESS |
| 62 + && encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_CO
MP_LZO |
| 63 +#endif |
| 64 + )) { |
| 65 encodings[0].scope = 0; |
| 66 av_log(matroska->ctx, AV_LOG_ERROR, |
| 67 "Unsupported encoding type"); |
| 68 @@ -1505,11 +1520,13 @@ static int matroska_read_header(AVFormat |
| 69 st->codec->block_align = track->audio.coded_framesize; |
| 70 track->codec_priv.size = 0; |
| 71 } else { |
| 72 +#if CONFIG_SIPR_DECODER |
| 73 if (codec_id == CODEC_ID_SIPR && flavor < 4) { |
| 74 const int sipr_bit_rate[4] = { 6504, 8496, 5000, 16000 }; |
| 75 track->audio.sub_packet_size = ff_sipr_subpk_size[flavor]; |
| 76 st->codec->bit_rate = sipr_bit_rate[flavor]; |
| 77 } |
| 78 +#endif |
| 79 st->codec->block_align = track->audio.sub_packet_size; |
| 80 extradata_offset = 78; |
| 81 } |
| 82 @@ -1593,6 +1610,8 @@ static int matroska_read_header(AVFormat |
| 83 } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) { |
| 84 st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 85 st->codec->sample_rate = track->audio.out_samplerate; |
| 86 + if (st->codec->sample_rate <= 0) |
| 87 + st->codec->sample_rate = 1; |
| 88 st->codec->channels = track->audio.channels; |
| 89 if (st->codec->codec_id != CODEC_ID_AAC) |
| 90 st->need_parsing = AVSTREAM_PARSE_HEADERS; |
| 91 @@ -1853,8 +1872,10 @@ static int matroska_parse_block(Matroska |
| 92 memcpy(track->audio.buf+sps*(h*x+((h+1)/2)*(y&1)+(y
>>1)), data+x*sps, sps); |
| 93 |
| 94 if (++track->audio.sub_packet_cnt >= h) { |
| 95 +#if CONFIG_SIPR_DECODER |
| 96 if (st->codec->codec_id == CODEC_ID_SIPR) |
| 97 ff_rm_reorder_sipr_data(track->audio.buf, h, w); |
| 98 +#endif |
| 99 track->audio.sub_packet_cnt = 0; |
| 100 track->audio.pkt_cnt = h*w / a; |
| 101 } |
| OLD | NEW |