1 diff -Naur ffmpeg.orig/libavcodec/Makefile ffmpeg/libavcodec/Makefile
2 --- ffmpeg.orig/libavcodec/Makefile 2008-12-01 01:40:36.000000000 -0500
3 +++ ffmpeg/libavcodec/Makefile 2009-02-21 08:25:13.000000000 -0500
5 OBJS-$(CONFIG_LIBDIRAC_DECODER) += libdiracdec.o
6 OBJS-$(CONFIG_LIBDIRAC_ENCODER) += libdiracenc.o libdirac_libschro.o
7 OBJS-$(CONFIG_LIBFAAC) += libfaac.o
8 -OBJS-$(CONFIG_LIBFAAD) += libfaad.o
9 +OBJS-$(CONFIG_LIBFAAD) += libfaad.o latmaac.o
10 OBJS-$(CONFIG_LIBGSM) += libgsm.o
11 OBJS-$(CONFIG_LIBMP3LAME) += libmp3lame.o
12 OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o libschroedinger.o libdirac_libschro.o
14 OBJS-$(CONFIG_LIBXVID) += libxvidff.o libxvid_rc.o
17 -OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o mpeg4audio.o
18 +OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o mpeg4audio.o latm_parser.o
19 OBJS-$(CONFIG_AC3_PARSER) += ac3_parser.o ac3tab.o aac_ac3_parser.o
20 OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o
21 OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o
22 diff -Naur ffmpeg.orig/libavcodec/allcodecs.c ffmpeg/libavcodec/allcodecs.c
23 --- ffmpeg.orig/libavcodec/allcodecs.c 2008-12-01 01:40:36.000000000 -0500
24 +++ ffmpeg/libavcodec/allcodecs.c 2009-02-21 08:25:13.000000000 -0500
26 REGISTER_ENCDEC (LIBDIRAC, libdirac);
27 REGISTER_ENCODER (LIBFAAC, libfaac);
28 REGISTER_DECODER (LIBFAAD, libfaad);
29 + REGISTER_DECODER (LIBFAAD, libfaad2);
30 REGISTER_ENCDEC (LIBGSM, libgsm);
31 REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
32 REGISTER_ENCODER (LIBMP3LAME, libmp3lame);
36 REGISTER_PARSER (AAC, aac);
37 + REGISTER_PARSER (AAC, aac_latm);
38 REGISTER_PARSER (AC3, ac3);
39 REGISTER_PARSER (CAVSVIDEO, cavsvideo);
40 REGISTER_PARSER (DCA, dca);
41 diff -Naur ffmpeg.orig/libavcodec/avcodec.h ffmpeg/libavcodec/avcodec.h
42 --- ffmpeg.orig/libavcodec/avcodec.h 2008-12-01 01:40:36.000000000 -0500
43 +++ ffmpeg/libavcodec/avcodec.h 2009-02-21 08:25:13.000000000 -0500
45 CODEC_ID_MP2= 0x15000,
46 CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
52 diff -Naur ffmpeg.orig/libavcodec/latm_parser.c ffmpeg/libavcodec/latm_parser.c
53 --- ffmpeg.orig/libavcodec/latm_parser.c 1969-12-31 19:00:00.000000000 -0500
54 +++ ffmpeg/libavcodec/latm_parser.c 2009-02-21 08:25:13.000000000 -0500
58 + * Copyright (c) 2008 Paul Kendall <paul@kcbbs.gen.nz>
60 + * This file is part of FFmpeg.
62 + * FFmpeg is free software; you can redistribute it and/or
63 + * modify it under the terms of the GNU Lesser General Public
64 + * License as published by the Free Software Foundation; either
65 + * version 2.1 of the License, or (at your option) any later version.
67 + * FFmpeg is distributed in the hope that it will be useful,
68 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
69 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
70 + * Lesser General Public License for more details.
72 + * You should have received a copy of the GNU Lesser General Public
73 + * License along with FFmpeg; if not, write to the Free Software
74 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
78 + * @file latm_parser.c
84 +#define LATM_HEADER 0x56e000 // 0x2b7 (11 bits)
85 +#define LATM_MASK 0xFFE000 // top 11 bits
86 +#define LATM_SIZE_MASK 0x001FFF // bottom 13 bits
88 +typedef struct LATMParseContext{
94 + * finds the end of the current frame in the bitstream.
95 + * @return the position of the first byte of the next frame, or -1
97 +static int latm_find_frame_end(AVCodecParserContext *s1, const uint8_t *buf,
99 + LATMParseContext *s = s1->priv_data;
100 + ParseContext *pc = &s->pc;
104 + pic_found = pc->frame_start_found;
109 + for(i=0; i<buf_size; i++){
110 + state = (state<<8) | buf[i];
111 + if((state & LATM_MASK) == LATM_HEADER){
121 + /* EOF considered as end of frame */
124 + if((state & LATM_SIZE_MASK) - s->count <= buf_size) {
125 + pc->frame_start_found = 0;
127 + return (state & LATM_SIZE_MASK) - s->count;
131 + s->count += buf_size;
132 + pc->frame_start_found = pic_found;
134 + return END_NOT_FOUND;
137 +static int latm_parse(AVCodecParserContext *s1,
138 + AVCodecContext *avctx,
139 + const uint8_t **poutbuf, int *poutbuf_size,
140 + const uint8_t *buf, int buf_size)
142 + LATMParseContext *s = s1->priv_data;
143 + ParseContext *pc = &s->pc;
146 + if(s1->flags & PARSER_FLAG_COMPLETE_FRAMES){
149 + next = latm_find_frame_end(s1, buf, buf_size);
151 + if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
158 + *poutbuf_size = buf_size;
162 +static int latm_split(AVCodecContext *avctx,
163 + const uint8_t *buf, int buf_size)
166 + uint32_t state= -1;
168 + for(i=0; i<buf_size; i++){
169 + state= (state<<8) | buf[i];
170 + if((state & LATM_MASK) == LATM_HEADER)
176 +AVCodecParser aac_latm_parser = {
177 + { CODEC_ID_AAC_LATM },
178 + sizeof(LATMParseContext),
184 diff -Naur ffmpeg.orig/libavcodec/latmaac.c ffmpeg/libavcodec/latmaac.c
185 --- ffmpeg.orig/libavcodec/latmaac.c 1969-12-31 19:00:00.000000000 -0500
186 +++ ffmpeg/libavcodec/latmaac.c 2009-02-21 08:25:13.000000000 -0500
189 + * copyright (c) 2008 Paul Kendall <paul@kcbbs.gen.nz>
191 + * This file is part of FFmpeg.
193 + * FFmpeg is free software; you can redistribute it and/or
194 + * modify it under the terms of the GNU Lesser General Public
195 + * License as published by the Free Software Foundation; either
196 + * version 2.1 of the License, or (at your option) any later version.
198 + * FFmpeg is distributed in the hope that it will be useful,
199 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
200 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
201 + * Lesser General Public License for more details.
203 + * You should have received a copy of the GNU Lesser General Public
204 + * License along with FFmpeg; if not, write to the Free Software
205 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
210 + * LATM wrapped AAC decoder
217 +#include <sys/types.h>
220 +#include "bitstream.h"
221 +#include "mpeg4audio.h"
222 +#include "neaacdec.h"
224 +#define min(a,b) ((a)<(b) ? (a) : (b))
228 + Note: This decoder filter is intended to decode LATM streams transferred
229 + in MPEG transport streams which are only supposed to contain one program.
230 + To do a more complex LATM demuxing a separate LATM demuxer should be used.
233 +#define AAC_NONE 0 // mode not detected (or indicated in mediatype)
234 +#define AAC_LATM 1 // LATM packets (ISO/IEC 14496-3 1.7.3 Multiplex layer)
236 +#define SYNC_LATM 0x2b7 // 11 bits
238 +#define MAX_SIZE 8*1024
240 +typedef struct AACConfig
242 + uint8_t extra[64]; // should be way enough
245 + int audioObjectType;
246 + int samplingFrequencyIndex;
247 + int samplingFrequency;
248 + int channelConfiguration;
252 +typedef struct AACParser
255 + uint8_t frameLengthType;
256 + uint16_t muxSlotLengthBytes;
258 + uint8_t audio_mux_version;
259 + uint8_t audio_mux_version_A;
261 + uint8_t config_crc;
262 + int64_t other_data_bits;
265 + int offset; // byte offset in "buf" buffer
266 + uint8_t buf[MAX_SIZE]; // allocated buffer
267 + int count; // number of bytes written in buffer
270 +typedef struct AACDecoder
273 + faacDecHandle aac_decoder;
275 + uint32_t in_samplerate;
276 + uint8_t in_channels;
280 + AACDecoder* decoder;
283 +static inline int64_t latm_get_value(GetBitContext *b)
285 + uint8_t bytesForValue = get_bits(b, 2);
288 + for (i=0; i<=bytesForValue; i++) {
290 + value |= get_bits(b, 8);
295 +static void readGASpecificConfig(struct AACConfig *cfg, GetBitContext *b, PutBitContext *o)
297 + int framelen_flag = get_bits(b, 1);
298 + put_bits(o, 1, framelen_flag);
299 + int dependsOnCoder = get_bits(b, 1);
300 + put_bits(o, 1, dependsOnCoder);
305 + if (dependsOnCoder) {
306 + delay = get_bits(b, 14);
307 + put_bits(o, 14, delay);
309 + ext_flag = get_bits(b, 1);
310 + put_bits(o, 1, ext_flag);
311 + if (!cfg->channelConfiguration) {
312 + // program config element
316 + if (cfg->audioObjectType == 6 || cfg->audioObjectType == 20) {
317 + layerNr = get_bits(b, 3);
318 + put_bits(o, 3, layerNr);
321 + if (cfg->audioObjectType == 22) {
322 + skip_bits(b, 5); // numOfSubFrame
323 + skip_bits(b, 11); // layer_length
325 + put_bits(o, 16, 0);
327 + if (cfg->audioObjectType == 17 ||
328 + cfg->audioObjectType == 19 ||
329 + cfg->audioObjectType == 20 ||
330 + cfg->audioObjectType == 23) {
332 + skip_bits(b, 3); // stuff
336 + skip_bits(b, 1); // extflag3
341 +static int readAudioSpecificConfig(struct AACConfig *cfg, GetBitContext *b)
344 + init_put_bits(&o, cfg->extra, sizeof(cfg->extra));
346 + // returns the number of bits read
348 + int sbr_present = -1;
351 + cfg->audioObjectType = get_bits(b, 5);
352 + put_bits(&o, 5, cfg->audioObjectType);
353 + if (cfg->audioObjectType == 31) {
354 + uint8_t n = get_bits(b, 6);
355 + put_bits(&o, 6, n);
356 + cfg->audioObjectType = 32 + n;
359 + cfg->samplingFrequencyIndex = get_bits(b, 4);
360 + cfg->samplingFrequency = ff_mpeg4audio_sample_rates[cfg->samplingFrequencyIndex];
361 + put_bits(&o, 4, cfg->samplingFrequencyIndex);
362 + if (cfg->samplingFrequencyIndex == 0x0f) {
363 + uint32_t f = get_bits_long(b, 24);
364 + put_bits(&o, 24, f);
365 + cfg->samplingFrequency = f;
367 + cfg->channelConfiguration = get_bits(b, 4);
368 + put_bits(&o, 4, cfg->channelConfiguration);
369 + cfg->channels = ff_mpeg4audio_channels[cfg->channelConfiguration];
371 + if (cfg->audioObjectType == 5) {
374 + // TODO: parsing !!!!!!!!!!!!!!!!
377 + switch (cfg->audioObjectType) {
390 + readGASpecificConfig(cfg, b, &o);
394 + if (sbr_present == -1) {
395 + if (cfg->samplingFrequency <= 24000) {
396 + cfg->samplingFrequency *= 2;
400 + // count the extradata
401 + ret = put_bits_count(&o);
402 + align_put_bits(&o);
403 + flush_put_bits(&o);
404 + cfg->extrasize = (ret + 7) >> 3;
408 +static void readStreamMuxConfig(struct AACParser *parser, GetBitContext *b)
410 + parser->audio_mux_version_A = 0;
411 + parser->audio_mux_version = get_bits(b, 1);
412 + if (parser->audio_mux_version == 1) { // audioMuxVersion
413 + parser->audio_mux_version_A = get_bits(b, 1);
416 + if (parser->audio_mux_version_A == 0) {
417 + if (parser->audio_mux_version == 1) {
418 + parser->taraFullness = latm_get_value(b);
420 + get_bits(b, 1); // allStreamSameTimeFraming = 1
421 + get_bits(b, 6); // numSubFrames = 0
422 + get_bits(b, 4); // numPrograms = 0
424 + // for each program
425 + get_bits(b, 3); // numLayer = 0
428 + if (parser->audio_mux_version == 0) {
429 + // audio specific config.
430 + readAudioSpecificConfig(&parser->config, b);
432 + int ascLen = latm_get_value(b);
433 + ascLen -= readAudioSpecificConfig(&parser->config, b);
436 + while (ascLen > 16) {
440 + skip_bits(b, ascLen);
443 + // these are not needed... perhaps
444 + int frame_length_type = get_bits(b, 3);
445 + parser->frameLengthType = frame_length_type;
446 + if (frame_length_type == 0) {
448 + } else if (frame_length_type == 1) {
450 + } else if (frame_length_type == 3 ||
451 + frame_length_type == 4 ||
452 + frame_length_type == 5) {
453 + int celp_table_index = get_bits(b, 6);
454 + } else if (frame_length_type == 6 ||
455 + frame_length_type == 7) {
456 + int hvxc_table_index = get_bits(b, 1);
460 + parser->other_data_bits = 0;
461 + if (get_bits(b, 1)) {
462 + // other data present
463 + if (parser->audio_mux_version == 1) {
464 + parser->other_data_bits = latm_get_value(b);
466 + // other data not present
467 + parser->other_data_bits = 0;
470 + parser->other_data_bits <<= 8;
471 + esc = get_bits(b, 1);
472 + tmp = get_bits(b, 8);
473 + parser->other_data_bits |= tmp;
479 + if (get_bits(b, 1)) {
480 + parser->config_crc = get_bits(b, 8);
487 +static void readPayloadLengthInfo(struct AACParser *parser, GetBitContext *b)
490 + if (parser->frameLengthType == 0) {
491 + parser->muxSlotLengthBytes = 0;
493 + tmp = get_bits(b, 8);
494 + parser->muxSlotLengthBytes += tmp;
495 + } while (tmp == 255);
497 + if (parser->frameLengthType == 5 ||
498 + parser->frameLengthType == 7 ||
499 + parser->frameLengthType == 3) {
505 +static void readAudioMuxElement(struct AACParser *parser, GetBitContext *b, uint8_t *payload, int *payloadsize)
507 + uint8_t use_same_mux = get_bits(b, 1);
508 + if (!use_same_mux) {
509 + readStreamMuxConfig(parser, b);
512 + if (parser->audio_mux_version_A == 0) {
515 + readPayloadLengthInfo(parser, b);
518 + for (j=0; j<parser->muxSlotLengthBytes; j++) {
519 + *payload++ = get_bits(b, 8);
521 + *payloadsize = parser->muxSlotLengthBytes;
523 + // ignore otherdata
529 +static int readAudioSyncStream(struct AACParser *parser, GetBitContext *b, int size, uint8_t *payload, int *payloadsize)
531 + // ISO/IEC 14496-3 Table 1.28 - Syntax of AudioMuxElement()
532 + if (get_bits(b, 11) != 0x2b7) return -1; // not LATM
533 + int muxlength = get_bits(b, 13);
535 + if (3+muxlength > size) return 0; // not enough data
537 + readAudioMuxElement(parser, b, payload, payloadsize);
539 + // we don't parse anything else here...
540 + return (3+muxlength);
544 +static void flush_buf(struct AACParser *parser, int offset) {
545 + int bytes_to_flush = min(parser->count, offset);
546 + int left = (parser->count - bytes_to_flush);
548 + if (bytes_to_flush > 0) {
550 + memcpy(parser->buf, parser->buf+bytes_to_flush, left);
551 + parser->count = left;
558 +static struct AACParser *latm_create_parser()
560 + struct AACParser *parser = (struct AACParser *)av_malloc(sizeof(struct AACParser));
561 + memset(parser, 0, sizeof(struct AACParser));
565 +static void latm_destroy_parser(struct AACParser *parser)
570 +static void latm_flush(struct AACParser *parser)
572 + parser->offset = 0;
576 +static void latm_write_data(struct AACParser *parser, uint8_t *data, int len)
578 + // buffer overflow check... just ignore the data before
579 + if (parser->count + len > MAX_SIZE) {
580 + flush_buf(parser, parser->offset);
581 + parser->offset = 0;
582 + if (parser->count + len > MAX_SIZE) {
583 + int to_flush = (parser->count+len) - MAX_SIZE;
584 + flush_buf(parser, to_flush);
589 + memcpy(parser->buf+parser->count, data, len);
590 + parser->count += len;
593 +static int latm_parse_packet(struct AACParser *parser, uint8_t *data, int maxsize)
596 + Return value is either number of bytes parsed or
598 + 0 = need more data.
601 + uint8_t *start = parser->buf + parser->offset;
602 + int bytes = parser->count - parser->offset;
604 + init_get_bits(&b, start, bytes);
606 + if (parser->mode == AAC_LATM) {
608 + int ret = readAudioSyncStream(parser, &b, bytes, data, &outsize);
610 + if (ret < 0) return -1;
611 + if (ret == 0) return 0;
613 + // update the offset
614 + parser->offset += ret;
618 + // check for syncwords
619 + while (bytes > 2) {
620 + if (show_bits(&b, 11) == SYNC_LATM) {
621 + // we must parse config first...
624 + // check if there is a complete packet available...
625 + int ret = readAudioSyncStream(parser, &b, bytes, data, &outsize);
626 + if (ret < 0) return -1;
627 + if (ret == 0) return 0;
628 + parser->offset += ret;
630 + parser->mode = AAC_LATM;
640 +static void aac_filter_close(AACDecoder *decoder)
642 + if (decoder->aac_decoder) {
643 + NeAACDecClose(decoder->aac_decoder);
644 + decoder->aac_decoder = NULL;
649 +static int aac_decoder_open(AACDecoder *decoder)
651 + if (decoder->aac_decoder) return 0;
653 + decoder->aac_decoder = NeAACDecOpen();
654 + if (!decoder->aac_decoder) return -1;
656 + // are we going to initialize from decoder specific info ?
657 + if (decoder->parser->config.extrasize > 0) {
658 + char ret = NeAACDecInit2(decoder->aac_decoder, (unsigned char*)decoder->parser->config.extra, decoder->parser->config.extrasize, &decoder->in_samplerate, &decoder->in_channels);
660 + aac_filter_close(decoder); // gone wrong ?
665 + // we'll open the decoder later...
671 +AACDecoder *aac_filter_create()
673 + AACDecoder *decoder = (AACDecoder *)av_malloc(sizeof(AACDecoder));
674 + decoder->parser = latm_create_parser();
675 + decoder->aac_decoder = NULL;
677 + return (void *)decoder;
680 +void aac_filter_destroy(AACDecoder *decoder)
682 + aac_filter_close(decoder);
683 + latm_destroy_parser(decoder->parser);
687 +int aac_filter_receive(AACDecoder *decoder, void *out, int *out_size, uint8_t *data, int size)
689 + uint8_t tempbuf[32*1024];
691 + int consumed = size;
693 + int max_size = *out_size;
697 + //-------------------------------------------------------------------------
698 + // Multiplex Parsing
699 + //-------------------------------------------------------------------------
701 + latm_write_data(decoder->parser, data, size);
704 + ret = latm_parse_packet(decoder->parser, tempbuf, sizeof(tempbuf));
706 + latm_flush(decoder->parser);
709 + if (ret == 0) return consumed;
714 + //-------------------------------------------------------------------------
715 + // Initialize decoder (if necessary)
716 + //-------------------------------------------------------------------------
717 + if (!decoder->open) {
718 + aac_filter_close(decoder);
719 + if (decoder->parser->mode == AAC_LATM) {
720 + ret = aac_decoder_open(decoder);
721 + if (ret < 0) return consumed;
724 + if(!decoder->open) return consumed;
727 + //-------------------------------------------------------------------------
729 + //-------------------------------------------------------------------------
730 + NeAACDecFrameInfo info;
731 + void *buf = NeAACDecDecode(decoder->aac_decoder, &info, data, size);
734 + decoder->in_samplerate = info.samplerate;
735 + decoder->in_channels = info.channels;
737 + //---------------------------------------------------------------------
738 + // Deliver decoded samples
739 + //---------------------------------------------------------------------
741 + // kram dekoduje 16-bit. my vypustame 16-bit. takze by to malo byt okej
742 + decoded = info.samples * sizeof(short);
744 + // napraskame tam sample
745 + *out_size += decoded;
746 + if(*out_size > max_size) {
747 + av_log(NULL, AV_LOG_ERROR, "overflow!\n");
749 + memcpy(out, buf, decoded);
750 + out = (unsigned char *)out + decoded;
757 + } while (1); // decode all packets
761 +void aac_filter_getinfo(AACDecoder *decoder, int *sample_rate, int *channels)
763 + if(!decoder->open) return;
764 + *sample_rate = decoder->in_samplerate;
765 + *channels = decoder->in_channels;
768 +static int faac_decode_init(AVCodecContext *avctx)
770 + FAACContext *s = avctx->priv_data;
771 + avctx->frame_size = 360;
772 + avctx->sample_rate = 48000;
773 + avctx->channels = 2;
774 + avctx->bit_rate = 8192 * 8 * avctx->sample_rate / avctx->frame_size;
775 + s->decoder = aac_filter_create();
779 +static int faac_decode_frame(AVCodecContext *avctx,
780 + void *data, int *data_size,
781 + uint8_t *buf, int buf_size)
783 + FAACContext *s = avctx->priv_data;
786 + if (s->decoder == NULL) faac_decode_init(avctx);
787 + ret = aac_filter_receive(s->decoder, data, data_size, buf, buf_size);
788 + aac_filter_getinfo(s->decoder, &(avctx->sample_rate), &(avctx->channels));
792 +static int faac_decode_end(AVCodecContext *avctx)
794 + FAACContext *s = avctx->priv_data;
795 + if(s->decoder != NULL) {
796 + aac_filter_destroy(s->decoder);
801 +AVCodec libfaad2_decoder = {
802 + .name = "AAC_LATM",
803 + .type = CODEC_TYPE_AUDIO,
804 + .id = CODEC_ID_AAC_LATM,
805 + .priv_data_size = sizeof (FAACContext),
806 + .init = faac_decode_init,
807 + .close = faac_decode_end,
808 + .decode = faac_decode_frame,
809 + .long_name = "AAC over LATM",
812 diff -Naur ffmpeg.orig/libavformat/mpeg.c ffmpeg/libavformat/mpeg.c
813 --- ffmpeg.orig/libavformat/mpeg.c 2008-10-02 12:03:00.000000000 -0400
814 +++ ffmpeg/libavformat/mpeg.c 2009-02-21 08:25:13.000000000 -0500
816 /* find matching stream */
817 if (!((startcode >= 0x1c0 && startcode <= 0x1df) ||
818 (startcode >= 0x1e0 && startcode <= 0x1ef) ||
819 - (startcode == 0x1bd) || (startcode == 0x1fd)))
820 + (startcode == 0x1bd) || (startcode == 0x1fa) || (startcode == 0x1fd)))
823 *ppos = url_ftell(s->pb) - 4;
825 } else if(es_type == STREAM_TYPE_AUDIO_AAC){
826 codec_id = CODEC_ID_AAC;
827 type = CODEC_TYPE_AUDIO;
828 + } else if(es_type == STREAM_TYPE_AUDIO_AAC_LATM){
829 + codec_id = CODEC_ID_AAC_LATM;
830 + type = CODEC_TYPE_AUDIO;
831 } else if(es_type == STREAM_TYPE_VIDEO_MPEG4){
832 codec_id = CODEC_ID_MPEG4;
833 type = CODEC_TYPE_VIDEO;
834 diff -Naur ffmpeg.orig/libavformat/mpeg.h ffmpeg/libavformat/mpeg.h
835 --- ffmpeg.orig/libavformat/mpeg.h 2008-08-31 03:39:47.000000000 -0400
836 +++ ffmpeg/libavformat/mpeg.h 2009-02-21 08:25:13.000000000 -0500
838 #define STREAM_TYPE_PRIVATE_DATA 0x06
839 #define STREAM_TYPE_AUDIO_AAC 0x0f
840 #define STREAM_TYPE_VIDEO_MPEG4 0x10
841 +#define STREAM_TYPE_AUDIO_AAC_LATM 0x11
842 #define STREAM_TYPE_VIDEO_H264 0x1b
844 #define STREAM_TYPE_AUDIO_AC3 0x81
845 diff -Naur ffmpeg.orig/libavformat/mpegts.c ffmpeg/libavformat/mpegts.c
846 --- ffmpeg.orig/libavformat/mpegts.c 2008-10-02 12:28:58.000000000 -0400
847 +++ ffmpeg/libavformat/mpegts.c 2009-02-21 08:25:13.000000000 -0500
849 case STREAM_TYPE_VIDEO_VC1:
850 case STREAM_TYPE_VIDEO_DIRAC:
851 case STREAM_TYPE_AUDIO_AAC:
852 + case STREAM_TYPE_AUDIO_AAC_LATM:
853 case STREAM_TYPE_AUDIO_AC3:
854 case STREAM_TYPE_AUDIO_DTS:
855 case STREAM_TYPE_AUDIO_HDMV_DTS:
857 code = pes->header[3] | 0x100;
858 if (!((code >= 0x1c0 && code <= 0x1df) ||
859 (code >= 0x1e0 && code <= 0x1ef) ||
860 - (code == 0x1bd) || (code == 0x1fd)))
861 + (code == 0x1bd) || (code == 0x1fa) || (code == 0x1fd)))
864 /* allocate stream */
866 codec_type = CODEC_TYPE_AUDIO;
867 codec_id = CODEC_ID_AAC;
869 + case STREAM_TYPE_AUDIO_AAC_LATM:
870 + codec_type = CODEC_TYPE_AUDIO;
871 + codec_id = CODEC_ID_AAC_LATM;
873 case STREAM_TYPE_AUDIO_AC3:
874 codec_type = CODEC_TYPE_AUDIO;
875 codec_id = CODEC_ID_AC3;
876 diff -Naur ffmpeg.orig/libavformat/mpegts.h ffmpeg/libavformat/mpegts.h
877 --- ffmpeg.orig/libavformat/mpegts.h 2008-08-31 03:39:47.000000000 -0400
878 +++ ffmpeg/libavformat/mpegts.h 2009-02-21 08:25:13.000000000 -0500
880 #define STREAM_TYPE_PRIVATE_DATA 0x06
881 #define STREAM_TYPE_AUDIO_AAC 0x0f
882 #define STREAM_TYPE_VIDEO_MPEG4 0x10
883 +#define STREAM_TYPE_AUDIO_AAC_LATM 0x11
884 #define STREAM_TYPE_VIDEO_H264 0x1b
885 #define STREAM_TYPE_VIDEO_VC1 0xea
886 #define STREAM_TYPE_VIDEO_DIRAC 0xd1