├── AndroidManifest.xml
├── README
├── default.properties
├── gen
└── com
│ └── churnlabs
│ └── ffmpegsample
│ └── R.java
├── jni
├── Android.mk
├── include
│ ├── libavcodec
│ │ ├── avcodec.h
│ │ ├── avfft.h
│ │ ├── dxva2.h
│ │ ├── opt.h
│ │ ├── vaapi.h
│ │ ├── vdpau.h
│ │ └── xvmc.h
│ ├── libavcore
│ │ ├── audioconvert.h
│ │ ├── avcore.h
│ │ ├── imgutils.h
│ │ ├── parseutils.h
│ │ └── samplefmt.h
│ ├── libavdevice
│ │ └── avdevice.h
│ ├── libavfilter
│ │ ├── avfilter.h
│ │ └── avfiltergraph.h
│ ├── libavformat
│ │ ├── avformat.h
│ │ └── avio.h
│ ├── libavutil
│ │ ├── adler32.h
│ │ ├── attributes.h
│ │ ├── avassert.h
│ │ ├── avconfig.h
│ │ ├── avstring.h
│ │ ├── avutil.h
│ │ ├── base64.h
│ │ ├── bswap.h
│ │ ├── common.h
│ │ ├── cpu.h
│ │ ├── crc.h
│ │ ├── error.h
│ │ ├── eval.h
│ │ ├── fifo.h
│ │ ├── intfloat_readwrite.h
│ │ ├── intreadwrite.h
│ │ ├── lfg.h
│ │ ├── log.h
│ │ ├── lzo.h
│ │ ├── mathematics.h
│ │ ├── md5.h
│ │ ├── mem.h
│ │ ├── opt.h
│ │ ├── pixdesc.h
│ │ ├── pixfmt.h
│ │ ├── random_seed.h
│ │ ├── rational.h
│ │ └── sha1.h
│ └── libswscale
│ │ └── swscale.h
├── libavcodec.a
├── libavcore.a
├── libavdevice.a
├── libavfilter.a
├── libavformat.a
├── libavutil.a
├── libswscale.a
└── native.c
├── res
├── drawable-hdpi
│ └── icon.png
├── drawable-ldpi
│ └── icon.png
├── drawable-mdpi
│ └── icon.png
├── layout
│ └── main.xml
└── values
│ └── strings.xml
└── src
└── com
└── churnlabs
└── ffmpegsample
└── MainActivity.java
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | This is based off the scripts that the Bambuser folks have shared:
2 |
3 | http://bambuser.com/opensource
4 |
5 | Their version turns off almost all of the decoders and disables access to the
6 | filesystem (the file protocol). In order to generate the libs sitting in the
7 | jni directory I turned back on a few options and compiled their stuff. You can
8 | give that a try if you need to turn on additional options. But it should also
9 | work to just use the .a files already in the jni directory when you download
10 | this.
11 |
12 | Right now all this does is open up a video file from the filesystem (hardcoded
13 | to /sdcard/vid.3gp in native.c right now), and it'll advance frame by frame
14 | through the video as you hit the "Frame" button and draw the image into a
15 | bitmap that gets displayed on the screen.
16 |
--------------------------------------------------------------------------------
/default.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 use,
7 | # "build.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=Google Inc.:Google APIs:8
12 |
--------------------------------------------------------------------------------
/gen/com/churnlabs/ffmpegsample/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package com.churnlabs.ffmpegsample;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class drawable {
14 | public static final int icon=0x7f020000;
15 | }
16 | public static final class id {
17 | public static final int frame=0x7f050000;
18 | public static final int frame_adv=0x7f050001;
19 | public static final int frame_back=0x7f050003;
20 | public static final int frame_fwd=0x7f050002;
21 | }
22 | public static final class layout {
23 | public static final int main=0x7f030000;
24 | }
25 | public static final class string {
26 | public static final int app_name=0x7f040001;
27 | public static final int hello=0x7f040000;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 |
5 | LOCAL_MODULE := ffmpegutils
6 | LOCAL_SRC_FILES := native.c
7 |
8 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
9 | LOCAL_LDLIBS := -L$(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-arm/usr/lib -L$(LOCAL_PATH) -lavformat -lavcodec -lavdevice -lavfilter -lavcore -lavutil -lswscale -llog -ljnigraphics -lz -ldl -lgcc
10 |
11 | include $(BUILD_SHARED_LIBRARY)
12 |
--------------------------------------------------------------------------------
/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 | typedef float FFTSample;
23 |
24 | typedef struct FFTComplex {
25 | FFTSample re, im;
26 | } FFTComplex;
27 |
28 | typedef struct FFTContext FFTContext;
29 |
30 | /**
31 | * Set up a complex FFT.
32 | * @param nbits log2 of the length of the input array
33 | * @param inverse if 0 perform the forward transform, if 1 perform the inverse
34 | */
35 | FFTContext *av_fft_init(int nbits, int inverse);
36 |
37 | /**
38 | * Do the permutation needed BEFORE calling ff_fft_calc().
39 | */
40 | void av_fft_permute(FFTContext *s, FFTComplex *z);
41 |
42 | /**
43 | * Do a complex FFT with the parameters defined in av_fft_init(). The
44 | * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
45 | */
46 | void av_fft_calc(FFTContext *s, FFTComplex *z);
47 |
48 | void av_fft_end(FFTContext *s);
49 |
50 | FFTContext *av_mdct_init(int nbits, int inverse, double scale);
51 | void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
52 | void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
53 | void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
54 | void av_mdct_end(FFTContext *s);
55 |
56 | /* Real Discrete Fourier Transform */
57 |
58 | enum RDFTransformType {
59 | DFT_R2C,
60 | IDFT_C2R,
61 | IDFT_R2C,
62 | DFT_C2R,
63 | };
64 |
65 | typedef struct RDFTContext RDFTContext;
66 |
67 | /**
68 | * Set up a real FFT.
69 | * @param nbits log2 of the length of the input array
70 | * @param trans the type of transform
71 | */
72 | RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
73 | void av_rdft_calc(RDFTContext *s, FFTSample *data);
74 | void av_rdft_end(RDFTContext *s);
75 |
76 | /* Discrete Cosine Transform */
77 |
78 | typedef struct DCTContext DCTContext;
79 |
80 | enum DCTTransformType {
81 | DCT_II = 0,
82 | DCT_III,
83 | DCT_I,
84 | DST_I,
85 | };
86 |
87 | /**
88 | * Set up DCT.
89 | * @param nbits size of the input array:
90 | * (1 << nbits) for DCT-II, DCT-III and DST-I
91 | * (1 << nbits) + 1 for DCT-I
92 | *
93 | * @note the first element of the input of DST-I is ignored
94 | */
95 | DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
96 | void av_dct_calc(DCTContext *s, FFTSample *data);
97 | void av_dct_end (DCTContext *s);
98 |
99 | #endif /* AVCODEC_AVFFT_H */
100 |
--------------------------------------------------------------------------------
/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 | #include
27 |
28 | #include
29 |
30 | /**
31 | * This structure is used to provides the necessary configurations and data
32 | * to the DXVA2 FFmpeg HWAccel implementation.
33 | *
34 | * The application must make it available as AVCodecContext.hwaccel_context.
35 | */
36 | struct dxva_context {
37 | /**
38 | * DXVA2 decoder object
39 | */
40 | IDirectXVideoDecoder *decoder;
41 |
42 | /**
43 | * DXVA2 configuration used to create the decoder
44 | */
45 | const DXVA2_ConfigPictureDecode *cfg;
46 |
47 | /**
48 | * The number of surface in the surface array
49 | */
50 | unsigned surface_count;
51 |
52 | /**
53 | * The array of Direct3D surfaces used to create the decoder
54 | */
55 | LPDIRECT3DSURFACE9 *surface;
56 |
57 | /**
58 | * A bit field configuring the workarounds needed for using the decoder
59 | */
60 | uint64_t workaround;
61 |
62 | /**
63 | * Private to the FFmpeg AVHWAccel implementation
64 | */
65 | unsigned report_id;
66 | };
67 |
68 | #endif /* AVCODEC_DXVA_H */
69 |
--------------------------------------------------------------------------------
/jni/include/libavcodec/opt.h:
--------------------------------------------------------------------------------
1 | /*
2 | * AVOptions
3 | * copyright (c) 2005 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 AVCODEC_OPT_H
23 | #define AVCODEC_OPT_H
24 |
25 | /**
26 | * @file
27 | * AVOptions
28 | */
29 |
30 | #include "libavutil/rational.h"
31 | #include "avcodec.h"
32 | #include "libavutil/opt.h"
33 |
34 | #if FF_API_SET_STRING_OLD
35 | /**
36 | * @see av_set_string2()
37 | */
38 | attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val);
39 |
40 | /**
41 | * @return a pointer to the AVOption corresponding to the field set or
42 | * NULL if no matching AVOption exists, or if the value val is not
43 | * valid
44 | * @see av_set_string3()
45 | */
46 | attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc);
47 | #endif
48 | #if FF_API_OPT_SHOW
49 | /**
50 | * @deprecated Use av_opt_show2() instead.
51 | */
52 | attribute_deprecated int av_opt_show(void *obj, void *av_log_obj);
53 | #endif
54 |
55 | #endif /* AVCODEC_OPT_H */
56 |
--------------------------------------------------------------------------------
/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 | #include
28 |
29 | /**
30 | * \defgroup VAAPI_Decoding VA API Decoding
31 | * \ingroup Decoder
32 | * @{
33 | */
34 |
35 | /**
36 | * This structure is used to share data between the FFmpeg library and
37 | * the client video application.
38 | * This shall be zero-allocated and available as
39 | * AVCodecContext.hwaccel_context. All user members can be set once
40 | * during initialization or through each AVCodecContext.get_buffer()
41 | * function call. In any case, they must be valid prior to calling
42 | * decoding functions.
43 | */
44 | struct vaapi_context {
45 | /**
46 | * Window system dependent data
47 | *
48 | * - encoding: unused
49 | * - decoding: Set by user
50 | */
51 | void *display;
52 |
53 | /**
54 | * Configuration ID
55 | *
56 | * - encoding: unused
57 | * - decoding: Set by user
58 | */
59 | uint32_t config_id;
60 |
61 | /**
62 | * Context ID (video decode pipeline)
63 | *
64 | * - encoding: unused
65 | * - decoding: Set by user
66 | */
67 | uint32_t context_id;
68 |
69 | /**
70 | * VAPictureParameterBuffer ID
71 | *
72 | * - encoding: unused
73 | * - decoding: Set by libavcodec
74 | */
75 | uint32_t pic_param_buf_id;
76 |
77 | /**
78 | * VAIQMatrixBuffer ID
79 | *
80 | * - encoding: unused
81 | * - decoding: Set by libavcodec
82 | */
83 | uint32_t iq_matrix_buf_id;
84 |
85 | /**
86 | * VABitPlaneBuffer ID (for VC-1 decoding)
87 | *
88 | * - encoding: unused
89 | * - decoding: Set by libavcodec
90 | */
91 | uint32_t bitplane_buf_id;
92 |
93 | /**
94 | * Slice parameter/data buffer IDs
95 | *
96 | * - encoding: unused
97 | * - decoding: Set by libavcodec
98 | */
99 | uint32_t *slice_buf_ids;
100 |
101 | /**
102 | * Number of effective slice buffer IDs to send to the HW
103 | *
104 | * - encoding: unused
105 | * - decoding: Set by libavcodec
106 | */
107 | unsigned int n_slice_buf_ids;
108 |
109 | /**
110 | * Size of pre-allocated slice_buf_ids
111 | *
112 | * - encoding: unused
113 | * - decoding: Set by libavcodec
114 | */
115 | unsigned int slice_buf_ids_alloc;
116 |
117 | /**
118 | * Pointer to VASliceParameterBuffers
119 | *
120 | * - encoding: unused
121 | * - decoding: Set by libavcodec
122 | */
123 | void *slice_params;
124 |
125 | /**
126 | * Size of a VASliceParameterBuffer element
127 | *
128 | * - encoding: unused
129 | * - decoding: Set by libavcodec
130 | */
131 | unsigned int slice_param_size;
132 |
133 | /**
134 | * Size of pre-allocated slice_params
135 | *
136 | * - encoding: unused
137 | * - decoding: Set by libavcodec
138 | */
139 | unsigned int slice_params_alloc;
140 |
141 | /**
142 | * Number of slices currently filled in
143 | *
144 | * - encoding: unused
145 | * - decoding: Set by libavcodec
146 | */
147 | unsigned int slice_count;
148 |
149 | /**
150 | * Pointer to slice data buffer base
151 | * - encoding: unused
152 | * - decoding: Set by libavcodec
153 | */
154 | const uint8_t *slice_data;
155 |
156 | /**
157 | * Current size of slice data
158 | *
159 | * - encoding: unused
160 | * - decoding: Set by libavcodec
161 | */
162 | uint32_t slice_data_size;
163 | };
164 |
165 | /* @} */
166 |
167 | #endif /* AVCODEC_VAAPI_H */
168 |
--------------------------------------------------------------------------------
/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 | * \defgroup Decoder VDPAU Decoder and Renderer
29 | *
30 | * VDPAU hardware acceleration has two modules
31 | * - VDPAU decoding
32 | * - VDPAU presentation
33 | *
34 | * The VDPAU decoding module parses all headers using FFmpeg
35 | * parsing mechanisms and uses VDPAU for the actual decoding.
36 | *
37 | * As per the current implementation, the actual decoding
38 | * and rendering (API calls) are done as part of the VDPAU
39 | * presentation (vo_vdpau.c) module.
40 | *
41 | * \defgroup VDPAU_Decoding VDPAU Decoding
42 | * \ingroup Decoder
43 | * @{
44 | */
45 |
46 | #include
47 | #include
48 |
49 | /** \brief The videoSurface is used for rendering. */
50 | #define FF_VDPAU_STATE_USED_FOR_RENDER 1
51 |
52 | /**
53 | * \brief The videoSurface is needed for reference/prediction.
54 | * The codec manipulates this.
55 | */
56 | #define FF_VDPAU_STATE_USED_FOR_REFERENCE 2
57 |
58 | /**
59 | * \brief This structure is used as a callback between the FFmpeg
60 | * decoder (vd_) and presentation (vo_) module.
61 | * This is used for defining a video frame containing surface,
62 | * picture parameter, bitstream information etc which are passed
63 | * between the FFmpeg decoder and its clients.
64 | */
65 | struct vdpau_render_state {
66 | VdpVideoSurface surface; ///< Used as rendered surface, never changed.
67 |
68 | int state; ///< Holds FF_VDPAU_STATE_* values.
69 |
70 | /** picture parameter information for all supported codecs */
71 | union VdpPictureInfo {
72 | VdpPictureInfoH264 h264;
73 | VdpPictureInfoMPEG1Or2 mpeg;
74 | VdpPictureInfoVC1 vc1;
75 | VdpPictureInfoMPEG4Part2 mpeg4;
76 | } info;
77 |
78 | /** Describe size/location of the compressed video data.
79 | Set to 0 when freeing bitstream_buffers. */
80 | int bitstream_buffers_allocated;
81 | int bitstream_buffers_used;
82 | /** The user is responsible for freeing this buffer using av_freep(). */
83 | VdpBitstreamBuffer *bitstream_buffers;
84 | };
85 |
86 | /* @}*/
87 |
88 | #endif /* AVCODEC_VDPAU_H */
89 |
--------------------------------------------------------------------------------
/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 | #include
25 |
26 | #include "avcodec.h"
27 |
28 | #if LIBAVCODEC_VERSION_MAJOR < 53
29 | #define AV_XVMC_STATE_DISPLAY_PENDING 1 /** the surface should be shown, the video driver manipulates this */
30 | #define AV_XVMC_STATE_PREDICTION 2 /** the surface is needed for prediction, the codec manipulates this */
31 | #define AV_XVMC_STATE_OSD_SOURCE 4 /** the surface is needed for subpicture rendering */
32 | #endif
33 | #define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct
34 | the number is 1337 speak for the letters IDCT MCo (motion compensation) */
35 |
36 | struct xvmc_pix_fmt {
37 | /** The field contains the special constant value AV_XVMC_ID.
38 | It is used as a test that the application correctly uses the API,
39 | and that there is no corruption caused by pixel routines.
40 | - application - set during initialization
41 | - libavcodec - unchanged
42 | */
43 | int xvmc_id;
44 |
45 | /** Pointer to the block array allocated by XvMCCreateBlocks().
46 | The array has to be freed by XvMCDestroyBlocks().
47 | Each group of 64 values represents one data block of differential
48 | pixel information (in MoCo mode) or coefficients for IDCT.
49 | - application - set the pointer during initialization
50 | - libavcodec - fills coefficients/pixel data into the array
51 | */
52 | short* data_blocks;
53 |
54 | /** Pointer to the macroblock description array allocated by
55 | XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks().
56 | - application - set the pointer during initialization
57 | - libavcodec - fills description data into the array
58 | */
59 | XvMCMacroBlock* mv_blocks;
60 |
61 | /** Number of macroblock descriptions that can be stored in the mv_blocks
62 | array.
63 | - application - set during initialization
64 | - libavcodec - unchanged
65 | */
66 | int allocated_mv_blocks;
67 |
68 | /** Number of blocks that can be stored at once in the data_blocks array.
69 | - application - set during initialization
70 | - libavcodec - unchanged
71 | */
72 | int allocated_data_blocks;
73 |
74 | /** Indicate that the hardware would interpret data_blocks as IDCT
75 | coefficients and perform IDCT on them.
76 | - application - set during initialization
77 | - libavcodec - unchanged
78 | */
79 | int idct;
80 |
81 | /** In MoCo mode it indicates that intra macroblocks are assumed to be in
82 | unsigned format; same as the XVMC_INTRA_UNSIGNED flag.
83 | - application - set during initialization
84 | - libavcodec - unchanged
85 | */
86 | int unsigned_intra;
87 |
88 | /** Pointer to the surface allocated by XvMCCreateSurface().
89 | It has to be freed by XvMCDestroySurface() on application exit.
90 | It identifies the frame and its state on the video hardware.
91 | - application - set during initialization
92 | - libavcodec - unchanged
93 | */
94 | XvMCSurface* p_surface;
95 |
96 | /** Set by the decoder before calling ff_draw_horiz_band(),
97 | needed by the XvMCRenderSurface function. */
98 | //@{
99 | /** Pointer to the surface used as past reference
100 | - application - unchanged
101 | - libavcodec - set
102 | */
103 | XvMCSurface* p_past_surface;
104 |
105 | /** Pointer to the surface used as future reference
106 | - application - unchanged
107 | - libavcodec - set
108 | */
109 | XvMCSurface* p_future_surface;
110 |
111 | /** top/bottom field or frame
112 | - application - unchanged
113 | - libavcodec - set
114 | */
115 | unsigned int picture_structure;
116 |
117 | /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence
118 | - application - unchanged
119 | - libavcodec - set
120 | */
121 | unsigned int flags;
122 | //}@
123 |
124 | /** Number of macroblock descriptions in the mv_blocks array
125 | that have already been passed to the hardware.
126 | - application - zeroes it on get_buffer().
127 | A successful ff_draw_horiz_band() may increment it
128 | with filled_mb_block_num or zero both.
129 | - libavcodec - unchanged
130 | */
131 | int start_mv_blocks_num;
132 |
133 | /** Number of new macroblock descriptions in the mv_blocks array (after
134 | start_mv_blocks_num) that are filled by libavcodec and have to be
135 | passed to the hardware.
136 | - application - zeroes it on get_buffer() or after successful
137 | ff_draw_horiz_band().
138 | - libavcodec - increment with one of each stored MB
139 | */
140 | int filled_mv_blocks_num;
141 |
142 | /** Number of the the next free data block; one data block consists of
143 | 64 short values in the data_blocks array.
144 | All blocks before this one have already been claimed by placing their
145 | position into the corresponding block description structure field,
146 | that are part of the mv_blocks array.
147 | - application - zeroes it on get_buffer().
148 | A successful ff_draw_horiz_band() may zero it together
149 | with start_mb_blocks_num.
150 | - libavcodec - each decoded macroblock increases it by the number
151 | of coded blocks it contains.
152 | */
153 | int next_free_data_block_num;
154 |
155 | /** extensions may be placed here */
156 | #if LIBAVCODEC_VERSION_MAJOR < 53
157 | //@{
158 | /** State flags used to work around limitations in the MPlayer video system.
159 | 0 - Surface is not used.
160 | 1 - Surface is still held in application to be displayed or is
161 | still visible.
162 | 2 - Surface is still held in libavcodec buffer for prediction.
163 | */
164 | int state;
165 |
166 | /** pointer to the surface where the subpicture is rendered */
167 | void* p_osd_target_surface_render;
168 | //}@
169 | #endif
170 | };
171 |
172 | #endif /* AVCODEC_XVMC_H */
173 |
--------------------------------------------------------------------------------
/jni/include/libavcore/audioconvert.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006 Michael Niedermayer
3 | * Copyright (c) 2008 Peter Ross
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 AVCORE_AUDIOCONVERT_H
23 | #define AVCORE_AUDIOCONVERT_H
24 |
25 | /**
26 | * @file
27 | * audio conversion routines
28 | */
29 |
30 | #include "avcore.h"
31 |
32 | /* Audio channel masks */
33 | #define AV_CH_FRONT_LEFT 0x00000001
34 | #define AV_CH_FRONT_RIGHT 0x00000002
35 | #define AV_CH_FRONT_CENTER 0x00000004
36 | #define AV_CH_LOW_FREQUENCY 0x00000008
37 | #define AV_CH_BACK_LEFT 0x00000010
38 | #define AV_CH_BACK_RIGHT 0x00000020
39 | #define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040
40 | #define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080
41 | #define AV_CH_BACK_CENTER 0x00000100
42 | #define AV_CH_SIDE_LEFT 0x00000200
43 | #define AV_CH_SIDE_RIGHT 0x00000400
44 | #define AV_CH_TOP_CENTER 0x00000800
45 | #define AV_CH_TOP_FRONT_LEFT 0x00001000
46 | #define AV_CH_TOP_FRONT_CENTER 0x00002000
47 | #define AV_CH_TOP_FRONT_RIGHT 0x00004000
48 | #define AV_CH_TOP_BACK_LEFT 0x00008000
49 | #define AV_CH_TOP_BACK_CENTER 0x00010000
50 | #define AV_CH_TOP_BACK_RIGHT 0x00020000
51 | #define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
52 | #define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT.
53 |
54 | /** Channel mask value used for AVCodecContext.request_channel_layout
55 | to indicate that the user requests the channel order of the decoder output
56 | to be the native codec channel order. */
57 | #define AV_CH_LAYOUT_NATIVE 0x8000000000000000LL
58 |
59 | /* Audio channel convenience macros */
60 | #define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER)
61 | #define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
62 | #define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
63 | #define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
64 | #define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
65 | #define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
66 | #define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
67 | #define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
68 | #define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
69 | #define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
70 | #define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
71 | #define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
72 | #define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
73 | #define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
74 | #define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
75 |
76 | /**
77 | * Return a channel layout id that matches name, 0 if no match.
78 | */
79 | int64_t av_get_channel_layout(const char *name);
80 |
81 | /**
82 | * Return a description of a channel layout.
83 | *
84 | * @param buf put here the string containing the channel layout
85 | * @param buf_size size in bytes of the buffer
86 | */
87 | void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout);
88 |
89 | /**
90 | * Return the number of channels in the channel layout.
91 | */
92 | int av_get_channel_layout_nb_channels(int64_t channel_layout);
93 |
94 | #endif /* AVCORE_AUDIOCONVERT_H */
95 |
--------------------------------------------------------------------------------
/jni/include/libavcore/avcore.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 AVCORE_AVCORE_H
20 | #define AVCORE_AVCORE_H
21 |
22 | /**
23 | * @file
24 | * shared media utilities for the libav* libraries
25 | */
26 |
27 | #include "libavutil/avutil.h"
28 |
29 | #define LIBAVCORE_VERSION_MAJOR 0
30 | #define LIBAVCORE_VERSION_MINOR 16
31 | #define LIBAVCORE_VERSION_MICRO 0
32 |
33 | #define LIBAVCORE_VERSION_INT AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \
34 | LIBAVCORE_VERSION_MINOR, \
35 | LIBAVCORE_VERSION_MICRO)
36 | #define LIBAVCORE_VERSION AV_VERSION(LIBAVCORE_VERSION_MAJOR, \
37 | LIBAVCORE_VERSION_MINOR, \
38 | LIBAVCORE_VERSION_MICRO)
39 | #define LIBAVCORE_BUILD LIBAVCORE_VERSION_INT
40 |
41 | #define LIBAVCORE_IDENT "Lavcore" AV_STRINGIFY(LIBAVCORE_VERSION)
42 |
43 | /**
44 | * Return the LIBAVCORE_VERSION_INT constant.
45 | */
46 | unsigned avcore_version(void);
47 |
48 | /**
49 | * Return the libavcore build-time configuration.
50 | */
51 | const char *avcore_configuration(void);
52 |
53 | /**
54 | * Return the libavcore license.
55 | */
56 | const char *avcore_license(void);
57 |
58 | #define AV_NOPTS_VALUE INT64_C(0x8000000000000000)
59 | #define AV_TIME_BASE 1000000
60 | #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
61 |
62 | /**
63 | * Those FF_API_* defines are not part of public API.
64 | * They may change, break or disappear at any time.
65 | */
66 | #ifndef FF_API_OLD_IMAGE_NAMES
67 | #define FF_API_OLD_IMAGE_NAMES (LIBAVCORE_VERSION_MAJOR < 1)
68 | #endif
69 |
70 | #endif /* AVCORE_AVCORE_H */
71 |
--------------------------------------------------------------------------------
/jni/include/libavcore/imgutils.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 AVCORE_IMGUTILS_H
20 | #define AVCORE_IMGUTILS_H
21 |
22 | /**
23 | * @file
24 | * misc image utilities
25 | */
26 |
27 | #include "libavutil/pixdesc.h"
28 | #include "avcore.h"
29 |
30 | /**
31 | * Compute the max pixel step for each plane of an image with a
32 | * format described by pixdesc.
33 | *
34 | * The pixel step is the distance in bytes between the first byte of
35 | * the group of bytes which describe a pixel component and the first
36 | * byte of the successive group in the same plane for the same
37 | * component.
38 | *
39 | * @param max_pixsteps an array which is filled with the max pixel step
40 | * for each plane. Since a plane may contain different pixel
41 | * components, the computed max_pixsteps[plane] is relative to the
42 | * component in the plane with the max pixel step.
43 | * @param max_pixstep_comps an array which is filled with the component
44 | * for each plane which has the max pixel step. May be NULL.
45 | */
46 | void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
47 | const AVPixFmtDescriptor *pixdesc);
48 |
49 | /**
50 | * Compute the size of an image line with format pix_fmt and width
51 | * width for the plane plane.
52 | *
53 | * @return the computed size in bytes
54 | */
55 | int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane);
56 |
57 | /**
58 | * Fill plane linesizes for an image with pixel format pix_fmt and
59 | * width width.
60 | *
61 | * @param linesizes array to be filled with the linesize for each plane
62 | * @return >= 0 in case of success, a negative error code otherwise
63 | */
64 | int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
65 |
66 | /**
67 | * Fill plane data pointers for an image with pixel format pix_fmt and
68 | * height height.
69 | *
70 | * @param data pointers array to be filled with the pointer for each image plane
71 | * @param ptr the pointer to a buffer which will contain the image
72 | * @param linesizes[4] the array containing the linesize for each
73 | * plane, should be filled by av_image_fill_linesizes()
74 | * @return the size in bytes required for the image buffer, a negative
75 | * error code in case of failure
76 | */
77 | int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
78 | uint8_t *ptr, const int linesizes[4]);
79 |
80 | /**
81 | * Allocate an image with size w and h and pixel format pix_fmt, and
82 | * fill pointers and linesizes accordingly.
83 | * The allocated image buffer has to be freed by using
84 | * av_freep(&pointers[0]).
85 | *
86 | * @param align the value to use for buffer size alignment
87 | * @return the size in bytes required for the image buffer, a negative
88 | * error code in case of failure
89 | */
90 | int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
91 | int w, int h, enum PixelFormat pix_fmt, int align);
92 |
93 | /**
94 | * Copy image plane from src to dst.
95 | * That is, copy "height" number of lines of "bytewidth" bytes each.
96 | * The first byte of each successive line is separated by *_linesize
97 | * bytes.
98 | *
99 | * @param dst_linesize linesize for the image plane in dst
100 | * @param src_linesize linesize for the image plane in src
101 | */
102 | void av_image_copy_plane(uint8_t *dst, int dst_linesize,
103 | const uint8_t *src, int src_linesize,
104 | int bytewidth, int height);
105 |
106 | /**
107 | * Copy image in src_data to dst_data.
108 | *
109 | * @param dst_linesize linesizes for the image in dst_data
110 | * @param src_linesize linesizes for the image in src_data
111 | */
112 | void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
113 | const uint8_t *src_data[4], const int src_linesizes[4],
114 | enum PixelFormat pix_fmt, int width, int height);
115 |
116 | /**
117 | * Check if the given dimension of an image is valid, meaning that all
118 | * bytes of the image can be addressed with a signed int.
119 | *
120 | * @param w the width of the picture
121 | * @param h the height of the picture
122 | * @param log_offset the offset to sum to the log level for logging with log_ctx
123 | * @param log_ctx the parent logging context, it may be NULL
124 | * @return >= 0 if valid, a negative error code otherwise
125 | */
126 | int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
127 |
128 | #if FF_API_OLD_IMAGE_NAMES
129 | attribute_deprecated
130 | void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
131 | const AVPixFmtDescriptor *pixdesc);
132 |
133 | attribute_deprecated
134 | int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane);
135 |
136 | attribute_deprecated
137 | int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
138 |
139 | attribute_deprecated
140 | int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
141 | uint8_t *ptr, const int linesizes[4]);
142 |
143 | attribute_deprecated
144 | int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
145 | #endif
146 |
147 | #endif /* AVCORE_IMGUTILS_H */
148 |
--------------------------------------------------------------------------------
/jni/include/libavcore/parseutils.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 AVCORE_PARSEUTILS_H
20 | #define AVCORE_PARSEUTILS_H
21 |
22 | #include "libavutil/rational.h"
23 |
24 | /**
25 | * @file
26 | * misc parsing utilities for libavcore
27 | */
28 |
29 | /**
30 | * Parse str and put in width_ptr and height_ptr the detected values.
31 | *
32 | * @param[in,out] width_ptr pointer to the variable which will contain the detected
33 | * width value
34 | * @param[in,out] height_ptr pointer to the variable which will contain the detected
35 | * height value
36 | * @param[in] str the string to parse: it has to be a string in the format
37 | * width x height or a valid video size abbreviation.
38 | * @return >= 0 on success, a negative error code otherwise
39 | */
40 | int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str);
41 |
42 | /**
43 | * Parse str and store the detected values in *rate.
44 | *
45 | * @param[in,out] rate pointer to the AVRational which will contain the detected
46 | * frame rate
47 | * @param[in] str the string to parse: it has to be a string in the format
48 | * rate_num / rate_den, a float number or a valid video rate abbreviation
49 | * @return >= 0 on success, a negative error code otherwise
50 | */
51 | int av_parse_video_rate(AVRational *rate, const char *str);
52 |
53 | /**
54 | * Put the RGBA values that correspond to color_string in rgba_color.
55 | *
56 | * @param color_string a string specifying a color. It can be the name of
57 | * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence,
58 | * possibly followed by "@" and a string representing the alpha
59 | * component.
60 | * The alpha component may be a string composed by "0x" followed by an
61 | * hexadecimal number or a decimal number between 0.0 and 1.0, which
62 | * represents the opacity value (0x00/0.0 means completely transparent,
63 | * 0xff/1.0 completely opaque).
64 | * If the alpha component is not specified then 0xff is assumed.
65 | * The string "random" will result in a random color.
66 | * @param slen length of the initial part of color_string containing the
67 | * color. It can be set to -1 if color_string is a null terminated string
68 | * containing nothing else than the color.
69 | * @return >= 0 in case of success, a negative value in case of
70 | * failure (for example if color_string cannot be parsed).
71 | */
72 | int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
73 | void *log_ctx);
74 |
75 | #endif /* AVCORE_PARSEUTILS_H */
76 |
--------------------------------------------------------------------------------
/jni/include/libavcore/samplefmt.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 AVCORE_SAMPLEFMT_H
20 | #define AVCORE_SAMPLEFMT_H
21 |
22 | /**
23 | * all in native-endian format
24 | */
25 | enum AVSampleFormat {
26 | AV_SAMPLE_FMT_NONE = -1,
27 | AV_SAMPLE_FMT_U8, ///< unsigned 8 bits
28 | AV_SAMPLE_FMT_S16, ///< signed 16 bits
29 | AV_SAMPLE_FMT_S32, ///< signed 32 bits
30 | AV_SAMPLE_FMT_FLT, ///< float
31 | AV_SAMPLE_FMT_DBL, ///< double
32 | AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcore
33 | };
34 |
35 | /**
36 | * Return the name of sample_fmt, or NULL if sample_fmt is not
37 | * recognized.
38 | */
39 | const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
40 |
41 | /**
42 | * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE
43 | * on error.
44 | */
45 | enum AVSampleFormat av_get_sample_fmt(const char *name);
46 |
47 | /**
48 | * Generate a string corresponding to the sample format with
49 | * sample_fmt, or a header if sample_fmt is negative.
50 | *
51 | * @param buf the buffer where to write the string
52 | * @param buf_size the size of buf
53 | * @param sample_fmt the number of the sample format to print the
54 | * corresponding info string, or a negative value to print the
55 | * corresponding header.
56 | * @return the pointer to the filled buffer or NULL if sample_fmt is
57 | * unknown or in case of other errors
58 | */
59 | char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
60 |
61 | /**
62 | * Return sample format bits per sample.
63 | *
64 | * @param sample_fmt the sample format
65 | * @return number of bits per sample or zero if unknown for the given
66 | * sample format
67 | */
68 | int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt);
69 |
70 | #endif /* AVCORE_SAMPLEFMT_H */
71 |
--------------------------------------------------------------------------------
/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 "libavutil/avutil.h"
23 |
24 | #define LIBAVDEVICE_VERSION_MAJOR 52
25 | #define LIBAVDEVICE_VERSION_MINOR 2
26 | #define LIBAVDEVICE_VERSION_MICRO 2
27 |
28 | #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
29 | LIBAVDEVICE_VERSION_MINOR, \
30 | LIBAVDEVICE_VERSION_MICRO)
31 | #define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \
32 | LIBAVDEVICE_VERSION_MINOR, \
33 | LIBAVDEVICE_VERSION_MICRO)
34 | #define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT
35 |
36 | /**
37 | * Return the LIBAVDEVICE_VERSION_INT constant.
38 | */
39 | unsigned avdevice_version(void);
40 |
41 | /**
42 | * Return the libavdevice build-time configuration.
43 | */
44 | const char *avdevice_configuration(void);
45 |
46 | /**
47 | * Return the libavdevice license.
48 | */
49 | const char *avdevice_license(void);
50 |
51 | /**
52 | * Initialize libavdevice and register all the input and output devices.
53 | * @warning This function is not thread safe.
54 | */
55 | void avdevice_register_all(void);
56 |
57 | #endif /* AVDEVICE_AVDEVICE_H */
58 |
59 |
--------------------------------------------------------------------------------
/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 |
27 | typedef struct AVFilterGraph {
28 | unsigned filter_count;
29 | AVFilterContext **filters;
30 |
31 | char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters
32 | } AVFilterGraph;
33 |
34 | /**
35 | * Allocate a filter graph.
36 | */
37 | AVFilterGraph *avfilter_graph_alloc(void);
38 |
39 | /**
40 | * Get a filter instance with name name from graph.
41 | *
42 | * @return the pointer to the found filter instance or NULL if it
43 | * cannot be found.
44 | */
45 | AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name);
46 |
47 | /**
48 | * Add an existing filter instance to a filter graph.
49 | *
50 | * @param graphctx the filter graph
51 | * @param filter the filter to be added
52 | */
53 | int avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter);
54 |
55 | /**
56 | * Create and add a filter instance into an existing graph.
57 | * The filter instance is created from the filter filt and inited
58 | * with the parameters args and opaque.
59 | *
60 | * In case of success put in *filt_ctx the pointer to the created
61 | * filter instance, otherwise set *filt_ctx to NULL.
62 | *
63 | * @param name the instance name to give to the created filter instance
64 | * @param graph_ctx the filter graph
65 | * @return a negative AVERROR error code in case of failure, a non
66 | * negative value otherwise
67 | */
68 | int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt,
69 | const char *name, const char *args, void *opaque,
70 | AVFilterGraph *graph_ctx);
71 |
72 | /**
73 | * Check validity and configure all the links and formats in the graph.
74 | *
75 | * @param graphctx the filter graph
76 | * @param log_ctx context used for logging
77 | * @return 0 in case of success, a negative AVERROR code otherwise
78 | */
79 | int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx);
80 |
81 | /**
82 | * Free a graph and destroy its links.
83 | */
84 | void avfilter_graph_free(AVFilterGraph *graph);
85 |
86 | /**
87 | * A linked-list of the inputs/outputs of the filter chain.
88 | *
89 | * This is mainly useful for avfilter_graph_parse(), since this
90 | * function may accept a description of a graph with not connected
91 | * input/output pads. This struct specifies, per each not connected
92 | * pad contained in the graph, the filter context and the pad index
93 | * required for establishing a link.
94 | */
95 | typedef struct AVFilterInOut {
96 | /** unique name for this input/output in the list */
97 | char *name;
98 |
99 | /** filter context associated to this input/output */
100 | AVFilterContext *filter_ctx;
101 |
102 | /** index of the filt_ctx pad to use for linking */
103 | int pad_idx;
104 |
105 | /** next input/input in the list, NULL if this is the last */
106 | struct AVFilterInOut *next;
107 | } AVFilterInOut;
108 |
109 | /**
110 | * Add a graph described by a string to a graph.
111 | *
112 | * @param graph the filter graph where to link the parsed graph context
113 | * @param filters string to be parsed
114 | * @param inputs linked list to the inputs of the graph
115 | * @param outputs linked list to the outputs of the graph
116 | * @return zero on success, a negative AVERROR code on error
117 | */
118 | int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
119 | AVFilterInOut *inputs, AVFilterInOut *outputs,
120 | AVClass *log_ctx);
121 |
122 | #endif /* AVFILTER_AVFILTERGRAPH_H */
123 |
--------------------------------------------------------------------------------
/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 | * Calculate the Adler32 checksum of a buffer.
29 | *
30 | * Passing the return value to a subsequent av_adler32_update() call
31 | * allows the checksum of multiple buffers to be calculated as though
32 | * they were concatenated.
33 | *
34 | * @param adler initial checksum value
35 | * @param buf pointer to input buffer
36 | * @param len size of input buffer
37 | * @return updated checksum
38 | */
39 | unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf,
40 | unsigned int len) av_pure;
41 |
42 | #endif /* AVUTIL_ADLER32_H */
43 |
--------------------------------------------------------------------------------
/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 | #else
39 | # define av_always_inline inline
40 | #endif
41 | #endif
42 |
43 | #ifndef av_noinline
44 | #if AV_GCC_VERSION_AT_LEAST(3,1)
45 | # define av_noinline __attribute__((noinline))
46 | #else
47 | # define av_noinline
48 | #endif
49 | #endif
50 |
51 | #ifndef av_pure
52 | #if AV_GCC_VERSION_AT_LEAST(3,1)
53 | # define av_pure __attribute__((pure))
54 | #else
55 | # define av_pure
56 | #endif
57 | #endif
58 |
59 | #ifndef av_const
60 | #if AV_GCC_VERSION_AT_LEAST(2,6)
61 | # define av_const __attribute__((const))
62 | #else
63 | # define av_const
64 | #endif
65 | #endif
66 |
67 | #ifndef av_cold
68 | #if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3)
69 | # define av_cold __attribute__((cold))
70 | #else
71 | # define av_cold
72 | #endif
73 | #endif
74 |
75 | #ifndef av_flatten
76 | #if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,1)
77 | # define av_flatten __attribute__((flatten))
78 | #else
79 | # define av_flatten
80 | #endif
81 | #endif
82 |
83 | #ifndef attribute_deprecated
84 | #if AV_GCC_VERSION_AT_LEAST(3,1)
85 | # define attribute_deprecated __attribute__((deprecated))
86 | #else
87 | # define attribute_deprecated
88 | #endif
89 | #endif
90 |
91 | #ifndef av_unused
92 | #if defined(__GNUC__)
93 | # define av_unused __attribute__((unused))
94 | #else
95 | # define av_unused
96 | #endif
97 | #endif
98 |
99 | #ifndef av_alias
100 | #if (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(3,3)
101 | # define av_alias __attribute__((may_alias))
102 | #else
103 | # define av_alias
104 | #endif
105 | #endif
106 |
107 | #ifndef av_uninit
108 | #if defined(__GNUC__) && !defined(__ICC)
109 | # define av_uninit(x) x=x
110 | #else
111 | # define av_uninit(x) x
112 | #endif
113 | #endif
114 |
115 | #ifdef __GNUC__
116 | # define av_builtin_constant_p __builtin_constant_p
117 | #else
118 | # define av_builtin_constant_p(x) 0
119 | #endif
120 |
121 | #endif /* AVUTIL_ATTRIBUTES_H */
122 |
--------------------------------------------------------------------------------
/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_FATAL, "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
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 | #endif /* AVUTIL_AVCONFIG_H */
7 |
--------------------------------------------------------------------------------
/jni/include/libavutil/avstring.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007 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_AVSTRING_H
22 | #define AVUTIL_AVSTRING_H
23 |
24 | #include
25 |
26 | /**
27 | * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to
28 | * the address of the first character in str after the prefix.
29 | *
30 | * @param str input string
31 | * @param pfx prefix to test
32 | * @param ptr updated if the prefix is matched inside str
33 | * @return non-zero if the prefix matches, zero otherwise
34 | */
35 | int av_strstart(const char *str, const char *pfx, const char **ptr);
36 |
37 | /**
38 | * Return non-zero if pfx is a prefix of str independent of case. If
39 | * it is, *ptr is set to the address of the first character in str
40 | * after the prefix.
41 | *
42 | * @param str input string
43 | * @param pfx prefix to test
44 | * @param ptr updated if the prefix is matched inside str
45 | * @return non-zero if the prefix matches, zero otherwise
46 | */
47 | int av_stristart(const char *str, const char *pfx, const char **ptr);
48 |
49 | /**
50 | * Locate the first case-independent occurrence in the string haystack
51 | * of the string needle. A zero-length string needle is considered to
52 | * match at the start of haystack.
53 | *
54 | * This function is a case-insensitive version of the standard strstr().
55 | *
56 | * @param haystack string to search in
57 | * @param needle string to search for
58 | * @return pointer to the located match within haystack
59 | * or a null pointer if no match
60 | */
61 | char *av_stristr(const char *haystack, const char *needle);
62 |
63 | /**
64 | * Copy the string src to dst, but no more than size - 1 bytes, and
65 | * null-terminate dst.
66 | *
67 | * This function is the same as BSD strlcpy().
68 | *
69 | * @param dst destination buffer
70 | * @param src source string
71 | * @param size size of destination buffer
72 | * @return the length of src
73 | *
74 | * WARNING: since the return value is the length of src, src absolutely
75 | * _must_ be a properly 0-terminated string, otherwise this will read beyond
76 | * the end of the buffer and possibly crash.
77 | */
78 | size_t av_strlcpy(char *dst, const char *src, size_t size);
79 |
80 | /**
81 | * Append the string src to the string dst, but to a total length of
82 | * no more than size - 1 bytes, and null-terminate dst.
83 | *
84 | * This function is similar to BSD strlcat(), but differs when
85 | * size <= strlen(dst).
86 | *
87 | * @param dst destination buffer
88 | * @param src source string
89 | * @param size size of destination buffer
90 | * @return the total length of src and dst
91 | *
92 | * WARNING: since the return value use the length of src and dst, these absolutely
93 | * _must_ be a properly 0-terminated strings, otherwise this will read beyond
94 | * the end of the buffer and possibly crash.
95 | */
96 | size_t av_strlcat(char *dst, const char *src, size_t size);
97 |
98 | /**
99 | * Append output to a string, according to a format. Never write out of
100 | * the destination buffer, and always put a terminating 0 within
101 | * the buffer.
102 | * @param dst destination buffer (string to which the output is
103 | * appended)
104 | * @param size total size of the destination buffer
105 | * @param fmt printf-compatible format string, specifying how the
106 | * following parameters are used
107 | * @return the length of the string that would have been generated
108 | * if enough space had been available
109 | */
110 | size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...);
111 |
112 | /**
113 | * Convert a number to a av_malloced string.
114 | */
115 | char *av_d2str(double d);
116 |
117 | /**
118 | * Unescape the given string until a non escaped terminating char,
119 | * and return the token corresponding to the unescaped string.
120 | *
121 | * The normal \ and ' escaping is supported. Leading and trailing
122 | * whitespaces are removed, unless they are escaped with '\' or are
123 | * enclosed between ''.
124 | *
125 | * @param buf the buffer to parse, buf will be updated to point to the
126 | * terminating char
127 | * @param term a 0-terminated list of terminating chars
128 | * @return the malloced unescaped string, which must be av_freed by
129 | * the user, NULL in case of allocation failure
130 | */
131 | char *av_get_token(const char **buf, const char *term);
132 |
133 | #endif /* AVUTIL_AVSTRING_H */
134 |
--------------------------------------------------------------------------------
/jni/include/libavutil/avutil.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_AVUTIL_H
22 | #define AVUTIL_AVUTIL_H
23 |
24 | /**
25 | * @file
26 | * external API header
27 | */
28 |
29 |
30 | #define AV_STRINGIFY(s) AV_TOSTRING(s)
31 | #define AV_TOSTRING(s) #s
32 |
33 | #define AV_GLUE(a, b) a ## b
34 | #define AV_JOIN(a, b) AV_GLUE(a, b)
35 |
36 | #define AV_PRAGMA(s) _Pragma(#s)
37 |
38 | #define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c)
39 | #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
40 | #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
41 |
42 | #define LIBAVUTIL_VERSION_MAJOR 50
43 | #define LIBAVUTIL_VERSION_MINOR 34
44 | #define LIBAVUTIL_VERSION_MICRO 0
45 |
46 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
47 | LIBAVUTIL_VERSION_MINOR, \
48 | LIBAVUTIL_VERSION_MICRO)
49 | #define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \
50 | LIBAVUTIL_VERSION_MINOR, \
51 | LIBAVUTIL_VERSION_MICRO)
52 | #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT
53 |
54 | #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
55 |
56 | /**
57 | * Those FF_API_* defines are not part of public API.
58 | * They may change, break or disappear at any time.
59 | */
60 | #ifndef FF_API_OLD_EVAL_NAMES
61 | #define FF_API_OLD_EVAL_NAMES (LIBAVUTIL_VERSION_MAJOR < 51)
62 | #endif
63 |
64 | /**
65 | * Return the LIBAVUTIL_VERSION_INT constant.
66 | */
67 | unsigned avutil_version(void);
68 |
69 | /**
70 | * Return the libavutil build-time configuration.
71 | */
72 | const char *avutil_configuration(void);
73 |
74 | /**
75 | * Return the libavutil license.
76 | */
77 | const char *avutil_license(void);
78 |
79 | enum AVMediaType {
80 | AVMEDIA_TYPE_UNKNOWN = -1,
81 | AVMEDIA_TYPE_VIDEO,
82 | AVMEDIA_TYPE_AUDIO,
83 | AVMEDIA_TYPE_DATA,
84 | AVMEDIA_TYPE_SUBTITLE,
85 | AVMEDIA_TYPE_ATTACHMENT,
86 | AVMEDIA_TYPE_NB
87 | };
88 |
89 | #define FF_LAMBDA_SHIFT 7
90 | #define FF_LAMBDA_SCALE (1<
25 |
26 | /**
27 | * Decode a base64-encoded string.
28 | *
29 | * @param out buffer for decoded data
30 | * @param in null-terminated input string
31 | * @param out_size size in bytes of the out buffer, must be at
32 | * least 3/4 of the length of in
33 | * @return number of bytes written, or a negative value in case of
34 | * invalid input
35 | */
36 | int av_base64_decode(uint8_t *out, const char *in, int out_size);
37 |
38 | /**
39 | * Encode data to base64 and null-terminate.
40 | *
41 | * @param out buffer for encoded data
42 | * @param out_size size in bytes of the output buffer, must be at
43 | * least AV_BASE64_SIZE(in_size)
44 | * @param in_size size in bytes of the 'in' buffer
45 | * @return 'out' or NULL in case of error
46 | */
47 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
48 |
49 | /**
50 | * Calculate the output size needed to base64-encode x bytes.
51 | */
52 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1)
53 |
54 | #endif /* AVUTIL_BASE64_H */
55 |
--------------------------------------------------------------------------------
/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 | x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
69 | x= (x>>16) | (x<<16);
70 | return x;
71 | }
72 | #endif
73 |
74 | #ifndef av_bswap64
75 | static inline uint64_t av_const av_bswap64(uint64_t x)
76 | {
77 | #if 0
78 | x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL);
79 | x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL);
80 | return (x>>32) | (x<<32);
81 | #else
82 | union {
83 | uint64_t ll;
84 | uint32_t l[2];
85 | } w, r;
86 | w.ll = x;
87 | r.l[0] = av_bswap32 (w.l[1]);
88 | r.l[1] = av_bswap32 (w.l[0]);
89 | return r.ll;
90 | #endif
91 | }
92 | #endif
93 |
94 | // be2ne ... big-endian to native-endian
95 | // le2ne ... little-endian to native-endian
96 |
97 | #if AV_HAVE_BIGENDIAN
98 | #define av_be2ne16(x) (x)
99 | #define av_be2ne32(x) (x)
100 | #define av_be2ne64(x) (x)
101 | #define av_le2ne16(x) av_bswap16(x)
102 | #define av_le2ne32(x) av_bswap32(x)
103 | #define av_le2ne64(x) av_bswap64(x)
104 | #define AV_BE2NEC(s, x) (x)
105 | #define AV_LE2NEC(s, x) AV_BSWAPC(s, x)
106 | #else
107 | #define av_be2ne16(x) av_bswap16(x)
108 | #define av_be2ne32(x) av_bswap32(x)
109 | #define av_be2ne64(x) av_bswap64(x)
110 | #define av_le2ne16(x) (x)
111 | #define av_le2ne32(x) (x)
112 | #define av_le2ne64(x) (x)
113 | #define AV_BE2NEC(s, x) AV_BSWAPC(s, x)
114 | #define AV_LE2NEC(s, x) (x)
115 | #endif
116 |
117 | #define AV_BE2NE16C(x) AV_BE2NEC(16, x)
118 | #define AV_BE2NE32C(x) AV_BE2NEC(32, x)
119 | #define AV_BE2NE64C(x) AV_BE2NEC(64, x)
120 | #define AV_LE2NE16C(x) AV_LE2NEC(16, x)
121 | #define AV_LE2NE32C(x) AV_LE2NEC(32, x)
122 | #define AV_LE2NE64C(x) AV_LE2NEC(64, x)
123 |
124 | #endif /* AVUTIL_BSWAP_H */
125 |
--------------------------------------------------------------------------------
/jni/include/libavutil/common.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 | * common internal and external API header
24 | */
25 |
26 | #ifndef AVUTIL_COMMON_H
27 | #define AVUTIL_COMMON_H
28 |
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include "attributes.h"
38 | #include "libavutil/avconfig.h"
39 |
40 | #if AV_HAVE_BIGENDIAN
41 | # define AV_NE(be, le) (be)
42 | #else
43 | # define AV_NE(be, le) (le)
44 | #endif
45 |
46 | //rounded division & shift
47 | #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
48 | /* assume b>0 */
49 | #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
50 | #define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
51 | #define FFSIGN(a) ((a) > 0 ? 1 : -1)
52 |
53 | #define FFMAX(a,b) ((a) > (b) ? (a) : (b))
54 | #define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
55 | #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
56 | #define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
57 |
58 | #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
59 | #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
60 | #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
61 |
62 | /* misc math functions */
63 | extern const uint8_t ff_log2_tab[256];
64 |
65 | extern const uint8_t av_reverse[256];
66 |
67 | static inline av_const int av_log2_c(unsigned int v)
68 | {
69 | int n = 0;
70 | if (v & 0xffff0000) {
71 | v >>= 16;
72 | n += 16;
73 | }
74 | if (v & 0xff00) {
75 | v >>= 8;
76 | n += 8;
77 | }
78 | n += ff_log2_tab[v];
79 |
80 | return n;
81 | }
82 |
83 | static inline av_const int av_log2_16bit_c(unsigned int v)
84 | {
85 | int n = 0;
86 | if (v & 0xff00) {
87 | v >>= 8;
88 | n += 8;
89 | }
90 | n += ff_log2_tab[v];
91 |
92 | return n;
93 | }
94 |
95 | #ifdef HAVE_AV_CONFIG_H
96 | # include "config.h"
97 | # include "intmath.h"
98 | #endif
99 |
100 | /* Pull in unguarded fallback defines at the end of this file. */
101 | #include "common.h"
102 |
103 | /**
104 | * Clip a signed integer value into the amin-amax range.
105 | * @param a value to clip
106 | * @param amin minimum value of the clip range
107 | * @param amax maximum value of the clip range
108 | * @return clipped value
109 | */
110 | static inline av_const int av_clip_c(int a, int amin, int amax)
111 | {
112 | if (a < amin) return amin;
113 | else if (a > amax) return amax;
114 | else return a;
115 | }
116 |
117 | /**
118 | * Clip a signed integer value into the 0-255 range.
119 | * @param a value to clip
120 | * @return clipped value
121 | */
122 | static inline av_const uint8_t av_clip_uint8_c(int a)
123 | {
124 | if (a&(~0xFF)) return (-a)>>31;
125 | else return a;
126 | }
127 |
128 | /**
129 | * Clip a signed integer value into the -128,127 range.
130 | * @param a value to clip
131 | * @return clipped value
132 | */
133 | static inline av_const int8_t av_clip_int8_c(int a)
134 | {
135 | if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F;
136 | else return a;
137 | }
138 |
139 | /**
140 | * Clip a signed integer value into the 0-65535 range.
141 | * @param a value to clip
142 | * @return clipped value
143 | */
144 | static inline av_const uint16_t av_clip_uint16_c(int a)
145 | {
146 | if (a&(~0xFFFF)) return (-a)>>31;
147 | else return a;
148 | }
149 |
150 | /**
151 | * Clip a signed integer value into the -32768,32767 range.
152 | * @param a value to clip
153 | * @return clipped value
154 | */
155 | static inline av_const int16_t av_clip_int16_c(int a)
156 | {
157 | if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
158 | else return a;
159 | }
160 |
161 | /**
162 | * Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
163 | * @param a value to clip
164 | * @return clipped value
165 | */
166 | static inline av_const int32_t av_clipl_int32_c(int64_t a)
167 | {
168 | if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF;
169 | else return a;
170 | }
171 |
172 | /**
173 | * Clip a float value into the amin-amax range.
174 | * @param a value to clip
175 | * @param amin minimum value of the clip range
176 | * @param amax maximum value of the clip range
177 | * @return clipped value
178 | */
179 | static inline av_const float av_clipf_c(float a, float amin, float amax)
180 | {
181 | if (a < amin) return amin;
182 | else if (a > amax) return amax;
183 | else return a;
184 | }
185 |
186 | /** Compute ceil(log2(x)).
187 | * @param x value used to compute ceil(log2(x))
188 | * @return computed ceiling of log2(x)
189 | */
190 | static inline av_const int av_ceil_log2_c(int x)
191 | {
192 | return av_log2((x - 1) << 1);
193 | }
194 |
195 | /**
196 | * Count number of bits set to one in x
197 | * @param x value to count bits of
198 | * @return the number of bits set to one in x
199 | */
200 | static inline av_const int av_popcount_c(uint32_t x)
201 | {
202 | x -= (x >> 1) & 0x55555555;
203 | x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
204 | x = (x + (x >> 4)) & 0x0F0F0F0F;
205 | x += x >> 8;
206 | return (x + (x >> 16)) & 0x3F;
207 | }
208 |
209 | #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
210 | #define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((a) << 24))
211 |
212 | /**
213 | * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
214 | *
215 | * @param val Output value, must be an lvalue of type uint32_t.
216 | * @param GET_BYTE Expression reading one byte from the input.
217 | * Evaluated up to 7 times (4 for the currently
218 | * assigned Unicode range). With a memory buffer
219 | * input, this could be *ptr++.
220 | * @param ERROR Expression to be evaluated on invalid input,
221 | * typically a goto statement.
222 | */
223 | #define GET_UTF8(val, GET_BYTE, ERROR)\
224 | val= GET_BYTE;\
225 | {\
226 | int ones= 7 - av_log2(val ^ 255);\
227 | if(ones==1)\
228 | ERROR\
229 | val&= 127>>ones;\
230 | while(--ones > 0){\
231 | int tmp= GET_BYTE - 128;\
232 | if(tmp>>6)\
233 | ERROR\
234 | val= (val<<6) + tmp;\
235 | }\
236 | }
237 |
238 | /**
239 | * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form.
240 | *
241 | * @param val Output value, must be an lvalue of type uint32_t.
242 | * @param GET_16BIT Expression returning two bytes of UTF-16 data converted
243 | * to native byte order. Evaluated one or two times.
244 | * @param ERROR Expression to be evaluated on invalid input,
245 | * typically a goto statement.
246 | */
247 | #define GET_UTF16(val, GET_16BIT, ERROR)\
248 | val = GET_16BIT;\
249 | {\
250 | unsigned int hi = val - 0xD800;\
251 | if (hi < 0x800) {\
252 | val = GET_16BIT - 0xDC00;\
253 | if (val > 0x3FFU || hi > 0x3FFU)\
254 | ERROR\
255 | val += (hi<<10) + 0x10000;\
256 | }\
257 | }\
258 |
259 | /*!
260 | * \def PUT_UTF8(val, tmp, PUT_BYTE)
261 | * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
262 | * \param val is an input-only argument and should be of type uint32_t. It holds
263 | * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If
264 | * val is given as a function it is executed only once.
265 | * \param tmp is a temporary variable and should be of type uint8_t. It
266 | * represents an intermediate value during conversion that is to be
267 | * output by PUT_BYTE.
268 | * \param PUT_BYTE writes the converted UTF-8 bytes to any proper destination.
269 | * It could be a function or a statement, and uses tmp as the input byte.
270 | * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be
271 | * executed up to 4 times for values in the valid UTF-8 range and up to
272 | * 7 times in the general case, depending on the length of the converted
273 | * Unicode character.
274 | */
275 | #define PUT_UTF8(val, tmp, PUT_BYTE)\
276 | {\
277 | int bytes, shift;\
278 | uint32_t in = val;\
279 | if (in < 0x80) {\
280 | tmp = in;\
281 | PUT_BYTE\
282 | } else {\
283 | bytes = (av_log2(in) + 4) / 5;\
284 | shift = (bytes - 1) * 6;\
285 | tmp = (256 - (256 >> bytes)) | (in >> shift);\
286 | PUT_BYTE\
287 | while (shift >= 6) {\
288 | shift -= 6;\
289 | tmp = 0x80 | ((in >> shift) & 0x3f);\
290 | PUT_BYTE\
291 | }\
292 | }\
293 | }
294 |
295 | /*!
296 | * \def PUT_UTF16(val, tmp, PUT_16BIT)
297 | * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
298 | * \param val is an input-only argument and should be of type uint32_t. It holds
299 | * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
300 | * val is given as a function it is executed only once.
301 | * \param tmp is a temporary variable and should be of type uint16_t. It
302 | * represents an intermediate value during conversion that is to be
303 | * output by PUT_16BIT.
304 | * \param PUT_16BIT writes the converted UTF-16 data to any proper destination
305 | * in desired endianness. It could be a function or a statement, and uses tmp
306 | * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;"
307 | * PUT_BYTE will be executed 1 or 2 times depending on input character.
308 | */
309 | #define PUT_UTF16(val, tmp, PUT_16BIT)\
310 | {\
311 | uint32_t in = val;\
312 | if (in < 0x10000) {\
313 | tmp = in;\
314 | PUT_16BIT\
315 | } else {\
316 | tmp = 0xD800 | ((in - 0x10000) >> 10);\
317 | PUT_16BIT\
318 | tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
319 | PUT_16BIT\
320 | }\
321 | }\
322 |
323 |
324 |
325 | #include "mem.h"
326 |
327 | #ifdef HAVE_AV_CONFIG_H
328 | # include "internal.h"
329 | #endif /* HAVE_AV_CONFIG_H */
330 |
331 | #endif /* AVUTIL_COMMON_H */
332 |
333 | /*
334 | * The following definitions are outside the multiple inclusion guard
335 | * to ensure they are immediately available in intmath.h.
336 | */
337 |
338 | #ifndef av_log2
339 | # define av_log2 av_log2_c
340 | #endif
341 | #ifndef av_log2_16bit
342 | # define av_log2_16bit av_log2_16bit_c
343 | #endif
344 | #ifndef av_ceil_log2
345 | # define av_ceil_log2 av_ceil_log2_c
346 | #endif
347 | #ifndef av_clip
348 | # define av_clip av_clip_c
349 | #endif
350 | #ifndef av_clip_uint8
351 | # define av_clip_uint8 av_clip_uint8_c
352 | #endif
353 | #ifndef av_clip_int8
354 | # define av_clip_int8 av_clip_int8_c
355 | #endif
356 | #ifndef av_clip_uint16
357 | # define av_clip_uint16 av_clip_uint16_c
358 | #endif
359 | #ifndef av_clip_int16
360 | # define av_clip_int16 av_clip_int16_c
361 | #endif
362 | #ifndef av_clipl_int32
363 | # define av_clipl_int32 av_clipl_int32_c
364 | #endif
365 | #ifndef av_clipf
366 | # define av_clipf av_clipf_c
367 | #endif
368 | #ifndef av_popcount
369 | # define av_popcount av_popcount_c
370 | #endif
371 |
--------------------------------------------------------------------------------
/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 | #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
25 |
26 | /* lower 16 bits - CPU features */
27 | #define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX
28 | #define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext
29 | #define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW
30 | #define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions
31 | #define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions
32 | #define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster
33 | #define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt
34 | #define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions
35 | #define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
36 | #define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions
37 | #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions
38 | #define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions
39 | #define AV_CPU_FLAG_IWMMXT 0x0100 ///< XScale IWMMXT
40 | #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
41 |
42 | /**
43 | * Return the flags which specify extensions supported by the CPU.
44 | */
45 | int av_get_cpu_flags(void);
46 |
47 | /* The following CPU-specific functions shall not be called directly. */
48 | int ff_get_cpu_flags_arm(void);
49 | int ff_get_cpu_flags_ppc(void);
50 | int ff_get_cpu_flags_x86(void);
51 |
52 | #endif /* AVUTIL_CPU_H */
53 |
--------------------------------------------------------------------------------
/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 | typedef uint32_t AVCRC;
29 |
30 | typedef enum {
31 | AV_CRC_8_ATM,
32 | AV_CRC_16_ANSI,
33 | AV_CRC_16_CCITT,
34 | AV_CRC_32_IEEE,
35 | AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */
36 | AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */
37 | }AVCRCId;
38 |
39 | int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size);
40 | const AVCRC *av_crc_get_table(AVCRCId crc_id);
41 | uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length) av_pure;
42 |
43 | #endif /* AVUTIL_CRC_H */
44 |
45 |
--------------------------------------------------------------------------------
/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 "avutil.h"
29 |
30 | /* error handling */
31 | #if EDOM > 0
32 | #define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions.
33 | #define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value.
34 | #else
35 | /* Some platforms have E* and errno already negated. */
36 | #define AVERROR(e) (e)
37 | #define AVUNERROR(e) (e)
38 | #endif
39 |
40 | #if LIBAVUTIL_VERSION_MAJOR < 51
41 | #define AVERROR_INVALIDDATA AVERROR(EINVAL) ///< Invalid data found when processing input
42 | #define AVERROR_IO AVERROR(EIO) ///< I/O error
43 | #define AVERROR_NOENT AVERROR(ENOENT) ///< No such file or directory
44 | #define AVERROR_NOFMT AVERROR(EILSEQ) ///< Unknown format
45 | #define AVERROR_NOMEM AVERROR(ENOMEM) ///< Not enough memory
46 | #define AVERROR_NOTSUPP AVERROR(ENOSYS) ///< Operation not supported
47 | #define AVERROR_NUMEXPECTED AVERROR(EDOM) ///< Number syntax expected in filename
48 | #define AVERROR_UNKNOWN AVERROR(EINVAL) ///< Unknown error
49 | #endif
50 |
51 | #define AVERROR_EOF AVERROR(EPIPE) ///< End of file
52 |
53 | #define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in FFmpeg, patches welcome
54 |
55 | #if LIBAVUTIL_VERSION_MAJOR > 50
56 | #define AVERROR_INVALIDDATA (-MKTAG('I','N','D','A')) ///< Invalid data found when processing input
57 | #define AVERROR_NUMEXPECTED (-MKTAG('N','U','E','X')) ///< Number syntax expected in filename
58 | #endif
59 |
60 | /**
61 | * Put a description of the AVERROR code errnum in errbuf.
62 | * In case of failure the global variable errno is set to indicate the
63 | * error. Even in case of failure av_strerror() will print a generic
64 | * error message indicating the errnum provided to errbuf.
65 | *
66 | * @param errnum error code to describe
67 | * @param errbuf buffer to which description is written
68 | * @param errbuf_size the size in bytes of errbuf
69 | * @return 0 on success, a negative value if a description for errnum
70 | * cannot be found
71 | */
72 | int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
73 |
74 | #endif /* AVUTIL_ERROR_H */
75 |
--------------------------------------------------------------------------------
/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 successfull 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 | #if FF_API_OLD_EVAL_NAMES
95 | /**
96 | * @deprecated Deprecated in favor of av_expr_parse_and_eval().
97 | */
98 | attribute_deprecated
99 | int av_parse_and_eval_expr(double *res, const char *s,
100 | const char * const *const_names, const double *const_values,
101 | const char * const *func1_names, double (* const *funcs1)(void *, double),
102 | const char * const *func2_names, double (* const *funcs2)(void *, double, double),
103 | void *opaque, int log_offset, void *log_ctx);
104 |
105 | /**
106 | * @deprecated Deprecated in favor of av_expr_parse().
107 | */
108 | attribute_deprecated
109 | int av_parse_expr(AVExpr **expr, const char *s,
110 | const char * const *const_names,
111 | const char * const *func1_names, double (* const *funcs1)(void *, double),
112 | const char * const *func2_names, double (* const *funcs2)(void *, double, double),
113 | int log_offset, void *log_ctx);
114 | /**
115 | * @deprecated Deprecated in favor of av_expr_eval().
116 | */
117 | attribute_deprecated
118 | double av_eval_expr(AVExpr *e, const double *const_values, void *opaque);
119 |
120 | /**
121 | * @deprecated Deprecated in favor of av_expr_free().
122 | */
123 | attribute_deprecated
124 | void av_free_expr(AVExpr *e);
125 | #endif /* FF_API_OLD_EVAL_NAMES */
126 |
127 | /**
128 | * Parse the string in numstr and return its value as a double. If
129 | * the string is empty, contains only whitespaces, or does not contain
130 | * an initial substring that has the expected syntax for a
131 | * floating-point number, no conversion is performed. In this case,
132 | * returns a value of zero and the value returned in tail is the value
133 | * of numstr.
134 | *
135 | * @param numstr a string representing a number, may contain one of
136 | * the International System number postfixes, for example 'K', 'M',
137 | * 'G'. If 'i' is appended after the postfix, powers of 2 are used
138 | * instead of powers of 10. The 'B' postfix multiplies the value for
139 | * 8, and can be appended after another postfix or used alone. This
140 | * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix.
141 | * @param tail if non-NULL puts here the pointer to the char next
142 | * after the last parsed character
143 | */
144 | double av_strtod(const char *numstr, char **tail);
145 |
146 | #endif /* AVUTIL_EVAL_H */
147 |
--------------------------------------------------------------------------------
/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 |
29 | typedef struct AVFifoBuffer {
30 | uint8_t *buffer;
31 | uint8_t *rptr, *wptr, *end;
32 | uint32_t rndx, wndx;
33 | } AVFifoBuffer;
34 |
35 | /**
36 | * Initialize an AVFifoBuffer.
37 | * @param size of FIFO
38 | * @return AVFifoBuffer or NULL in case of memory allocation failure
39 | */
40 | AVFifoBuffer *av_fifo_alloc(unsigned int size);
41 |
42 | /**
43 | * Free an AVFifoBuffer.
44 | * @param *f AVFifoBuffer to free
45 | */
46 | void av_fifo_free(AVFifoBuffer *f);
47 |
48 | /**
49 | * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied.
50 | * @param *f AVFifoBuffer to reset
51 | */
52 | void av_fifo_reset(AVFifoBuffer *f);
53 |
54 | /**
55 | * Return the amount of data in bytes in the AVFifoBuffer, that is the
56 | * amount of data you can read from it.
57 | * @param *f AVFifoBuffer to read from
58 | * @return size
59 | */
60 | int av_fifo_size(AVFifoBuffer *f);
61 |
62 | /**
63 | * Return the amount of space in bytes in the AVFifoBuffer, that is the
64 | * amount of data you can write into it.
65 | * @param *f AVFifoBuffer to write into
66 | * @return size
67 | */
68 | int av_fifo_space(AVFifoBuffer *f);
69 |
70 | /**
71 | * Feed data from an AVFifoBuffer to a user-supplied callback.
72 | * @param *f AVFifoBuffer to read from
73 | * @param buf_size number of bytes to read
74 | * @param *func generic read function
75 | * @param *dest data destination
76 | */
77 | int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
78 |
79 | /**
80 | * Feed data from a user-supplied callback to an AVFifoBuffer.
81 | * @param *f AVFifoBuffer to write to
82 | * @param *src data source; non-const since it may be used as a
83 | * modifiable context by the function defined in func
84 | * @param size number of bytes to write
85 | * @param *func generic write function; the first parameter is src,
86 | * the second is dest_buf, the third is dest_buf_size.
87 | * func must return the number of bytes written to dest_buf, or <= 0 to
88 | * indicate no more data available to write.
89 | * If func is NULL, src is interpreted as a simple byte array for source data.
90 | * @return the number of bytes written to the FIFO
91 | */
92 | int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
93 |
94 | /**
95 | * Resize an AVFifoBuffer.
96 | * @param *f AVFifoBuffer to resize
97 | * @param size new AVFifoBuffer size in bytes
98 | * @return <0 for failure, >=0 otherwise
99 | */
100 | int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
101 |
102 | /**
103 | * Read and discard the specified amount of data from an AVFifoBuffer.
104 | * @param *f AVFifoBuffer to read from
105 | * @param size amount of data to read in bytes
106 | */
107 | void av_fifo_drain(AVFifoBuffer *f, int size);
108 |
109 | static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs)
110 | {
111 | uint8_t *ptr = f->rptr + offs;
112 | if (ptr >= f->end)
113 | ptr -= f->end - f->buffer;
114 | return *ptr;
115 | }
116 | #endif /* AVUTIL_FIFO_H */
117 |
--------------------------------------------------------------------------------
/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 | double av_int2dbl(int64_t v) av_const;
34 | float av_int2flt(int32_t v) av_const;
35 | double av_ext2dbl(const AVExtFloat ext) av_const;
36 | int64_t av_dbl2int(double d) av_const;
37 | int32_t av_flt2int(float d) av_const;
38 | AVExtFloat av_dbl2ext(double d) av_const;
39 |
40 | #endif /* AVUTIL_INTFLOAT_READWRITE_H */
41 |
--------------------------------------------------------------------------------
/jni/include/libavutil/intreadwrite.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_INTREADWRITE_H
20 | #define AVUTIL_INTREADWRITE_H
21 |
22 | #include
23 | #include "libavutil/avconfig.h"
24 | #include "attributes.h"
25 | #include "bswap.h"
26 |
27 | typedef union {
28 | uint64_t u64;
29 | uint32_t u32[2];
30 | uint16_t u16[4];
31 | uint8_t u8 [8];
32 | double f64;
33 | float f32[2];
34 | } av_alias av_alias64;
35 |
36 | typedef union {
37 | uint32_t u32;
38 | uint16_t u16[2];
39 | uint8_t u8 [4];
40 | float f32;
41 | } av_alias av_alias32;
42 |
43 | typedef union {
44 | uint16_t u16;
45 | uint8_t u8 [2];
46 | } av_alias av_alias16;
47 |
48 | /*
49 | * Arch-specific headers can provide any combination of
50 | * AV_[RW][BLN](16|24|32|64) and AV_(COPY|SWAP|ZERO)(64|128) macros.
51 | * Preprocessor symbols must be defined, even if these are implemented
52 | * as inline functions.
53 | */
54 |
55 | #ifdef HAVE_AV_CONFIG_H
56 |
57 | #include "config.h"
58 |
59 | #if ARCH_ARM
60 | # include "arm/intreadwrite.h"
61 | #elif ARCH_AVR32
62 | # include "avr32/intreadwrite.h"
63 | #elif ARCH_MIPS
64 | # include "mips/intreadwrite.h"
65 | #elif ARCH_PPC
66 | # include "ppc/intreadwrite.h"
67 | #elif ARCH_TOMI
68 | # include "tomi/intreadwrite.h"
69 | #elif ARCH_X86
70 | # include "x86/intreadwrite.h"
71 | #endif
72 |
73 | #endif /* HAVE_AV_CONFIG_H */
74 |
75 | /*
76 | * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers.
77 | */
78 |
79 | #if AV_HAVE_BIGENDIAN
80 |
81 | # if defined(AV_RN16) && !defined(AV_RB16)
82 | # define AV_RB16(p) AV_RN16(p)
83 | # elif !defined(AV_RN16) && defined(AV_RB16)
84 | # define AV_RN16(p) AV_RB16(p)
85 | # endif
86 |
87 | # if defined(AV_WN16) && !defined(AV_WB16)
88 | # define AV_WB16(p, v) AV_WN16(p, v)
89 | # elif !defined(AV_WN16) && defined(AV_WB16)
90 | # define AV_WN16(p, v) AV_WB16(p, v)
91 | # endif
92 |
93 | # if defined(AV_RN24) && !defined(AV_RB24)
94 | # define AV_RB24(p) AV_RN24(p)
95 | # elif !defined(AV_RN24) && defined(AV_RB24)
96 | # define AV_RN24(p) AV_RB24(p)
97 | # endif
98 |
99 | # if defined(AV_WN24) && !defined(AV_WB24)
100 | # define AV_WB24(p, v) AV_WN24(p, v)
101 | # elif !defined(AV_WN24) && defined(AV_WB24)
102 | # define AV_WN24(p, v) AV_WB24(p, v)
103 | # endif
104 |
105 | # if defined(AV_RN32) && !defined(AV_RB32)
106 | # define AV_RB32(p) AV_RN32(p)
107 | # elif !defined(AV_RN32) && defined(AV_RB32)
108 | # define AV_RN32(p) AV_RB32(p)
109 | # endif
110 |
111 | # if defined(AV_WN32) && !defined(AV_WB32)
112 | # define AV_WB32(p, v) AV_WN32(p, v)
113 | # elif !defined(AV_WN32) && defined(AV_WB32)
114 | # define AV_WN32(p, v) AV_WB32(p, v)
115 | # endif
116 |
117 | # if defined(AV_RN64) && !defined(AV_RB64)
118 | # define AV_RB64(p) AV_RN64(p)
119 | # elif !defined(AV_RN64) && defined(AV_RB64)
120 | # define AV_RN64(p) AV_RB64(p)
121 | # endif
122 |
123 | # if defined(AV_WN64) && !defined(AV_WB64)
124 | # define AV_WB64(p, v) AV_WN64(p, v)
125 | # elif !defined(AV_WN64) && defined(AV_WB64)
126 | # define AV_WN64(p, v) AV_WB64(p, v)
127 | # endif
128 |
129 | #else /* AV_HAVE_BIGENDIAN */
130 |
131 | # if defined(AV_RN16) && !defined(AV_RL16)
132 | # define AV_RL16(p) AV_RN16(p)
133 | # elif !defined(AV_RN16) && defined(AV_RL16)
134 | # define AV_RN16(p) AV_RL16(p)
135 | # endif
136 |
137 | # if defined(AV_WN16) && !defined(AV_WL16)
138 | # define AV_WL16(p, v) AV_WN16(p, v)
139 | # elif !defined(AV_WN16) && defined(AV_WL16)
140 | # define AV_WN16(p, v) AV_WL16(p, v)
141 | # endif
142 |
143 | # if defined(AV_RN24) && !defined(AV_RL24)
144 | # define AV_RL24(p) AV_RN24(p)
145 | # elif !defined(AV_RN24) && defined(AV_RL24)
146 | # define AV_RN24(p) AV_RL24(p)
147 | # endif
148 |
149 | # if defined(AV_WN24) && !defined(AV_WL24)
150 | # define AV_WL24(p, v) AV_WN24(p, v)
151 | # elif !defined(AV_WN24) && defined(AV_WL24)
152 | # define AV_WN24(p, v) AV_WL24(p, v)
153 | # endif
154 |
155 | # if defined(AV_RN32) && !defined(AV_RL32)
156 | # define AV_RL32(p) AV_RN32(p)
157 | # elif !defined(AV_RN32) && defined(AV_RL32)
158 | # define AV_RN32(p) AV_RL32(p)
159 | # endif
160 |
161 | # if defined(AV_WN32) && !defined(AV_WL32)
162 | # define AV_WL32(p, v) AV_WN32(p, v)
163 | # elif !defined(AV_WN32) && defined(AV_WL32)
164 | # define AV_WN32(p, v) AV_WL32(p, v)
165 | # endif
166 |
167 | # if defined(AV_RN64) && !defined(AV_RL64)
168 | # define AV_RL64(p) AV_RN64(p)
169 | # elif !defined(AV_RN64) && defined(AV_RL64)
170 | # define AV_RN64(p) AV_RL64(p)
171 | # endif
172 |
173 | # if defined(AV_WN64) && !defined(AV_WL64)
174 | # define AV_WL64(p, v) AV_WN64(p, v)
175 | # elif !defined(AV_WN64) && defined(AV_WL64)
176 | # define AV_WN64(p, v) AV_WL64(p, v)
177 | # endif
178 |
179 | #endif /* !AV_HAVE_BIGENDIAN */
180 |
181 | /*
182 | * Define AV_[RW]N helper macros to simplify definitions not provided
183 | * by per-arch headers.
184 | */
185 |
186 | #if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__)
187 |
188 | union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias;
189 | union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias;
190 | union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
191 |
192 | # define AV_RN(s, p) (((const union unaligned_##s *) (p))->l)
193 | # define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v))
194 |
195 | #elif defined(__DECC)
196 |
197 | # define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p)))
198 | # define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v))
199 |
200 | #elif AV_HAVE_FAST_UNALIGNED
201 |
202 | # define AV_RN(s, p) (((const av_alias##s*)(p))->u##s)
203 | # define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v))
204 |
205 | #else
206 |
207 | #ifndef AV_RB16
208 | # define AV_RB16(x) \
209 | ((((const uint8_t*)(x))[0] << 8) | \
210 | ((const uint8_t*)(x))[1])
211 | #endif
212 | #ifndef AV_WB16
213 | # define AV_WB16(p, d) do { \
214 | ((uint8_t*)(p))[1] = (d); \
215 | ((uint8_t*)(p))[0] = (d)>>8; \
216 | } while(0)
217 | #endif
218 |
219 | #ifndef AV_RL16
220 | # define AV_RL16(x) \
221 | ((((const uint8_t*)(x))[1] << 8) | \
222 | ((const uint8_t*)(x))[0])
223 | #endif
224 | #ifndef AV_WL16
225 | # define AV_WL16(p, d) do { \
226 | ((uint8_t*)(p))[0] = (d); \
227 | ((uint8_t*)(p))[1] = (d)>>8; \
228 | } while(0)
229 | #endif
230 |
231 | #ifndef AV_RB32
232 | # define AV_RB32(x) \
233 | ((((const uint8_t*)(x))[0] << 24) | \
234 | (((const uint8_t*)(x))[1] << 16) | \
235 | (((const uint8_t*)(x))[2] << 8) | \
236 | ((const uint8_t*)(x))[3])
237 | #endif
238 | #ifndef AV_WB32
239 | # define AV_WB32(p, d) do { \
240 | ((uint8_t*)(p))[3] = (d); \
241 | ((uint8_t*)(p))[2] = (d)>>8; \
242 | ((uint8_t*)(p))[1] = (d)>>16; \
243 | ((uint8_t*)(p))[0] = (d)>>24; \
244 | } while(0)
245 | #endif
246 |
247 | #ifndef AV_RL32
248 | # define AV_RL32(x) \
249 | ((((const uint8_t*)(x))[3] << 24) | \
250 | (((const uint8_t*)(x))[2] << 16) | \
251 | (((const uint8_t*)(x))[1] << 8) | \
252 | ((const uint8_t*)(x))[0])
253 | #endif
254 | #ifndef AV_WL32
255 | # define AV_WL32(p, d) do { \
256 | ((uint8_t*)(p))[0] = (d); \
257 | ((uint8_t*)(p))[1] = (d)>>8; \
258 | ((uint8_t*)(p))[2] = (d)>>16; \
259 | ((uint8_t*)(p))[3] = (d)>>24; \
260 | } while(0)
261 | #endif
262 |
263 | #ifndef AV_RB64
264 | # define AV_RB64(x) \
265 | (((uint64_t)((const uint8_t*)(x))[0] << 56) | \
266 | ((uint64_t)((const uint8_t*)(x))[1] << 48) | \
267 | ((uint64_t)((const uint8_t*)(x))[2] << 40) | \
268 | ((uint64_t)((const uint8_t*)(x))[3] << 32) | \
269 | ((uint64_t)((const uint8_t*)(x))[4] << 24) | \
270 | ((uint64_t)((const uint8_t*)(x))[5] << 16) | \
271 | ((uint64_t)((const uint8_t*)(x))[6] << 8) | \
272 | (uint64_t)((const uint8_t*)(x))[7])
273 | #endif
274 | #ifndef AV_WB64
275 | # define AV_WB64(p, d) do { \
276 | ((uint8_t*)(p))[7] = (d); \
277 | ((uint8_t*)(p))[6] = (d)>>8; \
278 | ((uint8_t*)(p))[5] = (d)>>16; \
279 | ((uint8_t*)(p))[4] = (d)>>24; \
280 | ((uint8_t*)(p))[3] = (d)>>32; \
281 | ((uint8_t*)(p))[2] = (d)>>40; \
282 | ((uint8_t*)(p))[1] = (d)>>48; \
283 | ((uint8_t*)(p))[0] = (d)>>56; \
284 | } while(0)
285 | #endif
286 |
287 | #ifndef AV_RL64
288 | # define AV_RL64(x) \
289 | (((uint64_t)((const uint8_t*)(x))[7] << 56) | \
290 | ((uint64_t)((const uint8_t*)(x))[6] << 48) | \
291 | ((uint64_t)((const uint8_t*)(x))[5] << 40) | \
292 | ((uint64_t)((const uint8_t*)(x))[4] << 32) | \
293 | ((uint64_t)((const uint8_t*)(x))[3] << 24) | \
294 | ((uint64_t)((const uint8_t*)(x))[2] << 16) | \
295 | ((uint64_t)((const uint8_t*)(x))[1] << 8) | \
296 | (uint64_t)((const uint8_t*)(x))[0])
297 | #endif
298 | #ifndef AV_WL64
299 | # define AV_WL64(p, d) do { \
300 | ((uint8_t*)(p))[0] = (d); \
301 | ((uint8_t*)(p))[1] = (d)>>8; \
302 | ((uint8_t*)(p))[2] = (d)>>16; \
303 | ((uint8_t*)(p))[3] = (d)>>24; \
304 | ((uint8_t*)(p))[4] = (d)>>32; \
305 | ((uint8_t*)(p))[5] = (d)>>40; \
306 | ((uint8_t*)(p))[6] = (d)>>48; \
307 | ((uint8_t*)(p))[7] = (d)>>56; \
308 | } while(0)
309 | #endif
310 |
311 | #if AV_HAVE_BIGENDIAN
312 | # define AV_RN(s, p) AV_RB##s(p)
313 | # define AV_WN(s, p, v) AV_WB##s(p, v)
314 | #else
315 | # define AV_RN(s, p) AV_RL##s(p)
316 | # define AV_WN(s, p, v) AV_WL##s(p, v)
317 | #endif
318 |
319 | #endif /* HAVE_FAST_UNALIGNED */
320 |
321 | #ifndef AV_RN16
322 | # define AV_RN16(p) AV_RN(16, p)
323 | #endif
324 |
325 | #ifndef AV_RN32
326 | # define AV_RN32(p) AV_RN(32, p)
327 | #endif
328 |
329 | #ifndef AV_RN64
330 | # define AV_RN64(p) AV_RN(64, p)
331 | #endif
332 |
333 | #ifndef AV_WN16
334 | # define AV_WN16(p, v) AV_WN(16, p, v)
335 | #endif
336 |
337 | #ifndef AV_WN32
338 | # define AV_WN32(p, v) AV_WN(32, p, v)
339 | #endif
340 |
341 | #ifndef AV_WN64
342 | # define AV_WN64(p, v) AV_WN(64, p, v)
343 | #endif
344 |
345 | #if AV_HAVE_BIGENDIAN
346 | # define AV_RB(s, p) AV_RN##s(p)
347 | # define AV_WB(s, p, v) AV_WN##s(p, v)
348 | # define AV_RL(s, p) av_bswap##s(AV_RN##s(p))
349 | # define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v))
350 | #else
351 | # define AV_RB(s, p) av_bswap##s(AV_RN##s(p))
352 | # define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v))
353 | # define AV_RL(s, p) AV_RN##s(p)
354 | # define AV_WL(s, p, v) AV_WN##s(p, v)
355 | #endif
356 |
357 | #define AV_RB8(x) (((const uint8_t*)(x))[0])
358 | #define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0)
359 |
360 | #define AV_RL8(x) AV_RB8(x)
361 | #define AV_WL8(p, d) AV_WB8(p, d)
362 |
363 | #ifndef AV_RB16
364 | # define AV_RB16(p) AV_RB(16, p)
365 | #endif
366 | #ifndef AV_WB16
367 | # define AV_WB16(p, v) AV_WB(16, p, v)
368 | #endif
369 |
370 | #ifndef AV_RL16
371 | # define AV_RL16(p) AV_RL(16, p)
372 | #endif
373 | #ifndef AV_WL16
374 | # define AV_WL16(p, v) AV_WL(16, p, v)
375 | #endif
376 |
377 | #ifndef AV_RB32
378 | # define AV_RB32(p) AV_RB(32, p)
379 | #endif
380 | #ifndef AV_WB32
381 | # define AV_WB32(p, v) AV_WB(32, p, v)
382 | #endif
383 |
384 | #ifndef AV_RL32
385 | # define AV_RL32(p) AV_RL(32, p)
386 | #endif
387 | #ifndef AV_WL32
388 | # define AV_WL32(p, v) AV_WL(32, p, v)
389 | #endif
390 |
391 | #ifndef AV_RB64
392 | # define AV_RB64(p) AV_RB(64, p)
393 | #endif
394 | #ifndef AV_WB64
395 | # define AV_WB64(p, v) AV_WB(64, p, v)
396 | #endif
397 |
398 | #ifndef AV_RL64
399 | # define AV_RL64(p) AV_RL(64, p)
400 | #endif
401 | #ifndef AV_WL64
402 | # define AV_WL64(p, v) AV_WL(64, p, v)
403 | #endif
404 |
405 | #ifndef AV_RB24
406 | # define AV_RB24(x) \
407 | ((((const uint8_t*)(x))[0] << 16) | \
408 | (((const uint8_t*)(x))[1] << 8) | \
409 | ((const uint8_t*)(x))[2])
410 | #endif
411 | #ifndef AV_WB24
412 | # define AV_WB24(p, d) do { \
413 | ((uint8_t*)(p))[2] = (d); \
414 | ((uint8_t*)(p))[1] = (d)>>8; \
415 | ((uint8_t*)(p))[0] = (d)>>16; \
416 | } while(0)
417 | #endif
418 |
419 | #ifndef AV_RL24
420 | # define AV_RL24(x) \
421 | ((((const uint8_t*)(x))[2] << 16) | \
422 | (((const uint8_t*)(x))[1] << 8) | \
423 | ((const uint8_t*)(x))[0])
424 | #endif
425 | #ifndef AV_WL24
426 | # define AV_WL24(p, d) do { \
427 | ((uint8_t*)(p))[0] = (d); \
428 | ((uint8_t*)(p))[1] = (d)>>8; \
429 | ((uint8_t*)(p))[2] = (d)>>16; \
430 | } while(0)
431 | #endif
432 |
433 | /*
434 | * The AV_[RW]NA macros access naturally aligned data
435 | * in a type-safe way.
436 | */
437 |
438 | #define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s)
439 | #define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v))
440 |
441 | #ifndef AV_RN16A
442 | # define AV_RN16A(p) AV_RNA(16, p)
443 | #endif
444 |
445 | #ifndef AV_RN32A
446 | # define AV_RN32A(p) AV_RNA(32, p)
447 | #endif
448 |
449 | #ifndef AV_RN64A
450 | # define AV_RN64A(p) AV_RNA(64, p)
451 | #endif
452 |
453 | #ifndef AV_WN16A
454 | # define AV_WN16A(p, v) AV_WNA(16, p, v)
455 | #endif
456 |
457 | #ifndef AV_WN32A
458 | # define AV_WN32A(p, v) AV_WNA(32, p, v)
459 | #endif
460 |
461 | #ifndef AV_WN64A
462 | # define AV_WN64A(p, v) AV_WNA(64, p, v)
463 | #endif
464 |
465 | /* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be
466 | * naturally aligned. They may be implemented using MMX,
467 | * so emms_c() must be called before using any float code
468 | * afterwards.
469 | */
470 |
471 | #define AV_COPY(n, d, s) \
472 | (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n)
473 |
474 | #ifndef AV_COPY16
475 | # define AV_COPY16(d, s) AV_COPY(16, d, s)
476 | #endif
477 |
478 | #ifndef AV_COPY32
479 | # define AV_COPY32(d, s) AV_COPY(32, d, s)
480 | #endif
481 |
482 | #ifndef AV_COPY64
483 | # define AV_COPY64(d, s) AV_COPY(64, d, s)
484 | #endif
485 |
486 | #ifndef AV_COPY128
487 | # define AV_COPY128(d, s) \
488 | do { \
489 | AV_COPY64(d, s); \
490 | AV_COPY64((char*)(d)+8, (char*)(s)+8); \
491 | } while(0)
492 | #endif
493 |
494 | #define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b))
495 |
496 | #ifndef AV_SWAP64
497 | # define AV_SWAP64(a, b) AV_SWAP(64, a, b)
498 | #endif
499 |
500 | #define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0)
501 |
502 | #ifndef AV_ZERO16
503 | # define AV_ZERO16(d) AV_ZERO(16, d)
504 | #endif
505 |
506 | #ifndef AV_ZERO32
507 | # define AV_ZERO32(d) AV_ZERO(32, d)
508 | #endif
509 |
510 | #ifndef AV_ZERO64
511 | # define AV_ZERO64(d) AV_ZERO(64, d)
512 | #endif
513 |
514 | #ifndef AV_ZERO128
515 | # define AV_ZERO128(d) \
516 | do { \
517 | AV_ZERO64(d); \
518 | AV_ZERO64((char*)(d)+8); \
519 | } while(0)
520 | #endif
521 |
522 | #endif /* AVUTIL_INTREADWRITE_H */
523 |
--------------------------------------------------------------------------------
/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 {
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[2] 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/log.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_LOG_H
22 | #define AVUTIL_LOG_H
23 |
24 | #include
25 | #include "avutil.h"
26 |
27 | /**
28 | * Describe the class of an AVClass context structure. That is an
29 | * arbitrary struct of which the first field is a pointer to an
30 | * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
31 | */
32 | typedef struct {
33 | /**
34 | * The name of the class; usually it is the same name as the
35 | * context structure type to which the AVClass is associated.
36 | */
37 | const char* class_name;
38 |
39 | /**
40 | * A pointer to a function which returns the name of a context
41 | * instance ctx associated with the class.
42 | */
43 | const char* (*item_name)(void* ctx);
44 |
45 | /**
46 | * a pointer to the first option specified in the class if any or NULL
47 | *
48 | * @see av_set_default_options()
49 | */
50 | const struct AVOption *option;
51 |
52 | /**
53 | * LIBAVUTIL_VERSION with which this structure was created.
54 | * This is used to allow fields to be added without requiring major
55 | * version bumps everywhere.
56 | */
57 |
58 | int version;
59 |
60 | /**
61 | * Offset in the structure where log_level_offset is stored.
62 | * 0 means there is no such variable
63 | */
64 | int log_level_offset_offset;
65 |
66 | /**
67 | * Offset in the structure where a pointer to the parent context for loging is stored.
68 | * for example a decoder that uses eval.c could pass its AVCodecContext to eval as such
69 | * parent context. And a av_log() implementation could then display the parent context
70 | * can be NULL of course
71 | */
72 | int parent_log_context_offset;
73 | } AVClass;
74 |
75 | /* av_log API */
76 |
77 | #define AV_LOG_QUIET -8
78 |
79 | /**
80 | * Something went really wrong and we will crash now.
81 | */
82 | #define AV_LOG_PANIC 0
83 |
84 | /**
85 | * Something went wrong and recovery is not possible.
86 | * For example, no header was found for a format which depends
87 | * on headers or an illegal combination of parameters is used.
88 | */
89 | #define AV_LOG_FATAL 8
90 |
91 | /**
92 | * Something went wrong and cannot losslessly be recovered.
93 | * However, not all future data is affected.
94 | */
95 | #define AV_LOG_ERROR 16
96 |
97 | /**
98 | * Something somehow does not look correct. This may or may not
99 | * lead to problems. An example would be the use of '-vstrict -2'.
100 | */
101 | #define AV_LOG_WARNING 24
102 |
103 | #define AV_LOG_INFO 32
104 | #define AV_LOG_VERBOSE 40
105 |
106 | /**
107 | * Stuff which is only useful for libav* developers.
108 | */
109 | #define AV_LOG_DEBUG 48
110 |
111 | /**
112 | * Send the specified message to the log if the level is less than or equal
113 | * to the current av_log_level. By default, all logging messages are sent to
114 | * stderr. This behavior can be altered by setting a different av_vlog callback
115 | * function.
116 | *
117 | * @param avcl A pointer to an arbitrary struct of which the first field is a
118 | * pointer to an AVClass struct.
119 | * @param level The importance level of the message, lower values signifying
120 | * higher importance.
121 | * @param fmt The format string (printf-compatible) that specifies how
122 | * subsequent arguments are converted to output.
123 | * @see av_vlog
124 | */
125 | #ifdef __GNUC__
126 | void av_log(void *avcl, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
127 | #else
128 | void av_log(void *avcl, int level, const char *fmt, ...);
129 | #endif
130 |
131 | void av_vlog(void *avcl, int level, const char *fmt, va_list);
132 | int av_log_get_level(void);
133 | void av_log_set_level(int);
134 | void av_log_set_callback(void (*)(void*, int, const char*, va_list));
135 | void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
136 | const char* av_default_item_name(void* ctx);
137 |
138 | /**
139 | * Skip repeated messages, this requires the user app to use av_log() instead of
140 | * (f)printf as the 2 would otherwise interfere and lead to
141 | * "Last message repeated x times" messages below (f)printf messages with some
142 | * bad luck.
143 | * Also to receive the last, "last repeated" line if any, the user app must
144 | * call av_log(NULL, AV_LOG_QUIET, ""); at the end
145 | */
146 | #define AV_LOG_SKIP_REPEATED 1
147 | void av_log_set_flags(int arg);
148 |
149 | #endif /* AVUTIL_LOG_H */
150 |
--------------------------------------------------------------------------------
/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 | #include
26 |
27 | /** \defgroup errflags Error flags returned by av_lzo1x_decode
28 | * \{ */
29 | //! end of the input buffer reached before decoding finished
30 | #define AV_LZO_INPUT_DEPLETED 1
31 | //! decoded data did not fit into output buffer
32 | #define AV_LZO_OUTPUT_FULL 2
33 | //! a reference to previously decoded data was wrong
34 | #define AV_LZO_INVALID_BACKPTR 4
35 | //! a non-specific error in the compressed bitstream
36 | #define AV_LZO_ERROR 8
37 | /** \} */
38 |
39 | #define AV_LZO_INPUT_PADDING 8
40 | #define AV_LZO_OUTPUT_PADDING 12
41 |
42 | /**
43 | * \brief Decodes LZO 1x compressed data.
44 | * \param out output buffer
45 | * \param outlen size of output buffer, number of bytes left are returned here
46 | * \param in input buffer
47 | * \param inlen size of input buffer, number of bytes left are returned here
48 | * \return 0 on success, otherwise a combination of the error flags above
49 | *
50 | * Make sure all buffers are appropriately padded, in must provide
51 | * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
52 | */
53 | int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
54 |
55 | /**
56 | * \brief deliberately overlapping memcpy implementation
57 | * \param dst destination buffer; must be padded with 12 additional bytes
58 | * \param back how many bytes back we start (the initial size of the overlapping window)
59 | * \param cnt number of bytes to copy, must be >= 0
60 | *
61 | * cnt > back is valid, this will copy the bytes we just copied,
62 | * thus creating a repeating pattern with a period length of back.
63 | */
64 | void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
65 |
66 | #endif /* AVUTIL_LZO_H */
67 |
--------------------------------------------------------------------------------
/jni/include/libavutil/mathematics.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_MATHEMATICS_H
22 | #define AVUTIL_MATHEMATICS_H
23 |
24 | #include
25 | #include
26 | #include "attributes.h"
27 | #include "rational.h"
28 |
29 | #ifndef M_E
30 | #define M_E 2.7182818284590452354 /* e */
31 | #endif
32 | #ifndef M_LN2
33 | #define M_LN2 0.69314718055994530942 /* log_e 2 */
34 | #endif
35 | #ifndef M_LN10
36 | #define M_LN10 2.30258509299404568402 /* log_e 10 */
37 | #endif
38 | #ifndef M_LOG2_10
39 | #define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
40 | #endif
41 | #ifndef M_PHI
42 | #define M_PHI 1.61803398874989484820 /* phi / golden ratio */
43 | #endif
44 | #ifndef M_PI
45 | #define M_PI 3.14159265358979323846 /* pi */
46 | #endif
47 | #ifndef M_SQRT1_2
48 | #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
49 | #endif
50 | #ifndef M_SQRT2
51 | #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
52 | #endif
53 | #ifndef NAN
54 | #define NAN (0.0/0.0)
55 | #endif
56 | #ifndef INFINITY
57 | #define INFINITY (1.0/0.0)
58 | #endif
59 |
60 | enum AVRounding {
61 | AV_ROUND_ZERO = 0, ///< Round toward zero.
62 | AV_ROUND_INF = 1, ///< Round away from zero.
63 | AV_ROUND_DOWN = 2, ///< Round toward -infinity.
64 | AV_ROUND_UP = 3, ///< Round toward +infinity.
65 | AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
66 | };
67 |
68 | /**
69 | * Return the greatest common divisor of a and b.
70 | * If both a and b are 0 or either or both are <0 then behavior is
71 | * undefined.
72 | */
73 | int64_t av_const av_gcd(int64_t a, int64_t b);
74 |
75 | /**
76 | * Rescale a 64-bit integer with rounding to nearest.
77 | * A simple a*b/c isn't possible as it can overflow.
78 | */
79 | int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
80 |
81 | /**
82 | * Rescale a 64-bit integer with specified rounding.
83 | * A simple a*b/c isn't possible as it can overflow.
84 | */
85 | int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const;
86 |
87 | /**
88 | * Rescale a 64-bit integer by 2 rational numbers.
89 | */
90 | int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
91 |
92 | /**
93 | * Compare 2 timestamps each in its own timebases.
94 | * The result of the function is undefined if one of the timestamps
95 | * is outside the int64_t range when represented in the others timebase.
96 | * @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
97 | */
98 | int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
99 |
100 | /**
101 | * Compare 2 integers modulo mod.
102 | * That is we compare integers a and b for which only the least
103 | * significant log2(mod) bits are known.
104 | *
105 | * @param mod must be a power of 2
106 | * @return a negative value if a is smaller than b
107 | * a positive value if a is greater than b
108 | * 0 if a equals b
109 | */
110 | int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
111 |
112 | #endif /* AVUTIL_MATHEMATICS_H */
113 |
--------------------------------------------------------------------------------
/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 | extern const int av_md5_size;
27 |
28 | struct AVMD5;
29 |
30 | void av_md5_init(struct AVMD5 *ctx);
31 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len);
32 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst);
33 | void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len);
34 |
35 | #endif /* AVUTIL_MD5_H */
36 |
37 |
--------------------------------------------------------------------------------
/jni/include/libavutil/mem.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 | * memory handling functions
24 | */
25 |
26 | #ifndef AVUTIL_MEM_H
27 | #define AVUTIL_MEM_H
28 |
29 | #include "attributes.h"
30 | #include "avutil.h"
31 |
32 | #if defined(__ICC) && _ICC < 1200 || defined(__SUNPRO_C)
33 | #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
34 | #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
35 | #elif defined(__TI_COMPILER_VERSION__)
36 | #define DECLARE_ALIGNED(n,t,v) \
37 | AV_PRAGMA(DATA_ALIGN(v,n)) \
38 | t __attribute__((aligned(n))) v
39 | #define DECLARE_ASM_CONST(n,t,v) \
40 | AV_PRAGMA(DATA_ALIGN(v,n)) \
41 | static const t __attribute__((aligned(n))) v
42 | #elif defined(__GNUC__)
43 | #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
44 | #define DECLARE_ASM_CONST(n,t,v) static const t attribute_used __attribute__ ((aligned (n))) v
45 | #elif defined(_MSC_VER)
46 | #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
47 | #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
48 | #else
49 | #define DECLARE_ALIGNED(n,t,v) t v
50 | #define DECLARE_ASM_CONST(n,t,v) static const t v
51 | #endif
52 |
53 | #if AV_GCC_VERSION_AT_LEAST(3,1)
54 | #define av_malloc_attrib __attribute__((__malloc__))
55 | #else
56 | #define av_malloc_attrib
57 | #endif
58 |
59 | #if (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(4,3)
60 | #define av_alloc_size(n) __attribute__((alloc_size(n)))
61 | #else
62 | #define av_alloc_size(n)
63 | #endif
64 |
65 | #if LIBAVUTIL_VERSION_MAJOR < 51
66 | # define FF_INTERNAL_MEM_TYPE unsigned int
67 | #else
68 | # define FF_INTERNAL_MEM_TYPE size_t
69 | #endif
70 |
71 | /**
72 | * Allocate a block of size bytes with alignment suitable for all
73 | * memory accesses (including vectors if available on the CPU).
74 | * @param size Size in bytes for the memory block to be allocated.
75 | * @return Pointer to the allocated block, NULL if the block cannot
76 | * be allocated.
77 | * @see av_mallocz()
78 | */
79 | void *av_malloc(FF_INTERNAL_MEM_TYPE size) av_malloc_attrib av_alloc_size(1);
80 |
81 | /**
82 | * Allocate or reallocate a block of memory.
83 | * If ptr is NULL and size > 0, allocate a new block. If
84 | * size is zero, free the memory block pointed to by ptr.
85 | * @param size Size in bytes for the memory block to be allocated or
86 | * reallocated.
87 | * @param ptr Pointer to a memory block already allocated with
88 | * av_malloc(z)() or av_realloc() or NULL.
89 | * @return Pointer to a newly reallocated block or NULL if the block
90 | * cannot be reallocated or the function is used to free the memory block.
91 | * @see av_fast_realloc()
92 | */
93 | void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) av_alloc_size(2);
94 |
95 | /**
96 | * Free a memory block which has been allocated with av_malloc(z)() or
97 | * av_realloc().
98 | * @param ptr Pointer to the memory block which should be freed.
99 | * @note ptr = NULL is explicitly allowed.
100 | * @note It is recommended that you use av_freep() instead.
101 | * @see av_freep()
102 | */
103 | void av_free(void *ptr);
104 |
105 | /**
106 | * Allocate a block of size bytes with alignment suitable for all
107 | * memory accesses (including vectors if available on the CPU) and
108 | * zero all the bytes of the block.
109 | * @param size Size in bytes for the memory block to be allocated.
110 | * @return Pointer to the allocated block, NULL if it cannot be allocated.
111 | * @see av_malloc()
112 | */
113 | void *av_mallocz(FF_INTERNAL_MEM_TYPE size) av_malloc_attrib av_alloc_size(1);
114 |
115 | /**
116 | * Duplicate the string s.
117 | * @param s string to be duplicated
118 | * @return Pointer to a newly allocated string containing a
119 | * copy of s or NULL if the string cannot be allocated.
120 | */
121 | char *av_strdup(const char *s) av_malloc_attrib;
122 |
123 | /**
124 | * Free a memory block which has been allocated with av_malloc(z)() or
125 | * av_realloc() and set the pointer pointing to it to NULL.
126 | * @param ptr Pointer to the pointer to the memory block which should
127 | * be freed.
128 | * @see av_free()
129 | */
130 | void av_freep(void *ptr);
131 |
132 | #endif /* AVUTIL_MEM_H */
133 |
--------------------------------------------------------------------------------
/jni/include/libavutil/opt.h:
--------------------------------------------------------------------------------
1 | /*
2 | * AVOptions
3 | * copyright (c) 2005 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_OPT_H
23 | #define AVUTIL_OPT_H
24 |
25 | /**
26 | * @file
27 | * AVOptions
28 | */
29 |
30 | #include "rational.h"
31 | #include "avutil.h"
32 |
33 | enum AVOptionType{
34 | FF_OPT_TYPE_FLAGS,
35 | FF_OPT_TYPE_INT,
36 | FF_OPT_TYPE_INT64,
37 | FF_OPT_TYPE_DOUBLE,
38 | FF_OPT_TYPE_FLOAT,
39 | FF_OPT_TYPE_STRING,
40 | FF_OPT_TYPE_RATIONAL,
41 | FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length
42 | FF_OPT_TYPE_CONST=128,
43 | };
44 |
45 | /**
46 | * AVOption
47 | */
48 | typedef struct AVOption {
49 | const char *name;
50 |
51 | /**
52 | * short English help text
53 | * @todo What about other languages?
54 | */
55 | const char *help;
56 |
57 | /**
58 | * The offset relative to the context structure where the option
59 | * value is stored. It should be 0 for named constants.
60 | */
61 | int offset;
62 | enum AVOptionType type;
63 |
64 | /**
65 | * the default value for scalar options
66 | */
67 | double default_val;
68 | double min; ///< minimum valid value for the option
69 | double max; ///< maximum valid value for the option
70 |
71 | int flags;
72 | #define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding
73 | #define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding
74 | #define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ...
75 | #define AV_OPT_FLAG_AUDIO_PARAM 8
76 | #define AV_OPT_FLAG_VIDEO_PARAM 16
77 | #define AV_OPT_FLAG_SUBTITLE_PARAM 32
78 | //FIXME think about enc-audio, ... style flags
79 |
80 | /**
81 | * The logical unit to which the option belongs. Non-constant
82 | * options and corresponding named constants share the same
83 | * unit. May be NULL.
84 | */
85 | const char *unit;
86 | } AVOption;
87 |
88 | /**
89 | * AVOption2.
90 | * THIS IS NOT PART OF THE API/ABI YET!
91 | * This is identical to AVOption except that default_val was replaced by
92 | * an union, it should be compatible with AVOption on normal platforms.
93 | */
94 | typedef struct AVOption2 {
95 | const char *name;
96 |
97 | /**
98 | * short English help text
99 | * @todo What about other languages?
100 | */
101 | const char *help;
102 |
103 | /**
104 | * The offset relative to the context structure where the option
105 | * value is stored. It should be 0 for named constants.
106 | */
107 | int offset;
108 | enum AVOptionType type;
109 |
110 | /**
111 | * the default value for scalar options
112 | */
113 | union {
114 | double dbl;
115 | const char *str;
116 | } default_val;
117 |
118 | double min; ///< minimum valid value for the option
119 | double max; ///< maximum valid value for the option
120 |
121 | int flags;
122 | /*
123 | #define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding
124 | #define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding
125 | #define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ...
126 | #define AV_OPT_FLAG_AUDIO_PARAM 8
127 | #define AV_OPT_FLAG_VIDEO_PARAM 16
128 | #define AV_OPT_FLAG_SUBTITLE_PARAM 32
129 | */
130 | //FIXME think about enc-audio, ... style flags
131 |
132 | /**
133 | * The logical unit to which the option belongs. Non-constant
134 | * options and corresponding named constants share the same
135 | * unit. May be NULL.
136 | */
137 | const char *unit;
138 | } AVOption2;
139 |
140 |
141 | /**
142 | * Look for an option in obj. Look only for the options which
143 | * have the flags set as specified in mask and flags (that is,
144 | * for which it is the case that opt->flags & mask == flags).
145 | *
146 | * @param[in] obj a pointer to a struct whose first element is a
147 | * pointer to an AVClass
148 | * @param[in] name the name of the option to look for
149 | * @param[in] unit the unit of the option to look for, or any if NULL
150 | * @return a pointer to the option found, or NULL if no option
151 | * has been found
152 | */
153 | const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags);
154 |
155 | /**
156 | * Set the field of obj with the given name to value.
157 | *
158 | * @param[in] obj A struct whose first element is a pointer to an
159 | * AVClass.
160 | * @param[in] name the name of the field to set
161 | * @param[in] val The value to set. If the field is not of a string
162 | * type, then the given string is parsed.
163 | * SI postfixes and some named scalars are supported.
164 | * If the field is of a numeric type, it has to be a numeric or named
165 | * scalar. Behavior with more than one scalar and +- infix operators
166 | * is undefined.
167 | * If the field is of a flags type, it has to be a sequence of numeric
168 | * scalars or named flags separated by '+' or '-'. Prefixing a flag
169 | * with '+' causes it to be set without affecting the other flags;
170 | * similarly, '-' unsets a flag.
171 | * @param[out] o_out if non-NULL put here a pointer to the AVOption
172 | * found
173 | * @param alloc when 1 then the old value will be av_freed() and the
174 | * new av_strduped()
175 | * when 0 then no av_free() nor av_strdup() will be used
176 | * @return 0 if the value has been set, or an AVERROR code in case of
177 | * error:
178 | * AVERROR(ENOENT) if no matching option exists
179 | * AVERROR(ERANGE) if the value is out of range
180 | * AVERROR(EINVAL) if the value is not valid
181 | */
182 | int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out);
183 |
184 | const AVOption *av_set_double(void *obj, const char *name, double n);
185 | const AVOption *av_set_q(void *obj, const char *name, AVRational n);
186 | const AVOption *av_set_int(void *obj, const char *name, int64_t n);
187 | double av_get_double(void *obj, const char *name, const AVOption **o_out);
188 | AVRational av_get_q(void *obj, const char *name, const AVOption **o_out);
189 | int64_t av_get_int(void *obj, const char *name, const AVOption **o_out);
190 | const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len);
191 | const AVOption *av_next_option(void *obj, const AVOption *last);
192 |
193 | /**
194 | * Show the obj options.
195 | *
196 | * @param req_flags requested flags for the options to show. Show only the
197 | * options for which it is opt->flags & req_flags.
198 | * @param rej_flags rejected flags for the options to show. Show only the
199 | * options for which it is !(opt->flags & req_flags).
200 | * @param av_log_obj log context to use for showing the options
201 | */
202 | int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
203 |
204 | void av_opt_set_defaults(void *s);
205 | void av_opt_set_defaults2(void *s, int mask, int flags);
206 |
207 | /**
208 | * Parse the key/value pairs list in opts. For each key/value pair
209 | * found, stores the value in the field in ctx that is named like the
210 | * key. ctx must be an AVClass context, storing is done using
211 | * AVOptions.
212 | *
213 | * @param key_val_sep a 0-terminated list of characters used to
214 | * separate key from value
215 | * @param pairs_sep a 0-terminated list of characters used to separate
216 | * two pairs from each other
217 | * @return the number of successfully set key/value pairs, or a negative
218 | * value corresponding to an AVERROR code in case of error:
219 | * AVERROR(EINVAL) if opts cannot be parsed,
220 | * the error code issued by av_set_string3() if a key/value pair
221 | * cannot be set
222 | */
223 | int av_set_options_string(void *ctx, const char *opts,
224 | const char *key_val_sep, const char *pairs_sep);
225 |
226 | #endif /* AVUTIL_OPT_H */
227 |
--------------------------------------------------------------------------------
/jni/include/libavutil/pixdesc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * pixel format descriptor
3 | * Copyright (c) 2009 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_PIXDESC_H
23 | #define AVUTIL_PIXDESC_H
24 |
25 | #include
26 |
27 | typedef struct AVComponentDescriptor{
28 | uint16_t plane :2; ///< which of the 4 planes contains the component
29 |
30 | /**
31 | * Number of elements between 2 horizontally consecutive pixels minus 1.
32 | * Elements are bits for bitstream formats, bytes otherwise.
33 | */
34 | uint16_t step_minus1 :3;
35 |
36 | /**
37 | * Number of elements before the component of the first pixel plus 1.
38 | * Elements are bits for bitstream formats, bytes otherwise.
39 | */
40 | uint16_t offset_plus1 :3;
41 | uint16_t shift :3; ///< number of least significant bits that must be shifted away to get the value
42 | uint16_t depth_minus1 :4; ///< number of bits in the component minus 1
43 | }AVComponentDescriptor;
44 |
45 | /**
46 | * Descriptor that unambiguously describes how the bits of a pixel are
47 | * stored in the up to 4 data planes of an image. It also stores the
48 | * subsampling factors and number of components.
49 | *
50 | * @note This is separate of the colorspace (RGB, YCbCr, YPbPr, JPEG-style YUV
51 | * and all the YUV variants) AVPixFmtDescriptor just stores how values
52 | * are stored not what these values represent.
53 | */
54 | typedef struct AVPixFmtDescriptor{
55 | const char *name;
56 | uint8_t nb_components; ///< The number of components each pixel has, (1-4)
57 |
58 | /**
59 | * Amount to shift the luma width right to find the chroma width.
60 | * For YV12 this is 1 for example.
61 | * chroma_width = -((-luma_width) >> log2_chroma_w)
62 | * The note above is needed to ensure rounding up.
63 | * This value only refers to the chroma components.
64 | */
65 | uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w)
66 |
67 | /**
68 | * Amount to shift the luma height right to find the chroma height.
69 | * For YV12 this is 1 for example.
70 | * chroma_height= -((-luma_height) >> log2_chroma_h)
71 | * The note above is needed to ensure rounding up.
72 | * This value only refers to the chroma components.
73 | */
74 | uint8_t log2_chroma_h;
75 | uint8_t flags;
76 |
77 | /**
78 | * Parameters that describe how pixels are packed. If the format
79 | * has chroma components, they must be stored in comp[1] and
80 | * comp[2].
81 | */
82 | AVComponentDescriptor comp[4];
83 | }AVPixFmtDescriptor;
84 |
85 | #define PIX_FMT_BE 1 ///< Pixel format is big-endian.
86 | #define PIX_FMT_PAL 2 ///< Pixel format has a palette in data[1], values are indexes in this palette.
87 | #define PIX_FMT_BITSTREAM 4 ///< All values of a component are bit-wise packed end to end.
88 | #define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format.
89 |
90 | /**
91 | * The array of all the pixel format descriptors.
92 | */
93 | extern const AVPixFmtDescriptor av_pix_fmt_descriptors[];
94 |
95 | /**
96 | * Read a line from an image, and write the values of the
97 | * pixel format component c to dst.
98 | *
99 | * @param data the array containing the pointers to the planes of the image
100 | * @param linesize the array containing the linesizes of the image
101 | * @param desc the pixel format descriptor for the image
102 | * @param x the horizontal coordinate of the first pixel to read
103 | * @param y the vertical coordinate of the first pixel to read
104 | * @param w the width of the line to read, that is the number of
105 | * values to write to dst
106 | * @param read_pal_component if not zero and the format is a paletted
107 | * format writes the values corresponding to the palette
108 | * component c in data[1] to dst, rather than the palette indexes in
109 | * data[0]. The behavior is undefined if the format is not paletted.
110 | */
111 | void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4],
112 | const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component);
113 |
114 | /**
115 | * Write the values from src to the pixel format component c of an
116 | * image line.
117 | *
118 | * @param src array containing the values to write
119 | * @param data the array containing the pointers to the planes of the
120 | * image to write into. It is supposed to be zeroed.
121 | * @param linesize the array containing the linesizes of the image
122 | * @param desc the pixel format descriptor for the image
123 | * @param x the horizontal coordinate of the first pixel to write
124 | * @param y the vertical coordinate of the first pixel to write
125 | * @param w the width of the line to write, that is the number of
126 | * values to write to the image line
127 | */
128 | void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4],
129 | const AVPixFmtDescriptor *desc, int x, int y, int c, int w);
130 |
131 | /**
132 | * Return the pixel format corresponding to name.
133 | *
134 | * If there is no pixel format with name name, then looks for a
135 | * pixel format with the name corresponding to the native endian
136 | * format of name.
137 | * For example in a little-endian system, first looks for "gray16",
138 | * then for "gray16le".
139 | *
140 | * Finally if no pixel format has been found, returns PIX_FMT_NONE.
141 | */
142 | enum PixelFormat av_get_pix_fmt(const char *name);
143 |
144 | /**
145 | * Print in buf the string corresponding to the pixel format with
146 | * number pix_fmt, or an header if pix_fmt is negative.
147 | *
148 | * @param buf the buffer where to write the string
149 | * @param buf_size the size of buf
150 | * @param pix_fmt the number of the pixel format to print the
151 | * corresponding info string, or a negative value to print the
152 | * corresponding header.
153 | */
154 | char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt);
155 |
156 | /**
157 | * Return the number of bits per pixel used by the pixel format
158 | * described by pixdesc.
159 | *
160 | * The returned number of bits refers to the number of bits actually
161 | * used for storing the pixel information, that is padding bits are
162 | * not counted.
163 | */
164 | int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc);
165 |
166 | #endif /* AVUTIL_PIXDESC_H */
167 |
--------------------------------------------------------------------------------
/jni/include/libavutil/pixfmt.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_PIXFMT_H
22 | #define AVUTIL_PIXFMT_H
23 |
24 | /**
25 | * @file
26 | * pixel format definitions
27 | *
28 | * @warning This file has to be considered an internal but installed
29 | * header, so it should not be directly included in your projects.
30 | */
31 |
32 | #include "libavutil/avconfig.h"
33 |
34 | /**
35 | * Pixel format. Notes:
36 | *
37 | * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA
38 | * color is put together as:
39 | * (A << 24) | (R << 16) | (G << 8) | B
40 | * This is stored as BGRA on little-endian CPU architectures and ARGB on
41 | * big-endian CPUs.
42 | *
43 | * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized
44 | * image data is stored in AVFrame.data[0]. The palette is transported in
45 | * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is
46 | * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is
47 | * also endian-specific). Note also that the individual RGB palette
48 | * components stored in AVFrame.data[1] should be in the range 0..255.
49 | * This is important as many custom PAL8 video codecs that were designed
50 | * to run on the IBM VGA graphics adapter use 6-bit palette components.
51 | *
52 | * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like
53 | * for pal8. This palette is filled in automatically by the function
54 | * allocating the picture.
55 | *
56 | * Note, make sure that all newly added big endian formats have pix_fmt&1==1
57 | * and that all newly added little endian formats have pix_fmt&1==0
58 | * this allows simpler detection of big vs little endian.
59 | */
60 | enum PixelFormat {
61 | PIX_FMT_NONE= -1,
62 | PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
63 | PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
64 | PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
65 | PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
66 | PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
67 | PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
68 | PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
69 | PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
70 | PIX_FMT_GRAY8, ///< Y , 8bpp
71 | PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
72 | PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
73 | PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette
74 | PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
75 | PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
76 | PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range
77 | PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
78 | PIX_FMT_XVMC_MPEG2_IDCT,
79 | PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
80 | PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
81 | PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
82 | PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
83 | PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
84 | PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
85 | PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
86 | PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
87 | PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
88 | PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
89 |
90 | PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
91 | PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
92 | PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
93 | PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
94 |
95 | PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
96 | PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
97 | PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
98 | PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range
99 | PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
100 | PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
101 | PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
102 | PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
103 | PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
104 | PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
105 | PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
106 | PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
107 |
108 | PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
109 | PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
110 | PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0
111 | PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0
112 |
113 | PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
114 | PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
115 | PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1
116 | PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1
117 |
118 | PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
119 | PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
120 | PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
121 |
122 | PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
123 | PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
124 | PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
125 | PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
126 | PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
127 | PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
128 | PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
129 | PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
130 |
131 | PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
132 | PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
133 | PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1
134 | PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
135 | PIX_FMT_Y400A, ///< 8bit gray, 8bit alpha
136 | PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
137 | };
138 |
139 | #if AV_HAVE_BIGENDIAN
140 | # define PIX_FMT_NE(be, le) PIX_FMT_##be
141 | #else
142 | # define PIX_FMT_NE(be, le) PIX_FMT_##le
143 | #endif
144 |
145 | #define PIX_FMT_RGB32 PIX_FMT_NE(ARGB, BGRA)
146 | #define PIX_FMT_RGB32_1 PIX_FMT_NE(RGBA, ABGR)
147 | #define PIX_FMT_BGR32 PIX_FMT_NE(ABGR, RGBA)
148 | #define PIX_FMT_BGR32_1 PIX_FMT_NE(BGRA, ARGB)
149 |
150 | #define PIX_FMT_GRAY16 PIX_FMT_NE(GRAY16BE, GRAY16LE)
151 | #define PIX_FMT_RGB48 PIX_FMT_NE(RGB48BE, RGB48LE)
152 | #define PIX_FMT_RGB565 PIX_FMT_NE(RGB565BE, RGB565LE)
153 | #define PIX_FMT_RGB555 PIX_FMT_NE(RGB555BE, RGB555LE)
154 | #define PIX_FMT_RGB444 PIX_FMT_NE(RGB444BE, RGB444LE)
155 | #define PIX_FMT_BGR565 PIX_FMT_NE(BGR565BE, BGR565LE)
156 | #define PIX_FMT_BGR555 PIX_FMT_NE(BGR555BE, BGR555LE)
157 | #define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE)
158 |
159 | #define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
160 | #define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
161 | #define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
162 |
163 | #endif /* AVUTIL_PIXFMT_H */
164 |
--------------------------------------------------------------------------------
/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 | /**
27 | * Get a seed to use in conjunction with random functions.
28 | */
29 | uint32_t av_get_random_seed(void);
30 |
31 | #endif /* AVUTIL_RANDOM_SEED_H */
32 |
--------------------------------------------------------------------------------
/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 | * rational number numerator/denominator
37 | */
38 | typedef struct AVRational{
39 | int num; ///< numerator
40 | int den; ///< denominator
41 | } AVRational;
42 |
43 | /**
44 | * Compare two rationals.
45 | * @param a first rational
46 | * @param b second rational
47 | * @return 0 if a==b, 1 if a>b, -1 if a>63)|1;
54 | else if(b.den && a.den) return 0;
55 | else if(a.num && b.num) return (a.num>>31) - (b.num>>31);
56 | else return INT_MIN;
57 | }
58 |
59 | /**
60 | * Convert rational to double.
61 | * @param a rational to convert
62 | * @return (double) a
63 | */
64 | static inline double av_q2d(AVRational a){
65 | return a.num / (double) a.den;
66 | }
67 |
68 | /**
69 | * Reduce a fraction.
70 | * This is useful for framerate calculations.
71 | * @param dst_num destination numerator
72 | * @param dst_den destination denominator
73 | * @param num source numerator
74 | * @param den source denominator
75 | * @param max the maximum allowed for dst_num & dst_den
76 | * @return 1 if exact, 0 otherwise
77 | */
78 | int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max);
79 |
80 | /**
81 | * Multiply two rationals.
82 | * @param b first rational
83 | * @param c second rational
84 | * @return b*c
85 | */
86 | AVRational av_mul_q(AVRational b, AVRational c) av_const;
87 |
88 | /**
89 | * Divide one rational by another.
90 | * @param b first rational
91 | * @param c second rational
92 | * @return b/c
93 | */
94 | AVRational av_div_q(AVRational b, AVRational c) av_const;
95 |
96 | /**
97 | * Add two rationals.
98 | * @param b first rational
99 | * @param c second rational
100 | * @return b+c
101 | */
102 | AVRational av_add_q(AVRational b, AVRational c) av_const;
103 |
104 | /**
105 | * Subtract one rational from another.
106 | * @param b first rational
107 | * @param c second rational
108 | * @return b-c
109 | */
110 | AVRational av_sub_q(AVRational b, AVRational c) av_const;
111 |
112 | /**
113 | * Convert a double precision floating point number to a rational.
114 | * inf is expressed as {1,0} or {-1,0} depending on the sign.
115 | *
116 | * @param d double to convert
117 | * @param max the maximum allowed numerator and denominator
118 | * @return (AVRational) d
119 | */
120 | AVRational av_d2q(double d, int max) av_const;
121 |
122 | /**
123 | * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer
124 | * than q1, 0 if they have the same distance.
125 | */
126 | int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
127 |
128 | /**
129 | * Find the nearest value in q_list to q.
130 | * @param q_list an array of rationals terminated by {0, 0}
131 | * @return the index of the nearest value found in the array
132 | */
133 | int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
134 |
135 | #endif /* AVUTIL_RATIONAL_H */
136 |
--------------------------------------------------------------------------------
/jni/include/libavutil/sha1.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_SHA1_H
22 | #define AVUTIL_SHA1_H
23 |
24 | #include
25 |
26 | extern const int av_sha1_size;
27 |
28 | struct AVSHA1;
29 |
30 | /**
31 | * Initialize SHA-1 hashing.
32 | *
33 | * @param context pointer to the function context (of size av_sha_size)
34 | * @deprecated use av_sha_init() instead
35 | */
36 | void av_sha1_init(struct AVSHA1* context);
37 |
38 | /**
39 | * Update hash value.
40 | *
41 | * @param context hash function context
42 | * @param data input data to update hash with
43 | * @param len input data length
44 | * @deprecated use av_sha_update() instead
45 | */
46 | void av_sha1_update(struct AVSHA1* context, const uint8_t* data, unsigned int len);
47 |
48 | /**
49 | * Finish hashing and output digest value.
50 | *
51 | * @param context hash function context
52 | * @param digest buffer where output digest value is stored
53 | * @deprecated use av_sha_final() instead
54 | */
55 | void av_sha1_final(struct AVSHA1* context, uint8_t digest[20]);
56 |
57 | #endif /* AVUTIL_SHA1_H */
58 |
--------------------------------------------------------------------------------
/jni/include/libswscale/swscale.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2001-2003 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 SWSCALE_SWSCALE_H
22 | #define SWSCALE_SWSCALE_H
23 |
24 | /**
25 | * @file
26 | * @brief
27 | * external api for the swscale stuff
28 | */
29 |
30 | #include "libavutil/avutil.h"
31 |
32 | #define LIBSWSCALE_VERSION_MAJOR 0
33 | #define LIBSWSCALE_VERSION_MINOR 12
34 | #define LIBSWSCALE_VERSION_MICRO 0
35 |
36 | #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
37 | LIBSWSCALE_VERSION_MINOR, \
38 | LIBSWSCALE_VERSION_MICRO)
39 | #define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \
40 | LIBSWSCALE_VERSION_MINOR, \
41 | LIBSWSCALE_VERSION_MICRO)
42 | #define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT
43 |
44 | #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
45 |
46 | /**
47 | * Those FF_API_* defines are not part of public API.
48 | * They may change, break or disappear at any time.
49 | */
50 | #ifndef FF_API_SWS_GETCONTEXT
51 | #define FF_API_SWS_GETCONTEXT (LIBSWSCALE_VERSION_MAJOR < 1)
52 | #endif
53 |
54 | /**
55 | * Returns the LIBSWSCALE_VERSION_INT constant.
56 | */
57 | unsigned swscale_version(void);
58 |
59 | /**
60 | * Returns the libswscale build-time configuration.
61 | */
62 | const char *swscale_configuration(void);
63 |
64 | /**
65 | * Returns the libswscale license.
66 | */
67 | const char *swscale_license(void);
68 |
69 | /* values for the flags, the stuff on the command line is different */
70 | #define SWS_FAST_BILINEAR 1
71 | #define SWS_BILINEAR 2
72 | #define SWS_BICUBIC 4
73 | #define SWS_X 8
74 | #define SWS_POINT 0x10
75 | #define SWS_AREA 0x20
76 | #define SWS_BICUBLIN 0x40
77 | #define SWS_GAUSS 0x80
78 | #define SWS_SINC 0x100
79 | #define SWS_LANCZOS 0x200
80 | #define SWS_SPLINE 0x400
81 |
82 | #define SWS_SRC_V_CHR_DROP_MASK 0x30000
83 | #define SWS_SRC_V_CHR_DROP_SHIFT 16
84 |
85 | #define SWS_PARAM_DEFAULT 123456
86 |
87 | #define SWS_PRINT_INFO 0x1000
88 |
89 | //the following 3 flags are not completely implemented
90 | //internal chrominace subsampling info
91 | #define SWS_FULL_CHR_H_INT 0x2000
92 | //input subsampling info
93 | #define SWS_FULL_CHR_H_INP 0x4000
94 | #define SWS_DIRECT_BGR 0x8000
95 | #define SWS_ACCURATE_RND 0x40000
96 | #define SWS_BITEXACT 0x80000
97 |
98 | #define SWS_CPU_CAPS_MMX 0x80000000
99 | #define SWS_CPU_CAPS_MMX2 0x20000000
100 | #define SWS_CPU_CAPS_3DNOW 0x40000000
101 | #define SWS_CPU_CAPS_ALTIVEC 0x10000000
102 | #define SWS_CPU_CAPS_BFIN 0x01000000
103 | #define SWS_CPU_CAPS_SSE2 0x02000000
104 |
105 | #define SWS_MAX_REDUCE_CUTOFF 0.002
106 |
107 | #define SWS_CS_ITU709 1
108 | #define SWS_CS_FCC 4
109 | #define SWS_CS_ITU601 5
110 | #define SWS_CS_ITU624 5
111 | #define SWS_CS_SMPTE170M 5
112 | #define SWS_CS_SMPTE240M 7
113 | #define SWS_CS_DEFAULT 5
114 |
115 | /**
116 | * Returns a pointer to yuv<->rgb coefficients for the given colorspace
117 | * suitable for sws_setColorspaceDetails().
118 | *
119 | * @param colorspace One of the SWS_CS_* macros. If invalid,
120 | * SWS_CS_DEFAULT is used.
121 | */
122 | const int *sws_getCoefficients(int colorspace);
123 |
124 |
125 | // when used for filters they must have an odd number of elements
126 | // coeffs cannot be shared between vectors
127 | typedef struct {
128 | double *coeff; ///< pointer to the list of coefficients
129 | int length; ///< number of coefficients in the vector
130 | } SwsVector;
131 |
132 | // vectors can be shared
133 | typedef struct {
134 | SwsVector *lumH;
135 | SwsVector *lumV;
136 | SwsVector *chrH;
137 | SwsVector *chrV;
138 | } SwsFilter;
139 |
140 | struct SwsContext;
141 |
142 | /**
143 | * Returns a positive value if pix_fmt is a supported input format, 0
144 | * otherwise.
145 | */
146 | int sws_isSupportedInput(enum PixelFormat pix_fmt);
147 |
148 | /**
149 | * Returns a positive value if pix_fmt is a supported output format, 0
150 | * otherwise.
151 | */
152 | int sws_isSupportedOutput(enum PixelFormat pix_fmt);
153 |
154 | /**
155 | * Allocates an empty SwsContext. This must be filled and passed to
156 | * sws_init_context(). For filling see AVOptions, options.c and
157 | * sws_setColorspaceDetails().
158 | */
159 | struct SwsContext *sws_alloc_context(void);
160 |
161 | /**
162 | * Initializes the swscaler context sws_context.
163 | *
164 | * @return zero or positive value on success, a negative value on
165 | * error
166 | */
167 | int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter);
168 |
169 | /**
170 | * Frees the swscaler context swsContext.
171 | * If swsContext is NULL, then does nothing.
172 | */
173 | void sws_freeContext(struct SwsContext *swsContext);
174 |
175 | #if FF_API_SWS_GETCONTEXT
176 | /**
177 | * Allocates and returns a SwsContext. You need it to perform
178 | * scaling/conversion operations using sws_scale().
179 | *
180 | * @param srcW the width of the source image
181 | * @param srcH the height of the source image
182 | * @param srcFormat the source image format
183 | * @param dstW the width of the destination image
184 | * @param dstH the height of the destination image
185 | * @param dstFormat the destination image format
186 | * @param flags specify which algorithm and options to use for rescaling
187 | * @return a pointer to an allocated context, or NULL in case of error
188 | * @deprecated use sws_alloc_context() and sws_init_context()
189 | */
190 | attribute_deprecated
191 | struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
192 | int dstW, int dstH, enum PixelFormat dstFormat,
193 | int flags, SwsFilter *srcFilter,
194 | SwsFilter *dstFilter, const double *param);
195 | #endif
196 |
197 | /**
198 | * Scales the image slice in srcSlice and puts the resulting scaled
199 | * slice in the image in dst. A slice is a sequence of consecutive
200 | * rows in an image.
201 | *
202 | * Slices have to be provided in sequential order, either in
203 | * top-bottom or bottom-top order. If slices are provided in
204 | * non-sequential order the behavior of the function is undefined.
205 | *
206 | * @param context the scaling context previously created with
207 | * sws_getContext()
208 | * @param srcSlice the array containing the pointers to the planes of
209 | * the source slice
210 | * @param srcStride the array containing the strides for each plane of
211 | * the source image
212 | * @param srcSliceY the position in the source image of the slice to
213 | * process, that is the number (counted starting from
214 | * zero) in the image of the first row of the slice
215 | * @param srcSliceH the height of the source slice, that is the number
216 | * of rows in the slice
217 | * @param dst the array containing the pointers to the planes of
218 | * the destination image
219 | * @param dstStride the array containing the strides for each plane of
220 | * the destination image
221 | * @return the height of the output slice
222 | */
223 | int sws_scale(struct SwsContext *context, const uint8_t* const srcSlice[], const int srcStride[],
224 | int srcSliceY, int srcSliceH, uint8_t* const dst[], const int dstStride[]);
225 |
226 | #if LIBSWSCALE_VERSION_MAJOR < 1
227 | /**
228 | * @deprecated Use sws_scale() instead.
229 | */
230 | int sws_scale_ordered(struct SwsContext *context, const uint8_t* const src[],
231 | int srcStride[], int srcSliceY, int srcSliceH,
232 | uint8_t* dst[], int dstStride[]) attribute_deprecated;
233 | #endif
234 |
235 | /**
236 | * @param inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x]
237 | * @param fullRange if 1 then the luma range is 0..255 if 0 it is 16..235
238 | * @return -1 if not supported
239 | */
240 | int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
241 | int srcRange, const int table[4], int dstRange,
242 | int brightness, int contrast, int saturation);
243 |
244 | /**
245 | * @return -1 if not supported
246 | */
247 | int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table,
248 | int *srcRange, int **table, int *dstRange,
249 | int *brightness, int *contrast, int *saturation);
250 |
251 | /**
252 | * Allocates and returns an uninitialized vector with length coefficients.
253 | */
254 | SwsVector *sws_allocVec(int length);
255 |
256 | /**
257 | * Returns a normalized Gaussian curve used to filter stuff
258 | * quality=3 is high quality, lower is lower quality.
259 | */
260 | SwsVector *sws_getGaussianVec(double variance, double quality);
261 |
262 | /**
263 | * Allocates and returns a vector with length coefficients, all
264 | * with the same value c.
265 | */
266 | SwsVector *sws_getConstVec(double c, int length);
267 |
268 | /**
269 | * Allocates and returns a vector with just one coefficient, with
270 | * value 1.0.
271 | */
272 | SwsVector *sws_getIdentityVec(void);
273 |
274 | /**
275 | * Scales all the coefficients of a by the scalar value.
276 | */
277 | void sws_scaleVec(SwsVector *a, double scalar);
278 |
279 | /**
280 | * Scales all the coefficients of a so that their sum equals height.
281 | */
282 | void sws_normalizeVec(SwsVector *a, double height);
283 | void sws_convVec(SwsVector *a, SwsVector *b);
284 | void sws_addVec(SwsVector *a, SwsVector *b);
285 | void sws_subVec(SwsVector *a, SwsVector *b);
286 | void sws_shiftVec(SwsVector *a, int shift);
287 |
288 | /**
289 | * Allocates and returns a clone of the vector a, that is a vector
290 | * with the same coefficients as a.
291 | */
292 | SwsVector *sws_cloneVec(SwsVector *a);
293 |
294 | #if LIBSWSCALE_VERSION_MAJOR < 1
295 | /**
296 | * @deprecated Use sws_printVec2() instead.
297 | */
298 | attribute_deprecated void sws_printVec(SwsVector *a);
299 | #endif
300 |
301 | /**
302 | * Prints with av_log() a textual representation of the vector a
303 | * if log_level <= av_log_level.
304 | */
305 | void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level);
306 |
307 | void sws_freeVec(SwsVector *a);
308 |
309 | SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
310 | float lumaSharpen, float chromaSharpen,
311 | float chromaHShift, float chromaVShift,
312 | int verbose);
313 | void sws_freeFilter(SwsFilter *filter);
314 |
315 | /**
316 | * Checks if context can be reused, otherwise reallocates a new
317 | * one.
318 | *
319 | * If context is NULL, just calls sws_getContext() to get a new
320 | * context. Otherwise, checks if the parameters are the ones already
321 | * saved in context. If that is the case, returns the current
322 | * context. Otherwise, frees context and gets a new context with
323 | * the new parameters.
324 | *
325 | * Be warned that srcFilter and dstFilter are not checked, they
326 | * are assumed to remain the same.
327 | */
328 | struct SwsContext *sws_getCachedContext(struct SwsContext *context,
329 | int srcW, int srcH, enum PixelFormat srcFormat,
330 | int dstW, int dstH, enum PixelFormat dstFormat,
331 | int flags, SwsFilter *srcFilter,
332 | SwsFilter *dstFilter, const double *param);
333 |
334 | /**
335 | * Converts an 8bit paletted frame into a frame with a color depth of 32-bits.
336 | *
337 | * The output frame will have the same packed format as the palette.
338 | *
339 | * @param src source frame buffer
340 | * @param dst destination frame buffer
341 | * @param num_pixels number of pixels to convert
342 | * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
343 | */
344 | void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
345 |
346 | /**
347 | * Converts an 8bit paletted frame into a frame with a color depth of 24 bits.
348 | *
349 | * With the palette format "ABCD", the destination frame ends up with the format "ABC".
350 | *
351 | * @param src source frame buffer
352 | * @param dst destination frame buffer
353 | * @param num_pixels number of pixels to convert
354 | * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
355 | */
356 | void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
357 |
358 |
359 | #endif /* SWSCALE_SWSCALE_H */
360 |
--------------------------------------------------------------------------------
/jni/libavcodec.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/churnlabs/android-ffmpeg-sample/65c91266de1b90f7fc68dc34696eeff7ef19efce/jni/libavcodec.a
--------------------------------------------------------------------------------
/jni/libavcore.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/churnlabs/android-ffmpeg-sample/65c91266de1b90f7fc68dc34696eeff7ef19efce/jni/libavcore.a
--------------------------------------------------------------------------------
/jni/libavdevice.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/churnlabs/android-ffmpeg-sample/65c91266de1b90f7fc68dc34696eeff7ef19efce/jni/libavdevice.a
--------------------------------------------------------------------------------
/jni/libavfilter.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/churnlabs/android-ffmpeg-sample/65c91266de1b90f7fc68dc34696eeff7ef19efce/jni/libavfilter.a
--------------------------------------------------------------------------------
/jni/libavformat.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/churnlabs/android-ffmpeg-sample/65c91266de1b90f7fc68dc34696eeff7ef19efce/jni/libavformat.a
--------------------------------------------------------------------------------
/jni/libavutil.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/churnlabs/android-ffmpeg-sample/65c91266de1b90f7fc68dc34696eeff7ef19efce/jni/libavutil.a
--------------------------------------------------------------------------------
/jni/libswscale.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/churnlabs/android-ffmpeg-sample/65c91266de1b90f7fc68dc34696eeff7ef19efce/jni/libswscale.a
--------------------------------------------------------------------------------
/jni/native.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 - Churn Labs, LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /*
18 | * This is mostly based off of the FFMPEG tutorial:
19 | * http://dranger.com/ffmpeg/
20 | * With a few updates to support Android output mechanisms and to update
21 | * places where the APIs have shifted.
22 | */
23 |
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 |
30 | #include
31 | #include
32 | #include
33 |
34 | #define LOG_TAG "FFMPEGSample"
35 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
36 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
37 |
38 |
39 | /* Cheat to keep things simple and just use some globals. */
40 | AVFormatContext *pFormatCtx;
41 | AVCodecContext *pCodecCtx;
42 | AVFrame *pFrame;
43 | AVFrame *pFrameRGB;
44 | int videoStream;
45 |
46 |
47 | /*
48 | * Write a frame worth of video (in pFrame) into the Android bitmap
49 | * described by info using the raw pixel buffer. It's a very inefficient
50 | * draw routine, but it's easy to read. Relies on the format of the
51 | * bitmap being 8bits per color component plus an 8bit alpha channel.
52 | */
53 |
54 | static void fill_bitmap(AndroidBitmapInfo* info, void *pixels, AVFrame *pFrame)
55 | {
56 | uint8_t *frameLine;
57 |
58 | int yy;
59 | for (yy = 0; yy < info->height; yy++) {
60 | uint8_t* line = (uint8_t*)pixels;
61 | frameLine = (uint8_t *)pFrame->data[0] + (yy * pFrame->linesize[0]);
62 |
63 | int xx;
64 | for (xx = 0; xx < info->width; xx++) {
65 | int out_offset = xx * 4;
66 | int in_offset = xx * 3;
67 |
68 | line[out_offset] = frameLine[in_offset];
69 | line[out_offset+1] = frameLine[in_offset+1];
70 | line[out_offset+2] = frameLine[in_offset+2];
71 | line[out_offset+3] = 0;
72 | }
73 | pixels = (char*)pixels + info->stride;
74 | }
75 | }
76 |
77 | void Java_com_churnlabs_ffmpegsample_MainActivity_openFile(JNIEnv * env, jobject this)
78 | {
79 | int ret;
80 | int err;
81 | int i;
82 | AVCodec *pCodec;
83 | uint8_t *buffer;
84 | int numBytes;
85 |
86 | av_register_all();
87 | LOGE("Registered formats");
88 | err = av_open_input_file(&pFormatCtx, "file:/sdcard/vid.3gp", NULL, 0, NULL);
89 | LOGE("Called open file");
90 | if(err!=0) {
91 | LOGE("Couldn't open file");
92 | return;
93 | }
94 | LOGE("Opened file");
95 |
96 | if(av_find_stream_info(pFormatCtx)<0) {
97 | LOGE("Unable to get stream info");
98 | return;
99 | }
100 |
101 | videoStream = -1;
102 | for (i=0; inb_streams; i++) {
103 | if(pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO) {
104 | videoStream = i;
105 | break;
106 | }
107 | }
108 | if(videoStream==-1) {
109 | LOGE("Unable to find video stream");
110 | return;
111 | }
112 |
113 | LOGI("Video stream is [%d]", videoStream);
114 |
115 | pCodecCtx=pFormatCtx->streams[videoStream]->codec;
116 |
117 | pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
118 | if(pCodec==NULL) {
119 | LOGE("Unsupported codec");
120 | return;
121 | }
122 |
123 | if(avcodec_open(pCodecCtx, pCodec)<0) {
124 | LOGE("Unable to open codec");
125 | return;
126 | }
127 |
128 | pFrame=avcodec_alloc_frame();
129 | pFrameRGB=avcodec_alloc_frame();
130 | LOGI("Video size is [%d x %d]", pCodecCtx->width, pCodecCtx->height);
131 |
132 | numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width, pCodecCtx->height);
133 | buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
134 |
135 | avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,
136 | pCodecCtx->width, pCodecCtx->height);
137 | }
138 |
139 | void Java_com_churnlabs_ffmpegsample_MainActivity_drawFrame(JNIEnv * env, jobject this, jstring bitmap)
140 | {
141 | AndroidBitmapInfo info;
142 | void* pixels;
143 | int ret;
144 |
145 | int err;
146 | int i;
147 | int frameFinished = 0;
148 | AVPacket packet;
149 | static struct SwsContext *img_convert_ctx;
150 | int64_t seek_target;
151 |
152 | if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
153 | LOGE("AndroidBitmap_getInfo() failed ! error=%d", ret);
154 | return;
155 | }
156 | LOGE("Checked on the bitmap");
157 |
158 | if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
159 | LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
160 | }
161 | LOGE("Grabbed the pixels");
162 |
163 | i = 0;
164 | while((i==0) && (av_read_frame(pFormatCtx, &packet)>=0)) {
165 | if(packet.stream_index==videoStream) {
166 | avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
167 |
168 | if(frameFinished) {
169 | LOGE("packet pts %llu", packet.pts);
170 | // This is much different than the tutorial, sws_scale
171 | // replaces img_convert, but it's not a complete drop in.
172 | // This version keeps the image the same size but swaps to
173 | // RGB24 format, which works perfect for PPM output.
174 | int target_width = 320;
175 | int target_height = 240;
176 | img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height,
177 | pCodecCtx->pix_fmt,
178 | target_width, target_height, PIX_FMT_RGB24, SWS_BICUBIC,
179 | NULL, NULL, NULL);
180 | if(img_convert_ctx == NULL) {
181 | LOGE("could not initialize conversion context\n");
182 | return;
183 | }
184 | sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);
185 |
186 | // save_frame(pFrameRGB, target_width, target_height, i);
187 | fill_bitmap(&info, pixels, pFrameRGB);
188 | i = 1;
189 | }
190 | }
191 | av_free_packet(&packet);
192 | }
193 |
194 | AndroidBitmap_unlockPixels(env, bitmap);
195 | }
196 |
197 |
198 | int seek_frame(int tsms)
199 | {
200 | int64_t frame;
201 |
202 | frame = av_rescale(tsms,pFormatCtx->streams[videoStream]->time_base.den,pFormatCtx->streams[videoStream]->time_base.num);
203 | frame/=1000;
204 |
205 | if(avformat_seek_file(pFormatCtx,videoStream,0,frame,frame,AVSEEK_FLAG_FRAME)<0) {
206 | return 0;
207 | }
208 |
209 | avcodec_flush_buffers(pCodecCtx);
210 |
211 | return 1;
212 | }
213 |
214 | void Java_com_churnlabs_ffmpegsample_MainActivity_drawFrameAt(JNIEnv * env, jobject this, jstring bitmap, jint secs)
215 | {
216 | AndroidBitmapInfo info;
217 | void* pixels;
218 | int ret;
219 |
220 | int err;
221 | int i;
222 | int frameFinished = 0;
223 | AVPacket packet;
224 | static struct SwsContext *img_convert_ctx;
225 | int64_t seek_target;
226 |
227 | if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
228 | LOGE("AndroidBitmap_getInfo() failed ! error=%d", ret);
229 | return;
230 | }
231 | LOGE("Checked on the bitmap");
232 |
233 | if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
234 | LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
235 | }
236 | LOGE("Grabbed the pixels");
237 |
238 | seek_frame(secs * 1000);
239 |
240 | i = 0;
241 | while ((i== 0) && (av_read_frame(pFormatCtx, &packet)>=0)) {
242 | if(packet.stream_index==videoStream) {
243 | avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
244 |
245 | if(frameFinished) {
246 | // This is much different than the tutorial, sws_scale
247 | // replaces img_convert, but it's not a complete drop in.
248 | // This version keeps the image the same size but swaps to
249 | // RGB24 format, which works perfect for PPM output.
250 | int target_width = 320;
251 | int target_height = 240;
252 | img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height,
253 | pCodecCtx->pix_fmt,
254 | target_width, target_height, PIX_FMT_RGB24, SWS_BICUBIC,
255 | NULL, NULL, NULL);
256 | if(img_convert_ctx == NULL) {
257 | LOGE("could not initialize conversion context\n");
258 | return;
259 | }
260 | sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);
261 |
262 | // save_frame(pFrameRGB, target_width, target_height, i);
263 | fill_bitmap(&info, pixels, pFrameRGB);
264 | i = 1;
265 | }
266 | }
267 | av_free_packet(&packet);
268 | }
269 |
270 | AndroidBitmap_unlockPixels(env, bitmap);
271 | }
272 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/churnlabs/android-ffmpeg-sample/65c91266de1b90f7fc68dc34696eeff7ef19efce/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/churnlabs/android-ffmpeg-sample/65c91266de1b90f7fc68dc34696eeff7ef19efce/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/churnlabs/android-ffmpeg-sample/65c91266de1b90f7fc68dc34696eeff7ef19efce/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World, MainActivity!
4 | FFMPEG Sample
5 |
6 |
--------------------------------------------------------------------------------
/src/com/churnlabs/ffmpegsample/MainActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 - Churn Labs, LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.churnlabs.ffmpegsample;
18 |
19 | import android.app.Activity;
20 | import android.graphics.Bitmap;
21 | import android.os.Bundle;
22 | import android.view.View;
23 | import android.view.View.OnClickListener;
24 | import android.widget.Button;
25 | import android.widget.ImageView;
26 |
27 | public class MainActivity extends Activity {
28 | private static native void openFile();
29 | private static native void drawFrame(Bitmap bitmap);
30 | private static native void drawFrameAt(Bitmap bitmap, int secs);
31 |
32 | private Bitmap mBitmap;
33 | private int mSecs = 0;
34 |
35 | static {
36 | System.loadLibrary("ffmpegutils");
37 | }
38 |
39 | /** Called when the activity is first created. */
40 | @Override
41 | public void onCreate(Bundle savedInstanceState) {
42 | super.onCreate(savedInstanceState);
43 | //setContentView(new VideoView(this));
44 | setContentView(R.layout.main);
45 |
46 | mBitmap = Bitmap.createBitmap(320, 240, Bitmap.Config.ARGB_8888);
47 | openFile();
48 |
49 | Button btn = (Button)findViewById(R.id.frame_adv);
50 | btn.setOnClickListener(new OnClickListener() {
51 | public void onClick(View v) {
52 | drawFrame(mBitmap);
53 | ImageView i = (ImageView)findViewById(R.id.frame);
54 | i.setImageBitmap(mBitmap);
55 | }
56 | });
57 |
58 | Button btn_fwd = (Button)findViewById(R.id.frame_fwd);
59 | btn_fwd.setOnClickListener(new OnClickListener() {
60 | public void onClick(View v) {
61 | mSecs += 5;
62 | drawFrameAt(mBitmap, mSecs);
63 | ImageView i = (ImageView)findViewById(R.id.frame);
64 | i.setImageBitmap(mBitmap);
65 | }
66 | });
67 |
68 | Button btn_back = (Button)findViewById(R.id.frame_back);
69 | btn_back.setOnClickListener(new OnClickListener() {
70 | public void onClick(View v) {
71 | mSecs -= 5;
72 | drawFrameAt(mBitmap, mSecs);
73 | ImageView i = (ImageView)findViewById(R.id.frame);
74 | i.setImageBitmap(mBitmap);
75 | }
76 | });
77 | }
78 | }
--------------------------------------------------------------------------------