Skip to content

Commit

Permalink
build: add ffmpeg 6 for windows and android (#34)
Browse files Browse the repository at this point in the history
build: add ffmpeg 6 for windows and android

issue #33
  • Loading branch information
SiminBadri authored Oct 31, 2023
1 parent 2a8c80b commit bdb6026
Show file tree
Hide file tree
Showing 194 changed files with 34,892 additions and 0 deletions.
68 changes: 68 additions & 0 deletions ffmpeg/6/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
if (NOT WIN32 AND NOT ANDROID)
message(FATAL_ERROR "target platform is not supported.")
endif()

if (ANDROID)
set(SUPPORTED_ABIS armeabi-v7a)
if (NOT ${ANDROID_ABI} IN_LIST SUPPORTED_ABIS)
message(FATAL_ERROR "target android abi ${ANDROID_ABI} is not supported.")
endif()
endif()

add_library(wdeps-ffmpeg INTERFACE)
add_library(ffmpeg::ffmpeg ALIAS wdeps-ffmpeg)

add_library(wdeps-ffmpeg-options INTERFACE)
target_include_directories(wdeps-ffmpeg-options INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)

macro(add_ffmpeg_library LIBRARY_NAME LIBRARY_TYPE)
add_library(wdeps-ffmpeg-${LIBRARY_NAME} ${LIBRARY_TYPE} IMPORTED GLOBAL)
target_link_libraries(wdeps-ffmpeg-${LIBRARY_NAME} INTERFACE wdeps-ffmpeg-options)
target_link_libraries(wdeps-ffmpeg INTERFACE wdeps-ffmpeg-${LIBRARY_NAME})
endmacro()

if (WIN32)
macro(add_ffmpeg_library_windows LIBRARY_NAME SHARED_FILEPATH STATIC_FILEPATH)
add_ffmpeg_library(${LIBRARY_NAME} SHARED)
set_target_properties(wdeps-ffmpeg-${LIBRARY_NAME} PROPERTIES
IMPORTED_LOCATION ${SHARED_FILEPATH}
IMPORTED_LOCATION_RELEASE ${SHARED_FILEPATH}
IMPORTED_IMPLIB ${STATIC_FILEPATH}
)
endmacro()

add_ffmpeg_library_windows(avcodec ${CMAKE_CURRENT_SOURCE_DIR}/bin/win/avcodec-60.dll ${CMAKE_CURRENT_SOURCE_DIR}/lib/win/avcodec.lib)
add_ffmpeg_library_windows(avdevice ${CMAKE_CURRENT_SOURCE_DIR}/bin/win/avdevice-60.dll ${CMAKE_CURRENT_SOURCE_DIR}/lib/win/avdevice.lib)
add_ffmpeg_library_windows(avfilter ${CMAKE_CURRENT_SOURCE_DIR}/bin/win/avfilter-9.dll ${CMAKE_CURRENT_SOURCE_DIR}/lib/win/avfilter.lib)
add_ffmpeg_library_windows(avformat ${CMAKE_CURRENT_SOURCE_DIR}/bin/win/avformat-60.dll ${CMAKE_CURRENT_SOURCE_DIR}/lib/win/avformat.lib)
add_ffmpeg_library_windows(avutil ${CMAKE_CURRENT_SOURCE_DIR}/bin/win/avutil-58.dll ${CMAKE_CURRENT_SOURCE_DIR}/lib/win/avutil.lib)
add_ffmpeg_library_windows(swresample ${CMAKE_CURRENT_SOURCE_DIR}/bin/win/swresample-4.dll ${CMAKE_CURRENT_SOURCE_DIR}/lib/win/swresample.lib)
add_ffmpeg_library_windows(swscale ${CMAKE_CURRENT_SOURCE_DIR}/bin/win/swscale-7.dll ${CMAKE_CURRENT_SOURCE_DIR}/lib/win/swscale.lib)
elseif(ANDROID)
add_subdirectory(${PROJECT_SOURCE_DIR}/srt ${CMAKE_CURRENT_BINARY_DIR}/deps-srt)

macro(add_ffmpeg_library_android LIBRARY_NAME)
add_ffmpeg_library(${LIBRARY_NAME} SHARED)
set_target_properties(wdeps-ffmpeg-${LIBRARY_NAME} PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/bin/android-${ANDROID_ABI}/lib${LIBRARY_NAME}.so
IMPORTED_LOCATION_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin/android-${ANDROID_ABI}/lib${LIBRARY_NAME}.so
)

add_ffmpeg_library(${LIBRARY_NAME}-static STATIC)
set_target_properties(wdeps-ffmpeg-${LIBRARY_NAME}-static PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib/android-${ANDROID_ABI}/lib${LIBRARY_NAME}.a
IMPORTED_LOCATION_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/lib/android-${ANDROID_ABI}/lib${LIBRARY_NAME}.a
)
endmacro()

add_ffmpeg_library_android(avcodec)
add_ffmpeg_library_android(avdevice)
add_ffmpeg_library_android(avfilter)
add_ffmpeg_library_android(avformat)
add_ffmpeg_library_android(avutil)
add_ffmpeg_library_android(postproc)
add_ffmpeg_library_android(swresample)
add_ffmpeg_library_android(swscale)

target_link_libraries(wdeps-ffmpeg INTERFACE srt::srt)
endif()
674 changes: 674 additions & 0 deletions ffmpeg/6/LICENSE

Large diffs are not rendered by default.

685 changes: 685 additions & 0 deletions ffmpeg/6/README.txt

Large diffs are not rendered by default.

Binary file added ffmpeg/6/bin/android-armeabi-v7a/ffmpeg
Binary file not shown.
Binary file added ffmpeg/6/bin/android-armeabi-v7a/ffprobe
Binary file not shown.
Binary file added ffmpeg/6/bin/android-armeabi-v7a/libavcodec.so
Binary file not shown.
Binary file added ffmpeg/6/bin/android-armeabi-v7a/libavdevice.so
Binary file not shown.
Binary file added ffmpeg/6/bin/android-armeabi-v7a/libavfilter.so
Binary file not shown.
Binary file added ffmpeg/6/bin/android-armeabi-v7a/libavformat.so
Binary file not shown.
Binary file added ffmpeg/6/bin/android-armeabi-v7a/libavutil.so
Binary file not shown.
Binary file added ffmpeg/6/bin/android-armeabi-v7a/libpostproc.so
Binary file not shown.
Binary file added ffmpeg/6/bin/android-armeabi-v7a/libswresample.so
Binary file not shown.
Binary file added ffmpeg/6/bin/android-armeabi-v7a/libswscale.so
Binary file not shown.
14 changes: 14 additions & 0 deletions ffmpeg/6/bin/android-armeabi-v7a/pkgconfig/libavcodec.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
prefix=/home/simin/ffmpeg/FFmpeg/build-arm-release
exec_prefix=${prefix}
libdir=/home/simin/ffmpeg/FFmpeg/build-arm-release/lib
includedir=/home/simin/ffmpeg/FFmpeg/build-arm-release/include

Name: libavcodec
Description: FFmpeg codec library
Version: 60.27.100
Requires:
Requires.private: libswresample >= 4.11.100, libavutil >= 58.27.100
Conflicts:
Libs: -L${libdir} -lavcodec
Libs.private: -pthread -lm -latomic -lz
Cflags: -I${includedir}
14 changes: 14 additions & 0 deletions ffmpeg/6/bin/android-armeabi-v7a/pkgconfig/libavdevice.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
prefix=/home/simin/ffmpeg/FFmpeg/build-arm-release
exec_prefix=${prefix}
libdir=/home/simin/ffmpeg/FFmpeg/build-arm-release/lib
includedir=/home/simin/ffmpeg/FFmpeg/build-arm-release/include

Name: libavdevice
Description: FFmpeg device handling library
Version: 60.2.101
Requires:
Requires.private: libavfilter >= 9.11.100, libswscale >= 7.4.100, libpostproc >= 57.2.100, libavformat >= 60.13.100, libavcodec >= 60.27.100, libswresample >= 4.11.100, libavutil >= 58.27.100
Conflicts:
Libs: -L${libdir} -lavdevice
Libs.private: -lm -latomic
Cflags: -I${includedir}
14 changes: 14 additions & 0 deletions ffmpeg/6/bin/android-armeabi-v7a/pkgconfig/libavfilter.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
prefix=/home/simin/ffmpeg/FFmpeg/build-arm-release
exec_prefix=${prefix}
libdir=/home/simin/ffmpeg/FFmpeg/build-arm-release/lib
includedir=/home/simin/ffmpeg/FFmpeg/build-arm-release/include

Name: libavfilter
Description: FFmpeg audio/video filtering library
Version: 9.11.100
Requires:
Requires.private: libswscale >= 7.4.100, libpostproc >= 57.2.100, libavformat >= 60.13.100, libavcodec >= 60.27.100, libswresample >= 4.11.100, libavutil >= 58.27.100
Conflicts:
Libs: -L${libdir} -lavfilter
Libs.private: -pthread -lm -latomic
Cflags: -I${includedir}
14 changes: 14 additions & 0 deletions ffmpeg/6/bin/android-armeabi-v7a/pkgconfig/libavformat.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
prefix=/home/simin/ffmpeg/FFmpeg/build-arm-release
exec_prefix=${prefix}
libdir=/home/simin/ffmpeg/FFmpeg/build-arm-release/lib
includedir=/home/simin/ffmpeg/FFmpeg/build-arm-release/include

Name: libavformat
Description: FFmpeg container format library
Version: 60.13.100
Requires:
Requires.private: libavcodec >= 60.27.100, libswresample >= 4.11.100, libavutil >= 58.27.100
Conflicts:
Libs: -L${libdir} -lavformat
Libs.private: -lm -latomic -lz -L/mnt/c/Software/srt/scripts/build-android/armeabi-v7a/lib -lsrt
Cflags: -I${includedir}
14 changes: 14 additions & 0 deletions ffmpeg/6/bin/android-armeabi-v7a/pkgconfig/libavutil.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
prefix=/home/simin/ffmpeg/FFmpeg/build-arm-release
exec_prefix=${prefix}
libdir=/home/simin/ffmpeg/FFmpeg/build-arm-release/lib
includedir=/home/simin/ffmpeg/FFmpeg/build-arm-release/include

Name: libavutil
Description: FFmpeg utility library
Version: 58.27.100
Requires:
Requires.private:
Conflicts:
Libs: -L${libdir} -lavutil
Libs.private: -pthread -lm -latomic -landroid
Cflags: -I${includedir}
14 changes: 14 additions & 0 deletions ffmpeg/6/bin/android-armeabi-v7a/pkgconfig/libpostproc.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
prefix=/home/simin/ffmpeg/FFmpeg/build-arm-release
exec_prefix=${prefix}
libdir=/home/simin/ffmpeg/FFmpeg/build-arm-release/lib
includedir=/home/simin/ffmpeg/FFmpeg/build-arm-release/include

Name: libpostproc
Description: FFmpeg postprocessing library
Version: 57.2.100
Requires:
Requires.private: libavutil >= 58.27.100
Conflicts:
Libs: -L${libdir} -lpostproc
Libs.private: -lm -latomic
Cflags: -I${includedir}
14 changes: 14 additions & 0 deletions ffmpeg/6/bin/android-armeabi-v7a/pkgconfig/libswresample.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
prefix=/home/simin/ffmpeg/FFmpeg/build-arm-release
exec_prefix=${prefix}
libdir=/home/simin/ffmpeg/FFmpeg/build-arm-release/lib
includedir=/home/simin/ffmpeg/FFmpeg/build-arm-release/include

Name: libswresample
Description: FFmpeg audio resampling library
Version: 4.11.100
Requires:
Requires.private: libavutil >= 58.27.100
Conflicts:
Libs: -L${libdir} -lswresample
Libs.private: -lm -latomic
Cflags: -I${includedir}
14 changes: 14 additions & 0 deletions ffmpeg/6/bin/android-armeabi-v7a/pkgconfig/libswscale.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
prefix=/home/simin/ffmpeg/FFmpeg/build-arm-release
exec_prefix=${prefix}
libdir=/home/simin/ffmpeg/FFmpeg/build-arm-release/lib
includedir=/home/simin/ffmpeg/FFmpeg/build-arm-release/include

Name: libswscale
Description: FFmpeg image rescaling library
Version: 7.4.100
Requires:
Requires.private: libavutil >= 58.27.100
Conflicts:
Libs: -L${libdir} -lswscale
Libs.private: -lm -latomic
Cflags: -I${includedir}
Binary file added ffmpeg/6/bin/win/avcodec-60.dll
Binary file not shown.
Binary file added ffmpeg/6/bin/win/avdevice-60.dll
Binary file not shown.
Binary file added ffmpeg/6/bin/win/avfilter-9.dll
Binary file not shown.
Binary file added ffmpeg/6/bin/win/avformat-60.dll
Binary file not shown.
Binary file added ffmpeg/6/bin/win/avutil-58.dll
Binary file not shown.
Binary file added ffmpeg/6/bin/win/ffmpeg.exe
Binary file not shown.
Binary file added ffmpeg/6/bin/win/ffplay.exe
Binary file not shown.
Binary file added ffmpeg/6/bin/win/ffprobe.exe
Binary file not shown.
Binary file added ffmpeg/6/bin/win/swresample-4.dll
Binary file not shown.
Binary file added ffmpeg/6/bin/win/swscale-7.dll
Binary file not shown.
36 changes: 36 additions & 0 deletions ffmpeg/6/include/libavcodec/ac3_parser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* AC-3 parser prototypes
* Copyright (c) 2003 Fabrice Bellard
* Copyright (c) 2003 Michael Niedermayer
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef AVCODEC_AC3_PARSER_H
#define AVCODEC_AC3_PARSER_H

#include <stddef.h>
#include <stdint.h>

/**
* Extract the bitstream ID and the frame size from AC-3 data.
*/
int av_ac3_parse_header(const uint8_t *buf, size_t size,
uint8_t *bitstream_id, uint16_t *frame_size);


#endif /* AVCODEC_AC3_PARSER_H */
37 changes: 37 additions & 0 deletions ffmpeg/6/include/libavcodec/adts_parser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef AVCODEC_ADTS_PARSER_H
#define AVCODEC_ADTS_PARSER_H

#include <stddef.h>
#include <stdint.h>

#define AV_AAC_ADTS_HEADER_SIZE 7

/**
* Extract the number of samples and frames from AAC data.
* @param[in] buf pointer to AAC data buffer
* @param[out] samples Pointer to where number of samples is written
* @param[out] frames Pointer to where number of frames is written
* @return Returns 0 on success, error code on failure.
*/
int av_adts_header_parse(const uint8_t *buf, uint32_t *samples,
uint8_t *frames);

#endif /* AVCODEC_ADTS_PARSER_H */
Loading

0 comments on commit bdb6026

Please sign in to comment.