1 diff -Naur ffmpeg-r19067.orig/libavcodec/Makefile ffmpeg-r19067/libavcodec/Makefile
2 --- ffmpeg-r19067.orig/libavcodec/Makefile 2009-05-25 18:19:35.000000000 -0400
3 +++ ffmpeg-r19067/libavcodec/Makefile 2009-06-01 12:39:48.000000000 -0400
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_LIBOPENJPEG) += libopenjpeg.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-r19067.orig/libavcodec/allcodecs.c ffmpeg-r19067/libavcodec/allcodecs.c
23 --- ffmpeg-r19067.orig/libavcodec/allcodecs.c 2009-05-12 15:56:48.000000000 -0400
24 +++ ffmpeg-r19067/libavcodec/allcodecs.c 2009-06-01 12:39:48.000000000 -0400
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-r19067.orig/libavcodec/avcodec.h ffmpeg-r19067/libavcodec/avcodec.h
42 --- ffmpeg-r19067.orig/libavcodec/avcodec.h 2009-05-31 02:51:18.000000000 -0400
43 +++ ffmpeg-r19067/libavcodec/avcodec.h 2009-06-01 12:39:48.000000000 -0400
45 CODEC_ID_MP2= 0x15000,
46 CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
52 diff -Naur ffmpeg-r19067.orig/libavcodec/latm_parser.c ffmpeg-r19067/libavcodec/latm_parser.c
53 --- ffmpeg-r19067.orig/libavcodec/latm_parser.c 1969-12-31 19:00:00.000000000 -0500
54 +++ ffmpeg-r19067/libavcodec/latm_parser.c 2009-06-01 12:39:48.000000000 -0400
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-r19067.orig/libavcodec/latmaac.c ffmpeg-r19067/libavcodec/latmaac.c
185 --- ffmpeg-r19067.orig/libavcodec/latmaac.c 1969-12-31 19:00:00.000000000 -0500
186 +++ ffmpeg-r19067/libavcodec/latmaac.c 2009-06-01 12:39:48.000000000 -0400
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 "get_bits.h"
221 +#include "put_bits.h"
222 +#include "mpeg4audio.h"
223 +#include "neaacdec.h"
225 +#define min(a,b) ((a)<(b) ? (a) : (b))
229 + Note: This decoder filter is intended to decode LATM streams transferred
230 + in MPEG transport streams which are only supposed to contain one program.
231 + To do a more complex LATM demuxing a separate LATM demuxer should be used.
234 +#define AAC_NONE 0 // mode not detected (or indicated in mediatype)
235 +#define AAC_LATM 1 // LATM packets (ISO/IEC 14496-3 1.7.3 Multiplex layer)
237 +#define SYNC_LATM 0x2b7 // 11 bits
239 +#define MAX_SIZE 8*1024
241 +typedef struct AACConfig
243 + uint8_t extra[64]; // should be way enough
246 + int audioObjectType;
247 + int samplingFrequencyIndex;
248 + int samplingFrequency;
249 + int channelConfiguration;
253 +typedef struct AACParser
256 + uint8_t frameLengthType;
257 + uint16_t muxSlotLengthBytes;
259 + uint8_t audio_mux_version;
260 + uint8_t audio_mux_version_A;
262 + uint8_t config_crc;
263 + int64_t other_data_bits;
266 + int offset; // byte offset in "buf" buffer
267 + uint8_t buf[MAX_SIZE]; // allocated buffer
268 + int count; // number of bytes written in buffer
271 +typedef struct AACDecoder
274 + faacDecHandle aac_decoder;
276 + uint32_t in_samplerate;
277 + uint8_t in_channels;
281 + AACDecoder* decoder;
284 +static inline int64_t latm_get_value(GetBitContext *b)
286 + uint8_t bytesForValue = get_bits(b, 2);
289 + for (i=0; i<=bytesForValue; i++) {
291 + value |= get_bits(b, 8);
296 +static void readGASpecificConfig(struct AACConfig *cfg, GetBitContext *b, PutBitContext *o)
298 + int framelen_flag = get_bits(b, 1);
299 + put_bits(o, 1, framelen_flag);
300 + int dependsOnCoder = get_bits(b, 1);
301 + put_bits(o, 1, dependsOnCoder);
306 + if (dependsOnCoder) {
307 + delay = get_bits(b, 14);
308 + put_bits(o, 14, delay);
310 + ext_flag = get_bits(b, 1);
311 + put_bits(o, 1, ext_flag);
312 + if (!cfg->channelConfiguration) {
313 + // program config element
317 + if (cfg->audioObjectType == 6 || cfg->audioObjectType == 20) {
318 + layerNr = get_bits(b, 3);
319 + put_bits(o, 3, layerNr);
322 + if (cfg->audioObjectType == 22) {
323 + skip_bits(b, 5); // numOfSubFrame
324 + skip_bits(b, 11); // layer_length
326 + put_bits(o, 16, 0);
328 + if (cfg->audioObjectType == 17 ||
329 + cfg->audioObjectType == 19 ||
330 + cfg->audioObjectType == 20 ||
331 + cfg->audioObjectType == 23) {
333 + skip_bits(b, 3); // stuff
337 + skip_bits(b, 1); // extflag3
342 +static int readAudioSpecificConfig(struct AACConfig *cfg, GetBitContext *b)
345 + init_put_bits(&o, cfg->extra, sizeof(cfg->extra));
347 + // returns the number of bits read
349 + int sbr_present = -1;
352 + cfg->audioObjectType = get_bits(b, 5);
353 + put_bits(&o, 5, cfg->audioObjectType);
354 + if (cfg->audioObjectType == 31) {
355 + uint8_t n = get_bits(b, 6);
356 + put_bits(&o, 6, n);
357 + cfg->audioObjectType = 32 + n;
360 + cfg->samplingFrequencyIndex = get_bits(b, 4);
361 + cfg->samplingFrequency = ff_mpeg4audio_sample_rates[cfg->samplingFrequencyIndex];
362 + put_bits(&o, 4, cfg->samplingFrequencyIndex);
363 + if (cfg->samplingFrequencyIndex == 0x0f) {
364 + uint32_t f = get_bits_long(b, 24);
365 + put_bits(&o, 24, f);
366 + cfg->samplingFrequency = f;
368 + cfg->channelConfiguration = get_bits(b, 4);
369 + put_bits(&o, 4, cfg->channelConfiguration);
370 + cfg->channels = ff_mpeg4audio_channels[cfg->channelConfiguration];
372 + if (cfg->audioObjectType == 5) {
375 + // TODO: parsing !!!!!!!!!!!!!!!!
378 + switch (cfg->audioObjectType) {
391 + readGASpecificConfig(cfg, b, &o);
395 + if (sbr_present == -1) {
396 + if (cfg->samplingFrequency <= 24000) {
397 + cfg->samplingFrequency *= 2;
401 + // count the extradata
402 + ret = put_bits_count(&o);
403 + align_put_bits(&o);
404 + flush_put_bits(&o);
405 + cfg->extrasize = (ret + 7) >> 3;
409 +static void readStreamMuxConfig(struct AACParser *parser, GetBitContext *b)
411 + parser->audio_mux_version_A = 0;
412 + parser->audio_mux_version = get_bits(b, 1);
413 + if (parser->audio_mux_version == 1) { // audioMuxVersion
414 + parser->audio_mux_version_A = get_bits(b, 1);
417 + if (parser->audio_mux_version_A == 0) {
418 + if (parser->audio_mux_version == 1) {
419 + parser->taraFullness = latm_get_value(b);
421 + get_bits(b, 1); // allStreamSameTimeFraming = 1
422 + get_bits(b, 6); // numSubFrames = 0
423 + get_bits(b, 4); // numPrograms = 0
425 + // for each program
426 + get_bits(b, 3); // numLayer = 0
429 + if (parser->audio_mux_version == 0) {
430 + // audio specific config.
431 + readAudioSpecificConfig(&parser->config, b);
433 + int ascLen = latm_get_value(b);
434 + ascLen -= readAudioSpecificConfig(&parser->config, b);
437 + while (ascLen > 16) {
441 + skip_bits(b, ascLen);
444 + // these are not needed... perhaps
445 + int frame_length_type = get_bits(b, 3);
446 + parser->frameLengthType = frame_length_type;
447 + if (frame_length_type == 0) {
449 + } else if (frame_length_type == 1) {
451 + } else if (frame_length_type == 3 ||
452 + frame_length_type == 4 ||
453 + frame_length_type == 5) {
454 + int celp_table_index = get_bits(b, 6);
455 + } else if (frame_length_type == 6 ||
456 + frame_length_type == 7) {
457 + int hvxc_table_index = get_bits(b, 1);
461 + parser->other_data_bits = 0;
462 + if (get_bits(b, 1)) {
463 + // other data present
464 + if (parser->audio_mux_version == 1) {
465 + parser->other_data_bits = latm_get_value(b);
467 + // other data not present
468 + parser->other_data_bits = 0;
471 + parser->other_data_bits <<= 8;
472 + esc = get_bits(b, 1);
473 + tmp = get_bits(b, 8);
474 + parser->other_data_bits |= tmp;
480 + if (get_bits(b, 1)) {
481 + parser->config_crc = get_bits(b, 8);
488 +static void readPayloadLengthInfo(struct AACParser *parser, GetBitContext *b)
491 + if (parser->frameLengthType == 0) {
492 + parser->muxSlotLengthBytes = 0;
494 + tmp = get_bits(b, 8);
495 + parser->muxSlotLengthBytes += tmp;
496 + } while (tmp == 255);
498 + if (parser->frameLengthType == 5 ||
499 + parser->frameLengthType == 7 ||
500 + parser->frameLengthType == 3) {
506 +static void readAudioMuxElement(struct AACParser *parser, GetBitContext *b, uint8_t *payload, int *payloadsize)
508 + uint8_t use_same_mux = get_bits(b, 1);
509 + if (!use_same_mux) {
510 + readStreamMuxConfig(parser, b);
513 + if (parser->audio_mux_version_A == 0) {
516 + readPayloadLengthInfo(parser, b);
519 + for (j=0; j<parser->muxSlotLengthBytes; j++) {
520 + *payload++ = get_bits(b, 8);
522 + *payloadsize = parser->muxSlotLengthBytes;
524 + // ignore otherdata
530 +static int readAudioSyncStream(struct AACParser *parser, GetBitContext *b, int size, uint8_t *payload, int *payloadsize)
532 + // ISO/IEC 14496-3 Table 1.28 - Syntax of AudioMuxElement()
533 + if (get_bits(b, 11) != 0x2b7) return -1; // not LATM
534 + int muxlength = get_bits(b, 13);
536 + if (3+muxlength > size) return 0; // not enough data
538 + readAudioMuxElement(parser, b, payload, payloadsize);
540 + // we don't parse anything else here...
541 + return (3+muxlength);
545 +static void flush_buf(struct AACParser *parser, int offset) {
546 + int bytes_to_flush = min(parser->count, offset);
547 + int left = (parser->count - bytes_to_flush);
549 + if (bytes_to_flush > 0) {
551 + memcpy(parser->buf, parser->buf+bytes_to_flush, left);
552 + parser->count = left;
559 +static struct AACParser *latm_create_parser()
561 + struct AACParser *parser = (struct AACParser *)av_malloc(sizeof(struct AACParser));
562 + memset(parser, 0, sizeof(struct AACParser));
566 +static void latm_destroy_parser(struct AACParser *parser)
571 +static void latm_flush(struct AACParser *parser)
573 + parser->offset = 0;
577 +static void latm_write_data(struct AACParser *parser, uint8_t *data, int len)
579 + // buffer overflow check... just ignore the data before
580 + if (parser->count + len > MAX_SIZE) {
581 + flush_buf(parser, parser->offset);
582 + parser->offset = 0;
583 + if (parser->count + len > MAX_SIZE) {
584 + int to_flush = (parser->count+len) - MAX_SIZE;
585 + flush_buf(parser, to_flush);
590 + memcpy(parser->buf+parser->count, data, len);
591 + parser->count += len;
594 +static int latm_parse_packet(struct AACParser *parser, uint8_t *data, int maxsize)
597 + Return value is either number of bytes parsed or
599 + 0 = need more data.
602 + uint8_t *start = parser->buf + parser->offset;
603 + int bytes = parser->count - parser->offset;
605 + init_get_bits(&b, start, bytes);
607 + if (parser->mode == AAC_LATM) {
609 + int ret = readAudioSyncStream(parser, &b, bytes, data, &outsize);
611 + if (ret < 0) return -1;
612 + if (ret == 0) return 0;
614 + // update the offset
615 + parser->offset += ret;
619 + // check for syncwords
620 + while (bytes > 2) {
621 + if (show_bits(&b, 11) == SYNC_LATM) {
622 + // we must parse config first...
625 + // check if there is a complete packet available...
626 + int ret = readAudioSyncStream(parser, &b, bytes, data, &outsize);
627 + if (ret < 0) return -1;
628 + if (ret == 0) return 0;
629 + parser->offset += ret;
631 + parser->mode = AAC_LATM;
641 +static void aac_filter_close(AACDecoder *decoder)
643 + if (decoder->aac_decoder) {
644 + NeAACDecClose(decoder->aac_decoder);
645 + decoder->aac_decoder = NULL;
650 +static int aac_decoder_open(AACDecoder *decoder)
652 + if (decoder->aac_decoder) return 0;
654 + decoder->aac_decoder = NeAACDecOpen();
655 + if (!decoder->aac_decoder) return -1;
657 + // are we going to initialize from decoder specific info ?
658 + if (decoder->parser->config.extrasize > 0) {
659 + char ret = NeAACDecInit2(decoder->aac_decoder, (unsigned char*)decoder->parser->config.extra, decoder->parser->config.extrasize, &decoder->in_samplerate, &decoder->in_channels);
661 + aac_filter_close(decoder); // gone wrong ?
666 + // we'll open the decoder later...
672 +AACDecoder *aac_filter_create()
674 + AACDecoder *decoder = (AACDecoder *)av_malloc(sizeof(AACDecoder));
675 + decoder->parser = latm_create_parser();
676 + decoder->aac_decoder = NULL;
678 + return (void *)decoder;
681 +void aac_filter_destroy(AACDecoder *decoder)
683 + aac_filter_close(decoder);
684 + latm_destroy_parser(decoder->parser);
688 +int aac_filter_receive(AACDecoder *decoder, void *out, int *out_size, uint8_t *data, int size)
690 + uint8_t tempbuf[32*1024];
692 + int consumed = size;
694 + int max_size = *out_size;
698 + //-------------------------------------------------------------------------
699 + // Multiplex Parsing
700 + //-------------------------------------------------------------------------
702 + latm_write_data(decoder->parser, data, size);
705 + ret = latm_parse_packet(decoder->parser, tempbuf, sizeof(tempbuf));
707 + latm_flush(decoder->parser);
710 + if (ret == 0) return consumed;
715 + //-------------------------------------------------------------------------
716 + // Initialize decoder (if necessary)
717 + //-------------------------------------------------------------------------
718 + if (!decoder->open) {
719 + aac_filter_close(decoder);
720 + if (decoder->parser->mode == AAC_LATM) {
721 + ret = aac_decoder_open(decoder);
722 + if (ret < 0) return consumed;
725 + if(!decoder->open) return consumed;
728 + //-------------------------------------------------------------------------
730 + //-------------------------------------------------------------------------
731 + NeAACDecFrameInfo info;
732 + void *buf = NeAACDecDecode(decoder->aac_decoder, &info, data, size);
735 + decoder->in_samplerate = info.samplerate;
736 + decoder->in_channels = info.channels;
738 + //---------------------------------------------------------------------
739 + // Deliver decoded samples
740 + //---------------------------------------------------------------------
742 + // kram dekoduje 16-bit. my vypustame 16-bit. takze by to malo byt okej
743 + decoded = info.samples * sizeof(short);
745 + // napraskame tam sample
746 + *out_size += decoded;
747 + if(*out_size > max_size) {
748 + av_log(NULL, AV_LOG_ERROR, "overflow!\n");
750 + memcpy(out, buf, decoded);
751 + out = (unsigned char *)out + decoded;
758 + } while (1); // decode all packets
762 +void aac_filter_getinfo(AACDecoder *decoder, int *sample_rate, int *channels)
764 + if(!decoder->open) return;
765 + *sample_rate = decoder->in_samplerate;
766 + *channels = decoder->in_channels;
769 +static int faac_decode_init(AVCodecContext *avctx)
771 + FAACContext *s = avctx->priv_data;
772 + avctx->frame_size = 360;
773 + avctx->sample_rate = 48000;
774 + avctx->channels = 2;
775 + avctx->bit_rate = 8192 * 8 * avctx->sample_rate / avctx->frame_size;
776 + s->decoder = aac_filter_create();
780 +static int faac_decode_frame(AVCodecContext *avctx,
781 + void *data, int *data_size,
784 + FAACContext *s = avctx->priv_data;
787 + if (s->decoder == NULL) faac_decode_init(avctx);
788 + ret = aac_filter_receive(s->decoder, data, data_size, avpkt->data, avpkt->size);
789 + aac_filter_getinfo(s->decoder, &(avctx->sample_rate), &(avctx->channels));
793 +static int faac_decode_end(AVCodecContext *avctx)
795 + FAACContext *s = avctx->priv_data;
796 + if(s->decoder != NULL) {
797 + aac_filter_destroy(s->decoder);
802 +AVCodec libfaad2_decoder = {
803 + .name = "AAC_LATM",
804 + .type = CODEC_TYPE_AUDIO,
805 + .id = CODEC_ID_AAC_LATM,
806 + .priv_data_size = sizeof (FAACContext),
807 + .init = faac_decode_init,
808 + .close = faac_decode_end,
809 + .decode = faac_decode_frame,
810 + .long_name = "AAC over LATM",
812 diff -Naur ffmpeg-r19067.orig/libavformat/mpeg.c ffmpeg-r19067/libavformat/mpeg.c
813 --- ffmpeg-r19067.orig/libavformat/mpeg.c 2009-04-17 14:08:39.000000000 -0400
814 +++ ffmpeg-r19067/libavformat/mpeg.c 2009-06-01 12:39:48.000000000 -0400
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-r19067.orig/libavformat/mpeg.h ffmpeg-r19067/libavformat/mpeg.h
835 --- ffmpeg-r19067.orig/libavformat/mpeg.h 2009-01-19 10:46:40.000000000 -0500
836 +++ ffmpeg-r19067/libavformat/mpeg.h 2009-06-01 12:39:48.000000000 -0400
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-r19067.orig/libavformat/mpegts.c ffmpeg-r19067/libavformat/mpegts.c
846 --- ffmpeg-r19067.orig/libavformat/mpegts.c 2009-05-31 04:47:40.000000000 -0400
847 +++ ffmpeg-r19067/libavformat/mpegts.c 2009-06-01 12:39:48.000000000 -0400
849 { 0x04, CODEC_TYPE_AUDIO, CODEC_ID_MP3 },
850 { 0x0f, CODEC_TYPE_AUDIO, CODEC_ID_AAC },
851 { 0x10, CODEC_TYPE_VIDEO, CODEC_ID_MPEG4 },
852 + { 0x11, CODEC_TYPE_AUDIO, CODEC_ID_AAC_LATM },
853 { 0x1b, CODEC_TYPE_VIDEO, CODEC_ID_H264 },
854 { 0xd1, CODEC_TYPE_VIDEO, CODEC_ID_DIRAC },
855 { 0xea, CODEC_TYPE_VIDEO, CODEC_ID_VC1 },
857 if (pes->st->discard == AVDISCARD_ALL ||
858 !((code >= 0x1c0 && code <= 0x1df) ||
859 (code >= 0x1e0 && code <= 0x1ef) ||
860 - (code == 0x1bd) || (code == 0x1fd)))
861 + (code == 0x1bd) || (code == 0x1fa) || (code == 0x1fd)))
863 pes->state = MPEGTS_PESHEADER_FILL;
864 pes->total_size = AV_RB16(pes->header + 4);
865 diff -Naur ffmpeg-r19067.orig/libavformat/mpegts.h ffmpeg-r19067/libavformat/mpegts.h
866 --- ffmpeg-r19067.orig/libavformat/mpegts.h 2009-05-30 23:02:12.000000000 -0400
867 +++ ffmpeg-r19067/libavformat/mpegts.h 2009-06-01 12:39:48.000000000 -0400
869 #define STREAM_TYPE_PRIVATE_DATA 0x06
870 #define STREAM_TYPE_AUDIO_AAC 0x0f
871 #define STREAM_TYPE_VIDEO_MPEG4 0x10
872 +#define STREAM_TYPE_AUDIO_AAC_LATM 0x11
873 #define STREAM_TYPE_VIDEO_H264 0x1b
874 #define STREAM_TYPE_VIDEO_VC1 0xea
875 #define STREAM_TYPE_VIDEO_DIRAC 0xd1