Ticket #9064: mythtv_aac_latm_ffmpeg_3.diff

File mythtv_aac_latm_ffmpeg_3.diff, 21.3 KB (added by Janne Grunau, 16 years ago)
  • mythtv/configure

    diff --git a/mythtv/configure b/mythtv/configure
    index ee4f386..48b1d81 100755
    a b rdft_select="fft"  
    14711471# decoders / encoders / hardware accelerators
    14721472aac_decoder_select="mdct rdft"
    14731473aac_encoder_select="mdct"
     1474aac_latm_decoder_select="aac_decoder"
    14741475ac3_decoder_select="mdct ac3_parser"
    14751476alac_encoder_select="lpc"
    14761477amrnb_decoder_select="lsp"
  • mythtv/external/FFmpeg/libavcodec/Makefile

    diff --git a/mythtv/external/FFmpeg/libavcodec/Makefile b/mythtv/external/FFmpeg/libavcodec/Makefile
    index 1b5d628..0d6ab83 100644
    a b OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \  
    6161                                          aacpsy.o aactab.o      \
    6262                                          psymodel.o iirfilter.o \
    6363                                          mpeg4audio.o
     64OBJS-$(CONFIG_AAC_LATM_DECODER)        += aaclatmdec.o
    6465OBJS-$(CONFIG_AASC_DECODER)            += aasc.o msrledec.o
    6566OBJS-$(CONFIG_AC3_DECODER)             += ac3dec.o ac3dec_data.o ac3.o
    6667OBJS-$(CONFIG_AC3_ENCODER)             += ac3enc.o ac3tab.o ac3.o
    OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264.o \  
    583584                                          h264_loopfilter.o h264_cabac.o \
    584585                                          h264_cavlc.o h264_ps.o \
    585586                                          mpegvideo.o error_resilience.o
     587OBJS-$(CONFIG_AAC_LATM_PARSER)         += latm_parser.o
    586588OBJS-$(CONFIG_MJPEG_PARSER)            += mjpeg_parser.o
    587589OBJS-$(CONFIG_MLP_PARSER)              += mlp_parser.o mlp.o
    588590OBJS-$(CONFIG_MPEG4VIDEO_PARSER)       += mpeg4video_parser.o h263.o \
  • new file mythtv/external/FFmpeg/libavcodec/aaclatmdec.c

    diff --git a/mythtv/external/FFmpeg/libavcodec/aaclatmdec.c b/mythtv/external/FFmpeg/libavcodec/aaclatmdec.c
    new file mode 100644
    index 0000000..47057e4
    - +  
     1/*
     2 * AAC LATM decoder
     3 * Copyright (c) 2008-2010 Paul Kendall <paul@kcbbs.gen.nz>
     4 * Copyright (c) 2010      Janne Grunau <janne-ffmpeg@jannau.net>
     5 *
     6 * This file is part of FFmpeg.
     7 *
     8 * FFmpeg is free software; you can redistribute it and/or
     9 * modify it under the terms of the GNU Lesser General Public
     10 * License as published by the Free Software Foundation; either
     11 * version 2.1 of the License, or (at your option) any later version.
     12 *
     13 * FFmpeg is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16 * Lesser General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU Lesser General Public
     19 * License along with FFmpeg; if not, write to the Free Software
     20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
     21 */
     22
     23/**
     24 * @file
     25 * AAC LATM decoder
     26 * @author Paul Kendall <paul@kcbbs.gen.nz>
     27 * @author Janne Grunau <janne-ffmpeg@jannau.net>
     28 */
     29
     30/*
     31    Note: This decoder filter is intended to decode LATM streams transferred
     32    in MPEG transport streams which only contain one program.
     33    To do a more complex LATM demuxing a separate LATM demuxer should be used.
     34*/
     35
     36#include "get_bits.h"
     37#include "dsputil.h"
     38
     39#include "aac.h"
     40#include "aacdectab.h"
     41#include "mpeg4audio.h"
     42
     43#include <assert.h>
     44
     45#define LOAS_SYNC_WORD   0x2b7       // 11 bits
     46#define MAX_SIZE         8*1024
     47
     48struct LATMContext
     49{
     50    AACContext      aac_ctx;
     51    AVCodec        *aac_codec;
     52    uint8_t         initialized;
     53
     54    // parser data
     55    uint8_t         audio_mux_version_A;
     56    uint8_t         same_time_framing;
     57    uint8_t         frame_length_type;
     58    uint32_t        frame_length;
     59};
     60
     61static inline int64_t latm_get_value(GetBitContext *b)
     62{
     63    uint8_t bytesForValue = get_bits(b, 2);
     64    int64_t value = 0;
     65    int i;
     66    for (i=0; i<=bytesForValue; i++) {
     67        value <<= 8;
     68        value |= get_bits(b, 8);
     69    }
     70    return value;
     71}
     72
     73// copied from libavcodec/mpeg4audio.c
     74static av_always_inline unsigned int copy_bits(PutBitContext *pb,
     75                                               GetBitContext *gb, int bits)
     76{
     77    unsigned int el = get_bits(gb, bits);
     78    put_bits(pb, bits, el);
     79    return el;
     80}
     81
     82static void latm_read_ga_specific_config(int audio_object_type,
     83                                         MPEG4AudioConfig *c,
     84                                         GetBitContext *gb, PutBitContext *pb)
     85{
     86    int ext_flag;
     87
     88    copy_bits(pb, gb, 1);                        // framelen_flag
     89    if (copy_bits(pb, gb, 1))                    // depends_on_coder
     90        copy_bits(pb, gb, 14);                   // delay
     91    ext_flag = copy_bits(pb, gb, 1);
     92
     93    if (!c->chan_config)
     94        ff_copy_pce_data(pb, gb);                // program_config_element
     95
     96    if (audio_object_type == AOT_AAC_SCALABLE ||
     97        audio_object_type == AOT_ER_AAC_SCALABLE)
     98        copy_bits(pb, gb, 3);                    // layer number
     99
     100    if (!ext_flag)
     101        return;
     102
     103    if (audio_object_type == AOT_ER_BSAC) {
     104        copy_bits(pb, gb, 5);                    // numOfSubFrame
     105        copy_bits(pb, gb, 11);                   // layer_length
     106    } else if (audio_object_type == AOT_ER_AAC_LC ||
     107               audio_object_type == AOT_ER_AAC_LTP ||
     108               audio_object_type == AOT_ER_AAC_SCALABLE ||
     109               audio_object_type == AOT_ER_AAC_LD)
     110        copy_bits(pb, gb, 3);                    // stuff
     111    copy_bits(pb, gb, 1);                        // extflag3
     112}
     113
     114static int latm_read_audio_specific_config(GetBitContext *gb,
     115                                           PutBitContext *pb)
     116{
     117    int num_bits=0;
     118    int audio_object_type;
     119
     120    MPEG4AudioConfig b, *c;
     121    c = &b;
     122
     123    c->sbr = -1;
     124
     125    audio_object_type = copy_bits(pb, gb, 5);
     126    if (audio_object_type == AOT_ESCAPE) {
     127        audio_object_type = AOT_ESCAPE + copy_bits(pb, gb, 6) + 1;
     128    }
     129    c->object_type = audio_object_type;
     130
     131    c->sampling_index = copy_bits(pb, gb, 4);
     132    c->sample_rate = ff_mpeg4audio_sample_rates[c->sampling_index];
     133    if (c->sampling_index == 0x0f) {
     134        c->sample_rate = copy_bits(pb, gb, 24);
     135    }
     136    c->chan_config = copy_bits(pb, gb, 4);
     137
     138    if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels))
     139        c->channels = ff_mpeg4audio_channels[c->chan_config];
     140
     141    if (audio_object_type == AOT_AAC_MAIN ||
     142        audio_object_type == AOT_AAC_LC ||
     143        audio_object_type == AOT_AAC_SSR ||
     144        audio_object_type == AOT_AAC_LTP ||
     145        audio_object_type == AOT_AAC_SCALABLE ||
     146        audio_object_type == AOT_TWINVQ) {
     147        latm_read_ga_specific_config(audio_object_type, c, gb, pb);
     148    } else if (audio_object_type == AOT_SBR) {
     149        c->sbr = 1;
     150        c->ext_sampling_index = copy_bits(pb, gb, 4);
     151        c->ext_sample_rate = ff_mpeg4audio_sample_rates[c->ext_sampling_index];
     152        if (c->ext_sampling_index == 0x0f) {
     153            c->ext_sample_rate = copy_bits(pb, gb, 24);
     154        }
     155        c->object_type = copy_bits(pb, gb, 5);
     156    } else if (audio_object_type >= AOT_ER_AAC_LC) {
     157        latm_read_ga_specific_config(audio_object_type, c, gb, pb);
     158        copy_bits(pb, gb, 2);                   // epConfig
     159    }
     160
     161    if (c->sbr == -1 && c->sample_rate <= 24000)
     162        c->sample_rate *= 2;
     163
     164    // count the extradata
     165    num_bits = put_bits_count(pb);
     166
     167    flush_put_bits(pb);
     168    return num_bits;
     169}
     170
     171static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
     172                                             GetBitContext *gb)
     173{
     174    PutBitContext pb;
     175    int32_t esize, bits_consumed;
     176    uint8_t extradata[32+FF_INPUT_BUFFER_PADDING_SIZE];
     177    AVCodecContext *avctx = latmctx->aac_ctx.avctx;
     178
     179    init_put_bits(&pb, extradata, 32 * 8);
     180
     181    bits_consumed = latm_read_audio_specific_config(gb, &pb);
     182
     183    if (bits_consumed < 0)
     184        return AVERROR_INVALIDDATA;
     185
     186    esize = (bits_consumed+7) / 8;
     187
     188    if (avctx->extradata_size != esize) {
     189        av_free(avctx->extradata);
     190        avctx->extradata = av_malloc(esize + FF_INPUT_BUFFER_PADDING_SIZE);
     191        if (!avctx->extradata)
     192            return AVERROR(ENOMEM);
     193
     194        avctx->extradata_size = esize;
     195        memcpy(avctx->extradata, extradata, esize);
     196        memset(avctx->extradata+esize, 0, FF_INPUT_BUFFER_PADDING_SIZE);
     197    }
     198
     199    return bits_consumed;
     200}
     201
     202static int read_stream_mux_config(struct LATMContext *latmctx,
     203                                  GetBitContext *gb)
     204{
     205    int ret, audio_mux_version = get_bits(gb, 1);
     206
     207    latmctx->audio_mux_version_A = 0;
     208    if (audio_mux_version)
     209        latmctx->audio_mux_version_A = get_bits(gb, 1);
     210
     211    if (!latmctx->audio_mux_version_A) {
     212
     213        if (audio_mux_version)
     214            latm_get_value(gb);                 // taraFullness
     215
     216        skip_bits(gb, 1);                       // allStreamSameTimeFraming
     217        skip_bits(gb, 6);                       // numSubFrames
     218        // numPrograms
     219        if (get_bits(gb, 4)) {                  // numPrograms
     220            av_log_missing_feature(latmctx->aac_ctx.avctx,
     221                                   "multiple programs are not supported\n", 1);
     222            return AVERROR_PATCHWELCOME;
     223        }
     224
     225        // for each program (which there is only on in DVB)
     226
     227        // for each layer (which there is only on in DVB)
     228        if (get_bits(gb, 3)) {                   // numLayer
     229            av_log_missing_feature(latmctx->aac_ctx.avctx,
     230                                   "multiple layers are not supported\n", 1);
     231            return AVERROR_PATCHWELCOME;
     232        }
     233
     234        // for all but first stream: use_same_config = get_bits(gb, 1);
     235        if (!audio_mux_version) {
     236            ret = latm_decode_audio_specific_config(latmctx, gb);
     237            if (ret < 0)
     238                return ret;
     239        } else {
     240            int ascLen = latm_get_value(gb);
     241            ret = latm_decode_audio_specific_config(latmctx, gb);
     242            if (ret < 0)
     243                return ret;
     244            ascLen -= ret;
     245            skip_bits_long(gb, ascLen);
     246        }
     247
     248        latmctx->frame_length_type = get_bits(gb, 3);
     249        switch (latmctx->frame_length_type) {
     250            case 0:
     251                skip_bits(gb, 8);       // latmBufferFullness
     252                break;
     253            case 1:
     254                latmctx->frame_length = get_bits(gb, 9);
     255                break;
     256            case 3:
     257            case 4:
     258            case 5:
     259                skip_bits(gb, 6);       // CELP frame length table index
     260                break;
     261            case 6:
     262            case 7:
     263                skip_bits(gb, 1);       // HVXC frame length table index
     264                break;
     265        }
     266
     267        if (get_bits(gb, 1)) {                  // other data
     268            if (audio_mux_version) {
     269                latm_get_value(gb);             // other_data_bits
     270            } else {
     271                int esc;
     272                do {
     273                    esc = get_bits(gb, 1);
     274                    skip_bits(gb, 8);
     275                } while (esc);
     276            }
     277        }
     278
     279        if (get_bits(gb, 1))                     // crc present
     280            skip_bits(gb, 8);                    // config_crc
     281    }
     282
     283    return 0;
     284}
     285
     286static int read_payload_length_info(struct LATMContext *ctx, GetBitContext *gb)
     287{
     288    uint8_t tmp;
     289
     290    if (ctx->frame_length_type == 0) {
     291        int mux_slot_length = 0;
     292        do {
     293            tmp = get_bits(gb, 8);
     294            mux_slot_length += tmp;
     295        } while (tmp == 255);
     296        return mux_slot_length;
     297    } else if (ctx->frame_length_type == 1) {
     298        return ctx->frame_length;
     299    } else if (ctx->frame_length_type == 3 ||
     300               ctx->frame_length_type == 5 ||
     301               ctx->frame_length_type == 7) {
     302        skip_bits(gb, 2);          // mux_slot_length_coded
     303    }
     304    return 0;
     305}
     306
     307static int read_audio_mux_element(struct LATMContext *latmctx,
     308                                  GetBitContext *b,
     309                                  uint8_t *payload, int *payloadsize)
     310{
     311    uint8_t use_same_mux = get_bits(b, 1);
     312    if (!use_same_mux) {
     313        read_stream_mux_config(latmctx, b);
     314    } else if (!latmctx->aac_ctx.avctx->extradata) {
     315        av_log(latmctx->aac_ctx.avctx, AV_LOG_DEBUG,
     316               "no decoder config found\n");
     317        return AVERROR(EAGAIN);
     318    }
     319    if (latmctx->audio_mux_version_A == 0) {
     320        int j;
     321        int mux_slot_length_bytes = read_payload_length_info(latmctx, b);
     322        mux_slot_length_bytes = FFMIN(mux_slot_length_bytes, *payloadsize);
     323        for (j=0; j<mux_slot_length_bytes; j++) {
     324            *payload++ = get_bits(b, 8);
     325        }
     326        *payloadsize = mux_slot_length_bytes;
     327    }
     328    return 0;
     329}
     330
     331static int read_audio_sync_stream(struct LATMContext *latmctx,
     332                                  GetBitContext *gb, int size,
     333                                  uint8_t *payload, int *payloadsize)
     334{
     335    int muxlength;
     336
     337    if (get_bits(gb, 11) != LOAS_SYNC_WORD)
     338        return AVERROR_INVALIDDATA;
     339
     340    muxlength = get_bits(gb, 13);
     341    // not enough data, the parser should have sorted this
     342    if (muxlength+3 > size)
     343        return AVERROR_INVALIDDATA;
     344
     345    read_audio_mux_element(latmctx, gb, payload, payloadsize);
     346
     347    return 0;
     348}
     349
     350
     351static int latm_decode_frame(AVCodecContext *avctx, void *out, int *out_size,
     352                             AVPacket *avpkt)
     353{
     354    struct LATMContext *latmctx = avctx->priv_data;
     355    uint8_t            *tmp, tmpbuf[MAX_SIZE];
     356    int                 ret, bufsize = MAX_SIZE;
     357    GetBitContext       gb;
     358
     359    if(avpkt->size == 0)
     360        return 0;
     361
     362    init_get_bits(&gb, avpkt->data, avpkt->size * 8);
     363
     364    ret = read_audio_sync_stream(latmctx, &gb, avpkt->size, tmpbuf, &bufsize);
     365    if (ret < 0)
     366        return ret;
     367
     368    if (!latmctx->initialized) {
     369        if (!avctx->extradata) {
     370            *out_size = 0;
     371            return avpkt->size;
     372        } else {
     373            assert(latmctx->aac_codec->init);
     374            ret = latmctx->aac_codec->init(avctx);
     375            if (ret < 0)
     376                return ret;
     377            latmctx->initialized = 1;
     378        }
     379    }
     380
     381    tmp         = avpkt->data;
     382    avpkt->data = tmpbuf;
     383    avpkt->size = bufsize;
     384
     385    assert(latmctx->aac_codec->decode);
     386    ret = latmctx->aac_codec->decode(avctx, out, out_size, avpkt);
     387    avpkt->data = tmp;
     388    return ret;
     389}
     390
     391static int latm_decode_init(AVCodecContext *avctx)
     392{
     393    struct LATMContext *latmctx = avctx->priv_data;
     394    int ret;
     395
     396    latmctx->aac_codec = avcodec_find_decoder_by_name("aac");
     397    if (!latmctx->aac_codec) {
     398        av_log(avctx, AV_LOG_ERROR, "AAC decoder is required by AAC LATM decoder.\n");
     399        return AVERROR(ENOSYS);
     400    }
     401
     402    assert(latmctx->aac_codec->init);
     403    ret = latmctx->aac_codec->init(avctx);
     404
     405    if (avctx->extradata_size > 0)
     406        latmctx->initialized = !ret;
     407    else
     408        latmctx->initialized = 0;
     409
     410    return ret;
     411}
     412
     413static int latm_decode_close(AVCodecContext *avctx)
     414{
     415    struct LATMContext *latmctx = avctx->priv_data;
     416    assert(latmctx->aac_codec->close);
     417    return latmctx->aac_codec->close(avctx);
     418}
     419
     420AVCodec aac_latm_decoder = {
     421    .name = "aac_latm",
     422    .type = CODEC_TYPE_AUDIO,
     423    .id   = CODEC_ID_AAC_LATM,
     424    .priv_data_size = sizeof(struct LATMContext),
     425    .init   = latm_decode_init,
     426    .close  = latm_decode_close,
     427    .decode = latm_decode_frame,
     428    .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM "
     429                                      "syntax)"),
     430    .sample_fmts = (const enum SampleFormat[]) {
     431        SAMPLE_FMT_S16,SAMPLE_FMT_NONE
     432    },
     433    .channel_layouts = aac_channel_layout,
     434};
  • mythtv/external/FFmpeg/libavcodec/allcodecs.c

    diff --git a/mythtv/external/FFmpeg/libavcodec/allcodecs.c b/mythtv/external/FFmpeg/libavcodec/allcodecs.c
    index f0f4edf..35ad09d 100644
    a b void avcodec_register_all(void)  
    220220
    221221    /* audio codecs */
    222222    REGISTER_ENCDEC  (AAC, aac);
     223    REGISTER_DECODER (AAC_LATM, aac_latm);
    223224    REGISTER_ENCDEC  (AC3, ac3);
    224225    REGISTER_ENCDEC  (ALAC, alac);
    225226    REGISTER_DECODER (ALS, als);
    void avcodec_register_all(void)  
    365366
    366367    /* parsers */
    367368    REGISTER_PARSER  (AAC, aac);
    368     REGISTER_PARSER  (LATM, latm);
     369    REGISTER_PARSER  (AAC_LATM, aac_latm);
    369370    REGISTER_PARSER  (AC3, ac3);
    370371    REGISTER_PARSER  (CAVSVIDEO, cavsvideo);
    371372    REGISTER_PARSER  (DCA, dca);
  • mythtv/external/FFmpeg/libavcodec/avcodec.h

    diff --git a/mythtv/external/FFmpeg/libavcodec/avcodec.h b/mythtv/external/FFmpeg/libavcodec/avcodec.h
    index 124dea5..0185b6c 100644
    a b enum CodecID {  
    293293    CODEC_ID_MP2= 0x15000,
    294294    CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
    295295    CODEC_ID_AAC,
    296     CODEC_ID_AAC_LATM,
    297296    CODEC_ID_AC3,
    298297    CODEC_ID_DTS,
    299298    CODEC_ID_VORBIS,
    enum CodecID {  
    343342    CODEC_ID_ATRAC1,
    344343    CODEC_ID_BINKAUDIO_RDFT,
    345344    CODEC_ID_BINKAUDIO_DCT,
     345    CODEC_ID_AAC_LATM,
    346346
    347347    /* subtitle codecs */
    348348    CODEC_ID_DVD_SUBTITLE= 0x17000,
  • new file mythtv/external/FFmpeg/libavcodec/latm_parser.c

    diff --git a/mythtv/external/FFmpeg/libavcodec/latm_parser.c b/mythtv/external/FFmpeg/libavcodec/latm_parser.c
    new file mode 100644
    index 0000000..48166cd
    - +  
     1/*
     2 * copyright (c) 2008 Paul Kendall <paul@kcbbs.gen.nz>
     3 *
     4 * This file is part of FFmpeg.
     5 *
     6 * FFmpeg is free software; you can redistribute it and/or
     7 * modify it under the terms of the GNU Lesser General Public
     8 * License as published by the Free Software Foundation; either
     9 * version 2.1 of the License, or (at your option) any later version.
     10 *
     11 * FFmpeg is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14 * Lesser General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU Lesser General Public
     17 * License along with FFmpeg; if not, write to the Free Software
     18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
     19 */
     20
     21/**
     22 * @file latm_parser.c
     23 * LATM parser
     24 */
     25
     26#include <stdio.h>
     27#include <stdlib.h>
     28#include <string.h>
     29#include <math.h>
     30#include <sys/types.h>
     31
     32#include "parser.h"
     33
     34#define LATM_HEADER     0x56e000        // 0x2b7 (11 bits)
     35#define LATM_MASK       0xFFE000        // top 11 bits
     36#define LATM_SIZE_MASK  0x001FFF        // bottom 13 bits
     37
     38typedef struct LATMParseContext{
     39    ParseContext pc;
     40    int count;
     41} LATMParseContext;
     42
     43/**
     44 * finds the end of the current frame in the bitstream.
     45 * @return the position of the first byte of the next frame, or -1
     46 */
     47static int latm_find_frame_end(AVCodecParserContext *s1, const uint8_t *buf,
     48                               int buf_size) {
     49    LATMParseContext *s = s1->priv_data;
     50    ParseContext *pc = &s->pc;
     51    int pic_found, i;
     52    uint32_t state;
     53
     54    pic_found = pc->frame_start_found;
     55    state = pc->state;
     56
     57    i = 0;
     58    if(!pic_found){
     59        for(i=0; i<buf_size; i++){
     60            state = (state<<8) | buf[i];
     61            if((state & LATM_MASK) == LATM_HEADER) {
     62                i++;
     63                s->count = - i;
     64                pic_found=1;
     65                break;
     66            }
     67        }
     68    }
     69
     70    if(pic_found){
     71        /* EOF considered as end of frame */
     72        if (buf_size == 0)
     73            return 0;
     74        if((state & LATM_SIZE_MASK) - s->count <= buf_size) {
     75            pc->frame_start_found = 0;
     76            pc->state = -1;
     77            return (state & LATM_SIZE_MASK) - s->count;
     78        }
     79    }
     80
     81    s->count += buf_size;
     82    pc->frame_start_found = pic_found;
     83    pc->state = state;
     84    return END_NOT_FOUND;
     85}
     86
     87static int latm_parse(AVCodecParserContext *s1,
     88                           AVCodecContext *avctx,
     89                           const uint8_t **poutbuf, int *poutbuf_size,
     90                           const uint8_t *buf, int buf_size)
     91{
     92    LATMParseContext *s = s1->priv_data;
     93    ParseContext *pc = &s->pc;
     94    int next;
     95
     96    if(s1->flags & PARSER_FLAG_COMPLETE_FRAMES){
     97        next = buf_size;
     98    }else{
     99        next = latm_find_frame_end(s1, buf, buf_size);
     100
     101        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
     102            *poutbuf = NULL;
     103            *poutbuf_size = 0;
     104            return buf_size;
     105        }
     106    }
     107    *poutbuf = buf;
     108    *poutbuf_size = buf_size;
     109    return next;
     110}
     111
     112AVCodecParser aac_latm_parser = {
     113    { CODEC_ID_AAC_LATM },
     114    sizeof(LATMParseContext),
     115    NULL,
     116    latm_parse,
     117    ff_parse_close
     118};
  • mythtv/external/FFmpeg/libavformat/mpegts.c

    diff --git a/mythtv/external/FFmpeg/libavformat/mpegts.c b/mythtv/external/FFmpeg/libavformat/mpegts.c
    index 65df872..1d8fbb5 100644
    a b static int mpegts_set_stream_info(AVStream *st, PESContext *pes,  
    799799            sub_pes->sub_st = pes->sub_st = sub_st;
    800800        }
    801801    }
    802     if (pes->stream_type == 0x11)
    803         av_log(pes->stream, AV_LOG_WARNING,
    804                "AAC LATM not currently supported, patch welcome\n");
    805802    if (st->codec->codec_id == CODEC_ID_NONE)
    806803        mpegts_find_stream_type(st, pes->stream_type, MISC_types);
    807804