├── .gitignore
├── .gitmodules
├── AndroidManifest.xml
├── README.md
├── ic_launcher-web.png
├── jni
├── Android.mk
├── FFmpegWrapper.c
├── ffmpeg
│ ├── libavcodec-55.so
│ ├── libavfilter-3.so
│ ├── libavformat-55.so
│ ├── libavutil-52.so
│ ├── libswresample-0.so
│ └── libswscale-2.so
├── include
│ ├── libavcodec
│ │ ├── avcodec.h
│ │ ├── avfft.h
│ │ ├── dxva2.h
│ │ ├── old_codec_ids.h
│ │ ├── vaapi.h
│ │ ├── vda.h
│ │ ├── vdpau.h
│ │ ├── version.h
│ │ └── xvmc.h
│ ├── libavdevice
│ │ ├── avdevice.h
│ │ └── version.h
│ ├── libavfilter
│ │ ├── asrc_abuffer.h
│ │ ├── avcodec.h
│ │ ├── avfilter.h
│ │ ├── avfiltergraph.h
│ │ ├── buffersink.h
│ │ ├── buffersrc.h
│ │ └── version.h
│ ├── libavformat
│ │ ├── avformat.h
│ │ ├── avio.h
│ │ └── version.h
│ ├── libavutil
│ │ ├── adler32.h
│ │ ├── aes.h
│ │ ├── attributes.h
│ │ ├── audio_fifo.h
│ │ ├── audioconvert.h
│ │ ├── avassert.h
│ │ ├── avconfig.h
│ │ ├── avstring.h
│ │ ├── avutil.h
│ │ ├── base64.h
│ │ ├── blowfish.h
│ │ ├── bprint.h
│ │ ├── bswap.h
│ │ ├── buffer.h
│ │ ├── channel_layout.h
│ │ ├── common.h
│ │ ├── cpu.h
│ │ ├── crc.h
│ │ ├── dict.h
│ │ ├── error.h
│ │ ├── eval.h
│ │ ├── fifo.h
│ │ ├── file.h
│ │ ├── frame.h
│ │ ├── hmac.h
│ │ ├── imgutils.h
│ │ ├── intfloat.h
│ │ ├── intfloat_readwrite.h
│ │ ├── intreadwrite.h
│ │ ├── lfg.h
│ │ ├── log.h
│ │ ├── lzo.h
│ │ ├── mathematics.h
│ │ ├── md5.h
│ │ ├── mem.h
│ │ ├── murmur3.h
│ │ ├── old_pix_fmts.h
│ │ ├── opt.h
│ │ ├── parseutils.h
│ │ ├── pixdesc.h
│ │ ├── pixfmt.h
│ │ ├── random_seed.h
│ │ ├── rational.h
│ │ ├── ripemd.h
│ │ ├── samplefmt.h
│ │ ├── sha.h
│ │ ├── sha512.h
│ │ ├── time.h
│ │ ├── timecode.h
│ │ ├── timestamp.h
│ │ ├── version.h
│ │ └── xtea.h
│ ├── libswresample
│ │ ├── swresample.h
│ │ └── version.h
│ └── libswscale
│ │ ├── swscale.h
│ │ └── version.h
└── ndk-build.sh
├── libs
├── Simpl3r-1.0.2.jar
├── android-support-v4.jar
├── armeabi
│ ├── gdb.setup
│ ├── gdbserver
│ ├── libFFmpegWrapper.so
│ ├── libavcodec-55.so
│ ├── libavfilter-3.so
│ ├── libavformat-55.so
│ ├── libavutil-52.so
│ ├── libswresample-0.so
│ └── libswscale-2.so
├── aws-android-sdk-1.7.0-core.jar
└── aws-android-sdk-1.7.0-s3.jar
├── proguard-project.txt
├── project.properties
├── res
├── anim
│ ├── slide_from_left.xml
│ └── slide_to_left.xml
├── drawable-hdpi
│ ├── ic_launcher.png
│ └── live_bg.9.png
├── drawable-mdpi
│ └── ic_launcher.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── drawable-xxhdpi
│ └── ic_launcher.png
├── layout
│ └── activity_hwrecorder.xml
├── menu
│ └── main.xml
├── values-sw600dp
│ └── dimens.xml
├── values-sw720dp-land
│ └── dimens.xml
├── values-v11
│ └── styles.xml
├── values-v14
│ └── styles.xml
└── values
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
└── src
└── com
└── example
└── ffmpegtest
├── FileUtils.java
├── HLSFileObserver.java
├── HWRecorderActivity.java
├── S3Client.java
└── recorder
├── FFmpegWrapper.java
├── HLSRecorder.java
└── LiveHLSRecorder.java
/.gitignore:
--------------------------------------------------------------------------------
1 | SECRETS.java
2 | converted-dump*
3 | bin
4 | gen
5 | obj
6 | .DS_Store
7 | .classpath
8 | .cproject
9 | .project
10 | .settings/
11 |
12 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "submodules/ffmpegwrapper"]
2 | path = submodules/ffmpegwrapper
3 | url = git@github.com:OpenWatch/FFmpegWrapper-Android.git
4 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FFmpegTest
2 | An attempt to feed encoded Audio and Video data from Android's MediaCodec to FFmpeg to provide support for formats beyond Android's capabilities (Android's MediaMuxer is currently limited to .mp4). Our ultimate goal is to allow an Android device to act as an HLS server.
3 |
4 | Included is a build of the ffmpeg 2.0.2 libraries for arm linux with debugging symbols enabled, and no optimizations.
5 |
6 | # Overview
7 |
8 | Camera frames and Microphone samples are queued into instances of Android's [MediaCodec](http://developer.android.com/reference/android/media/MediaCodec.html), which performs the encoding in hardware. We poll MediaCodec after submitting each audio / video to dequeue encoded data and pass it to FFmpeg.
9 |
10 | There are three JNI methods that bridge the tested Java/Android logic to FFmpeg. Their Java definitions are in [FFmpegWrapper.java](https://github.com/OnlyInAmerica/FFmpegTest/blob/master/src/com/example/ffmpegtest/FFmpegWrapper.java), and their C implementations in [FFmpegWrapper.c](https://github.com/OnlyInAmerica/FFmpegTest/blob/master/jni/FFmpegWrapper.c).
11 |
12 | + `prepareAVFormatContext(String outputPath);`
13 | + Prepares an `AVFormatContext` for output, currently by reading from an mp4 prepared using Android's MediaMuxer and identical codec parameters.
14 | + `writeAVPacketFromEncodedData(ByteBuffer jData, int jIsVideo, int jOffset, int jSize, int jFlags, long jPts);`
15 | + Prepares an `AVPacket` from MediaCodec encoder output and submits it to FFmpeg via `av_interleaved_write_frame(...)`, along with the `AVFormatContext` created with the first method.
16 | + `finalizeAVFormatContext();`
17 | + Finalizes our `AVFormatContext` with `av_write_trailer(...)`
18 |
19 | # Current Output
20 |
21 | A video produced with the latest version of this application is available [here](https://s3.amazonaws.com/dbro/h264_madness/ffmpeg_1383772856149.ts).
22 |
23 | Playing the output of this app in VLC results in generally correct audio and video.
24 |
25 | ffprobe reports:
26 |
27 | ffprobe version 1.2.4 Copyright (c) 2007-2013 the FFmpeg developers
28 | built on Oct 8 2013 17:01:58 with Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
29 | configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
30 | libavutil 52. 18.100 / 52. 18.100
31 | libavcodec 54. 92.100 / 54. 92.100
32 | libavformat 54. 63.104 / 54. 63.104
33 | libavdevice 54. 3.103 / 54. 3.103
34 | libavfilter 3. 42.103 / 3. 42.103
35 | libswscale 2. 2.100 / 2. 2.100
36 | libswresample 0. 17.102 / 0. 17.102
37 | libpostproc 52. 2.100 / 52. 2.100
38 | [h264 @ 0x7ffb29018400] corrupted macroblock 11 29 (total_coeff=-1)
39 | [h264 @ 0x7ffb29018400] error while decoding MB 11 29
40 | [h264 @ 0x7ffb29018400] concealing 78 DC, 78 AC, 78 MV errors in I frame
41 | Input #0, mpegts, from '/Users/davidbrodsky/Desktop/HWEncodingExperiments/ffmpeg/ffmpeg_1383766999385.mp4':
42 | Duration: 00:00:03.85, start: 0.000000, bitrate: 1214 kb/s
43 | Program 1
44 | Metadata:
45 | service_name : Service01
46 | service_provider: FFmpeg
47 | Stream #0:0[0x100]: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x480, 90k tbr, 90k tbn, 180k tbc
48 | Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, mono, fltp, 137 kb/s
49 |
50 |
51 | # Building
52 |
53 | To build, add a `SECRETS.java` file (see below) and import the project with Eclipse.
54 |
55 | ## SECRETS.java
56 |
57 | Add a SECRETS.java file to the project with the following format:
58 |
59 | package com.example.ffmpegtest;
60 |
61 | public class SECRETS {
62 |
63 | public static final String AWS_KEY = "YOUR_AWS_KEY";
64 | public static final String AWS_SECRET = "YOUR_AWS_SECRET";
65 |
66 | }
67 |
68 | If you don't have these handy, simply assign arbitrary values and change `LiveHLSRecorder.UPLOAD_TO_S3` to `false`.
69 |
70 |
71 | # Debugging Native Components
72 |
73 | In Eclipse with the [NDK plugin](http://tools.android.com/recent/usingthendkplugin).
74 |
75 | 1. Import the project
76 | 2. Follow the [NDK plugin setup instructions](http://tools.android.com/recent/usingthendkplugin)
77 | 3. Debug as Native Android Application
78 |
79 | Manually:
80 |
81 | $ cd ./jni
82 | $ ndk-build NDK_DEBUG=1
83 | # build and send the apk to device
84 | $ cd ../ # The project root
85 | $ ndk-gdb
86 |
87 |
88 | # License
89 |
90 |
91 | Software License Agreement (GPLv3+)
92 |
93 | Copyright (c) 2013, David Brodsky. All rights reserved.
94 |
95 | This program is free software: you can redistribute it and/or modify
96 | it under the terms of the GNU General Public License as published by
97 | the Free Software Foundation, either version 3 of the License, or
98 | (at your option) any later version.
99 |
100 | This program is distributed in the hope that it will be useful,
101 | but WITHOUT ANY WARRANTY; without even the implied warranty of
102 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
103 | GNU General Public License for more details.
104 |
105 | You should have received a copy of the GNU General Public License
106 | along with this program. If not, see .
107 |
108 |
109 | This software additionally references or incorporates the following sources
110 | of intellectual property, the license terms for which are set forth
111 | in the sources themselves:
112 |
113 | [FFmpeg](http://www.ffmpeg.org/legal.html) - Used for muxing and processing of encoded data
--------------------------------------------------------------------------------
/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/ic_launcher-web.png
--------------------------------------------------------------------------------
/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | APP_PLATFORM := android-10
4 |
5 | include $(CLEAR_VARS)
6 |
7 | # TODO: Observe $(TARGET_ARCH) and adjust appropriately. For now, we only have armeabi libraries
8 |
9 | # Prebuilt FFmpeg
10 |
11 | LOCAL_MODULE:= libavcodec
12 | LOCAL_SRC_FILES:= ./ffmpeg/libavcodec-55.so
13 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
14 | include $(PREBUILT_SHARED_LIBRARY)
15 |
16 | include $(CLEAR_VARS)
17 |
18 | LOCAL_MODULE:= libavfilter
19 | LOCAL_SRC_FILES:= ./ffmpeg/libavfilter-3.so
20 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
21 | include $(PREBUILT_SHARED_LIBRARY)
22 |
23 | include $(CLEAR_VARS)
24 |
25 | LOCAL_MODULE:= libavformat
26 | LOCAL_SRC_FILES:= ./ffmpeg/libavformat-55.so
27 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
28 | include $(PREBUILT_SHARED_LIBRARY)
29 |
30 | include $(CLEAR_VARS)
31 |
32 | LOCAL_MODULE:= libavutil
33 | LOCAL_SRC_FILES:= ./ffmpeg/libavutil-52.so
34 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
35 | include $(PREBUILT_SHARED_LIBRARY)
36 |
37 | include $(CLEAR_VARS)
38 |
39 | LOCAL_MODULE:= libswresample
40 | LOCAL_SRC_FILES:= ./ffmpeg/libswresample-0.so
41 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
42 | include $(PREBUILT_SHARED_LIBRARY)
43 |
44 | include $(CLEAR_VARS)
45 |
46 | LOCAL_MODULE:= libswscale
47 | LOCAL_SRC_FILES:= ./ffmpeg/libswscale-2.so
48 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
49 | include $(PREBUILT_SHARED_LIBRARY)
50 |
51 | # Our Wrapper
52 |
53 | include $(CLEAR_VARS)
54 |
55 | LOCAL_LDLIBS += -llog -lz
56 | LOCAL_STATIC_LIBRARIES := libavformat libavcodec libswscale libavutil
57 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
58 | LOCAL_SRC_FILES := FFmpegWrapper.c
59 | LOCAL_CFLAGS := -march=armv7-a -mfloat-abi=softfp -mfpu=neon -g -O0
60 | LOCAL_MODULE := FFmpegWrapper
61 |
62 | include $(BUILD_SHARED_LIBRARY)
63 |
--------------------------------------------------------------------------------
/jni/ffmpeg/libavcodec-55.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/jni/ffmpeg/libavcodec-55.so
--------------------------------------------------------------------------------
/jni/ffmpeg/libavfilter-3.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/jni/ffmpeg/libavfilter-3.so
--------------------------------------------------------------------------------
/jni/ffmpeg/libavformat-55.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/jni/ffmpeg/libavformat-55.so
--------------------------------------------------------------------------------
/jni/ffmpeg/libavutil-52.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/jni/ffmpeg/libavutil-52.so
--------------------------------------------------------------------------------
/jni/ffmpeg/libswresample-0.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/jni/ffmpeg/libswresample-0.so
--------------------------------------------------------------------------------
/jni/ffmpeg/libswscale-2.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/jni/ffmpeg/libswscale-2.so
--------------------------------------------------------------------------------
/jni/include/libavcodec/avfft.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVCODEC_AVFFT_H
20 | #define AVCODEC_AVFFT_H
21 |
22 | /**
23 | * @file
24 | * @ingroup lavc_fft
25 | * FFT functions
26 | */
27 |
28 | /**
29 | * @defgroup lavc_fft FFT functions
30 | * @ingroup lavc_misc
31 | *
32 | * @{
33 | */
34 |
35 | typedef float FFTSample;
36 |
37 | typedef struct FFTComplex {
38 | FFTSample re, im;
39 | } FFTComplex;
40 |
41 | typedef struct FFTContext FFTContext;
42 |
43 | /**
44 | * Set up a complex FFT.
45 | * @param nbits log2 of the length of the input array
46 | * @param inverse if 0 perform the forward transform, if 1 perform the inverse
47 | */
48 | FFTContext *av_fft_init(int nbits, int inverse);
49 |
50 | /**
51 | * Do the permutation needed BEFORE calling ff_fft_calc().
52 | */
53 | void av_fft_permute(FFTContext *s, FFTComplex *z);
54 |
55 | /**
56 | * Do a complex FFT with the parameters defined in av_fft_init(). The
57 | * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
58 | */
59 | void av_fft_calc(FFTContext *s, FFTComplex *z);
60 |
61 | void av_fft_end(FFTContext *s);
62 |
63 | FFTContext *av_mdct_init(int nbits, int inverse, double scale);
64 | void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
65 | void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
66 | void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
67 | void av_mdct_end(FFTContext *s);
68 |
69 | /* Real Discrete Fourier Transform */
70 |
71 | enum RDFTransformType {
72 | DFT_R2C,
73 | IDFT_C2R,
74 | IDFT_R2C,
75 | DFT_C2R,
76 | };
77 |
78 | typedef struct RDFTContext RDFTContext;
79 |
80 | /**
81 | * Set up a real FFT.
82 | * @param nbits log2 of the length of the input array
83 | * @param trans the type of transform
84 | */
85 | RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
86 | void av_rdft_calc(RDFTContext *s, FFTSample *data);
87 | void av_rdft_end(RDFTContext *s);
88 |
89 | /* Discrete Cosine Transform */
90 |
91 | typedef struct DCTContext DCTContext;
92 |
93 | enum DCTTransformType {
94 | DCT_II = 0,
95 | DCT_III,
96 | DCT_I,
97 | DST_I,
98 | };
99 |
100 | /**
101 | * Set up DCT.
102 | * @param nbits size of the input array:
103 | * (1 << nbits) for DCT-II, DCT-III and DST-I
104 | * (1 << nbits) + 1 for DCT-I
105 | *
106 | * @note the first element of the input of DST-I is ignored
107 | */
108 | DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
109 | void av_dct_calc(DCTContext *s, FFTSample *data);
110 | void av_dct_end (DCTContext *s);
111 |
112 | /**
113 | * @}
114 | */
115 |
116 | #endif /* AVCODEC_AVFFT_H */
117 |
--------------------------------------------------------------------------------
/jni/include/libavcodec/dxva2.h:
--------------------------------------------------------------------------------
1 | /*
2 | * DXVA2 HW acceleration
3 | *
4 | * copyright (c) 2009 Laurent Aimar
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 | #ifndef AVCODEC_DXVA_H
24 | #define AVCODEC_DXVA_H
25 |
26 | /**
27 | * @file
28 | * @ingroup lavc_codec_hwaccel_dxva2
29 | * Public libavcodec DXVA2 header.
30 | */
31 |
32 | #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600
33 | #undef _WIN32_WINNT
34 | #endif
35 |
36 | #if !defined(_WIN32_WINNT)
37 | #define _WIN32_WINNT 0x0600
38 | #endif
39 |
40 | #include
41 | #include
42 | #include
43 |
44 | /**
45 | * @defgroup lavc_codec_hwaccel_dxva2 DXVA2
46 | * @ingroup lavc_codec_hwaccel
47 | *
48 | * @{
49 | */
50 |
51 | #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards
52 |
53 | /**
54 | * This structure is used to provides the necessary configurations and data
55 | * to the DXVA2 FFmpeg HWAccel implementation.
56 | *
57 | * The application must make it available as AVCodecContext.hwaccel_context.
58 | */
59 | struct dxva_context {
60 | /**
61 | * DXVA2 decoder object
62 | */
63 | IDirectXVideoDecoder *decoder;
64 |
65 | /**
66 | * DXVA2 configuration used to create the decoder
67 | */
68 | const DXVA2_ConfigPictureDecode *cfg;
69 |
70 | /**
71 | * The number of surface in the surface array
72 | */
73 | unsigned surface_count;
74 |
75 | /**
76 | * The array of Direct3D surfaces used to create the decoder
77 | */
78 | LPDIRECT3DSURFACE9 *surface;
79 |
80 | /**
81 | * A bit field configuring the workarounds needed for using the decoder
82 | */
83 | uint64_t workaround;
84 |
85 | /**
86 | * Private to the FFmpeg AVHWAccel implementation
87 | */
88 | unsigned report_id;
89 | };
90 |
91 | /**
92 | * @}
93 | */
94 |
95 | #endif /* AVCODEC_DXVA_H */
96 |
--------------------------------------------------------------------------------
/jni/include/libavcodec/vaapi.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Video Acceleration API (shared data between FFmpeg and the video player)
3 | * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
4 | *
5 | * Copyright (C) 2008-2009 Splitted-Desktop Systems
6 | *
7 | * This file is part of FFmpeg.
8 | *
9 | * FFmpeg is free software; you can redistribute it and/or
10 | * modify it under the terms of the GNU Lesser General Public
11 | * License as published by the Free Software Foundation; either
12 | * version 2.1 of the License, or (at your option) any later version.
13 | *
14 | * FFmpeg is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | * Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public
20 | * License along with FFmpeg; if not, write to the Free Software
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 | */
23 |
24 | #ifndef AVCODEC_VAAPI_H
25 | #define AVCODEC_VAAPI_H
26 |
27 | /**
28 | * @file
29 | * @ingroup lavc_codec_hwaccel_vaapi
30 | * Public libavcodec VA API header.
31 | */
32 |
33 | #include
34 |
35 | /**
36 | * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
37 | * @ingroup lavc_codec_hwaccel
38 | * @{
39 | */
40 |
41 | /**
42 | * This structure is used to share data between the FFmpeg library and
43 | * the client video application.
44 | * This shall be zero-allocated and available as
45 | * AVCodecContext.hwaccel_context. All user members can be set once
46 | * during initialization or through each AVCodecContext.get_buffer()
47 | * function call. In any case, they must be valid prior to calling
48 | * decoding functions.
49 | */
50 | struct vaapi_context {
51 | /**
52 | * Window system dependent data
53 | *
54 | * - encoding: unused
55 | * - decoding: Set by user
56 | */
57 | void *display;
58 |
59 | /**
60 | * Configuration ID
61 | *
62 | * - encoding: unused
63 | * - decoding: Set by user
64 | */
65 | uint32_t config_id;
66 |
67 | /**
68 | * Context ID (video decode pipeline)
69 | *
70 | * - encoding: unused
71 | * - decoding: Set by user
72 | */
73 | uint32_t context_id;
74 |
75 | /**
76 | * VAPictureParameterBuffer ID
77 | *
78 | * - encoding: unused
79 | * - decoding: Set by libavcodec
80 | */
81 | uint32_t pic_param_buf_id;
82 |
83 | /**
84 | * VAIQMatrixBuffer ID
85 | *
86 | * - encoding: unused
87 | * - decoding: Set by libavcodec
88 | */
89 | uint32_t iq_matrix_buf_id;
90 |
91 | /**
92 | * VABitPlaneBuffer ID (for VC-1 decoding)
93 | *
94 | * - encoding: unused
95 | * - decoding: Set by libavcodec
96 | */
97 | uint32_t bitplane_buf_id;
98 |
99 | /**
100 | * Slice parameter/data buffer IDs
101 | *
102 | * - encoding: unused
103 | * - decoding: Set by libavcodec
104 | */
105 | uint32_t *slice_buf_ids;
106 |
107 | /**
108 | * Number of effective slice buffer IDs to send to the HW
109 | *
110 | * - encoding: unused
111 | * - decoding: Set by libavcodec
112 | */
113 | unsigned int n_slice_buf_ids;
114 |
115 | /**
116 | * Size of pre-allocated slice_buf_ids
117 | *
118 | * - encoding: unused
119 | * - decoding: Set by libavcodec
120 | */
121 | unsigned int slice_buf_ids_alloc;
122 |
123 | /**
124 | * Pointer to VASliceParameterBuffers
125 | *
126 | * - encoding: unused
127 | * - decoding: Set by libavcodec
128 | */
129 | void *slice_params;
130 |
131 | /**
132 | * Size of a VASliceParameterBuffer element
133 | *
134 | * - encoding: unused
135 | * - decoding: Set by libavcodec
136 | */
137 | unsigned int slice_param_size;
138 |
139 | /**
140 | * Size of pre-allocated slice_params
141 | *
142 | * - encoding: unused
143 | * - decoding: Set by libavcodec
144 | */
145 | unsigned int slice_params_alloc;
146 |
147 | /**
148 | * Number of slices currently filled in
149 | *
150 | * - encoding: unused
151 | * - decoding: Set by libavcodec
152 | */
153 | unsigned int slice_count;
154 |
155 | /**
156 | * Pointer to slice data buffer base
157 | * - encoding: unused
158 | * - decoding: Set by libavcodec
159 | */
160 | const uint8_t *slice_data;
161 |
162 | /**
163 | * Current size of slice data
164 | *
165 | * - encoding: unused
166 | * - decoding: Set by libavcodec
167 | */
168 | uint32_t slice_data_size;
169 | };
170 |
171 | /* @} */
172 |
173 | #endif /* AVCODEC_VAAPI_H */
174 |
--------------------------------------------------------------------------------
/jni/include/libavcodec/vda.h:
--------------------------------------------------------------------------------
1 | /*
2 | * VDA HW acceleration
3 | *
4 | * copyright (c) 2011 Sebastien Zwickert
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 | #ifndef AVCODEC_VDA_H
24 | #define AVCODEC_VDA_H
25 |
26 | /**
27 | * @file
28 | * @ingroup lavc_codec_hwaccel_vda
29 | * Public libavcodec VDA header.
30 | */
31 |
32 | #include
33 |
34 | // emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes
35 | // http://openradar.appspot.com/8026390
36 | #undef __GNUC_STDC_INLINE__
37 |
38 | #define Picture QuickdrawPicture
39 | #include
40 | #undef Picture
41 |
42 | #include "libavcodec/version.h"
43 |
44 | /**
45 | * @defgroup lavc_codec_hwaccel_vda VDA
46 | * @ingroup lavc_codec_hwaccel
47 | *
48 | * @{
49 | */
50 |
51 | /**
52 | * This structure is used to provide the necessary configurations and data
53 | * to the VDA FFmpeg HWAccel implementation.
54 | *
55 | * The application must make it available as AVCodecContext.hwaccel_context.
56 | */
57 | struct vda_context {
58 | /**
59 | * VDA decoder object.
60 | *
61 | * - encoding: unused
62 | * - decoding: Set/Unset by libavcodec.
63 | */
64 | VDADecoder decoder;
65 |
66 | /**
67 | * The Core Video pixel buffer that contains the current image data.
68 | *
69 | * encoding: unused
70 | * decoding: Set by libavcodec. Unset by user.
71 | */
72 | CVPixelBufferRef cv_buffer;
73 |
74 | /**
75 | * Use the hardware decoder in synchronous mode.
76 | *
77 | * encoding: unused
78 | * decoding: Set by user.
79 | */
80 | int use_sync_decoding;
81 |
82 | /**
83 | * The frame width.
84 | *
85 | * - encoding: unused
86 | * - decoding: Set/Unset by user.
87 | */
88 | int width;
89 |
90 | /**
91 | * The frame height.
92 | *
93 | * - encoding: unused
94 | * - decoding: Set/Unset by user.
95 | */
96 | int height;
97 |
98 | /**
99 | * The frame format.
100 | *
101 | * - encoding: unused
102 | * - decoding: Set/Unset by user.
103 | */
104 | int format;
105 |
106 | /**
107 | * The pixel format for output image buffers.
108 | *
109 | * - encoding: unused
110 | * - decoding: Set/Unset by user.
111 | */
112 | OSType cv_pix_fmt_type;
113 |
114 | /**
115 | * The current bitstream buffer.
116 | *
117 | * - encoding: unused
118 | * - decoding: Set/Unset by libavcodec.
119 | */
120 | uint8_t *priv_bitstream;
121 |
122 | /**
123 | * The current size of the bitstream.
124 | *
125 | * - encoding: unused
126 | * - decoding: Set/Unset by libavcodec.
127 | */
128 | int priv_bitstream_size;
129 |
130 | /**
131 | * The reference size used for fast reallocation.
132 | *
133 | * - encoding: unused
134 | * - decoding: Set/Unset by libavcodec.
135 | */
136 | int priv_allocated_size;
137 |
138 | /**
139 | * Use av_buffer to manage buffer.
140 | * When the flag is set, the CVPixelBuffers returned by the decoder will
141 | * be released automatically, so you have to retain them if necessary.
142 | * Not setting this flag may cause memory leak.
143 | *
144 | * encoding: unused
145 | * decoding: Set by user.
146 | */
147 | int use_ref_buffer;
148 | };
149 |
150 | /** Create the video decoder. */
151 | int ff_vda_create_decoder(struct vda_context *vda_ctx,
152 | uint8_t *extradata,
153 | int extradata_size);
154 |
155 | /** Destroy the video decoder. */
156 | int ff_vda_destroy_decoder(struct vda_context *vda_ctx);
157 |
158 | /**
159 | * @}
160 | */
161 |
162 | #endif /* AVCODEC_VDA_H */
163 |
--------------------------------------------------------------------------------
/jni/include/libavcodec/vdpau.h:
--------------------------------------------------------------------------------
1 | /*
2 | * The Video Decode and Presentation API for UNIX (VDPAU) is used for
3 | * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1.
4 | *
5 | * Copyright (C) 2008 NVIDIA
6 | *
7 | * This file is part of FFmpeg.
8 | *
9 | * FFmpeg is free software; you can redistribute it and/or
10 | * modify it under the terms of the GNU Lesser General Public
11 | * License as published by the Free Software Foundation; either
12 | * version 2.1 of the License, or (at your option) any later version.
13 | *
14 | * FFmpeg is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | * Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public
20 | * License along with FFmpeg; if not, write to the Free Software
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 | */
23 |
24 | #ifndef AVCODEC_VDPAU_H
25 | #define AVCODEC_VDPAU_H
26 |
27 | /**
28 | * @file
29 | * @ingroup lavc_codec_hwaccel_vdpau
30 | * Public libavcodec VDPAU header.
31 | */
32 |
33 |
34 | /**
35 | * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer
36 | * @ingroup lavc_codec_hwaccel
37 | *
38 | * VDPAU hardware acceleration has two modules
39 | * - VDPAU decoding
40 | * - VDPAU presentation
41 | *
42 | * The VDPAU decoding module parses all headers using FFmpeg
43 | * parsing mechanisms and uses VDPAU for the actual decoding.
44 | *
45 | * As per the current implementation, the actual decoding
46 | * and rendering (API calls) are done as part of the VDPAU
47 | * presentation (vo_vdpau.c) module.
48 | *
49 | * @{
50 | */
51 |
52 | #include
53 | #include
54 | #include "libavutil/avconfig.h"
55 |
56 | union FFVdpPictureInfo {
57 | VdpPictureInfoH264 h264;
58 | VdpPictureInfoMPEG1Or2 mpeg;
59 | VdpPictureInfoVC1 vc1;
60 | VdpPictureInfoMPEG4Part2 mpeg4;
61 | };
62 |
63 | /**
64 | * This structure is used to share data between the libavcodec library and
65 | * the client video application.
66 | * The user shall zero-allocate the structure and make it available as
67 | * AVCodecContext.hwaccel_context. Members can be set by the user once
68 | * during initialization or through each AVCodecContext.get_buffer()
69 | * function call. In any case, they must be valid prior to calling
70 | * decoding functions.
71 | */
72 | typedef struct AVVDPAUContext {
73 | /**
74 | * VDPAU decoder handle
75 | *
76 | * Set by user.
77 | */
78 | VdpDecoder decoder;
79 |
80 | /**
81 | * VDPAU decoder render callback
82 | *
83 | * Set by the user.
84 | */
85 | VdpDecoderRender *render;
86 |
87 | /**
88 | * VDPAU picture information
89 | *
90 | * Set by libavcodec.
91 | */
92 | union FFVdpPictureInfo info;
93 |
94 | /**
95 | * Allocated size of the bitstream_buffers table.
96 | *
97 | * Set by libavcodec.
98 | */
99 | int bitstream_buffers_allocated;
100 |
101 | /**
102 | * Useful bitstream buffers in the bitstream buffers table.
103 | *
104 | * Set by libavcodec.
105 | */
106 | int bitstream_buffers_used;
107 |
108 | /**
109 | * Table of bitstream buffers.
110 | * The user is responsible for freeing this buffer using av_freep().
111 | *
112 | * Set by libavcodec.
113 | */
114 | VdpBitstreamBuffer *bitstream_buffers;
115 | } AVVDPAUContext;
116 |
117 |
118 | /** @brief The videoSurface is used for rendering. */
119 | #define FF_VDPAU_STATE_USED_FOR_RENDER 1
120 |
121 | /**
122 | * @brief The videoSurface is needed for reference/prediction.
123 | * The codec manipulates this.
124 | */
125 | #define FF_VDPAU_STATE_USED_FOR_REFERENCE 2
126 |
127 | /**
128 | * @brief This structure is used as a callback between the FFmpeg
129 | * decoder (vd_) and presentation (vo_) module.
130 | * This is used for defining a video frame containing surface,
131 | * picture parameter, bitstream information etc which are passed
132 | * between the FFmpeg decoder and its clients.
133 | */
134 | struct vdpau_render_state {
135 | VdpVideoSurface surface; ///< Used as rendered surface, never changed.
136 |
137 | int state; ///< Holds FF_VDPAU_STATE_* values.
138 |
139 | #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI
140 | /** picture parameter information for all supported codecs */
141 | union FFVdpPictureInfo info;
142 | #endif
143 |
144 | /** Describe size/location of the compressed video data.
145 | Set to 0 when freeing bitstream_buffers. */
146 | int bitstream_buffers_allocated;
147 | int bitstream_buffers_used;
148 | /** The user is responsible for freeing this buffer using av_freep(). */
149 | VdpBitstreamBuffer *bitstream_buffers;
150 |
151 | #if !AV_HAVE_INCOMPATIBLE_LIBAV_ABI
152 | /** picture parameter information for all supported codecs */
153 | union FFVdpPictureInfo info;
154 | #endif
155 | };
156 |
157 | /* @}*/
158 |
159 | #endif /* AVCODEC_VDPAU_H */
160 |
--------------------------------------------------------------------------------
/jni/include/libavcodec/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * This file is part of FFmpeg.
4 | *
5 | * FFmpeg is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * FFmpeg is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with FFmpeg; if not, write to the Free Software
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 | */
19 |
20 | #ifndef AVCODEC_VERSION_H
21 | #define AVCODEC_VERSION_H
22 |
23 | /**
24 | * @file
25 | * @ingroup libavc
26 | * Libavcodec version macros.
27 | */
28 |
29 | #include "libavutil/avutil.h"
30 |
31 | #define LIBAVCODEC_VERSION_MAJOR 55
32 | #define LIBAVCODEC_VERSION_MINOR 18
33 | #define LIBAVCODEC_VERSION_MICRO 102
34 |
35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
36 | LIBAVCODEC_VERSION_MINOR, \
37 | LIBAVCODEC_VERSION_MICRO)
38 | #define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
39 | LIBAVCODEC_VERSION_MINOR, \
40 | LIBAVCODEC_VERSION_MICRO)
41 | #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
42 |
43 | #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
44 |
45 | /**
46 | * FF_API_* defines may be placed below to indicate public API that will be
47 | * dropped at a future version bump. The defines themselves are not part of
48 | * the public API and may change, break or disappear at any time.
49 | */
50 |
51 | #ifndef FF_API_REQUEST_CHANNELS
52 | #define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 56)
53 | #endif
54 | #ifndef FF_API_ALLOC_CONTEXT
55 | #define FF_API_ALLOC_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 55)
56 | #endif
57 | #ifndef FF_API_AVCODEC_OPEN
58 | #define FF_API_AVCODEC_OPEN (LIBAVCODEC_VERSION_MAJOR < 55)
59 | #endif
60 | #ifndef FF_API_OLD_DECODE_AUDIO
61 | #define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 56)
62 | #endif
63 | #ifndef FF_API_OLD_TIMECODE
64 | #define FF_API_OLD_TIMECODE (LIBAVCODEC_VERSION_MAJOR < 55)
65 | #endif
66 |
67 | #ifndef FF_API_OLD_ENCODE_AUDIO
68 | #define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 56)
69 | #endif
70 | #ifndef FF_API_OLD_ENCODE_VIDEO
71 | #define FF_API_OLD_ENCODE_VIDEO (LIBAVCODEC_VERSION_MAJOR < 56)
72 | #endif
73 | #ifndef FF_API_CODEC_ID
74 | #define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 56)
75 | #endif
76 | #ifndef FF_API_AVCODEC_RESAMPLE
77 | #define FF_API_AVCODEC_RESAMPLE (LIBAVCODEC_VERSION_MAJOR < 56)
78 | #endif
79 | #ifndef FF_API_DEINTERLACE
80 | #define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 56)
81 | #endif
82 | #ifndef FF_API_DESTRUCT_PACKET
83 | #define FF_API_DESTRUCT_PACKET (LIBAVCODEC_VERSION_MAJOR < 56)
84 | #endif
85 | #ifndef FF_API_GET_BUFFER
86 | #define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 56)
87 | #endif
88 | #ifndef FF_API_MISSING_SAMPLE
89 | #define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 56)
90 | #endif
91 | #ifndef FF_API_LOWRES
92 | #define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 56)
93 | #endif
94 |
95 | #endif /* AVCODEC_VERSION_H */
96 |
--------------------------------------------------------------------------------
/jni/include/libavcodec/xvmc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2003 Ivan Kalvachev
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 | #ifndef AVCODEC_XVMC_H
22 | #define AVCODEC_XVMC_H
23 |
24 | /**
25 | * @file
26 | * @ingroup lavc_codec_hwaccel_xvmc
27 | * Public libavcodec XvMC header.
28 | */
29 |
30 | #include
31 |
32 | #include "avcodec.h"
33 |
34 | /**
35 | * @defgroup lavc_codec_hwaccel_xvmc XvMC
36 | * @ingroup lavc_codec_hwaccel
37 | *
38 | * @{
39 | */
40 |
41 | #define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct
42 | the number is 1337 speak for the letters IDCT MCo (motion compensation) */
43 |
44 | struct xvmc_pix_fmt {
45 | /** The field contains the special constant value AV_XVMC_ID.
46 | It is used as a test that the application correctly uses the API,
47 | and that there is no corruption caused by pixel routines.
48 | - application - set during initialization
49 | - libavcodec - unchanged
50 | */
51 | int xvmc_id;
52 |
53 | /** Pointer to the block array allocated by XvMCCreateBlocks().
54 | The array has to be freed by XvMCDestroyBlocks().
55 | Each group of 64 values represents one data block of differential
56 | pixel information (in MoCo mode) or coefficients for IDCT.
57 | - application - set the pointer during initialization
58 | - libavcodec - fills coefficients/pixel data into the array
59 | */
60 | short* data_blocks;
61 |
62 | /** Pointer to the macroblock description array allocated by
63 | XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks().
64 | - application - set the pointer during initialization
65 | - libavcodec - fills description data into the array
66 | */
67 | XvMCMacroBlock* mv_blocks;
68 |
69 | /** Number of macroblock descriptions that can be stored in the mv_blocks
70 | array.
71 | - application - set during initialization
72 | - libavcodec - unchanged
73 | */
74 | int allocated_mv_blocks;
75 |
76 | /** Number of blocks that can be stored at once in the data_blocks array.
77 | - application - set during initialization
78 | - libavcodec - unchanged
79 | */
80 | int allocated_data_blocks;
81 |
82 | /** Indicate that the hardware would interpret data_blocks as IDCT
83 | coefficients and perform IDCT on them.
84 | - application - set during initialization
85 | - libavcodec - unchanged
86 | */
87 | int idct;
88 |
89 | /** In MoCo mode it indicates that intra macroblocks are assumed to be in
90 | unsigned format; same as the XVMC_INTRA_UNSIGNED flag.
91 | - application - set during initialization
92 | - libavcodec - unchanged
93 | */
94 | int unsigned_intra;
95 |
96 | /** Pointer to the surface allocated by XvMCCreateSurface().
97 | It has to be freed by XvMCDestroySurface() on application exit.
98 | It identifies the frame and its state on the video hardware.
99 | - application - set during initialization
100 | - libavcodec - unchanged
101 | */
102 | XvMCSurface* p_surface;
103 |
104 | /** Set by the decoder before calling ff_draw_horiz_band(),
105 | needed by the XvMCRenderSurface function. */
106 | //@{
107 | /** Pointer to the surface used as past reference
108 | - application - unchanged
109 | - libavcodec - set
110 | */
111 | XvMCSurface* p_past_surface;
112 |
113 | /** Pointer to the surface used as future reference
114 | - application - unchanged
115 | - libavcodec - set
116 | */
117 | XvMCSurface* p_future_surface;
118 |
119 | /** top/bottom field or frame
120 | - application - unchanged
121 | - libavcodec - set
122 | */
123 | unsigned int picture_structure;
124 |
125 | /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence
126 | - application - unchanged
127 | - libavcodec - set
128 | */
129 | unsigned int flags;
130 | //}@
131 |
132 | /** Number of macroblock descriptions in the mv_blocks array
133 | that have already been passed to the hardware.
134 | - application - zeroes it on get_buffer().
135 | A successful ff_draw_horiz_band() may increment it
136 | with filled_mb_block_num or zero both.
137 | - libavcodec - unchanged
138 | */
139 | int start_mv_blocks_num;
140 |
141 | /** Number of new macroblock descriptions in the mv_blocks array (after
142 | start_mv_blocks_num) that are filled by libavcodec and have to be
143 | passed to the hardware.
144 | - application - zeroes it on get_buffer() or after successful
145 | ff_draw_horiz_band().
146 | - libavcodec - increment with one of each stored MB
147 | */
148 | int filled_mv_blocks_num;
149 |
150 | /** Number of the next free data block; one data block consists of
151 | 64 short values in the data_blocks array.
152 | All blocks before this one have already been claimed by placing their
153 | position into the corresponding block description structure field,
154 | that are part of the mv_blocks array.
155 | - application - zeroes it on get_buffer().
156 | A successful ff_draw_horiz_band() may zero it together
157 | with start_mb_blocks_num.
158 | - libavcodec - each decoded macroblock increases it by the number
159 | of coded blocks it contains.
160 | */
161 | int next_free_data_block_num;
162 | };
163 |
164 | /**
165 | * @}
166 | */
167 |
168 | #endif /* AVCODEC_XVMC_H */
169 |
--------------------------------------------------------------------------------
/jni/include/libavdevice/avdevice.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVDEVICE_AVDEVICE_H
20 | #define AVDEVICE_AVDEVICE_H
21 |
22 | #include "version.h"
23 |
24 | /**
25 | * @file
26 | * @ingroup lavd
27 | * Main libavdevice API header
28 | */
29 |
30 | /**
31 | * @defgroup lavd Special devices muxing/demuxing library
32 | * @{
33 | * Libavdevice is a complementary library to @ref libavf "libavformat". It
34 | * provides various "special" platform-specific muxers and demuxers, e.g. for
35 | * grabbing devices, audio capture and playback etc. As a consequence, the
36 | * (de)muxers in libavdevice are of the AVFMT_NOFILE type (they use their own
37 | * I/O functions). The filename passed to avformat_open_input() often does not
38 | * refer to an actually existing file, but has some special device-specific
39 | * meaning - e.g. for x11grab it is the display name.
40 | *
41 | * To use libavdevice, simply call avdevice_register_all() to register all
42 | * compiled muxers and demuxers. They all use standard libavformat API.
43 | * @}
44 | */
45 |
46 | #include "libavformat/avformat.h"
47 |
48 | /**
49 | * Return the LIBAVDEVICE_VERSION_INT constant.
50 | */
51 | unsigned avdevice_version(void);
52 |
53 | /**
54 | * Return the libavdevice build-time configuration.
55 | */
56 | const char *avdevice_configuration(void);
57 |
58 | /**
59 | * Return the libavdevice license.
60 | */
61 | const char *avdevice_license(void);
62 |
63 | /**
64 | * Initialize libavdevice and register all the input and output devices.
65 | * @warning This function is not thread safe.
66 | */
67 | void avdevice_register_all(void);
68 |
69 | #endif /* AVDEVICE_AVDEVICE_H */
70 |
--------------------------------------------------------------------------------
/jni/include/libavdevice/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVDEVICE_VERSION_H
20 | #define AVDEVICE_VERSION_H
21 |
22 | /**
23 | * @file
24 | * @ingroup lavd
25 | * Libavdevice version macros
26 | */
27 |
28 | #include "libavutil/avutil.h"
29 |
30 | #define LIBAVDEVICE_VERSION_MAJOR 55
31 | #define LIBAVDEVICE_VERSION_MINOR 3
32 | #define LIBAVDEVICE_VERSION_MICRO 100
33 |
34 | #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
35 | LIBAVDEVICE_VERSION_MINOR, \
36 | LIBAVDEVICE_VERSION_MICRO)
37 | #define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \
38 | LIBAVDEVICE_VERSION_MINOR, \
39 | LIBAVDEVICE_VERSION_MICRO)
40 | #define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT
41 |
42 | #define LIBAVDEVICE_IDENT "Lavd" AV_STRINGIFY(LIBAVDEVICE_VERSION)
43 |
44 | /**
45 | * FF_API_* defines may be placed below to indicate public API that will be
46 | * dropped at a future version bump. The defines themselves are not part of
47 | * the public API and may change, break or disappear at any time.
48 | */
49 |
50 | #endif /* AVDEVICE_VERSION_H */
51 |
--------------------------------------------------------------------------------
/jni/include/libavfilter/asrc_abuffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVFILTER_ASRC_ABUFFER_H
20 | #define AVFILTER_ASRC_ABUFFER_H
21 |
22 | #include "avfilter.h"
23 |
24 | /**
25 | * @file
26 | * memory buffer source for audio
27 | *
28 | * @deprecated use buffersrc.h instead.
29 | */
30 |
31 | /**
32 | * Queue an audio buffer to the audio buffer source.
33 | *
34 | * @param abuffersrc audio source buffer context
35 | * @param data pointers to the samples planes
36 | * @param linesize linesizes of each audio buffer plane
37 | * @param nb_samples number of samples per channel
38 | * @param sample_fmt sample format of the audio data
39 | * @param ch_layout channel layout of the audio data
40 | * @param planar flag to indicate if audio data is planar or packed
41 | * @param pts presentation timestamp of the audio buffer
42 | * @param flags unused
43 | *
44 | * @deprecated use av_buffersrc_add_ref() instead.
45 | */
46 | attribute_deprecated
47 | int av_asrc_buffer_add_samples(AVFilterContext *abuffersrc,
48 | uint8_t *data[8], int linesize[8],
49 | int nb_samples, int sample_rate,
50 | int sample_fmt, int64_t ch_layout, int planar,
51 | int64_t pts, int av_unused flags);
52 |
53 | /**
54 | * Queue an audio buffer to the audio buffer source.
55 | *
56 | * This is similar to av_asrc_buffer_add_samples(), but the samples
57 | * are stored in a buffer with known size.
58 | *
59 | * @param abuffersrc audio source buffer context
60 | * @param buf pointer to the samples data, packed is assumed
61 | * @param size the size in bytes of the buffer, it must contain an
62 | * integer number of samples
63 | * @param sample_fmt sample format of the audio data
64 | * @param ch_layout channel layout of the audio data
65 | * @param pts presentation timestamp of the audio buffer
66 | * @param flags unused
67 | *
68 | * @deprecated use av_buffersrc_add_ref() instead.
69 | */
70 | attribute_deprecated
71 | int av_asrc_buffer_add_buffer(AVFilterContext *abuffersrc,
72 | uint8_t *buf, int buf_size,
73 | int sample_rate,
74 | int sample_fmt, int64_t ch_layout, int planar,
75 | int64_t pts, int av_unused flags);
76 |
77 | /**
78 | * Queue an audio buffer to the audio buffer source.
79 | *
80 | * @param abuffersrc audio source buffer context
81 | * @param samplesref buffer ref to queue
82 | * @param flags unused
83 | *
84 | * @deprecated use av_buffersrc_add_ref() instead.
85 | */
86 | attribute_deprecated
87 | int av_asrc_buffer_add_audio_buffer_ref(AVFilterContext *abuffersrc,
88 | AVFilterBufferRef *samplesref,
89 | int av_unused flags);
90 |
91 | #endif /* AVFILTER_ASRC_ABUFFER_H */
92 |
--------------------------------------------------------------------------------
/jni/include/libavfilter/avcodec.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVFILTER_AVCODEC_H
20 | #define AVFILTER_AVCODEC_H
21 |
22 | /**
23 | * @file
24 | * libavcodec/libavfilter gluing utilities
25 | *
26 | * This should be included in an application ONLY if the installed
27 | * libavfilter has been compiled with libavcodec support, otherwise
28 | * symbols defined below will not be available.
29 | */
30 |
31 | #include "avfilter.h"
32 |
33 | #if FF_API_AVFILTERBUFFER
34 | /**
35 | * Create and return a picref reference from the data and properties
36 | * contained in frame.
37 | *
38 | * @param perms permissions to assign to the new buffer reference
39 | * @deprecated avfilter APIs work natively with AVFrame instead.
40 | */
41 | attribute_deprecated
42 | AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, int perms);
43 |
44 |
45 | /**
46 | * Create and return a picref reference from the data and properties
47 | * contained in frame.
48 | *
49 | * @param perms permissions to assign to the new buffer reference
50 | * @deprecated avfilter APIs work natively with AVFrame instead.
51 | */
52 | attribute_deprecated
53 | AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame,
54 | int perms);
55 |
56 | /**
57 | * Create and return a buffer reference from the data and properties
58 | * contained in frame.
59 | *
60 | * @param perms permissions to assign to the new buffer reference
61 | * @deprecated avfilter APIs work natively with AVFrame instead.
62 | */
63 | attribute_deprecated
64 | AVFilterBufferRef *avfilter_get_buffer_ref_from_frame(enum AVMediaType type,
65 | const AVFrame *frame,
66 | int perms);
67 | #endif
68 |
69 | #if FF_API_FILL_FRAME
70 | /**
71 | * Fill an AVFrame with the information stored in samplesref.
72 | *
73 | * @param frame an already allocated AVFrame
74 | * @param samplesref an audio buffer reference
75 | * @return 0 in case of success, a negative AVERROR code in case of
76 | * failure
77 | * @deprecated Use avfilter_copy_buf_props() instead.
78 | */
79 | attribute_deprecated
80 | int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame,
81 | const AVFilterBufferRef *samplesref);
82 |
83 | /**
84 | * Fill an AVFrame with the information stored in picref.
85 | *
86 | * @param frame an already allocated AVFrame
87 | * @param picref a video buffer reference
88 | * @return 0 in case of success, a negative AVERROR code in case of
89 | * failure
90 | * @deprecated Use avfilter_copy_buf_props() instead.
91 | */
92 | attribute_deprecated
93 | int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
94 | const AVFilterBufferRef *picref);
95 |
96 | /**
97 | * Fill an AVFrame with information stored in ref.
98 | *
99 | * @param frame an already allocated AVFrame
100 | * @param ref a video or audio buffer reference
101 | * @return 0 in case of success, a negative AVERROR code in case of
102 | * failure
103 | * @deprecated Use avfilter_copy_buf_props() instead.
104 | */
105 | attribute_deprecated
106 | int avfilter_fill_frame_from_buffer_ref(AVFrame *frame,
107 | const AVFilterBufferRef *ref);
108 | #endif
109 |
110 | #endif /* AVFILTER_AVCODEC_H */
111 |
--------------------------------------------------------------------------------
/jni/include/libavfilter/avfiltergraph.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Filter graphs
3 | * copyright (c) 2007 Bobby Bingham
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVFILTER_AVFILTERGRAPH_H
23 | #define AVFILTER_AVFILTERGRAPH_H
24 |
25 | #include "avfilter.h"
26 | #include "libavutil/log.h"
27 |
28 | #endif /* AVFILTER_AVFILTERGRAPH_H */
29 |
--------------------------------------------------------------------------------
/jni/include/libavfilter/buffersrc.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * This file is part of Libav.
4 | *
5 | * Libav is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * Libav is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with Libav; if not, write to the Free Software
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 | */
19 |
20 | #ifndef AVFILTER_BUFFERSRC_H
21 | #define AVFILTER_BUFFERSRC_H
22 |
23 | /**
24 | * @file
25 | * Memory buffer source API.
26 | */
27 |
28 | #include "libavcodec/avcodec.h"
29 | #include "avfilter.h"
30 |
31 | enum {
32 |
33 | /**
34 | * Do not check for format changes.
35 | */
36 | AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT = 1,
37 |
38 | #if FF_API_AVFILTERBUFFER
39 | /**
40 | * Ignored
41 | */
42 | AV_BUFFERSRC_FLAG_NO_COPY = 2,
43 | #endif
44 |
45 | /**
46 | * Immediately push the frame to the output.
47 | */
48 | AV_BUFFERSRC_FLAG_PUSH = 4,
49 |
50 | /**
51 | * Keep a reference to the frame.
52 | * If the frame if reference-counted, create a new reference; otherwise
53 | * copy the frame data.
54 | */
55 | AV_BUFFERSRC_FLAG_KEEP_REF = 8,
56 |
57 | };
58 |
59 | /**
60 | * Add buffer data in picref to buffer_src.
61 | *
62 | * @param buffer_src pointer to a buffer source context
63 | * @param picref a buffer reference, or NULL to mark EOF
64 | * @param flags a combination of AV_BUFFERSRC_FLAG_*
65 | * @return >= 0 in case of success, a negative AVERROR code
66 | * in case of failure
67 | */
68 | int av_buffersrc_add_ref(AVFilterContext *buffer_src,
69 | AVFilterBufferRef *picref, int flags);
70 |
71 | /**
72 | * Get the number of failed requests.
73 | *
74 | * A failed request is when the request_frame method is called while no
75 | * frame is present in the buffer.
76 | * The number is reset when a frame is added.
77 | */
78 | unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src);
79 |
80 | #if FF_API_AVFILTERBUFFER
81 | /**
82 | * Add a buffer to the filtergraph s.
83 | *
84 | * @param buf buffer containing frame data to be passed down the filtergraph.
85 | * This function will take ownership of buf, the user must not free it.
86 | * A NULL buf signals EOF -- i.e. no more frames will be sent to this filter.
87 | *
88 | * @deprecated use av_buffersrc_write_frame() or av_buffersrc_add_frame()
89 | */
90 | attribute_deprecated
91 | int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf);
92 | #endif
93 |
94 | /**
95 | * Add a frame to the buffer source.
96 | *
97 | * @param s an instance of the buffersrc filter.
98 | * @param frame frame to be added. If the frame is reference counted, this
99 | * function will make a new reference to it. Otherwise the frame data will be
100 | * copied.
101 | *
102 | * @return 0 on success, a negative AVERROR on error
103 | *
104 | * This function is equivalent to av_buffersrc_add_frame_flags() with the
105 | * AV_BUFFERSRC_FLAG_KEEP_REF flag.
106 | */
107 | int av_buffersrc_write_frame(AVFilterContext *s, const AVFrame *frame);
108 |
109 | /**
110 | * Add a frame to the buffer source.
111 | *
112 | * @param s an instance of the buffersrc filter.
113 | * @param frame frame to be added. If the frame is reference counted, this
114 | * function will take ownership of the reference(s) and reset the frame.
115 | * Otherwise the frame data will be copied. If this function returns an error,
116 | * the input frame is not touched.
117 | *
118 | * @return 0 on success, a negative AVERROR on error.
119 | *
120 | * @note the difference between this function and av_buffersrc_write_frame() is
121 | * that av_buffersrc_write_frame() creates a new reference to the input frame,
122 | * while this function takes ownership of the reference passed to it.
123 | *
124 | * This function is equivalent to av_buffersrc_add_frame_flags() without the
125 | * AV_BUFFERSRC_FLAG_KEEP_REF flag.
126 | */
127 | int av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame);
128 |
129 | /**
130 | * Add a frame to the buffer source.
131 | *
132 | * By default, if the frame is reference-counted, this function will take
133 | * ownership of the reference(s) and reset the frame. This can be controled
134 | * using the flags.
135 | *
136 | * If this function returns an error, the input frame is not touched.
137 | *
138 | * @param buffer_src pointer to a buffer source context
139 | * @param frame a frame, or NULL to mark EOF
140 | * @param flags a combination of AV_BUFFERSRC_FLAG_*
141 | * @return >= 0 in case of success, a negative AVERROR code
142 | * in case of failure
143 | */
144 | int av_buffersrc_add_frame_flags(AVFilterContext *buffer_src,
145 | AVFrame *frame, int flags);
146 |
147 |
148 | #endif /* AVFILTER_BUFFERSRC_H */
149 |
--------------------------------------------------------------------------------
/jni/include/libavfilter/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Version macros.
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 | #ifndef AVFILTER_VERSION_H
22 | #define AVFILTER_VERSION_H
23 |
24 | /**
25 | * @file
26 | * @ingroup lavfi
27 | * Libavfilter version macros
28 | */
29 |
30 | #include "libavutil/avutil.h"
31 |
32 | #define LIBAVFILTER_VERSION_MAJOR 3
33 | #define LIBAVFILTER_VERSION_MINOR 79
34 | #define LIBAVFILTER_VERSION_MICRO 101
35 |
36 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
37 | LIBAVFILTER_VERSION_MINOR, \
38 | LIBAVFILTER_VERSION_MICRO)
39 | #define LIBAVFILTER_VERSION AV_VERSION(LIBAVFILTER_VERSION_MAJOR, \
40 | LIBAVFILTER_VERSION_MINOR, \
41 | LIBAVFILTER_VERSION_MICRO)
42 | #define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT
43 |
44 | #define LIBAVFILTER_IDENT "Lavfi" AV_STRINGIFY(LIBAVFILTER_VERSION)
45 |
46 | /**
47 | * FF_API_* defines may be placed below to indicate public API that will be
48 | * dropped at a future version bump. The defines themselves are not part of
49 | * the public API and may change, break or disappear at any time.
50 | */
51 |
52 | #ifndef FF_API_AVFILTERPAD_PUBLIC
53 | #define FF_API_AVFILTERPAD_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 4)
54 | #endif
55 | #ifndef FF_API_FOO_COUNT
56 | #define FF_API_FOO_COUNT (LIBAVFILTER_VERSION_MAJOR < 4)
57 | #endif
58 | #ifndef FF_API_FILL_FRAME
59 | #define FF_API_FILL_FRAME (LIBAVFILTER_VERSION_MAJOR < 4)
60 | #endif
61 | #ifndef FF_API_BUFFERSRC_BUFFER
62 | #define FF_API_BUFFERSRC_BUFFER (LIBAVFILTER_VERSION_MAJOR < 4)
63 | #endif
64 | #ifndef FF_API_AVFILTERBUFFER
65 | #define FF_API_AVFILTERBUFFER (LIBAVFILTER_VERSION_MAJOR < 4)
66 | #endif
67 | #ifndef FF_API_OLD_FILTER_OPTS
68 | #define FF_API_OLD_FILTER_OPTS (LIBAVFILTER_VERSION_MAJOR < 4)
69 | #endif
70 | #ifndef FF_API_ACONVERT_FILTER
71 | #define FF_API_ACONVERT_FILTER (LIBAVFILTER_VERSION_MAJOR < 4)
72 | #endif
73 | #ifndef FF_API_AVFILTER_OPEN
74 | #define FF_API_AVFILTER_OPEN (LIBAVFILTER_VERSION_MAJOR < 4)
75 | #endif
76 | #ifndef FF_API_AVFILTER_INIT_FILTER
77 | #define FF_API_AVFILTER_INIT_FILTER (LIBAVFILTER_VERSION_MAJOR < 4)
78 | #endif
79 | #ifndef FF_API_OLD_FILTER_REGISTER
80 | #define FF_API_OLD_FILTER_REGISTER (LIBAVFILTER_VERSION_MAJOR < 4)
81 | #endif
82 | #ifndef FF_API_OLD_GRAPH_PARSE
83 | #define FF_API_OLD_GRAPH_PARSE (LIBAVFILTER_VERSION_MAJOR < 4)
84 | #endif
85 |
86 | #endif /* AVFILTER_VERSION_H */
87 |
--------------------------------------------------------------------------------
/jni/include/libavformat/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Version macros.
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 | #ifndef AVFORMAT_VERSION_H
22 | #define AVFORMAT_VERSION_H
23 |
24 | /**
25 | * @file
26 | * @ingroup libavf
27 | * Libavformat version macros
28 | */
29 |
30 | #include "libavutil/avutil.h"
31 |
32 | #define LIBAVFORMAT_VERSION_MAJOR 55
33 | #define LIBAVFORMAT_VERSION_MINOR 12
34 | #define LIBAVFORMAT_VERSION_MICRO 100
35 |
36 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
37 | LIBAVFORMAT_VERSION_MINOR, \
38 | LIBAVFORMAT_VERSION_MICRO)
39 | #define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \
40 | LIBAVFORMAT_VERSION_MINOR, \
41 | LIBAVFORMAT_VERSION_MICRO)
42 | #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT
43 |
44 | #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
45 |
46 | /**
47 | * FF_API_* defines may be placed below to indicate public API that will be
48 | * dropped at a future version bump. The defines themselves are not part of
49 | * the public API and may change, break or disappear at any time.
50 | */
51 |
52 | #ifndef FF_API_OLD_AVIO
53 | #define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 55)
54 | #endif
55 | #ifndef FF_API_PKT_DUMP
56 | #define FF_API_PKT_DUMP (LIBAVFORMAT_VERSION_MAJOR < 54)
57 | #endif
58 | #ifndef FF_API_ALLOC_OUTPUT_CONTEXT
59 | #define FF_API_ALLOC_OUTPUT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 56)
60 | #endif
61 | #ifndef FF_API_FORMAT_PARAMETERS
62 | #define FF_API_FORMAT_PARAMETERS (LIBAVFORMAT_VERSION_MAJOR < 56)
63 | #endif
64 | #ifndef FF_API_NEW_STREAM
65 | #define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 56)
66 | #endif
67 | #ifndef FF_API_SET_PTS_INFO
68 | #define FF_API_SET_PTS_INFO (LIBAVFORMAT_VERSION_MAJOR < 56)
69 | #endif
70 | #ifndef FF_API_CLOSE_INPUT_FILE
71 | #define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 56)
72 | #endif
73 | #ifndef FF_API_READ_PACKET
74 | #define FF_API_READ_PACKET (LIBAVFORMAT_VERSION_MAJOR < 56)
75 | #endif
76 | #ifndef FF_API_ASS_SSA
77 | #define FF_API_ASS_SSA (LIBAVFORMAT_VERSION_MAJOR < 56)
78 | #endif
79 | #ifndef FF_API_R_FRAME_RATE
80 | #define FF_API_R_FRAME_RATE 1
81 | #endif
82 | #endif /* AVFORMAT_VERSION_H */
83 |
--------------------------------------------------------------------------------
/jni/include/libavutil/adler32.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2006 Mans Rullgard
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 | #ifndef AVUTIL_ADLER32_H
22 | #define AVUTIL_ADLER32_H
23 |
24 | #include
25 | #include "attributes.h"
26 |
27 | /**
28 | * @defgroup lavu_adler32 Adler32
29 | * @ingroup lavu_crypto
30 | * @{
31 | */
32 |
33 | /**
34 | * Calculate the Adler32 checksum of a buffer.
35 | *
36 | * Passing the return value to a subsequent av_adler32_update() call
37 | * allows the checksum of multiple buffers to be calculated as though
38 | * they were concatenated.
39 | *
40 | * @param adler initial checksum value
41 | * @param buf pointer to input buffer
42 | * @param len size of input buffer
43 | * @return updated checksum
44 | */
45 | unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf,
46 | unsigned int len) av_pure;
47 |
48 | /**
49 | * @}
50 | */
51 |
52 | #endif /* AVUTIL_ADLER32_H */
53 |
--------------------------------------------------------------------------------
/jni/include/libavutil/aes.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2007 Michael Niedermayer
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 | #ifndef AVUTIL_AES_H
22 | #define AVUTIL_AES_H
23 |
24 | #include
25 |
26 | #include "attributes.h"
27 | #include "version.h"
28 |
29 | /**
30 | * @defgroup lavu_aes AES
31 | * @ingroup lavu_crypto
32 | * @{
33 | */
34 |
35 | extern const int av_aes_size;
36 |
37 | struct AVAES;
38 |
39 | /**
40 | * Allocate an AVAES context.
41 | */
42 | struct AVAES *av_aes_alloc(void);
43 |
44 | /**
45 | * Initialize an AVAES context.
46 | * @param key_bits 128, 192 or 256
47 | * @param decrypt 0 for encryption, 1 for decryption
48 | */
49 | int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt);
50 |
51 | /**
52 | * Encrypt or decrypt a buffer using a previously initialized context.
53 | * @param count number of 16 byte blocks
54 | * @param dst destination array, can be equal to src
55 | * @param src source array, can be equal to dst
56 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used
57 | * @param decrypt 0 for encryption, 1 for decryption
58 | */
59 | void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
60 |
61 | /**
62 | * @}
63 | */
64 |
65 | #endif /* AVUTIL_AES_H */
66 |
--------------------------------------------------------------------------------
/jni/include/libavutil/attributes.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2006 Michael Niedermayer
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
23 | * Macro definitions for various function/variable attributes
24 | */
25 |
26 | #ifndef AVUTIL_ATTRIBUTES_H
27 | #define AVUTIL_ATTRIBUTES_H
28 |
29 | #ifdef __GNUC__
30 | # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y)
31 | #else
32 | # define AV_GCC_VERSION_AT_LEAST(x,y) 0
33 | #endif
34 |
35 | #ifndef av_always_inline
36 | #if AV_GCC_VERSION_AT_LEAST(3,1)
37 | # define av_always_inline __attribute__((always_inline)) inline
38 | #elif defined(_MSC_VER)
39 | # define av_always_inline __forceinline
40 | #else
41 | # define av_always_inline inline
42 | #endif
43 | #endif
44 |
45 | #ifndef av_extern_inline
46 | #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
47 | # define av_extern_inline extern inline
48 | #else
49 | # define av_extern_inline inline
50 | #endif
51 | #endif
52 |
53 | #if AV_GCC_VERSION_AT_LEAST(3,1)
54 | # define av_noinline __attribute__((noinline))
55 | #else
56 | # define av_noinline
57 | #endif
58 |
59 | #if AV_GCC_VERSION_AT_LEAST(3,1)
60 | # define av_pure __attribute__((pure))
61 | #else
62 | # define av_pure
63 | #endif
64 |
65 | #ifndef av_restrict
66 | #define av_restrict restrict
67 | #endif
68 |
69 | #if AV_GCC_VERSION_AT_LEAST(2,6)
70 | # define av_const __attribute__((const))
71 | #else
72 | # define av_const
73 | #endif
74 |
75 | #if AV_GCC_VERSION_AT_LEAST(4,3)
76 | # define av_cold __attribute__((cold))
77 | #else
78 | # define av_cold
79 | #endif
80 |
81 | #if AV_GCC_VERSION_AT_LEAST(4,1)
82 | # define av_flatten __attribute__((flatten))
83 | #else
84 | # define av_flatten
85 | #endif
86 |
87 | #if AV_GCC_VERSION_AT_LEAST(3,1)
88 | # define attribute_deprecated __attribute__((deprecated))
89 | #else
90 | # define attribute_deprecated
91 | #endif
92 |
93 | /**
94 | * Disable warnings about deprecated features
95 | * This is useful for sections of code kept for backward compatibility and
96 | * scheduled for removal.
97 | */
98 | #ifndef AV_NOWARN_DEPRECATED
99 | #if AV_GCC_VERSION_AT_LEAST(4,6)
100 | # define AV_NOWARN_DEPRECATED(code) \
101 | _Pragma("GCC diagnostic push") \
102 | _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
103 | code \
104 | _Pragma("GCC diagnostic pop")
105 | #else
106 | # define AV_NOWARN_DEPRECATED(code) code
107 | #endif
108 | #endif
109 |
110 |
111 | #if defined(__GNUC__)
112 | # define av_unused __attribute__((unused))
113 | #else
114 | # define av_unused
115 | #endif
116 |
117 | /**
118 | * Mark a variable as used and prevent the compiler from optimizing it
119 | * away. This is useful for variables accessed only from inline
120 | * assembler without the compiler being aware.
121 | */
122 | #if AV_GCC_VERSION_AT_LEAST(3,1)
123 | # define av_used __attribute__((used))
124 | #else
125 | # define av_used
126 | #endif
127 |
128 | #if AV_GCC_VERSION_AT_LEAST(3,3)
129 | # define av_alias __attribute__((may_alias))
130 | #else
131 | # define av_alias
132 | #endif
133 |
134 | #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
135 | # define av_uninit(x) x=x
136 | #else
137 | # define av_uninit(x) x
138 | #endif
139 |
140 | #ifdef __GNUC__
141 | # define av_builtin_constant_p __builtin_constant_p
142 | # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
143 | #else
144 | # define av_builtin_constant_p(x) 0
145 | # define av_printf_format(fmtpos, attrpos)
146 | #endif
147 |
148 | #if AV_GCC_VERSION_AT_LEAST(2,5)
149 | # define av_noreturn __attribute__((noreturn))
150 | #else
151 | # define av_noreturn
152 | #endif
153 |
154 | #endif /* AVUTIL_ATTRIBUTES_H */
155 |
--------------------------------------------------------------------------------
/jni/include/libavutil/audio_fifo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Audio FIFO
3 | * Copyright (c) 2012 Justin Ruggles
4 | *
5 | * This file is part of Libav.
6 | *
7 | * Libav is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * Libav is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with Libav; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | /**
23 | * @file
24 | * Audio FIFO Buffer
25 | */
26 |
27 | #ifndef AVUTIL_AUDIO_FIFO_H
28 | #define AVUTIL_AUDIO_FIFO_H
29 |
30 | #include "avutil.h"
31 | #include "fifo.h"
32 | #include "samplefmt.h"
33 |
34 | /**
35 | * @addtogroup lavu_audio
36 | * @{
37 | */
38 |
39 | /**
40 | * Context for an Audio FIFO Buffer.
41 | *
42 | * - Operates at the sample level rather than the byte level.
43 | * - Supports multiple channels with either planar or packed sample format.
44 | * - Automatic reallocation when writing to a full buffer.
45 | */
46 | typedef struct AVAudioFifo AVAudioFifo;
47 |
48 | /**
49 | * Free an AVAudioFifo.
50 | *
51 | * @param af AVAudioFifo to free
52 | */
53 | void av_audio_fifo_free(AVAudioFifo *af);
54 |
55 | /**
56 | * Allocate an AVAudioFifo.
57 | *
58 | * @param sample_fmt sample format
59 | * @param channels number of channels
60 | * @param nb_samples initial allocation size, in samples
61 | * @return newly allocated AVAudioFifo, or NULL on error
62 | */
63 | AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels,
64 | int nb_samples);
65 |
66 | /**
67 | * Reallocate an AVAudioFifo.
68 | *
69 | * @param af AVAudioFifo to reallocate
70 | * @param nb_samples new allocation size, in samples
71 | * @return 0 if OK, or negative AVERROR code on failure
72 | */
73 | int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples);
74 |
75 | /**
76 | * Write data to an AVAudioFifo.
77 | *
78 | * The AVAudioFifo will be reallocated automatically if the available space
79 | * is less than nb_samples.
80 | *
81 | * @see enum AVSampleFormat
82 | * The documentation for AVSampleFormat describes the data layout.
83 | *
84 | * @param af AVAudioFifo to write to
85 | * @param data audio data plane pointers
86 | * @param nb_samples number of samples to write
87 | * @return number of samples actually written, or negative AVERROR
88 | * code on failure. If successful, the number of samples
89 | * actually written will always be nb_samples.
90 | */
91 | int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples);
92 |
93 | /**
94 | * Read data from an AVAudioFifo.
95 | *
96 | * @see enum AVSampleFormat
97 | * The documentation for AVSampleFormat describes the data layout.
98 | *
99 | * @param af AVAudioFifo to read from
100 | * @param data audio data plane pointers
101 | * @param nb_samples number of samples to read
102 | * @return number of samples actually read, or negative AVERROR code
103 | * on failure. The number of samples actually read will not
104 | * be greater than nb_samples, and will only be less than
105 | * nb_samples if av_audio_fifo_size is less than nb_samples.
106 | */
107 | int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples);
108 |
109 | /**
110 | * Drain data from an AVAudioFifo.
111 | *
112 | * Removes the data without reading it.
113 | *
114 | * @param af AVAudioFifo to drain
115 | * @param nb_samples number of samples to drain
116 | * @return 0 if OK, or negative AVERROR code on failure
117 | */
118 | int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples);
119 |
120 | /**
121 | * Reset the AVAudioFifo buffer.
122 | *
123 | * This empties all data in the buffer.
124 | *
125 | * @param af AVAudioFifo to reset
126 | */
127 | void av_audio_fifo_reset(AVAudioFifo *af);
128 |
129 | /**
130 | * Get the current number of samples in the AVAudioFifo available for reading.
131 | *
132 | * @param af the AVAudioFifo to query
133 | * @return number of samples available for reading
134 | */
135 | int av_audio_fifo_size(AVAudioFifo *af);
136 |
137 | /**
138 | * Get the current number of samples in the AVAudioFifo available for writing.
139 | *
140 | * @param af the AVAudioFifo to query
141 | * @return number of samples available for writing
142 | */
143 | int av_audio_fifo_space(AVAudioFifo *af);
144 |
145 | /**
146 | * @}
147 | */
148 |
149 | #endif /* AVUTIL_AUDIO_FIFO_H */
150 |
--------------------------------------------------------------------------------
/jni/include/libavutil/audioconvert.h:
--------------------------------------------------------------------------------
1 |
2 | #include "version.h"
3 |
4 | #if FF_API_AUDIOCONVERT
5 | #include "channel_layout.h"
6 | #endif
7 |
--------------------------------------------------------------------------------
/jni/include/libavutil/avassert.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2010 Michael Niedermayer
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
23 | * simple assert() macros that are a bit more flexible than ISO C assert().
24 | * @author Michael Niedermayer
25 | */
26 |
27 | #ifndef AVUTIL_AVASSERT_H
28 | #define AVUTIL_AVASSERT_H
29 |
30 | #include
31 | #include "avutil.h"
32 | #include "log.h"
33 |
34 | /**
35 | * assert() equivalent, that is always enabled.
36 | */
37 | #define av_assert0(cond) do { \
38 | if (!(cond)) { \
39 | av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \
40 | AV_STRINGIFY(cond), __FILE__, __LINE__); \
41 | abort(); \
42 | } \
43 | } while (0)
44 |
45 |
46 | /**
47 | * assert() equivalent, that does not lie in speed critical code.
48 | * These asserts() thus can be enabled without fearing speedloss.
49 | */
50 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0
51 | #define av_assert1(cond) av_assert0(cond)
52 | #else
53 | #define av_assert1(cond) ((void)0)
54 | #endif
55 |
56 |
57 | /**
58 | * assert() equivalent, that does lie in speed critical code.
59 | */
60 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
61 | #define av_assert2(cond) av_assert0(cond)
62 | #else
63 | #define av_assert2(cond) ((void)0)
64 | #endif
65 |
66 | #endif /* AVUTIL_AVASSERT_H */
67 |
--------------------------------------------------------------------------------
/jni/include/libavutil/avconfig.h:
--------------------------------------------------------------------------------
1 | /* Generated by ffconf */
2 | #ifndef AVUTIL_AVCONFIG_H
3 | #define AVUTIL_AVCONFIG_H
4 | #define AV_HAVE_BIGENDIAN 0
5 | #define AV_HAVE_FAST_UNALIGNED 0
6 | #define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0
7 | #define AV_HAVE_INCOMPATIBLE_FORK_ABI 0
8 | #endif /* AVUTIL_AVCONFIG_H */
9 |
--------------------------------------------------------------------------------
/jni/include/libavutil/base64.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com)
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 | #ifndef AVUTIL_BASE64_H
22 | #define AVUTIL_BASE64_H
23 |
24 | #include
25 |
26 | /**
27 | * @defgroup lavu_base64 Base64
28 | * @ingroup lavu_crypto
29 | * @{
30 | */
31 |
32 |
33 | /**
34 | * Decode a base64-encoded string.
35 | *
36 | * @param out buffer for decoded data
37 | * @param in null-terminated input string
38 | * @param out_size size in bytes of the out buffer, must be at
39 | * least 3/4 of the length of in
40 | * @return number of bytes written, or a negative value in case of
41 | * invalid input
42 | */
43 | int av_base64_decode(uint8_t *out, const char *in, int out_size);
44 |
45 | /**
46 | * Encode data to base64 and null-terminate.
47 | *
48 | * @param out buffer for encoded data
49 | * @param out_size size in bytes of the out buffer (including the
50 | * null terminator), must be at least AV_BASE64_SIZE(in_size)
51 | * @param in input buffer containing the data to encode
52 | * @param in_size size in bytes of the in buffer
53 | * @return out or NULL in case of error
54 | */
55 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
56 |
57 | /**
58 | * Calculate the output size needed to base64-encode x bytes to a
59 | * null-terminated string.
60 | */
61 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1)
62 |
63 | /**
64 | * @}
65 | */
66 |
67 | #endif /* AVUTIL_BASE64_H */
68 |
--------------------------------------------------------------------------------
/jni/include/libavutil/blowfish.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Blowfish algorithm
3 | * Copyright (c) 2012 Samuel Pitoiset
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_BLOWFISH_H
23 | #define AVUTIL_BLOWFISH_H
24 |
25 | #include
26 |
27 | /**
28 | * @defgroup lavu_blowfish Blowfish
29 | * @ingroup lavu_crypto
30 | * @{
31 | */
32 |
33 | #define AV_BF_ROUNDS 16
34 |
35 | typedef struct AVBlowfish {
36 | uint32_t p[AV_BF_ROUNDS + 2];
37 | uint32_t s[4][256];
38 | } AVBlowfish;
39 |
40 | /**
41 | * Initialize an AVBlowfish context.
42 | *
43 | * @param ctx an AVBlowfish context
44 | * @param key a key
45 | * @param key_len length of the key
46 | */
47 | void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len);
48 |
49 | /**
50 | * Encrypt or decrypt a buffer using a previously initialized context.
51 | *
52 | * @param ctx an AVBlowfish context
53 | * @param xl left four bytes halves of input to be encrypted
54 | * @param xr right four bytes halves of input to be encrypted
55 | * @param decrypt 0 for encryption, 1 for decryption
56 | */
57 | void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr,
58 | int decrypt);
59 |
60 | /**
61 | * Encrypt or decrypt a buffer using a previously initialized context.
62 | *
63 | * @param ctx an AVBlowfish context
64 | * @param dst destination array, can be equal to src
65 | * @param src source array, can be equal to dst
66 | * @param count number of 8 byte blocks
67 | * @param iv initialization vector for CBC mode, if NULL ECB will be used
68 | * @param decrypt 0 for encryption, 1 for decryption
69 | */
70 | void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src,
71 | int count, uint8_t *iv, int decrypt);
72 |
73 | /**
74 | * @}
75 | */
76 |
77 | #endif /* AVUTIL_BLOWFISH_H */
78 |
--------------------------------------------------------------------------------
/jni/include/libavutil/bswap.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2006 Michael Niedermayer
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
23 | * byte swapping routines
24 | */
25 |
26 | #ifndef AVUTIL_BSWAP_H
27 | #define AVUTIL_BSWAP_H
28 |
29 | #include
30 | #include "libavutil/avconfig.h"
31 | #include "attributes.h"
32 |
33 | #ifdef HAVE_AV_CONFIG_H
34 |
35 | #include "config.h"
36 |
37 | #if ARCH_ARM
38 | # include "arm/bswap.h"
39 | #elif ARCH_AVR32
40 | # include "avr32/bswap.h"
41 | #elif ARCH_BFIN
42 | # include "bfin/bswap.h"
43 | #elif ARCH_SH4
44 | # include "sh4/bswap.h"
45 | #elif ARCH_X86
46 | # include "x86/bswap.h"
47 | #endif
48 |
49 | #endif /* HAVE_AV_CONFIG_H */
50 |
51 | #define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff))
52 | #define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16))
53 | #define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32))
54 |
55 | #define AV_BSWAPC(s, x) AV_BSWAP##s##C(x)
56 |
57 | #ifndef av_bswap16
58 | static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
59 | {
60 | x= (x>>8) | (x<<8);
61 | return x;
62 | }
63 | #endif
64 |
65 | #ifndef av_bswap32
66 | static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
67 | {
68 | return AV_BSWAP32C(x);
69 | }
70 | #endif
71 |
72 | #ifndef av_bswap64
73 | static inline uint64_t av_const av_bswap64(uint64_t x)
74 | {
75 | return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32);
76 | }
77 | #endif
78 |
79 | // be2ne ... big-endian to native-endian
80 | // le2ne ... little-endian to native-endian
81 |
82 | #if AV_HAVE_BIGENDIAN
83 | #define av_be2ne16(x) (x)
84 | #define av_be2ne32(x) (x)
85 | #define av_be2ne64(x) (x)
86 | #define av_le2ne16(x) av_bswap16(x)
87 | #define av_le2ne32(x) av_bswap32(x)
88 | #define av_le2ne64(x) av_bswap64(x)
89 | #define AV_BE2NEC(s, x) (x)
90 | #define AV_LE2NEC(s, x) AV_BSWAPC(s, x)
91 | #else
92 | #define av_be2ne16(x) av_bswap16(x)
93 | #define av_be2ne32(x) av_bswap32(x)
94 | #define av_be2ne64(x) av_bswap64(x)
95 | #define av_le2ne16(x) (x)
96 | #define av_le2ne32(x) (x)
97 | #define av_le2ne64(x) (x)
98 | #define AV_BE2NEC(s, x) AV_BSWAPC(s, x)
99 | #define AV_LE2NEC(s, x) (x)
100 | #endif
101 |
102 | #define AV_BE2NE16C(x) AV_BE2NEC(16, x)
103 | #define AV_BE2NE32C(x) AV_BE2NEC(32, x)
104 | #define AV_BE2NE64C(x) AV_BE2NEC(64, x)
105 | #define AV_LE2NE16C(x) AV_LE2NEC(16, x)
106 | #define AV_LE2NE32C(x) AV_LE2NEC(32, x)
107 | #define AV_LE2NE64C(x) AV_LE2NEC(64, x)
108 |
109 | #endif /* AVUTIL_BSWAP_H */
110 |
--------------------------------------------------------------------------------
/jni/include/libavutil/cpu.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
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 | #ifndef AVUTIL_CPU_H
22 | #define AVUTIL_CPU_H
23 |
24 | #include "attributes.h"
25 |
26 | #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
27 |
28 | /* lower 16 bits - CPU features */
29 | #define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX
30 | #define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext
31 | #define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext
32 | #define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW
33 | #define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions
34 | #define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions
35 | #define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster
36 | #define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt
37 | #define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions
38 | #define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
39 | #define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions
40 | #define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower
41 | #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions
42 | #define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions
43 | #define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
44 | #define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions
45 | #define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions
46 | // #if LIBAVUTIL_VERSION_MAJOR <52
47 | #define AV_CPU_FLAG_CMOV 0x1001000 ///< supports cmov instruction
48 | // #else
49 | // #define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction
50 | // #endif
51 |
52 | #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
53 |
54 | #define AV_CPU_FLAG_ARMV5TE (1 << 0)
55 | #define AV_CPU_FLAG_ARMV6 (1 << 1)
56 | #define AV_CPU_FLAG_ARMV6T2 (1 << 2)
57 | #define AV_CPU_FLAG_VFP (1 << 3)
58 | #define AV_CPU_FLAG_VFPV3 (1 << 4)
59 | #define AV_CPU_FLAG_NEON (1 << 5)
60 |
61 | /**
62 | * Return the flags which specify extensions supported by the CPU.
63 | * The returned value is affected by av_force_cpu_flags() if that was used
64 | * before. So av_get_cpu_flags() can easily be used in a application to
65 | * detect the enabled cpu flags.
66 | */
67 | int av_get_cpu_flags(void);
68 |
69 | /**
70 | * Disables cpu detection and forces the specified flags.
71 | * -1 is a special case that disables forcing of specific flags.
72 | */
73 | void av_force_cpu_flags(int flags);
74 |
75 | /**
76 | * Set a mask on flags returned by av_get_cpu_flags().
77 | * This function is mainly useful for testing.
78 | * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible
79 | *
80 | * @warning this function is not thread safe.
81 | */
82 | attribute_deprecated void av_set_cpu_flags_mask(int mask);
83 |
84 | /**
85 | * Parse CPU flags from a string.
86 | *
87 | * The returned flags contain the specified flags as well as related unspecified flags.
88 | *
89 | * This function exists only for compatibility with libav.
90 | * Please use av_parse_cpu_caps() when possible.
91 | * @return a combination of AV_CPU_* flags, negative on error.
92 | */
93 | attribute_deprecated
94 | int av_parse_cpu_flags(const char *s);
95 |
96 | /**
97 | * Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
98 | *
99 | * @return negative on error.
100 | */
101 | int av_parse_cpu_caps(unsigned *flags, const char *s);
102 |
103 | /**
104 | * @return the number of logical CPU cores present.
105 | */
106 | int av_cpu_count(void);
107 |
108 | /* The following CPU-specific functions shall not be called directly. */
109 | int ff_get_cpu_flags_arm(void);
110 | int ff_get_cpu_flags_ppc(void);
111 | int ff_get_cpu_flags_x86(void);
112 |
113 | #endif /* AVUTIL_CPU_H */
114 |
--------------------------------------------------------------------------------
/jni/include/libavutil/crc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2006 Michael Niedermayer
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 | #ifndef AVUTIL_CRC_H
22 | #define AVUTIL_CRC_H
23 |
24 | #include
25 | #include
26 | #include "attributes.h"
27 |
28 | /**
29 | * @defgroup lavu_crc32 CRC32
30 | * @ingroup lavu_crypto
31 | * @{
32 | */
33 |
34 | typedef uint32_t AVCRC;
35 |
36 | typedef enum {
37 | AV_CRC_8_ATM,
38 | AV_CRC_16_ANSI,
39 | AV_CRC_16_CCITT,
40 | AV_CRC_32_IEEE,
41 | AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */
42 | AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */
43 | }AVCRCId;
44 |
45 | /**
46 | * Initialize a CRC table.
47 | * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024
48 | * @param le If 1, the lowest bit represents the coefficient for the highest
49 | * exponent of the corresponding polynomial (both for poly and
50 | * actual CRC).
51 | * If 0, you must swap the CRC parameter and the result of av_crc
52 | * if you need the standard representation (can be simplified in
53 | * most cases to e.g. bswap16):
54 | * av_bswap32(crc << (32-bits))
55 | * @param bits number of bits for the CRC
56 | * @param poly generator polynomial without the x**bits coefficient, in the
57 | * representation as specified by le
58 | * @param ctx_size size of ctx in bytes
59 | * @return <0 on failure
60 | */
61 | int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size);
62 |
63 | /**
64 | * Get an initialized standard CRC table.
65 | * @param crc_id ID of a standard CRC
66 | * @return a pointer to the CRC table or NULL on failure
67 | */
68 | const AVCRC *av_crc_get_table(AVCRCId crc_id);
69 |
70 | /**
71 | * Calculate the CRC of a block.
72 | * @param crc CRC of previous blocks if any or initial value for CRC
73 | * @return CRC updated with the data from the given block
74 | *
75 | * @see av_crc_init() "le" parameter
76 | */
77 | uint32_t av_crc(const AVCRC *ctx, uint32_t crc,
78 | const uint8_t *buffer, size_t length) av_pure;
79 |
80 | /**
81 | * @}
82 | */
83 |
84 | #endif /* AVUTIL_CRC_H */
85 |
--------------------------------------------------------------------------------
/jni/include/libavutil/dict.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * This file is part of FFmpeg.
4 | *
5 | * FFmpeg is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * FFmpeg is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with FFmpeg; if not, write to the Free Software
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 | */
19 |
20 | /**
21 | * @file
22 | * Public dictionary API.
23 | * @deprecated
24 | * AVDictionary is provided for compatibility with libav. It is both in
25 | * implementation as well as API inefficient. It does not scale and is
26 | * extremely slow with large dictionaries.
27 | * It is recommended that new code uses our tree container from tree.c/h
28 | * where applicable, which uses AVL trees to achieve O(log n) performance.
29 | */
30 |
31 | #ifndef AVUTIL_DICT_H
32 | #define AVUTIL_DICT_H
33 |
34 | /**
35 | * @addtogroup lavu_dict AVDictionary
36 | * @ingroup lavu_data
37 | *
38 | * @brief Simple key:value store
39 | *
40 | * @{
41 | * Dictionaries are used for storing key:value pairs. To create
42 | * an AVDictionary, simply pass an address of a NULL pointer to
43 | * av_dict_set(). NULL can be used as an empty dictionary wherever
44 | * a pointer to an AVDictionary is required.
45 | * Use av_dict_get() to retrieve an entry or iterate over all
46 | * entries and finally av_dict_free() to free the dictionary
47 | * and all its contents.
48 | *
49 | * @code
50 | * AVDictionary *d = NULL; // "create" an empty dictionary
51 | * av_dict_set(&d, "foo", "bar", 0); // add an entry
52 | *
53 | * char *k = av_strdup("key"); // if your strings are already allocated,
54 | * char *v = av_strdup("value"); // you can avoid copying them like this
55 | * av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
56 | *
57 | * AVDictionaryEntry *t = NULL;
58 | * while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
59 | * <....> // iterate over all entries in d
60 | * }
61 | *
62 | * av_dict_free(&d);
63 | * @endcode
64 | *
65 | */
66 |
67 | #define AV_DICT_MATCH_CASE 1
68 | #define AV_DICT_IGNORE_SUFFIX 2
69 | #define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been
70 | allocated with av_malloc() and children. */
71 | #define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been
72 | allocated with av_malloc() and chilren. */
73 | #define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries.
74 | #define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
75 | delimiter is added, the strings are simply concatenated. */
76 |
77 | typedef struct AVDictionaryEntry {
78 | char *key;
79 | char *value;
80 | } AVDictionaryEntry;
81 |
82 | typedef struct AVDictionary AVDictionary;
83 |
84 | /**
85 | * Get a dictionary entry with matching key.
86 | *
87 | * @param prev Set to the previous matching element to find the next.
88 | * If set to NULL the first matching element is returned.
89 | * @param flags Allows case as well as suffix-insensitive comparisons.
90 | * @return Found entry or NULL, changing key or value leads to undefined behavior.
91 | */
92 | AVDictionaryEntry *
93 | av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags);
94 |
95 | /**
96 | * Get number of entries in dictionary.
97 | *
98 | * @param m dictionary
99 | * @return number of entries in dictionary
100 | */
101 | int av_dict_count(const AVDictionary *m);
102 |
103 | /**
104 | * Set the given entry in *pm, overwriting an existing entry.
105 | *
106 | * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
107 | * a dictionary struct is allocated and put in *pm.
108 | * @param key entry key to add to *pm (will be av_strduped depending on flags)
109 | * @param value entry value to add to *pm (will be av_strduped depending on flags).
110 | * Passing a NULL value will cause an existing entry to be deleted.
111 | * @return >= 0 on success otherwise an error code <0
112 | */
113 | int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
114 |
115 | /**
116 | * Parse the key/value pairs list and add to a dictionary.
117 | *
118 | * @param key_val_sep a 0-terminated list of characters used to separate
119 | * key from value
120 | * @param pairs_sep a 0-terminated list of characters used to separate
121 | * two pairs from each other
122 | * @param flags flags to use when adding to dictionary.
123 | * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL
124 | * are ignored since the key/value tokens will always
125 | * be duplicated.
126 | * @return 0 on success, negative AVERROR code on failure
127 | */
128 | int av_dict_parse_string(AVDictionary **pm, const char *str,
129 | const char *key_val_sep, const char *pairs_sep,
130 | int flags);
131 |
132 | /**
133 | * Copy entries from one AVDictionary struct into another.
134 | * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
135 | * this function will allocate a struct for you and put it in *dst
136 | * @param src pointer to source AVDictionary struct
137 | * @param flags flags to use when setting entries in *dst
138 | * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
139 | */
140 | void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags);
141 |
142 | /**
143 | * Free all the memory allocated for an AVDictionary struct
144 | * and all keys and values.
145 | */
146 | void av_dict_free(AVDictionary **m);
147 |
148 | /**
149 | * @}
150 | */
151 |
152 | #endif /* AVUTIL_DICT_H */
153 |
--------------------------------------------------------------------------------
/jni/include/libavutil/error.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | /**
20 | * @file
21 | * error code definitions
22 | */
23 |
24 | #ifndef AVUTIL_ERROR_H
25 | #define AVUTIL_ERROR_H
26 |
27 | #include
28 | #include
29 |
30 | /**
31 | * @addtogroup lavu_error
32 | *
33 | * @{
34 | */
35 |
36 |
37 | /* error handling */
38 | #if EDOM > 0
39 | #define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions.
40 | #define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value.
41 | #else
42 | /* Some platforms have E* and errno already negated. */
43 | #define AVERROR(e) (e)
44 | #define AVUNERROR(e) (e)
45 | #endif
46 |
47 | #define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d))
48 |
49 | #define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found
50 | #define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2
51 | #define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small
52 | #define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found
53 | #define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found
54 | #define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found
55 | #define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file
56 | #define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted
57 | #define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library
58 | #define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found
59 | #define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input
60 | #define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found
61 | #define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found
62 | #define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome
63 | #define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found
64 |
65 | #define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found
66 | /**
67 | * This is semantically identical to AVERROR_BUG
68 | * it has been introduced in Libav after our AVERROR_BUG and with a modified value.
69 | */
70 | #define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ')
71 | #define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library
72 | #define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
73 |
74 | #define AV_ERROR_MAX_STRING_SIZE 64
75 |
76 | /**
77 | * Put a description of the AVERROR code errnum in errbuf.
78 | * In case of failure the global variable errno is set to indicate the
79 | * error. Even in case of failure av_strerror() will print a generic
80 | * error message indicating the errnum provided to errbuf.
81 | *
82 | * @param errnum error code to describe
83 | * @param errbuf buffer to which description is written
84 | * @param errbuf_size the size in bytes of errbuf
85 | * @return 0 on success, a negative value if a description for errnum
86 | * cannot be found
87 | */
88 | int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
89 |
90 | /**
91 | * Fill the provided buffer with a string containing an error string
92 | * corresponding to the AVERROR code errnum.
93 | *
94 | * @param errbuf a buffer
95 | * @param errbuf_size size in bytes of errbuf
96 | * @param errnum error code to describe
97 | * @return the buffer in input, filled with the error description
98 | * @see av_strerror()
99 | */
100 | static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum)
101 | {
102 | av_strerror(errnum, errbuf, errbuf_size);
103 | return errbuf;
104 | }
105 |
106 | /**
107 | * Convenience macro, the return value should be used only directly in
108 | * function arguments but never stand-alone.
109 | */
110 | #define av_err2str(errnum) \
111 | av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)
112 |
113 | /**
114 | * @}
115 | */
116 |
117 | #endif /* AVUTIL_ERROR_H */
118 |
--------------------------------------------------------------------------------
/jni/include/libavutil/eval.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2002 Michael Niedermayer
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
23 | * simple arithmetic expression evaluator
24 | */
25 |
26 | #ifndef AVUTIL_EVAL_H
27 | #define AVUTIL_EVAL_H
28 |
29 | #include "avutil.h"
30 |
31 | typedef struct AVExpr AVExpr;
32 |
33 | /**
34 | * Parse and evaluate an expression.
35 | * Note, this is significantly slower than av_expr_eval().
36 | *
37 | * @param res a pointer to a double where is put the result value of
38 | * the expression, or NAN in case of error
39 | * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)"
40 | * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0}
41 | * @param const_values a zero terminated array of values for the identifiers from const_names
42 | * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers
43 | * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument
44 | * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers
45 | * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments
46 | * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2
47 | * @param log_ctx parent logging context
48 | * @return 0 in case of success, a negative value corresponding to an
49 | * AVERROR code otherwise
50 | */
51 | int av_expr_parse_and_eval(double *res, const char *s,
52 | const char * const *const_names, const double *const_values,
53 | const char * const *func1_names, double (* const *funcs1)(void *, double),
54 | const char * const *func2_names, double (* const *funcs2)(void *, double, double),
55 | void *opaque, int log_offset, void *log_ctx);
56 |
57 | /**
58 | * Parse an expression.
59 | *
60 | * @param expr a pointer where is put an AVExpr containing the parsed
61 | * value in case of successful parsing, or NULL otherwise.
62 | * The pointed to AVExpr must be freed with av_expr_free() by the user
63 | * when it is not needed anymore.
64 | * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)"
65 | * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0}
66 | * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers
67 | * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument
68 | * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers
69 | * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments
70 | * @param log_ctx parent logging context
71 | * @return 0 in case of success, a negative value corresponding to an
72 | * AVERROR code otherwise
73 | */
74 | int av_expr_parse(AVExpr **expr, const char *s,
75 | const char * const *const_names,
76 | const char * const *func1_names, double (* const *funcs1)(void *, double),
77 | const char * const *func2_names, double (* const *funcs2)(void *, double, double),
78 | int log_offset, void *log_ctx);
79 |
80 | /**
81 | * Evaluate a previously parsed expression.
82 | *
83 | * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names
84 | * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2
85 | * @return the value of the expression
86 | */
87 | double av_expr_eval(AVExpr *e, const double *const_values, void *opaque);
88 |
89 | /**
90 | * Free a parsed expression previously created with av_expr_parse().
91 | */
92 | void av_expr_free(AVExpr *e);
93 |
94 | /**
95 | * Parse the string in numstr and return its value as a double. If
96 | * the string is empty, contains only whitespaces, or does not contain
97 | * an initial substring that has the expected syntax for a
98 | * floating-point number, no conversion is performed. In this case,
99 | * returns a value of zero and the value returned in tail is the value
100 | * of numstr.
101 | *
102 | * @param numstr a string representing a number, may contain one of
103 | * the International System number postfixes, for example 'K', 'M',
104 | * 'G'. If 'i' is appended after the postfix, powers of 2 are used
105 | * instead of powers of 10. The 'B' postfix multiplies the value for
106 | * 8, and can be appended after another postfix or used alone. This
107 | * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix.
108 | * @param tail if non-NULL puts here the pointer to the char next
109 | * after the last parsed character
110 | */
111 | double av_strtod(const char *numstr, char **tail);
112 |
113 | #endif /* AVUTIL_EVAL_H */
114 |
--------------------------------------------------------------------------------
/jni/include/libavutil/fifo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | /**
20 | * @file
21 | * a very simple circular buffer FIFO implementation
22 | */
23 |
24 | #ifndef AVUTIL_FIFO_H
25 | #define AVUTIL_FIFO_H
26 |
27 | #include
28 | #include "avutil.h"
29 | #include "attributes.h"
30 |
31 | typedef struct AVFifoBuffer {
32 | uint8_t *buffer;
33 | uint8_t *rptr, *wptr, *end;
34 | uint32_t rndx, wndx;
35 | } AVFifoBuffer;
36 |
37 | /**
38 | * Initialize an AVFifoBuffer.
39 | * @param size of FIFO
40 | * @return AVFifoBuffer or NULL in case of memory allocation failure
41 | */
42 | AVFifoBuffer *av_fifo_alloc(unsigned int size);
43 |
44 | /**
45 | * Free an AVFifoBuffer.
46 | * @param f AVFifoBuffer to free
47 | */
48 | void av_fifo_free(AVFifoBuffer *f);
49 |
50 | /**
51 | * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied.
52 | * @param f AVFifoBuffer to reset
53 | */
54 | void av_fifo_reset(AVFifoBuffer *f);
55 |
56 | /**
57 | * Return the amount of data in bytes in the AVFifoBuffer, that is the
58 | * amount of data you can read from it.
59 | * @param f AVFifoBuffer to read from
60 | * @return size
61 | */
62 | int av_fifo_size(AVFifoBuffer *f);
63 |
64 | /**
65 | * Return the amount of space in bytes in the AVFifoBuffer, that is the
66 | * amount of data you can write into it.
67 | * @param f AVFifoBuffer to write into
68 | * @return size
69 | */
70 | int av_fifo_space(AVFifoBuffer *f);
71 |
72 | /**
73 | * Feed data from an AVFifoBuffer to a user-supplied callback.
74 | * @param f AVFifoBuffer to read from
75 | * @param buf_size number of bytes to read
76 | * @param func generic read function
77 | * @param dest data destination
78 | */
79 | int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
80 |
81 | /**
82 | * Feed data from a user-supplied callback to an AVFifoBuffer.
83 | * @param f AVFifoBuffer to write to
84 | * @param src data source; non-const since it may be used as a
85 | * modifiable context by the function defined in func
86 | * @param size number of bytes to write
87 | * @param func generic write function; the first parameter is src,
88 | * the second is dest_buf, the third is dest_buf_size.
89 | * func must return the number of bytes written to dest_buf, or <= 0 to
90 | * indicate no more data available to write.
91 | * If func is NULL, src is interpreted as a simple byte array for source data.
92 | * @return the number of bytes written to the FIFO
93 | */
94 | int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
95 |
96 | /**
97 | * Resize an AVFifoBuffer.
98 | * In case of reallocation failure, the old FIFO is kept unchanged.
99 | *
100 | * @param f AVFifoBuffer to resize
101 | * @param size new AVFifoBuffer size in bytes
102 | * @return <0 for failure, >=0 otherwise
103 | */
104 | int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
105 |
106 | /**
107 | * Enlarge an AVFifoBuffer.
108 | * In case of reallocation failure, the old FIFO is kept unchanged.
109 | * The new fifo size may be larger than the requested size.
110 | *
111 | * @param f AVFifoBuffer to resize
112 | * @param additional_space the amount of space in bytes to allocate in addition to av_fifo_size()
113 | * @return <0 for failure, >=0 otherwise
114 | */
115 | int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space);
116 |
117 | /**
118 | * Read and discard the specified amount of data from an AVFifoBuffer.
119 | * @param f AVFifoBuffer to read from
120 | * @param size amount of data to read in bytes
121 | */
122 | void av_fifo_drain(AVFifoBuffer *f, int size);
123 |
124 | /**
125 | * Return a pointer to the data stored in a FIFO buffer at a certain offset.
126 | * The FIFO buffer is not modified.
127 | *
128 | * @param f AVFifoBuffer to peek at, f must be non-NULL
129 | * @param offs an offset in bytes, its absolute value must be less
130 | * than the used buffer size or the returned pointer will
131 | * point outside to the buffer data.
132 | * The used buffer size can be checked with av_fifo_size().
133 | */
134 | static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs)
135 | {
136 | uint8_t *ptr = f->rptr + offs;
137 | if (ptr >= f->end)
138 | ptr = f->buffer + (ptr - f->end);
139 | else if (ptr < f->buffer)
140 | ptr = f->end - (f->buffer - ptr);
141 | return ptr;
142 | }
143 |
144 | #endif /* AVUTIL_FIFO_H */
145 |
--------------------------------------------------------------------------------
/jni/include/libavutil/file.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_FILE_H
20 | #define AVUTIL_FILE_H
21 |
22 | #include
23 |
24 | #include "avutil.h"
25 |
26 | /**
27 | * @file
28 | * Misc file utilities.
29 | */
30 |
31 | /**
32 | * Read the file with name filename, and put its content in a newly
33 | * allocated buffer or map it with mmap() when available.
34 | * In case of success set *bufptr to the read or mmapped buffer, and
35 | * *size to the size in bytes of the buffer in *bufptr.
36 | * The returned buffer must be released with av_file_unmap().
37 | *
38 | * @param log_offset loglevel offset used for logging
39 | * @param log_ctx context used for logging
40 | * @return a non negative number in case of success, a negative value
41 | * corresponding to an AVERROR error code in case of failure
42 | */
43 | int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
44 | int log_offset, void *log_ctx);
45 |
46 | /**
47 | * Unmap or free the buffer bufptr created by av_file_map().
48 | *
49 | * @param size size in bytes of bufptr, must be the same as returned
50 | * by av_file_map()
51 | */
52 | void av_file_unmap(uint8_t *bufptr, size_t size);
53 |
54 | /**
55 | * Wrapper to work around the lack of mkstemp() on mingw.
56 | * Also, tries to create file in /tmp first, if possible.
57 | * *prefix can be a character constant; *filename will be allocated internally.
58 | * @return file descriptor of opened file (or -1 on error)
59 | * and opened file name in **filename.
60 | * @note On very old libcs it is necessary to set a secure umask before
61 | * calling this, av_tempfile() can't call umask itself as it is used in
62 | * libraries and could interfere with the calling application.
63 | */
64 | int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx);
65 |
66 | #endif /* AVUTIL_FILE_H */
67 |
--------------------------------------------------------------------------------
/jni/include/libavutil/hmac.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Martin Storsjo
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 | #ifndef AVUTIL_HMAC_H
22 | #define AVUTIL_HMAC_H
23 |
24 | #include
25 |
26 | /**
27 | * @defgroup lavu_hmac HMAC
28 | * @ingroup lavu_crypto
29 | * @{
30 | */
31 |
32 | enum AVHMACType {
33 | AV_HMAC_MD5,
34 | AV_HMAC_SHA1,
35 | AV_HMAC_SHA224 = 10,
36 | AV_HMAC_SHA256,
37 | AV_HMAC_SHA384,
38 | AV_HMAC_SHA512,
39 | };
40 |
41 | typedef struct AVHMAC AVHMAC;
42 |
43 | /**
44 | * Allocate an AVHMAC context.
45 | * @param type The hash function used for the HMAC.
46 | */
47 | AVHMAC *av_hmac_alloc(enum AVHMACType type);
48 |
49 | /**
50 | * Free an AVHMAC context.
51 | * @param ctx The context to free, may be NULL
52 | */
53 | void av_hmac_free(AVHMAC *ctx);
54 |
55 | /**
56 | * Initialize an AVHMAC context with an authentication key.
57 | * @param ctx The HMAC context
58 | * @param key The authentication key
59 | * @param keylen The length of the key, in bytes
60 | */
61 | void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen);
62 |
63 | /**
64 | * Hash data with the HMAC.
65 | * @param ctx The HMAC context
66 | * @param data The data to hash
67 | * @param len The length of the data, in bytes
68 | */
69 | void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len);
70 |
71 | /**
72 | * Finish hashing and output the HMAC digest.
73 | * @param ctx The HMAC context
74 | * @param out The output buffer to write the digest into
75 | * @param outlen The length of the out buffer, in bytes
76 | * @return The number of bytes written to out, or a negative error code.
77 | */
78 | int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen);
79 |
80 | /**
81 | * Hash an array of data with a key.
82 | * @param ctx The HMAC context
83 | * @param data The data to hash
84 | * @param len The length of the data, in bytes
85 | * @param key The authentication key
86 | * @param keylen The length of the key, in bytes
87 | * @param out The output buffer to write the digest into
88 | * @param outlen The length of the out buffer, in bytes
89 | * @return The number of bytes written to out, or a negative error code.
90 | */
91 | int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len,
92 | const uint8_t *key, unsigned int keylen,
93 | uint8_t *out, unsigned int outlen);
94 |
95 | /**
96 | * @}
97 | */
98 |
99 | #endif /* AVUTIL_HMAC_H */
100 |
--------------------------------------------------------------------------------
/jni/include/libavutil/intfloat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2011 Mans Rullgard
3 | *
4 | * This file is part of Libav.
5 | *
6 | * Libav 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 | * Libav 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 Libav; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVUTIL_INTFLOAT_H
22 | #define AVUTIL_INTFLOAT_H
23 |
24 | #include
25 | #include "attributes.h"
26 |
27 | union av_intfloat32 {
28 | uint32_t i;
29 | float f;
30 | };
31 |
32 | union av_intfloat64 {
33 | uint64_t i;
34 | double f;
35 | };
36 |
37 | /**
38 | * Reinterpret a 32-bit integer as a float.
39 | */
40 | static av_always_inline float av_int2float(uint32_t i)
41 | {
42 | union av_intfloat32 v;
43 | v.i = i;
44 | return v.f;
45 | }
46 |
47 | /**
48 | * Reinterpret a float as a 32-bit integer.
49 | */
50 | static av_always_inline uint32_t av_float2int(float f)
51 | {
52 | union av_intfloat32 v;
53 | v.f = f;
54 | return v.i;
55 | }
56 |
57 | /**
58 | * Reinterpret a 64-bit integer as a double.
59 | */
60 | static av_always_inline double av_int2double(uint64_t i)
61 | {
62 | union av_intfloat64 v;
63 | v.i = i;
64 | return v.f;
65 | }
66 |
67 | /**
68 | * Reinterpret a double as a 64-bit integer.
69 | */
70 | static av_always_inline uint64_t av_double2int(double f)
71 | {
72 | union av_intfloat64 v;
73 | v.f = f;
74 | return v.i;
75 | }
76 |
77 | #endif /* AVUTIL_INTFLOAT_H */
78 |
--------------------------------------------------------------------------------
/jni/include/libavutil/intfloat_readwrite.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2005 Michael Niedermayer
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 | #ifndef AVUTIL_INTFLOAT_READWRITE_H
22 | #define AVUTIL_INTFLOAT_READWRITE_H
23 |
24 | #include
25 | #include "attributes.h"
26 |
27 | /* IEEE 80 bits extended float */
28 | typedef struct AVExtFloat {
29 | uint8_t exponent[2];
30 | uint8_t mantissa[8];
31 | } AVExtFloat;
32 |
33 | attribute_deprecated double av_int2dbl(int64_t v) av_const;
34 | attribute_deprecated float av_int2flt(int32_t v) av_const;
35 | attribute_deprecated double av_ext2dbl(const AVExtFloat ext) av_const;
36 | attribute_deprecated int64_t av_dbl2int(double d) av_const;
37 | attribute_deprecated int32_t av_flt2int(float d) av_const;
38 | attribute_deprecated AVExtFloat av_dbl2ext(double d) av_const;
39 |
40 | #endif /* AVUTIL_INTFLOAT_READWRITE_H */
41 |
--------------------------------------------------------------------------------
/jni/include/libavutil/lfg.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Lagged Fibonacci PRNG
3 | * Copyright (c) 2008 Michael Niedermayer
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_LFG_H
23 | #define AVUTIL_LFG_H
24 |
25 | typedef struct AVLFG {
26 | unsigned int state[64];
27 | int index;
28 | } AVLFG;
29 |
30 | void av_lfg_init(AVLFG *c, unsigned int seed);
31 |
32 | /**
33 | * Get the next random unsigned 32-bit number using an ALFG.
34 | *
35 | * Please also consider a simple LCG like state= state*1664525+1013904223,
36 | * it may be good enough and faster for your specific use case.
37 | */
38 | static inline unsigned int av_lfg_get(AVLFG *c){
39 | c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
40 | return c->state[c->index++ & 63];
41 | }
42 |
43 | /**
44 | * Get the next random unsigned 32-bit number using a MLFG.
45 | *
46 | * Please also consider av_lfg_get() above, it is faster.
47 | */
48 | static inline unsigned int av_mlfg_get(AVLFG *c){
49 | unsigned int a= c->state[(c->index-55) & 63];
50 | unsigned int b= c->state[(c->index-24) & 63];
51 | return c->state[c->index++ & 63] = 2*a*b+a+b;
52 | }
53 |
54 | /**
55 | * Get the next two numbers generated by a Box-Muller Gaussian
56 | * generator using the random numbers issued by lfg.
57 | *
58 | * @param out array where the two generated numbers are placed
59 | */
60 | void av_bmg_get(AVLFG *lfg, double out[2]);
61 |
62 | #endif /* AVUTIL_LFG_H */
63 |
--------------------------------------------------------------------------------
/jni/include/libavutil/lzo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * LZO 1x decompression
3 | * copyright (c) 2006 Reimar Doeffinger
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_LZO_H
23 | #define AVUTIL_LZO_H
24 |
25 | /**
26 | * @defgroup lavu_lzo LZO
27 | * @ingroup lavu_crypto
28 | *
29 | * @{
30 | */
31 |
32 | #include
33 |
34 | /** @name Error flags returned by av_lzo1x_decode
35 | * @{ */
36 | /// end of the input buffer reached before decoding finished
37 | #define AV_LZO_INPUT_DEPLETED 1
38 | /// decoded data did not fit into output buffer
39 | #define AV_LZO_OUTPUT_FULL 2
40 | /// a reference to previously decoded data was wrong
41 | #define AV_LZO_INVALID_BACKPTR 4
42 | /// a non-specific error in the compressed bitstream
43 | #define AV_LZO_ERROR 8
44 | /** @} */
45 |
46 | #define AV_LZO_INPUT_PADDING 8
47 | #define AV_LZO_OUTPUT_PADDING 12
48 |
49 | /**
50 | * @brief Decodes LZO 1x compressed data.
51 | * @param out output buffer
52 | * @param outlen size of output buffer, number of bytes left are returned here
53 | * @param in input buffer
54 | * @param inlen size of input buffer, number of bytes left are returned here
55 | * @return 0 on success, otherwise a combination of the error flags above
56 | *
57 | * Make sure all buffers are appropriately padded, in must provide
58 | * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
59 | */
60 | int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
61 |
62 | /**
63 | * @}
64 | */
65 |
66 | #endif /* AVUTIL_LZO_H */
67 |
--------------------------------------------------------------------------------
/jni/include/libavutil/mathematics.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2005-2012 Michael Niedermayer
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 | #ifndef AVUTIL_MATHEMATICS_H
22 | #define AVUTIL_MATHEMATICS_H
23 |
24 | #include
25 | #include
26 | #include "attributes.h"
27 | #include "rational.h"
28 | #include "intfloat.h"
29 |
30 | #ifndef M_E
31 | #define M_E 2.7182818284590452354 /* e */
32 | #endif
33 | #ifndef M_LN2
34 | #define M_LN2 0.69314718055994530942 /* log_e 2 */
35 | #endif
36 | #ifndef M_LN10
37 | #define M_LN10 2.30258509299404568402 /* log_e 10 */
38 | #endif
39 | #ifndef M_LOG2_10
40 | #define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
41 | #endif
42 | #ifndef M_PHI
43 | #define M_PHI 1.61803398874989484820 /* phi / golden ratio */
44 | #endif
45 | #ifndef M_PI
46 | #define M_PI 3.14159265358979323846 /* pi */
47 | #endif
48 | #ifndef M_SQRT1_2
49 | #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
50 | #endif
51 | #ifndef M_SQRT2
52 | #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
53 | #endif
54 | #ifndef NAN
55 | #define NAN av_int2float(0x7fc00000)
56 | #endif
57 | #ifndef INFINITY
58 | #define INFINITY av_int2float(0x7f800000)
59 | #endif
60 |
61 | /**
62 | * @addtogroup lavu_math
63 | * @{
64 | */
65 |
66 |
67 | enum AVRounding {
68 | AV_ROUND_ZERO = 0, ///< Round toward zero.
69 | AV_ROUND_INF = 1, ///< Round away from zero.
70 | AV_ROUND_DOWN = 2, ///< Round toward -infinity.
71 | AV_ROUND_UP = 3, ///< Round toward +infinity.
72 | AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
73 | AV_ROUND_PASS_MINMAX = 8192, ///< Flag to pass INT64_MIN/MAX through instead of rescaling, this avoids special cases for AV_NOPTS_VALUE
74 | };
75 |
76 | /**
77 | * Return the greatest common divisor of a and b.
78 | * If both a and b are 0 or either or both are <0 then behavior is
79 | * undefined.
80 | */
81 | int64_t av_const av_gcd(int64_t a, int64_t b);
82 |
83 | /**
84 | * Rescale a 64-bit integer with rounding to nearest.
85 | * A simple a*b/c isn't possible as it can overflow.
86 | */
87 | int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
88 |
89 | /**
90 | * Rescale a 64-bit integer with specified rounding.
91 | * A simple a*b/c isn't possible as it can overflow.
92 | *
93 | * @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is
94 | * INT64_MIN or INT64_MAX then a is passed through unchanged.
95 | */
96 | int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const;
97 |
98 | /**
99 | * Rescale a 64-bit integer by 2 rational numbers.
100 | */
101 | int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
102 |
103 | /**
104 | * Rescale a 64-bit integer by 2 rational numbers with specified rounding.
105 | *
106 | * @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is
107 | * INT64_MIN or INT64_MAX then a is passed through unchanged.
108 | */
109 | int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
110 | enum AVRounding) av_const;
111 |
112 | /**
113 | * Compare 2 timestamps each in its own timebases.
114 | * The result of the function is undefined if one of the timestamps
115 | * is outside the int64_t range when represented in the others timebase.
116 | * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position
117 | */
118 | int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
119 |
120 | /**
121 | * Compare 2 integers modulo mod.
122 | * That is we compare integers a and b for which only the least
123 | * significant log2(mod) bits are known.
124 | *
125 | * @param mod must be a power of 2
126 | * @return a negative value if a is smaller than b
127 | * a positive value if a is greater than b
128 | * 0 if a equals b
129 | */
130 | int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
131 |
132 | /**
133 | * Rescale a timestamp while preserving known durations.
134 | *
135 | * @param in_ts Input timestamp
136 | * @param in_tb Input timesbase
137 | * @param fs_tb Duration and *last timebase
138 | * @param duration duration till the next call
139 | * @param out_tb Output timesbase
140 | */
141 | int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb);
142 |
143 | /**
144 | * @}
145 | */
146 |
147 | #endif /* AVUTIL_MATHEMATICS_H */
148 |
--------------------------------------------------------------------------------
/jni/include/libavutil/md5.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2006 Michael Niedermayer
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 | #ifndef AVUTIL_MD5_H
22 | #define AVUTIL_MD5_H
23 |
24 | #include
25 |
26 | #include "attributes.h"
27 | #include "version.h"
28 |
29 | /**
30 | * @defgroup lavu_md5 MD5
31 | * @ingroup lavu_crypto
32 | * @{
33 | */
34 |
35 | extern const int av_md5_size;
36 |
37 | struct AVMD5;
38 |
39 | /**
40 | * Allocate an AVMD5 context.
41 | */
42 | struct AVMD5 *av_md5_alloc(void);
43 |
44 | /**
45 | * Initialize MD5 hashing.
46 | *
47 | * @param ctx pointer to the function context (of size av_md5_size)
48 | */
49 | void av_md5_init(struct AVMD5 *ctx);
50 |
51 | /**
52 | * Update hash value.
53 | *
54 | * @param ctx hash function context
55 | * @param src input data to update hash with
56 | * @param len input data length
57 | */
58 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len);
59 |
60 | /**
61 | * Finish hashing and output digest value.
62 | *
63 | * @param ctx hash function context
64 | * @param dst buffer where output digest value is stored
65 | */
66 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst);
67 |
68 | /**
69 | * Hash an array of data.
70 | *
71 | * @param dst The output buffer to write the digest into
72 | * @param src The data to hash
73 | * @param len The length of the data, in bytes
74 | */
75 | void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len);
76 |
77 | /**
78 | * @}
79 | */
80 |
81 | #endif /* AVUTIL_MD5_H */
82 |
--------------------------------------------------------------------------------
/jni/include/libavutil/murmur3.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Reimar Döffinger
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 | #ifndef AVUTIL_MURMUR3_H
22 | #define AVUTIL_MURMUR3_H
23 |
24 | #include
25 |
26 | struct AVMurMur3 *av_murmur3_alloc(void);
27 | void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed);
28 | void av_murmur3_init(struct AVMurMur3 *c);
29 | void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len);
30 | void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]);
31 |
32 | #endif /* AVUTIL_MURMUR3_H */
33 |
--------------------------------------------------------------------------------
/jni/include/libavutil/random_seed.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009 Baptiste Coudurier
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 | #ifndef AVUTIL_RANDOM_SEED_H
22 | #define AVUTIL_RANDOM_SEED_H
23 |
24 | #include
25 | /**
26 | * @addtogroup lavu_crypto
27 | * @{
28 | */
29 |
30 | /**
31 | * Get a seed to use in conjunction with random functions.
32 | * This function tries to provide a good seed at a best effort bases.
33 | * Its possible to call this function multiple times if more bits are needed.
34 | * It can be quite slow, which is why it should only be used as seed for a faster
35 | * PRNG. The quality of the seed depends on the platform.
36 | */
37 | uint32_t av_get_random_seed(void);
38 |
39 | /**
40 | * @}
41 | */
42 |
43 | #endif /* AVUTIL_RANDOM_SEED_H */
44 |
--------------------------------------------------------------------------------
/jni/include/libavutil/rational.h:
--------------------------------------------------------------------------------
1 | /*
2 | * rational numbers
3 | * Copyright (c) 2003 Michael Niedermayer
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | /**
23 | * @file
24 | * rational numbers
25 | * @author Michael Niedermayer
26 | */
27 |
28 | #ifndef AVUTIL_RATIONAL_H
29 | #define AVUTIL_RATIONAL_H
30 |
31 | #include
32 | #include
33 | #include "attributes.h"
34 |
35 | /**
36 | * @addtogroup lavu_math
37 | * @{
38 | */
39 |
40 | /**
41 | * rational number numerator/denominator
42 | */
43 | typedef struct AVRational{
44 | int num; ///< numerator
45 | int den; ///< denominator
46 | } AVRational;
47 |
48 | /**
49 | * Compare two rationals.
50 | * @param a first rational
51 | * @param b second rational
52 | * @return 0 if a==b, 1 if a>b, -1 if a>63)|1;
59 | else if(b.den && a.den) return 0;
60 | else if(a.num && b.num) return (a.num>>31) - (b.num>>31);
61 | else return INT_MIN;
62 | }
63 |
64 | /**
65 | * Convert rational to double.
66 | * @param a rational to convert
67 | * @return (double) a
68 | */
69 | static inline double av_q2d(AVRational a){
70 | return a.num / (double) a.den;
71 | }
72 |
73 | /**
74 | * Reduce a fraction.
75 | * This is useful for framerate calculations.
76 | * @param dst_num destination numerator
77 | * @param dst_den destination denominator
78 | * @param num source numerator
79 | * @param den source denominator
80 | * @param max the maximum allowed for dst_num & dst_den
81 | * @return 1 if exact, 0 otherwise
82 | */
83 | int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max);
84 |
85 | /**
86 | * Multiply two rationals.
87 | * @param b first rational
88 | * @param c second rational
89 | * @return b*c
90 | */
91 | AVRational av_mul_q(AVRational b, AVRational c) av_const;
92 |
93 | /**
94 | * Divide one rational by another.
95 | * @param b first rational
96 | * @param c second rational
97 | * @return b/c
98 | */
99 | AVRational av_div_q(AVRational b, AVRational c) av_const;
100 |
101 | /**
102 | * Add two rationals.
103 | * @param b first rational
104 | * @param c second rational
105 | * @return b+c
106 | */
107 | AVRational av_add_q(AVRational b, AVRational c) av_const;
108 |
109 | /**
110 | * Subtract one rational from another.
111 | * @param b first rational
112 | * @param c second rational
113 | * @return b-c
114 | */
115 | AVRational av_sub_q(AVRational b, AVRational c) av_const;
116 |
117 | /**
118 | * Invert a rational.
119 | * @param q value
120 | * @return 1 / q
121 | */
122 | static av_always_inline AVRational av_inv_q(AVRational q)
123 | {
124 | AVRational r = { q.den, q.num };
125 | return r;
126 | }
127 |
128 | /**
129 | * Convert a double precision floating point number to a rational.
130 | * inf is expressed as {1,0} or {-1,0} depending on the sign.
131 | *
132 | * @param d double to convert
133 | * @param max the maximum allowed numerator and denominator
134 | * @return (AVRational) d
135 | */
136 | AVRational av_d2q(double d, int max) av_const;
137 |
138 | /**
139 | * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer
140 | * than q1, 0 if they have the same distance.
141 | */
142 | int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
143 |
144 | /**
145 | * Find the nearest value in q_list to q.
146 | * @param q_list an array of rationals terminated by {0, 0}
147 | * @return the index of the nearest value found in the array
148 | */
149 | int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
150 |
151 | /**
152 | * @}
153 | */
154 |
155 | #endif /* AVUTIL_RATIONAL_H */
156 |
--------------------------------------------------------------------------------
/jni/include/libavutil/ripemd.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 Michael Niedermayer
3 | * Copyright (C) 2013 James Almer
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_RIPEMD_H
23 | #define AVUTIL_RIPEMD_H
24 |
25 | #include
26 |
27 | #include "attributes.h"
28 | #include "version.h"
29 |
30 | /**
31 | * @defgroup lavu_ripemd RIPEMD
32 | * @ingroup lavu_crypto
33 | * @{
34 | */
35 |
36 | extern const int av_ripemd_size;
37 |
38 | struct AVRIPEMD;
39 |
40 | /**
41 | * Allocate an AVRIPEMD context.
42 | */
43 | struct AVRIPEMD *av_ripemd_alloc(void);
44 |
45 | /**
46 | * Initialize RIPEMD hashing.
47 | *
48 | * @param context pointer to the function context (of size av_ripemd_size)
49 | * @param bits number of bits in digest (128, 160, 256 or 320 bits)
50 | * @return zero if initialization succeeded, -1 otherwise
51 | */
52 | int av_ripemd_init(struct AVRIPEMD* context, int bits);
53 |
54 | /**
55 | * Update hash value.
56 | *
57 | * @param context hash function context
58 | * @param data input data to update hash with
59 | * @param len input data length
60 | */
61 | void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len);
62 |
63 | /**
64 | * Finish hashing and output digest value.
65 | *
66 | * @param context hash function context
67 | * @param digest buffer where output digest value is stored
68 | */
69 | void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest);
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | #endif /* AVUTIL_RIPEMD_H */
76 |
--------------------------------------------------------------------------------
/jni/include/libavutil/sha.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 Michael Niedermayer
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 | #ifndef AVUTIL_SHA_H
22 | #define AVUTIL_SHA_H
23 |
24 | #include
25 |
26 | #include "attributes.h"
27 | #include "version.h"
28 |
29 | /**
30 | * @defgroup lavu_sha SHA
31 | * @ingroup lavu_crypto
32 | * @{
33 | */
34 |
35 | extern const int av_sha_size;
36 |
37 | struct AVSHA;
38 |
39 | /**
40 | * Allocate an AVSHA context.
41 | */
42 | struct AVSHA *av_sha_alloc(void);
43 |
44 | /**
45 | * Initialize SHA-1 or SHA-2 hashing.
46 | *
47 | * @param context pointer to the function context (of size av_sha_size)
48 | * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits)
49 | * @return zero if initialization succeeded, -1 otherwise
50 | */
51 | int av_sha_init(struct AVSHA* context, int bits);
52 |
53 | /**
54 | * Update hash value.
55 | *
56 | * @param context hash function context
57 | * @param data input data to update hash with
58 | * @param len input data length
59 | */
60 | void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len);
61 |
62 | /**
63 | * Finish hashing and output digest value.
64 | *
65 | * @param context hash function context
66 | * @param digest buffer where output digest value is stored
67 | */
68 | void av_sha_final(struct AVSHA* context, uint8_t *digest);
69 |
70 | /**
71 | * @}
72 | */
73 |
74 | #endif /* AVUTIL_SHA_H */
75 |
--------------------------------------------------------------------------------
/jni/include/libavutil/sha512.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 Michael Niedermayer
3 | * Copyright (C) 2013 James Almer
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_SHA512_H
23 | #define AVUTIL_SHA512_H
24 |
25 | #include
26 |
27 | #include "attributes.h"
28 | #include "version.h"
29 |
30 | /**
31 | * @defgroup lavu_sha512 SHA512
32 | * @ingroup lavu_crypto
33 | * @{
34 | */
35 |
36 | extern const int av_sha512_size;
37 |
38 | struct AVSHA512;
39 |
40 | /**
41 | * Allocate an AVSHA512 context.
42 | */
43 | struct AVSHA512 *av_sha512_alloc(void);
44 |
45 | /**
46 | * Initialize SHA-2 512 hashing.
47 | *
48 | * @param context pointer to the function context (of size av_sha512_size)
49 | * @param bits number of bits in digest (224, 256, 384 or 512 bits)
50 | * @return zero if initialization succeeded, -1 otherwise
51 | */
52 | int av_sha512_init(struct AVSHA512* context, int bits);
53 |
54 | /**
55 | * Update hash value.
56 | *
57 | * @param context hash function context
58 | * @param data input data to update hash with
59 | * @param len input data length
60 | */
61 | void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len);
62 |
63 | /**
64 | * Finish hashing and output digest value.
65 | *
66 | * @param context hash function context
67 | * @param digest buffer where output digest value is stored
68 | */
69 | void av_sha512_final(struct AVSHA512* context, uint8_t *digest);
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | #endif /* AVUTIL_SHA512_H */
76 |
--------------------------------------------------------------------------------
/jni/include/libavutil/time.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2003 Fabrice Bellard
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 | #ifndef AVUTIL_TIME_H
22 | #define AVUTIL_TIME_H
23 |
24 | #include
25 |
26 | /**
27 | * Get the current time in microseconds.
28 | */
29 | int64_t av_gettime(void);
30 |
31 | /**
32 | * Sleep for a period of time. Although the duration is expressed in
33 | * microseconds, the actual delay may be rounded to the precision of the
34 | * system timer.
35 | *
36 | * @param usec Number of microseconds to sleep.
37 | * @return zero on success or (negative) error code.
38 | */
39 | int av_usleep(unsigned usec);
40 |
41 | #endif /* AVUTIL_TIME_H */
42 |
--------------------------------------------------------------------------------
/jni/include/libavutil/timecode.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006 Smartjog S.A.S, Baptiste Coudurier
3 | * Copyright (c) 2011-2012 Smartjog S.A.S, Clément Bœsch
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | /**
23 | * @file
24 | * Timecode helpers header
25 | */
26 |
27 | #ifndef AVUTIL_TIMECODE_H
28 | #define AVUTIL_TIMECODE_H
29 |
30 | #include
31 | #include "rational.h"
32 |
33 | #define AV_TIMECODE_STR_SIZE 16
34 |
35 | enum AVTimecodeFlag {
36 | AV_TIMECODE_FLAG_DROPFRAME = 1<<0, ///< timecode is drop frame
37 | AV_TIMECODE_FLAG_24HOURSMAX = 1<<1, ///< timecode wraps after 24 hours
38 | AV_TIMECODE_FLAG_ALLOWNEGATIVE = 1<<2, ///< negative time values are allowed
39 | };
40 |
41 | typedef struct {
42 | int start; ///< timecode frame start (first base frame number)
43 | uint32_t flags; ///< flags such as drop frame, +24 hours support, ...
44 | AVRational rate; ///< frame rate in rational form
45 | unsigned fps; ///< frame per second; must be consistent with the rate field
46 | } AVTimecode;
47 |
48 | /**
49 | * Adjust frame number for NTSC drop frame time code.
50 | *
51 | * @param framenum frame number to adjust
52 | * @param fps frame per second, 30 or 60
53 | * @return adjusted frame number
54 | * @warning adjustment is only valid in NTSC 29.97 and 59.94
55 | */
56 | int av_timecode_adjust_ntsc_framenum2(int framenum, int fps);
57 |
58 | /**
59 | * Convert frame number to SMPTE 12M binary representation.
60 | *
61 | * @param tc timecode data correctly initialized
62 | * @param framenum frame number
63 | * @return the SMPTE binary representation
64 | *
65 | * @note Frame number adjustment is automatically done in case of drop timecode,
66 | * you do NOT have to call av_timecode_adjust_ntsc_framenum2().
67 | * @note The frame number is relative to tc->start.
68 | * @note Color frame (CF), binary group flags (BGF) and biphase mark polarity
69 | * correction (PC) bits are set to zero.
70 | */
71 | uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum);
72 |
73 | /**
74 | * Load timecode string in buf.
75 | *
76 | * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
77 | * @param tc timecode data correctly initialized
78 | * @param framenum frame number
79 | * @return the buf parameter
80 | *
81 | * @note Timecode representation can be a negative timecode and have more than
82 | * 24 hours, but will only be honored if the flags are correctly set.
83 | * @note The frame number is relative to tc->start.
84 | */
85 | char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum);
86 |
87 | /**
88 | * Get the timecode string from the SMPTE timecode format.
89 | *
90 | * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
91 | * @param tcsmpte the 32-bit SMPTE timecode
92 | * @param prevent_df prevent the use of a drop flag when it is known the DF bit
93 | * is arbitrary
94 | * @return the buf parameter
95 | */
96 | char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df);
97 |
98 | /**
99 | * Get the timecode string from the 25-bit timecode format (MPEG GOP format).
100 | *
101 | * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
102 | * @param tc25bit the 25-bits timecode
103 | * @return the buf parameter
104 | */
105 | char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit);
106 |
107 | /**
108 | * Init a timecode struct with the passed parameters.
109 | *
110 | * @param log_ctx a pointer to an arbitrary struct of which the first field
111 | * is a pointer to an AVClass struct (used for av_log)
112 | * @param tc pointer to an allocated AVTimecode
113 | * @param rate frame rate in rational form
114 | * @param flags miscellaneous flags such as drop frame, +24 hours, ...
115 | * (see AVTimecodeFlag)
116 | * @param frame_start the first frame number
117 | * @return 0 on success, AVERROR otherwise
118 | */
119 | int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx);
120 |
121 | /**
122 | * Parse timecode representation (hh:mm:ss[:;.]ff).
123 | *
124 | * @param log_ctx a pointer to an arbitrary struct of which the first field is a
125 | * pointer to an AVClass struct (used for av_log).
126 | * @param tc pointer to an allocated AVTimecode
127 | * @param rate frame rate in rational form
128 | * @param str timecode string which will determine the frame start
129 | * @return 0 on success, AVERROR otherwise
130 | */
131 | int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx);
132 |
133 | /**
134 | * Check if the timecode feature is available for the given frame rate
135 | *
136 | * @return 0 if supported, <0 otherwise
137 | */
138 | int av_timecode_check_frame_rate(AVRational rate);
139 |
140 | #endif /* AVUTIL_TIMECODE_H */
141 |
--------------------------------------------------------------------------------
/jni/include/libavutil/timestamp.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | /**
20 | * @file
21 | * timestamp utils, mostly useful for debugging/logging purposes
22 | */
23 |
24 | #ifndef AVUTIL_TIMESTAMP_H
25 | #define AVUTIL_TIMESTAMP_H
26 |
27 | #include "common.h"
28 |
29 | #define AV_TS_MAX_STRING_SIZE 32
30 |
31 | /**
32 | * Fill the provided buffer with a string containing a timestamp
33 | * representation.
34 | *
35 | * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
36 | * @param ts the timestamp to represent
37 | * @return the buffer in input
38 | */
39 | static inline char *av_ts_make_string(char *buf, int64_t ts)
40 | {
41 | if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
42 | else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%"PRId64, ts);
43 | return buf;
44 | }
45 |
46 | /**
47 | * Convenience macro, the return value should be used only directly in
48 | * function arguments but never stand-alone.
49 | */
50 | #define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts)
51 |
52 | /**
53 | * Fill the provided buffer with a string containing a timestamp time
54 | * representation.
55 | *
56 | * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
57 | * @param ts the timestamp to represent
58 | * @param tb the timebase of the timestamp
59 | * @return the buffer in input
60 | */
61 | static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb)
62 | {
63 | if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
64 | else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts);
65 | return buf;
66 | }
67 |
68 | /**
69 | * Convenience macro, the return value should be used only directly in
70 | * function arguments but never stand-alone.
71 | */
72 | #define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb)
73 |
74 | #endif /* AVUTIL_TIMESTAMP_H */
75 |
--------------------------------------------------------------------------------
/jni/include/libavutil/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2003 Fabrice Bellard
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 | #ifndef AVUTIL_VERSION_H
22 | #define AVUTIL_VERSION_H
23 |
24 | /**
25 | * @defgroup preproc_misc Preprocessor String Macros
26 | *
27 | * String manipulation macros
28 | *
29 | * @{
30 | */
31 |
32 | #define AV_STRINGIFY(s) AV_TOSTRING(s)
33 | #define AV_TOSTRING(s) #s
34 |
35 | #define AV_GLUE(a, b) a ## b
36 | #define AV_JOIN(a, b) AV_GLUE(a, b)
37 |
38 | #define AV_PRAGMA(s) _Pragma(#s)
39 |
40 | /**
41 | * @}
42 | */
43 |
44 | /**
45 | * @defgroup version_utils Library Version Macros
46 | *
47 | * Useful to check and match library version in order to maintain
48 | * backward compatibility.
49 | *
50 | * @{
51 | */
52 |
53 | #define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c)
54 | #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
55 | #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
56 |
57 | /**
58 | * @}
59 | */
60 |
61 |
62 | /**
63 | * @file
64 | * @ingroup lavu
65 | * Libavutil version macros
66 | */
67 |
68 | /**
69 | * @defgroup lavu_ver Version and Build diagnostics
70 | *
71 | * Macros and function useful to check at compiletime and at runtime
72 | * which version of libavutil is in use.
73 | *
74 | * @{
75 | */
76 |
77 | #define LIBAVUTIL_VERSION_MAJOR 52
78 | #define LIBAVUTIL_VERSION_MINOR 38
79 | #define LIBAVUTIL_VERSION_MICRO 100
80 |
81 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
82 | LIBAVUTIL_VERSION_MINOR, \
83 | LIBAVUTIL_VERSION_MICRO)
84 | #define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \
85 | LIBAVUTIL_VERSION_MINOR, \
86 | LIBAVUTIL_VERSION_MICRO)
87 | #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT
88 |
89 | #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
90 |
91 | /**
92 | * @}
93 | *
94 | * @defgroup depr_guards Deprecation guards
95 | * FF_API_* defines may be placed below to indicate public API that will be
96 | * dropped at a future version bump. The defines themselves are not part of
97 | * the public API and may change, break or disappear at any time.
98 | *
99 | * @{
100 | */
101 |
102 | #ifndef FF_API_GET_BITS_PER_SAMPLE_FMT
103 | #define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 53)
104 | #endif
105 | #ifndef FF_API_FIND_OPT
106 | #define FF_API_FIND_OPT (LIBAVUTIL_VERSION_MAJOR < 53)
107 | #endif
108 | #ifndef FF_API_OLD_AVOPTIONS
109 | #define FF_API_OLD_AVOPTIONS (LIBAVUTIL_VERSION_MAJOR < 53)
110 | #endif
111 | #ifndef FF_API_PIX_FMT
112 | #define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 53)
113 | #endif
114 | #ifndef FF_API_CONTEXT_SIZE
115 | #define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 53)
116 | #endif
117 | #ifndef FF_API_PIX_FMT_DESC
118 | #define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 53)
119 | #endif
120 | #ifndef FF_API_AV_REVERSE
121 | #define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 53)
122 | #endif
123 | #ifndef FF_API_AUDIOCONVERT
124 | #define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 53)
125 | #endif
126 | #ifndef FF_API_CPU_FLAG_MMX2
127 | #define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 53)
128 | #endif
129 | #ifndef FF_API_SAMPLES_UTILS_RETURN_ZERO
130 | #define FF_API_SAMPLES_UTILS_RETURN_ZERO (LIBAVUTIL_VERSION_MAJOR < 53)
131 | #endif
132 | #ifndef FF_API_LLS_PRIVATE
133 | #define FF_API_LLS_PRIVATE (LIBAVUTIL_VERSION_MAJOR < 53)
134 | #endif
135 | #ifndef FF_API_AVFRAME_LAVC
136 | #define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 53)
137 | #endif
138 |
139 | /**
140 | * @}
141 | */
142 |
143 | #endif /* AVUTIL_VERSION_H */
144 |
145 |
--------------------------------------------------------------------------------
/jni/include/libavutil/xtea.h:
--------------------------------------------------------------------------------
1 | /*
2 | * A 32-bit implementation of the XTEA algorithm
3 | * Copyright (c) 2012 Samuel Pitoiset
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_XTEA_H
23 | #define AVUTIL_XTEA_H
24 |
25 | #include
26 |
27 | /**
28 | * @defgroup lavu_xtea XTEA
29 | * @ingroup lavu_crypto
30 | * @{
31 | */
32 |
33 | typedef struct AVXTEA {
34 | uint32_t key[16];
35 | } AVXTEA;
36 |
37 | /**
38 | * Initialize an AVXTEA context.
39 | *
40 | * @param ctx an AVXTEA context
41 | * @param key a key of 16 bytes used for encryption/decryption
42 | */
43 | void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]);
44 |
45 | /**
46 | * Encrypt or decrypt a buffer using a previously initialized context.
47 | *
48 | * @param ctx an AVXTEA context
49 | * @param dst destination array, can be equal to src
50 | * @param src source array, can be equal to dst
51 | * @param count number of 8 byte blocks
52 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used
53 | * @param decrypt 0 for encryption, 1 for decryption
54 | */
55 | void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src,
56 | int count, uint8_t *iv, int decrypt);
57 |
58 | /**
59 | * @}
60 | */
61 |
62 | #endif /* AVUTIL_XTEA_H */
63 |
--------------------------------------------------------------------------------
/jni/include/libswresample/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Version macros.
3 | *
4 | * This file is part of libswresample
5 | *
6 | * libswresample 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 | * libswresample 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 libswresample; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef SWR_VERSION_H
22 | #define SWR_VERSION_H
23 |
24 | /**
25 | * @file
26 | * Libswresample version macros
27 | */
28 |
29 | #include "libavutil/avutil.h"
30 |
31 | #define LIBSWRESAMPLE_VERSION_MAJOR 0
32 | #define LIBSWRESAMPLE_VERSION_MINOR 17
33 | #define LIBSWRESAMPLE_VERSION_MICRO 102
34 |
35 | #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
36 | LIBSWRESAMPLE_VERSION_MINOR, \
37 | LIBSWRESAMPLE_VERSION_MICRO)
38 | #define LIBSWRESAMPLE_VERSION AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, \
39 | LIBSWRESAMPLE_VERSION_MINOR, \
40 | LIBSWRESAMPLE_VERSION_MICRO)
41 | #define LIBSWRESAMPLE_BUILD LIBSWRESAMPLE_VERSION_INT
42 |
43 | #define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION)
44 |
45 | #endif /* SWR_VERSION_H */
46 |
--------------------------------------------------------------------------------
/jni/include/libswscale/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef SWSCALE_VERSION_H
20 | #define SWSCALE_VERSION_H
21 |
22 | /**
23 | * @file
24 | * swscale version macros
25 | */
26 |
27 | #include "libavutil/avutil.h"
28 |
29 | #define LIBSWSCALE_VERSION_MAJOR 2
30 | #define LIBSWSCALE_VERSION_MINOR 3
31 | #define LIBSWSCALE_VERSION_MICRO 100
32 |
33 | #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
34 | LIBSWSCALE_VERSION_MINOR, \
35 | LIBSWSCALE_VERSION_MICRO)
36 | #define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \
37 | LIBSWSCALE_VERSION_MINOR, \
38 | LIBSWSCALE_VERSION_MICRO)
39 | #define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT
40 |
41 | #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
42 |
43 | /**
44 | * FF_API_* defines may be placed below to indicate public API that will be
45 | * dropped at a future version bump. The defines themselves are not part of
46 | * the public API and may change, break or disappear at any time.
47 | */
48 |
49 | #ifndef FF_API_SWS_GETCONTEXT
50 | #define FF_API_SWS_GETCONTEXT (LIBSWSCALE_VERSION_MAJOR < 3)
51 | #endif
52 | #ifndef FF_API_SWS_CPU_CAPS
53 | #define FF_API_SWS_CPU_CAPS (LIBSWSCALE_VERSION_MAJOR < 3)
54 | #endif
55 | #ifndef FF_API_SWS_FORMAT_NAME
56 | #define FF_API_SWS_FORMAT_NAME (LIBSWSCALE_VERSION_MAJOR < 3)
57 | #endif
58 |
59 | #endif /* SWSCALE_VERSION_H */
60 |
--------------------------------------------------------------------------------
/jni/ndk-build.sh:
--------------------------------------------------------------------------------
1 | # for Mac OS X
2 | # /bin/bash
3 | #set -x # verbose
4 |
5 | # Compile .so from .c
6 | ndk-build NDK_DEBUG=1
7 |
8 | # Generate .jar from .so
9 | cd ../libs
10 | jarRoot="./lib"
11 |
12 | shopt -s nullglob
13 | for dir in ./*/
14 | do
15 | echo $dir
16 | dirName=`basename $dir` # armeabi
17 | mkdir -p $jarRoot"/"$dirName # mkdir lib/armeabi
18 |
19 | cpSrc=$dir"*"
20 | cpDst=$jarRoot"/"$dirName
21 | cp -r $cpSrc $cpDst # cp armeabi/lib lib/armeabi
22 | jarPath=$dirName".jar"
23 | zip -r $jarPath $jarRoot # zip armeabi.jar lib/
24 | rm -r $jarRoot
25 | done
26 |
--------------------------------------------------------------------------------
/libs/Simpl3r-1.0.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/libs/Simpl3r-1.0.2.jar
--------------------------------------------------------------------------------
/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/libs/armeabi/gdb.setup:
--------------------------------------------------------------------------------
1 | set solib-search-path ./obj/local/armeabi
2 | directory /Applications/android-ndk-r9b/platforms/android-18/arch-arm/usr/include jni/include /Applications/android-ndk-r9b/sources/cxx-stl/system
3 |
--------------------------------------------------------------------------------
/libs/armeabi/gdbserver:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/libs/armeabi/gdbserver
--------------------------------------------------------------------------------
/libs/armeabi/libFFmpegWrapper.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/libs/armeabi/libFFmpegWrapper.so
--------------------------------------------------------------------------------
/libs/armeabi/libavcodec-55.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/libs/armeabi/libavcodec-55.so
--------------------------------------------------------------------------------
/libs/armeabi/libavfilter-3.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/libs/armeabi/libavfilter-3.so
--------------------------------------------------------------------------------
/libs/armeabi/libavformat-55.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/libs/armeabi/libavformat-55.so
--------------------------------------------------------------------------------
/libs/armeabi/libavutil-52.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/libs/armeabi/libavutil-52.so
--------------------------------------------------------------------------------
/libs/armeabi/libswresample-0.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/libs/armeabi/libswresample-0.so
--------------------------------------------------------------------------------
/libs/armeabi/libswscale-2.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/libs/armeabi/libswscale-2.so
--------------------------------------------------------------------------------
/libs/aws-android-sdk-1.7.0-core.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/libs/aws-android-sdk-1.7.0-core.jar
--------------------------------------------------------------------------------
/libs/aws-android-sdk-1.7.0-s3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/libs/aws-android-sdk-1.7.0-s3.jar
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-18
15 |
--------------------------------------------------------------------------------
/res/anim/slide_from_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/res/anim/slide_to_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/live_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/res/drawable-hdpi/live_bg.9.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnlyInAmerica/FFmpegTest/07fcf587df3c05a277bdec0d3d008bcc8ec34975/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/layout/activity_hwrecorder.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
14 |
15 |
27 |
28 |
37 |
38 |
--------------------------------------------------------------------------------
/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ffmpegTest
5 | Settings
6 | Hello world!
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/com/example/ffmpegtest/FileUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013, David Brodsky. All rights reserved.
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | package com.example.ffmpegtest;
19 |
20 | import android.content.Context;
21 | import android.os.Environment;
22 | import android.util.Log;
23 |
24 | import java.io.BufferedReader;
25 | import java.io.File;
26 | import java.io.FileInputStream;
27 | import java.io.FileOutputStream;
28 | import java.io.IOException;
29 | import java.io.InputStream;
30 | import java.io.InputStreamReader;
31 | import java.io.OutputStream;
32 |
33 | public class FileUtils {
34 |
35 | static final String TAG = "FileUtils";
36 |
37 | static final String OUTPUT_DIR = "HWEncodingExperiments"; // Directory relative to External or Internal (fallback) Storage
38 |
39 | /**
40 | * Returns a Java File initialized to a directory of given name
41 | * at the root storage location, with preference to external storage.
42 | * If the directory did not exist, it will be created at the conclusion of this call.
43 | * If a file with conflicting name exists, this method returns null;
44 | *
45 | * @param c the context to determine the internal storage location, if external is unavailable
46 | * @param directory_name the name of the directory desired at the storage location
47 | * @return a File pointing to the storage directory, or null if a file with conflicting name
48 | * exists
49 | */
50 | public static File getRootStorageDirectory(Context c, String directory_name){
51 | File result;
52 | // First, try getting access to the sdcard partition
53 | if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
54 | Log.d(TAG,"Using sdcard");
55 | result = new File(Environment.getExternalStorageDirectory(), directory_name);
56 | } else {
57 | // Else, use the internal storage directory for this application
58 | Log.d(TAG,"Using internal storage");
59 | result = new File(c.getApplicationContext().getFilesDir(), directory_name);
60 | }
61 |
62 | if(!result.exists())
63 | result.mkdir();
64 | else if(result.isFile()){
65 | return null;
66 | }
67 | Log.d("getRootStorageDirectory", result.getAbsolutePath());
68 | return result;
69 | }
70 |
71 | /**
72 | * Returns a Java File initialized to a directory of given name
73 | * within the given location.
74 | *
75 | * @param parent_directory a File representing the directory in which the new child will reside
76 | * @return a File pointing to the desired directory, or null if a file with conflicting name
77 | * exists or if getRootStorageDirectory was not called first
78 | */
79 | public static File getStorageDirectory(File parent_directory, String new_child_directory_name){
80 |
81 | File result = new File(parent_directory, new_child_directory_name);
82 | if(!result.exists())
83 | if(result.mkdir())
84 | return result;
85 | else{
86 | Log.e("getStorageDirectory", "Error creating " + result.getAbsolutePath());
87 | return null;
88 | }
89 | else if(result.isFile()){
90 | return null;
91 | }
92 |
93 | Log.d("getStorageDirectory", "directory ready: " + result.getAbsolutePath());
94 | return result;
95 | }
96 |
97 | /**
98 | * Returns a TempFile with given root, filename, and extension.
99 | * The resulting TempFile is safe for use with Android's MediaRecorder
100 | * @param c
101 | * @param root
102 | * @param filename
103 | * @param extension
104 | * @return
105 | */
106 | public static File createTempFile(Context c, File root, String filename, String extension){
107 | File output = null;
108 | try {
109 | if(filename != null){
110 | if(!extension.contains("."))
111 | extension = "." + extension;
112 | output = new File(root, filename + extension);
113 | output.createNewFile();
114 | //output = File.createTempFile(filename, extension, root);
115 | Log.i(TAG, "Created temp file: " + output.getAbsolutePath());
116 | }
117 | return output;
118 | } catch (IOException e) {
119 | e.printStackTrace();
120 | return null;
121 | }
122 | }
123 |
124 | public static File createTempFileInRootAppStorage(Context c, String filename){
125 | File recordingDir = FileUtils.getRootStorageDirectory(c, OUTPUT_DIR);
126 | return createTempFile(c, recordingDir, filename.split("\\.")[0], filename.split("\\.")[1]);
127 | }
128 |
129 | public static String convertStreamToString(InputStream is) throws Exception {
130 | BufferedReader reader = new BufferedReader(new InputStreamReader(is));
131 | StringBuilder sb = new StringBuilder();
132 | String line = null;
133 | while ((line = reader.readLine()) != null) {
134 | sb.append(line).append("\n");
135 | }
136 | return sb.toString();
137 | }
138 |
139 | public static String getStringFromFile (String filePath) throws Exception {
140 | File fl = new File(filePath);
141 | FileInputStream fin = new FileInputStream(fl);
142 | String ret = convertStreamToString(fin);
143 | //Make sure you close all streams.
144 | fin.close();
145 | return ret;
146 | }
147 |
148 | public static void copy(File src, File dst) throws IOException {
149 | InputStream in = new FileInputStream(src);
150 | OutputStream out = new FileOutputStream(dst);
151 |
152 | // Transfer bytes from in to out
153 | byte[] buf = new byte[1024];
154 | int len;
155 | while ((len = in.read(buf)) > 0) {
156 | out.write(buf, 0, len);
157 | }
158 | in.close();
159 | out.close();
160 | }
161 |
162 | }
--------------------------------------------------------------------------------
/src/com/example/ffmpegtest/HLSFileObserver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013, David Brodsky. All rights reserved.
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | package com.example.ffmpegtest;
19 |
20 | import java.io.File;
21 |
22 | import android.os.FileObserver;
23 |
24 | /**
25 | * A FileObserver that listens for actions
26 | * specific to the creation of an HLS stream
27 | * e.g: A .ts segment is written
28 | * or a .m3u8 manifest is modified
29 | * @author davidbrodsky
30 | *
31 | */
32 | public class HLSFileObserver extends FileObserver{
33 |
34 | private static final String M3U8_EXT = "m3u8";
35 | private static final String TS_EXT = "ts";
36 | String targetDir;
37 |
38 | private HLSCallback callback;
39 |
40 | public interface HLSCallback{
41 | public void onSegmentComplete(String path);
42 | public void onManifestUpdated(String path);
43 | }
44 |
45 | /**
46 | * Begin observing the given path for changes
47 | * to .ts and .m3u8 files
48 | * @param path the absolute path to observe.
49 | * @param callback a callback to be notified when HLS files are modified
50 | */
51 | public HLSFileObserver(String path, HLSCallback callback){
52 | super(path, CLOSE_WRITE);
53 | this.callback = callback;
54 | targetDir = path;
55 | }
56 |
57 | @Override
58 | public void onEvent(int event, String path) {
59 | String ext = path.substring(path.lastIndexOf('.') + 1);
60 | if(ext.compareTo(M3U8_EXT) == 0){
61 | callback.onManifestUpdated(targetDir + File.separator + path);
62 | }else if(ext.compareTo(TS_EXT) == 0){
63 | callback.onSegmentComplete(targetDir + File.separator + path);
64 | }
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/src/com/example/ffmpegtest/HWRecorderActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013, David Brodsky. All rights reserved.
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | package com.example.ffmpegtest;
19 |
20 | import com.example.ffmpegtest.recorder.HLSRecorder;
21 | import com.example.ffmpegtest.recorder.LiveHLSRecorder;
22 |
23 | import android.app.Activity;
24 | import android.content.BroadcastReceiver;
25 | import android.content.Context;
26 | import android.content.Intent;
27 | import android.content.IntentFilter;
28 | import android.graphics.Color;
29 | import android.os.Bundle;
30 | import android.support.v4.content.LocalBroadcastManager;
31 | import android.util.Log;
32 | import android.view.Gravity;
33 | import android.view.LayoutInflater;
34 | import android.view.View;
35 | import android.view.Window;
36 | import android.view.WindowManager;
37 | import android.view.animation.AnimationUtils;
38 | import android.widget.Button;
39 | import android.widget.TextSwitcher;
40 | import android.widget.TextView;
41 | import android.widget.ViewSwitcher.ViewFactory;
42 |
43 | public class HWRecorderActivity extends Activity {
44 | private static final String TAG = "HWRecorderActivity";
45 | boolean recording = false;
46 | LiveHLSRecorder liveRecorder;
47 |
48 | TextView liveIndicator;
49 | String broadcastUrl;
50 |
51 | //GLSurfaceView glSurfaceView;
52 | //GlSurfaceViewRenderer glSurfaceViewRenderer = new GlSurfaceViewRenderer();
53 | LayoutInflater inflater;
54 |
55 | protected void onCreate (Bundle savedInstanceState){
56 | super.onCreate(savedInstanceState);
57 | requestWindowFeature(Window.FEATURE_NO_TITLE);
58 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
59 | setContentView(R.layout.activity_hwrecorder);
60 | inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
61 | liveIndicator = (TextView) findViewById(R.id.liveLabel);
62 | //glSurfaceView = (GLSurfaceView) findViewById(R.id.glSurfaceView);
63 | //glSurfaceView.setRenderer(glSurfaceViewRenderer);
64 |
65 | LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver,
66 | new IntentFilter(LiveHLSRecorder.INTENT_ACTION));
67 | }
68 |
69 | @Override
70 | public void onPause(){
71 | super.onPause();
72 | //glSurfaceView.onPause();
73 | }
74 |
75 | @Override
76 | public void onResume(){
77 | super.onResume();
78 | //glSurfaceView.onResume();
79 | }
80 |
81 | @Override
82 | protected void onDestroy() {
83 | // Unregister since the activity is about to be closed.
84 | LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver);
85 | super.onDestroy();
86 | }
87 |
88 | public void onRecordButtonClicked(View v){
89 | if(!recording){
90 | broadcastUrl = null;
91 |
92 | try {
93 | liveRecorder = new LiveHLSRecorder(getApplicationContext());
94 | liveRecorder.startRecording(null);
95 | ((Button) v).setText("Stop Recording");
96 | } catch (Throwable throwable) {
97 | throwable.printStackTrace();
98 | }
99 | }else{
100 | liveRecorder.stopRecording();
101 | ((Button) v).setText("Start Recording");
102 | liveIndicator.startAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_to_left));
103 | }
104 | recording = !recording;
105 | }
106 |
107 | private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
108 | @Override
109 | public void onReceive(Context context, Intent intent) {
110 | // Get extra data included in the Intent
111 | if (LiveHLSRecorder.HLS_STATUS.LIVE == (LiveHLSRecorder.HLS_STATUS) intent.getSerializableExtra("status")){
112 | broadcastUrl = intent.getStringExtra("url");
113 | liveIndicator.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_from_left));
114 | liveIndicator.setVisibility(View.VISIBLE);
115 | }
116 | }
117 | };
118 |
119 | public void onUrlLabelClick(View v){
120 | if(broadcastUrl != null){
121 | shareUrl(broadcastUrl);
122 | }
123 | }
124 |
125 | private void shareUrl(String url) {
126 | Intent shareIntent = new Intent(Intent.ACTION_SEND);
127 | shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
128 | shareIntent.setType("text/plain");
129 | startActivity(Intent.createChooser(shareIntent, "Share Broadcast!"));
130 | }
131 |
132 | /*
133 | static EGLContext context;
134 |
135 | public class GlSurfaceViewRenderer implements GLSurfaceView.Renderer{
136 |
137 | @Override
138 | public void onSurfaceCreated(GL10 gl, EGLConfig config) {
139 | Log.i(TAG, "GLSurfaceView created");
140 | context = EGL14.eglGetCurrentContext();
141 | if(context == EGL14.EGL_NO_CONTEXT)
142 | Log.e(TAG, "failed to get valid EGLContext");
143 |
144 | EGL14.eglMakeCurrent(EGL14.eglGetCurrentDisplay(), EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT);
145 | }
146 |
147 | @Override
148 | public void onSurfaceChanged(GL10 gl, int width, int height) {
149 |
150 | }
151 |
152 | @Override
153 | public void onDrawFrame(GL10 gl) {
154 | }
155 | }
156 | */
157 |
158 | }
--------------------------------------------------------------------------------
/src/com/example/ffmpegtest/S3Client.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegtest;
2 |
3 | import java.io.File;
4 |
5 | import android.content.Context;
6 | import android.util.Log;
7 |
8 | import com.amazonaws.auth.BasicAWSCredentials;
9 | import com.amazonaws.services.s3.AmazonS3Client;
10 | import com.amazonaws.services.s3.model.ProgressEvent;
11 | import com.readystatesoftware.simpl3r.Uploader;
12 | import com.readystatesoftware.simpl3r.Uploader.UploadProgressListener;
13 |
14 | public class S3Client {
15 | private static final String TAG = "S3Client";
16 |
17 | AmazonS3Client s3;
18 | Context c;
19 |
20 | String bucket;
21 |
22 | public interface S3Callback{
23 | public void onProgress(ProgressEvent progressEvent, long bytesUploaded, int percentUploaded);
24 | }
25 |
26 | public S3Client(Context c, String AWS_KEY, String AWS_SECRET){
27 | s3 = new AmazonS3Client(new BasicAWSCredentials(SECRETS.AWS_KEY, SECRETS.AWS_SECRET));
28 | this.c = c;
29 | }
30 |
31 | /**
32 | * Set the target S3 bucket of this client.
33 | * Must be set before calling upload.
34 | * @param bucket The name of the target S3 bucket.
35 | */
36 | public void setBucket(String bucket){
37 | this.bucket = bucket;
38 | }
39 |
40 | /**
41 | * Begin an upload to S3. Returns the url to the completed upload.
42 | * @param key Path relative to provided S3 bucket.
43 | * @param source File reference to be uploaded.
44 | * @param callback Callback providing upload progress.
45 | * @return
46 | */
47 | public String upload(String key, File source, final S3Callback callback){
48 | if(bucket == null){
49 | Log.e(TAG, "Bucket not set! Call setBucket(String bucket)");
50 | return "";
51 | }
52 | Uploader uploader = new Uploader(c, s3, bucket, key, source);
53 | uploader.setProgressListener(new UploadProgressListener() {
54 | @Override
55 | public void progressChanged(ProgressEvent progressEvent,
56 | long bytesUploaded, int percentUploaded) {
57 | if(callback != null)
58 | callback.onProgress(progressEvent, bytesUploaded, percentUploaded);
59 | }
60 | });
61 | return uploader.start();
62 | }
63 |
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/src/com/example/ffmpegtest/recorder/FFmpegWrapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013, David Brodsky. All rights reserved.
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | package com.example.ffmpegtest.recorder;
19 |
20 | import java.nio.ByteBuffer;
21 |
22 | import android.util.Log;
23 |
24 | /**
25 | * A wrapper around the FFmpeg C libraries
26 | * designed for muxing encoded AV packets
27 | * into various output formats not supported by
28 | * Android's MediaMuxer, which is currently limited to .mp4
29 | *
30 | * As this is designed to complement Android's MediaCodec class,
31 | * the only supported formats for jData in writeAVPacketFromEncodedData are:
32 | * H264 (YUV420P pixel format) / AAC (16 bit signed integer samples, one center channel)
33 | *
34 | * Methods of this class must be called in the following order:
35 | * 0. (optional) setAVOptions
36 | * 1. prepareAVFormatContext
37 | * 2. (repeat for each packet) writeAVPacketFromEncodedData
38 | * 3. finalizeAVFormatContext
39 | * @author davidbrodsky
40 | *
41 | */
42 | public class FFmpegWrapper {
43 |
44 | static {
45 | System.loadLibrary("FFmpegWrapper");
46 | }
47 |
48 | public native void setAVOptions(AVOptions jOpts);
49 | public native void prepareAVFormatContext(String jOutputPath);
50 | public native void writeAVPacketFromEncodedData(ByteBuffer jData, int jIsVideo, int jOffset, int jSize, int jFlags, long jPts);
51 | public native void finalizeAVFormatContext();
52 |
53 | /**
54 | * Used to configure the muxer's options.
55 | * Note the name of this class's fields
56 | * have to be hardcoded in the native method
57 | * for retrieval.
58 | * @author davidbrodsky
59 | *
60 | */
61 | static public class AVOptions{
62 | int videoHeight = 1280;
63 | int videoWidth = 720;
64 |
65 | int audioSampleRate = 44100;
66 | int numAudioChannels = 1;
67 |
68 | int hlsSegmentDurationSec = 10;
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/com/example/ffmpegtest/recorder/LiveHLSRecorder.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegtest.recorder;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.util.UUID;
6 | import java.util.concurrent.ExecutorService;
7 | import java.util.concurrent.Executors;
8 |
9 | import android.content.Context;
10 | import android.content.Intent;
11 | import android.os.Trace;
12 | import android.support.v4.content.LocalBroadcastManager;
13 | import android.util.Log;
14 |
15 | import com.amazonaws.auth.BasicAWSCredentials;
16 | import com.amazonaws.services.s3.AmazonS3Client;
17 | import com.amazonaws.services.s3.model.ProgressEvent;
18 | import com.example.ffmpegtest.FileUtils;
19 | import com.example.ffmpegtest.HLSFileObserver;
20 | import com.example.ffmpegtest.HLSFileObserver.HLSCallback;
21 | import com.example.ffmpegtest.S3Client;
22 | import com.example.ffmpegtest.S3Client.S3Callback;
23 | import com.example.ffmpegtest.SECRETS;
24 | import com.readystatesoftware.simpl3r.Uploader;
25 | import com.readystatesoftware.simpl3r.Uploader.UploadProgressListener;
26 |
27 | public class LiveHLSRecorder extends HLSRecorder{
28 | private final String TAG = "LiveHLSRecorder";
29 | private final boolean VERBOSE = false; // lots of logging
30 | private final boolean TRACE = true; // Enable systrace markers
31 | private final boolean UPLOAD_TO_S3 = true; // live uploading
32 |
33 | private Context c;
34 | private String uuid; // Recording UUID
35 | private HLSFileObserver observer; // Must hold reference to observer to continue receiving events
36 | private ExecutorService uploadService;
37 |
38 | public static final String INTENT_ACTION = "HLS"; // Intent action broadcast to LocalBroadcastManager
39 | public enum HLS_STATUS { OFFLINE, LIVE };
40 |
41 | private boolean sentIsLiveBroadcast = false; // Only send "broadcast is live" intent once per recording
42 | private int lastSegmentWritten = 0;
43 | File temp; // Temporary directory to store .m3u8s for each upload state
44 |
45 | // Amazon S3
46 | private final String S3_BUCKET = "openwatch-livestreamer";
47 | private S3Client s3Client;
48 |
49 | public LiveHLSRecorder(Context c){
50 | super(c);
51 | s3Client = new S3Client(c, SECRETS.AWS_KEY, SECRETS.AWS_SECRET);
52 | s3Client.setBucket(S3_BUCKET);
53 | uploadService = Executors.newSingleThreadExecutor();
54 | lastSegmentWritten = 0;
55 | this.c = c;
56 | }
57 |
58 | /**
59 | * We'll create a single thread ExecutorService for uploading, and immediately
60 | * submit the .ts and .m3u8 jobs in tick-tock fashion.
61 | * Currently, the fileObserver callbacks don't return until the entire upload
62 | * is complete, which means by the time the first .ts uploads, the the next callback (the .m3u8 write)
63 | * is called when the underlying action has been negated by future (but uncalled) events
64 | */
65 | @Override
66 | public void startRecording(final String outputDir){
67 | super.startRecording(outputDir);
68 | temp = new File(getOutputDirectory(), "temp"); // make temp directory for .m3u8s for each upload state
69 | temp.mkdirs();
70 | sentIsLiveBroadcast = false;
71 | if (!UPLOAD_TO_S3) return;
72 | observer = new HLSFileObserver(getOutputDirectory().getAbsolutePath(), new HLSCallback(){
73 |
74 | @Override
75 | public void onSegmentComplete(final String path) {
76 | lastSegmentWritten++;
77 | if (VERBOSE) Log.i(TAG, ".ts segment written: " + path);
78 | uploadService.submit(new Runnable(){
79 |
80 | @Override
81 | public void run() {
82 | File orig = new File(path);
83 | String url = s3Client.upload(getUUID() + File.separator + orig.getName(), orig, segmentUploadedCallback);
84 | if (VERBOSE) Log.i(TAG, ".ts segment destination url received: " + url);
85 | }
86 | });
87 | }
88 |
89 | @Override
90 | public void onManifestUpdated(String path) {
91 | if (VERBOSE) Log.i(TAG, ".m3u8 written: " + path);
92 | // Copy m3u8 at this moment and queue it to uploading service
93 | final File orig = new File(path);
94 | final File copy = new File(temp, orig.getName().replace(".m3u8", "_" + lastSegmentWritten + ".m3u8"));
95 |
96 | if (TRACE) Trace.beginSection("copyM3u8");
97 | try {
98 | FileUtils.copy(orig, copy);
99 | } catch (IOException e) {
100 | e.printStackTrace();
101 | }
102 | if (TRACE) Trace.endSection();
103 | uploadService.submit(new Runnable(){
104 |
105 | @Override
106 | public void run() {
107 | String url = s3Client.upload(getUUID() + File.separator + orig.getName(), copy, manifestUploadedCallback);
108 | // TODO: Delete copy
109 | if (VERBOSE) Log.i(TAG, ".m3u8 destination url received: " + url);
110 |
111 | if(!sentIsLiveBroadcast){
112 | broadcastRecordingIsLive(url);
113 | sentIsLiveBroadcast = true;
114 | }
115 | }
116 | });
117 | }
118 |
119 | });
120 | observer.startWatching();
121 | Log.i(TAG, "Watching " + getOutputDirectory() + " for changes");
122 | }
123 |
124 | S3Callback segmentUploadedCallback = new S3Callback(){
125 |
126 | @Override
127 | public void onProgress(ProgressEvent progressEvent, long bytesUploaded,
128 | int percentUploaded) {
129 | if (VERBOSE) Log.i(TAG, String.format(".ts segment upload progress: %d event: %d", percentUploaded, progressEvent.getEventCode()));
130 | if(progressEvent.getEventCode() == ProgressEvent.COMPLETED_EVENT_CODE){
131 | if (VERBOSE) Log.i(TAG, ".ts segment upload success");
132 | } else if(progressEvent.getEventCode() == ProgressEvent.FAILED_EVENT_CODE){
133 | if (VERBOSE) Log.i(TAG, ".ts segment upload failed");
134 | }
135 | }
136 |
137 | };
138 |
139 | S3Callback manifestUploadedCallback = new S3Callback(){
140 |
141 | @Override
142 | public void onProgress(ProgressEvent progressEvent, long bytesUploaded,
143 | int percentUploaded) {
144 | if (VERBOSE) Log.i(TAG, String.format(".m3u8 upload progress: %d event: %d", percentUploaded, progressEvent.getEventCode()));
145 | if(progressEvent.getEventCode() == ProgressEvent.COMPLETED_EVENT_CODE){
146 | if (VERBOSE) Log.i(TAG, ".m3u8 upload success");
147 | } else if(progressEvent.getEventCode() == ProgressEvent.FAILED_EVENT_CODE){
148 | if (VERBOSE) Log.i(TAG, ".m3u8 upload failed");
149 | }
150 | }
151 |
152 | };
153 |
154 | /**
155 | * Broadcasts a message to the LocalBroadcastManager
156 | * indicating the HLS stream is live.
157 | * This message is receivable only within the
158 | * hosting application
159 | * @param url address of the HLS stream
160 | */
161 | private void broadcastRecordingIsLive(String url) {
162 | Log.d(TAG, String.format("Broadcasting Live HLS link: %s", url));
163 | Intent intent = new Intent(INTENT_ACTION);
164 | intent.putExtra("url", url);
165 | intent.putExtra("status", HLS_STATUS.LIVE);
166 | LocalBroadcastManager.getInstance(c).sendBroadcast(intent);
167 | }
168 | }
169 |
--------------------------------------------------------------------------------