linux mp4 aac解码器,Android编译aac编解码库

1、源码下载

2、faac

2.1 android.mk文件

MY_LOCAL_PATH := $(call my-dir)

#/Users/xxxxx/code/media-service/LibraryBuild/faac/faac-1.28

FAAC_PATH := $(MY_LOCAL_PATH)/../faac-1.28/

#-----FAAC-----

include $(CLEAR_VARS)

LOCAL_PATH := $(FAAC_PATH)

LOCAL_MODULE := libfaac

LOCAL_SRC_FILES := ./libfaac/aacquant.c \

./libfaac/backpred.c \

./libfaac/bitstream.c \

./libfaac/channels.c \

./libfaac/fft.c \

./libfaac/filtbank.c \

./libfaac/frame.c \

./libfaac/huffman.c \

./libfaac/ltp.c \

./libfaac/midside.c \

./libfaac/psychkni.c \

./libfaac/tns.c \

./libfaac/util.c

LOCAL_C_INCLUDES := \

$(FAAC_PATH)/include

include $(BUILD_SHARED_LIBRARY)

2.2 Application.mk

APP_STL := gnustl_shared

APP_PLATFORM := android-14

APP_ABI := armeabi armeabi-v7a arm64-v8a

2.3 build.sh

export NDK=/Users/xxxxx/work/tools/android_sdk/ndk-bundle

export PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt

export PLATFORM=$NDK/platforms/android-21/arch-arm

CFLAGS="-fpic -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_7__ -Wno-psabi -march=armv7 -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -Wa,--noexecstack -MMD -MP "

#CFLAGS="-fpic -DANDROID -fpic -mthumb-interwork -D__ARM_ARCH_7__ -Wno-psabi -march=armv7-a -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -Wa, -MMD -MP "

CROSS_COMPILE=$PREBUILT/darwin-x86_64/bin/arm-linux-androideabi-

export CPPFLAGS="$CFLAGS"

export CFLAGS="$CFLAGS"

export CXXFLAGS="$CFLAGS"

export CXX="${CROSS_COMPILE}g++ --sysroot=${PLATFORM}"

export LDFLAGS="$LDFLAGS"

export CC="${CROSS_COMPILE}gcc --sysroot=${PLATFORM}"

export NM="${CROSS_COMPILE}nm"

export STRIP="${CROSS_COMPILE}strip"

export RANLIB="${CROSS_COMPILE}ranlib"

export AR="${CROSS_COMPILE}ar"

./configure --without-mp4v2 --host=arm-linux --enable-static

make clean

make

make install

cp -rf /usr/local/include/faac.h /Users/xxxxx/code/android-ffmepg/libaac

cp -rf /usr/local/include/faaccfg.h /Users/xxxxx/code/android-ffmepg/libaac

cp -rf /usr/local/lib/libfaac.a /Users/xxxxx/code/android-ffmepg/libaac

3、faad

Android.mk

MY_LOCAL_PATH := $(call my-dir)

FAAD_PATH := $(MY_LOCAL_PATH)/../faad2-2.7/

#-----FAAD-----

include $(CLEAR_VARS)

LOCAL_PATH := $(FAAD_PATH)

LOCAL_MODULE := libfaad

LOCAL_SRC_FILES := ./libfaad/bits.c \

./libfaad/cfft.c \

./libfaad/common.c \

./libfaad/decoder.c \

./libfaad/drc.c \

./libfaad/drm_dec.c \

./libfaad/error.c \

./libfaad/filtbank.c \

./libfaad/hcr.c \

./libfaad/huffman.c \

./libfaad/ic_predict.c \

./libfaad/is.c \

./libfaad/lt_predict.c \

./libfaad/mdct.c \

./libfaad/mp4.c \

./libfaad/ms.c \

./libfaad/output.c \

./libfaad/pns.c \

./libfaad/ps_dec.c \

./libfaad/ps_syntax.c \

./libfaad/pulse.c \

./libfaad/rvlc.c \

./libfaad/sbr_dct.c \

./libfaad/sbr_dec.c \

./libfaad/sbr_e_nf.c \

./libfaad/sbr_fbt.c \

./libfaad/sbr_hfadj.c \

./libfaad/sbr_hfgen.c \

./libfaad/sbr_huff.c \

./libfaad/sbr_qmf.c \

./libfaad/sbr_syntax.c \

./libfaad/sbr_tf_grid.c \

./libfaad/specrec.c \

./libfaad/ssr.c \

./libfaad/ssr_fb.c \

./libfaad/ssr_ipqf.c \

./libfaad/syntax.c \

./libfaad/tns.c

LOCAL_C_INCLUDES := \

$(FAAD_PATH)/include \

./libfaad/codebook

LOCAL_CFLAGS:= \

-DHAVE_CONFIG_H

include $(BUILD_SHARED_LIBRARY)

config.h

#ifndef VIDEOLIVE_CONFIG_H

#define VIDEOLIVE_CONFIG_H

/* config.h. Generated from config.h.in by configure. */

/* config.h.in. Generated from configure.in by autoheader. */

/* Define if you want to use libfaad together with Digital Radio Mondiale

(DRM) */

/* #undef DRM */

/* Define if you want support for Digital Radio Mondiale (DRM) parametric

stereo */

/* #undef DRM_PS */

/* Define to 1 if you have the header file. */

#define HAVE_DLFCN_H 1

/* Define to 1 if you have the header file. */

#define HAVE_ERRNO_H 1

/* Define if needed */

/* #undef HAVE_FLOAT32_T */

/* Define to 1 if you have the header file. */

#define HAVE_FLOAT_H 1

/* Define to 1 if you have the `getpwuid' function. */

#define HAVE_GETPWUID 1

/* Define to 1 if you have the header file. */

#define HAVE_INTTYPES_H 1

/* Define if you have the IOKit API */

/* #undef HAVE_IOKIT_IOKITLIB_H */

/* Define to 1 if you have the header file. */

#define HAVE_LIMITS_H 1

/* Define if you have C99's lrintf function. */

#define HAVE_LRINTF 1

/* Define to 1 if you have the header file. */

/* #undef HAVE_MATHF_H */

/* Define to 1 if you have the `memcpy' function. */

#define HAVE_MEMCPY 1

/* Define to 1 if you have the header file. */

#define HAVE_MEMORY_H 1

/* Define to 1 if you have the header file. */

#define HAVE_STDINT_H 1

/* Define to 1 if you have the header file. */

#define HAVE_STDLIB_H 1

/* Define to 1 if you have the `strchr' function. */

#define HAVE_STRCHR 1

/* Define to 1 if you have the header file. */

#define HAVE_STRINGS_H 1

/* Define to 1 if you have the header file. */

#define HAVE_STRING_H 1

/* Define to 1 if you have the `strsep' function. */

#define HAVE_STRSEP 1

/* Define to 1 if you have the header file. */

/* #undef HAVE_SYSFS_LIBSYSFS_H */

/* Define to 1 if you have the header file. */

#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the header file. */

#define HAVE_SYS_TIME_H 1

/* Define to 1 if you have the header file. */

#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the header file. */

#define HAVE_UNISTD_H 1

/* Define to 1 if your C compiler doesn't accept -c and -o together. */

/* #undef NO_MINUS_C_MINUS_O */

/* Name of package */

#define PACKAGE "faad2"

/* Define to the address where bug reports for this package should be sent. */

#define PACKAGE_BUGREPORT ""

/* Define to the full name of this package. */

#define PACKAGE_NAME ""

/* Define to the full name and version of this package. */

#define PACKAGE_STRING ""

/* Define to the one symbol short name of this package. */

#define PACKAGE_TARNAME ""

/* Define to the version of this package. */

#define PACKAGE_VERSION ""

/* Define to 1 if you have the ANSI C header files. */

#define STDC_HEADERS 1

/* Define to 1 if you can safely include both and . */

#define TIME_WITH_SYS_TIME 1

/* Version number of package */

#define VERSION "2.7.0"

/* Define to 1 if your processor stores words with the most significant byte

first (like Motorola and SPARC, unlike Intel and VAX). */

/* #undef WORDS_BIGENDIAN */

/* Define to `__inline__' or `__inline' if that's what the C compiler

calls it, or to nothing if 'inline' is not supported under any name. */

#ifndef __cplusplus

/* #undef inline */

#endif

/* Define to `long int' if does not define. */

/* #undef off_t */

#endif //VIDEOLIVE_CONFIG_H

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是使用mp4v3播放AAC音频的基本步骤: 1. 安装mp4v3:你可以从该的官方网站上下载相关源代码,然后编译和安装该。 2. 打开MP4文件:使用mp4v3打开MP4文件,可以使用MP4Read函数打开文件并获取相关信息。 3. 查找音频流:使用MP4FindTrack函数查找AAC音频流所在的轨道。 4. 解码音频数据:使用AAC解码器解码音频数据。 5. 播放音频:将解码后的音频数据提供给音频播放器进行播放。 下面是一个简单的代码片段,演示如何使用mp4v3播放AAC音频: ``` #include <mp4v2/mp4v2.h> #include <faad.h> int main(int argc, char** argv) { // 打开MP4文件 MP4FileHandle mp4File = MP4Read(argv[1]); if (!mp4File) { printf("无法打开文件: %s\n", argv[1]); return -1; } // 查找音频轨道 MP4TrackId trackId = MP4FindTrackId(mp4File, 0, MP4_AUDIO_TRACK_TYPE, 0); if (trackId == MP4_INVALID_TRACK_ID) { printf("无法找到音频轨道\n"); MP4Close(mp4File); return -1; } // 创建AAC解码器 NeAACDecConfigurationPtr config = NeAACDecOpen(); NeAACDecFrameInfo frameInfo; char* buffer = new char[1024]; // 获取音频数据 uint8_t* data = NULL; uint32_t dataSize = 0; uint8_t* adtsHeader = NULL; MP4SampleId sampleId = 1; while (dataSize = MP4ReadSample(mp4File, trackId, sampleId, &amp;data, &amp;dataSize, NULL, NULL)) { // 获取ADTS头 adtsHeader = (uint8_t*)NeAACDecDecode2(config, data, dataSize, &amp;buffer, 1024, &amp;frameInfo); if (adtsHeader) { // 播放音频 // ... } sampleId++; } // 关闭解码器 NeAACDecClose(config); delete[] buffer; // 关闭文件 MP4Close(mp4File); return 0; } ``` 注意:以上代码示例仅供参考,实际情况可能会因为AAC解码器版本等原因而有所不同。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值