Ticket #365: patchloas.diff

File patchloas.diff, 5.4 KB (added by cehoyos, 5 years ago)
  • Changelog

    diff --git a/Changelog b/Changelog
    index fa5d4fa..9cfc9e4 100644
    a b version next: 
    77- boxblur filter added 
    88- BWF muxer 
    99- Flash Screen Video 2 decoder 
     10- LOAS demuxer 
    1011 
    1112 
    1213version 0.8: 
  • doc/general.texi

    diff --git a/doc/general.texi b/doc/general.texi
    index c5045b1..af6758b 100644
    a b library: 
    120120    @tab A format used by libvpx 
    121121@item LMLM4                     @tab   @tab X 
    122122    @tab Used by Linux Media Labs MPEG-4 PCI boards 
     123@item LOAS                      @tab   @tab X 
     124    @tab contains LATM multiplexed AAC audio 
    123125@item LXF                       @tab   @tab X 
    124126    @tab VR native stream format, used by Leitch/Harris' video servers. 
    125127@item Matroska                  @tab X @tab X 
  • libavformat/Makefile

    diff --git a/libavformat/Makefile b/libavformat/Makefile
    index 9f5bfb4..649eddd 100644
    a b OBJS-$(CONFIG_IVF_DEMUXER) += ivfdec.o riff.o 
    113113OBJS-$(CONFIG_IVF_MUXER)                 += ivfenc.o 
    114114OBJS-$(CONFIG_JV_DEMUXER)                += jvdec.o 
    115115OBJS-$(CONFIG_LMLM4_DEMUXER)             += lmlm4.o 
     116OBJS-$(CONFIG_LOAS_DEMUXER)              += loasdec.o 
    116117OBJS-$(CONFIG_LXF_DEMUXER)               += lxfdec.o 
    117118OBJS-$(CONFIG_M4V_DEMUXER)               += m4vdec.o rawdec.o 
    118119OBJS-$(CONFIG_M4V_MUXER)                 += rawenc.o 
  • libavformat/allformats.c

    diff --git a/libavformat/allformats.c b/libavformat/allformats.c
    index a9fa117..d7a33e9 100644
    a b void av_register_all(void) 
    114114    REGISTER_MUXDEMUX (IVF, ivf); 
    115115    REGISTER_DEMUXER  (JV, jv); 
    116116    REGISTER_DEMUXER  (LMLM4, lmlm4); 
     117    REGISTER_DEMUXER  (LOAS, loas); 
    117118    REGISTER_DEMUXER  (LXF, lxf); 
    118119    REGISTER_MUXDEMUX (M4V, m4v); 
    119120    REGISTER_MUXER    (MD5, md5); 
  • libavformat/loasdec.c

    diff --git a/libavformat/loasdec.c b/libavformat/loasdec.c
    index e69de29..3bd2458 100644
    a b  
     1/* 
     2 * LOAS AudioSyncStream demuxer 
     3 * Copyright (c) 2008 Michael Niedermayer <michaelni@gmx.at> 
     4 * Copyright (c) 2009 Robert Swain ( rob opendot cl ) 
     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#include "libavutil/intreadwrite.h" 
     24#include "libavutil/internal.h" 
     25#include "avformat.h" 
     26#include "rawdec.h" 
     27 
     28 
     29static int loas_probe(AVProbeData *p) 
     30{ 
     31    int max_frames = 0, first_frames = 0; 
     32    int fsize, frames; 
     33    uint8_t *buf0 = p->buf; 
     34    uint8_t *buf2; 
     35    uint8_t *buf; 
     36    uint8_t *end = buf0 + p->buf_size - 3; 
     37    buf = buf0; 
     38 
     39    for(; buf < end; buf= buf2+1) { 
     40        buf2 = buf; 
     41 
     42        for(frames = 0; buf2 < end; frames++) { 
     43            uint32_t header = AV_RB24(buf2); 
     44            if((header >> 13) != 0x2B7) 
     45                break; 
     46            fsize = (header & 0x1FFF) + 3; 
     47            if(fsize < 7) 
     48                break; 
     49            fsize = FFMIN(fsize, end - buf2); 
     50            buf2 += fsize; 
     51        } 
     52        max_frames = FFMAX(max_frames, frames); 
     53        if(buf == buf0) 
     54            first_frames= frames; 
     55    } 
     56    if   (first_frames>=3) return AVPROBE_SCORE_MAX/2+1; 
     57    else if(max_frames>100)return AVPROBE_SCORE_MAX/2; 
     58    else if(max_frames>=3) return AVPROBE_SCORE_MAX/4; 
     59    else if(max_frames>=1) return 1; 
     60    else                   return 0; 
     61} 
     62 
     63static int loas_read_header(AVFormatContext *s, 
     64                            AVFormatParameters *ap) 
     65{ 
     66    AVStream *st; 
     67 
     68    st = av_new_stream(s, 0); 
     69    if (!st) 
     70        return AVERROR(ENOMEM); 
     71 
     72    st->codec->codec_type = AVMEDIA_TYPE_AUDIO; 
     73    st->codec->codec_id = s->iformat->value; 
     74    st->need_parsing = AVSTREAM_PARSE_FULL; 
     75 
     76    //LCM of all possible AAC sample rates 
     77    av_set_pts_info(st, 64, 1, 28224000); 
     78 
     79    return 0; 
     80} 
     81 
     82 
     83AVInputFormat ff_loas_demuxer = { 
     84    .name           = "loas", 
     85    .long_name      = NULL_IF_CONFIG_SMALL("LOAS AudioSyncStream"), 
     86    .read_probe     = loas_probe, 
     87    .read_header    = loas_read_header, 
     88    .read_packet    = ff_raw_read_partial_packet, 
     89    .flags= AVFMT_GENERIC_INDEX, 
     90    .value = CODEC_ID_AAC_LATM, 
     91}; 
  • libavformat/utils.c

    diff --git a/libavformat/utils.c b/libavformat/utils.c
    index 81577c9..1bd6d53 100644
    a b static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st, AVProbeDa 
    369369        { "dts"      , CODEC_ID_DTS       , AVMEDIA_TYPE_AUDIO }, 
    370370        { "eac3"     , CODEC_ID_EAC3      , AVMEDIA_TYPE_AUDIO }, 
    371371        { "h264"     , CODEC_ID_H264      , AVMEDIA_TYPE_VIDEO }, 
     372        { "loas"     , CODEC_ID_AAC_LATM  , AVMEDIA_TYPE_AUDIO }, 
    372373        { "m4v"      , CODEC_ID_MPEG4     , AVMEDIA_TYPE_VIDEO }, 
    373374        { "mp3"      , CODEC_ID_MP3       , AVMEDIA_TYPE_AUDIO }, 
    374375        { "mpegvideo", CODEC_ID_MPEG2VIDEO, AVMEDIA_TYPE_VIDEO },