Skip to content

Commit 2527689

Browse files
author
Andrea Medeghini
committed
Removed deprecated code. Fixed encoding and decoding video.
1 parent cdfa9f1 commit 2527689

2 files changed

Lines changed: 108 additions & 202 deletions

File tree

ffmpeg4java.i

Lines changed: 20 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,19 @@
2727
#include "libavutil/dict.h"
2828
#include "libavutil/imgutils.h"
2929
#include "libavcodec/avcodec.h"
30-
#include "libavformat/url.h"
3130
#include "libavformat/avformat.h"
31+
#include "libavformat/url.h"
3232
#include "libavfilter/avfilter.h"
3333
#include "libavdevice/avdevice.h"
3434
#include "libpostproc/postprocess.h"
3535
#include "libswscale/swscale.h"
3636
#include "libswresample/swresample.h"
3737

38-
struct AVFrame ** swig_create_frame_p_p(AVFrame * p);
39-
struct AVDictionary ** swig_create_dictionary_p_p();
40-
struct AVFormatContext ** swig_create_format_context_p_p();
41-
struct URLContext ** swig_create_url_context_p_p();
42-
struct AVDictionary * swig_get_dictionary(struct AVDictionary ** p);
43-
struct AVFormatContext * swig_get_format_context(struct AVFormatContext ** p);
44-
struct URLContext * swig_get_url_context(struct URLContext ** p);
4538
struct AVStream * swig_get_stream_p(struct AVStream **streams, int index);
46-
int * swig_create_int_p();
47-
int swig_get_int(int * p, int index);
48-
void swig_set_int(int * p, int index, int value);
39+
40+
void ** swig_from_p_to_p_p(void * p);
41+
void * swig_from_p_p_to_p(void ** p);
42+
4943
%}
5044

5145
%javaconst(1);
@@ -84,24 +78,18 @@ void swig_set_int(int * p, int index, int value);
8478

8579
%array_class(AVIOContext, AVIOContextArray);
8680

87-
%extend AVFormatContext {
88-
AVIOContext ** get_aviocontext_p_p() {
89-
return &self->pb;
81+
%extend AVCPBProperties {
82+
long size_of() {
83+
return sizeof(AVCPBProperties);
9084
}
9185
}
9286

93-
%typemap(javacode) SWIGTYPE *, SWIGTYPE ** %{
87+
%typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE ** %{
9488
public static final $javaclassname asTypePointer(SWIGTYPE_p_void p) {
95-
return new $javaclassname(SWIGTYPE_p_void.getCPtr(p), false);
96-
}
97-
public static final SWIGTYPE_p_void asVoidPointer($javaclassname p) {
98-
return new SWIGTYPE_p_void($javaclassname.getCPtr(p), false);
89+
return new $javaclassname(SWIGTYPE_p_void.getCPtr(p), false);
9990
}
100-
%}
101-
102-
%typemap(javacode) SWIGTYPE %{
10391
public static final SWIGTYPE_p_void asVoidPointer($javaclassname p) {
104-
return new SWIGTYPE_p_void($javaclassname.getCPtr(p), false);
92+
return new SWIGTYPE_p_void($javaclassname.getCPtr(p), false);
10593
}
10694
%}
10795

@@ -165,52 +153,21 @@ void swig_set_int(int * p, int index, int value);
165153

166154
%{
167155

168-
struct AVFrame ** swig_create_frame_p_p(AVFrame * p) {
169-
AVFrame ** d = (struct AVFrame **) av_mallocz(sizeof(struct AVFrame **));
170-
*d = p;
171-
return d;
172-
}
173-
174-
struct AVDictionary ** swig_create_dictionary_p_p() {
175-
return (struct AVDictionary **) av_mallocz(sizeof(struct AVDictionary **));
156+
void ** swig_from_p_to_p_p(void * p) {
157+
void ** q = av_mallocz(sizeof(void *));
158+
*q = p;
159+
return q;
176160
}
177161

178-
struct AVFormatContext ** swig_create_format_context_p_p() {
179-
return (struct AVFormatContext **) av_mallocz(sizeof(struct AVFormatContext **));
162+
void * swig_from_p_p_to_p(void ** p) {
163+
void * q = *p;
164+
return q;
180165
}
181166

182-
struct URLContext ** swig_create_url_context_p_p() {
183-
return (struct URLContext **) av_mallocz(sizeof(struct URLContext **));
184-
}
185-
186-
struct AVDictionary * swig_get_dictionary(struct AVDictionary ** p) {
187-
return *p;
188-
}
189-
190-
struct AVFormatContext * swig_get_format_context(struct AVFormatContext ** p) {
191-
return *p;
192-
}
193-
194-
struct URLContext * swig_get_url_context(struct URLContext ** p) {
195-
return *p;
196-
}
197-
198167
struct AVStream * swig_get_stream_p(struct AVStream **streams, int index) {
199168
return streams[index];
200169
}
201170

202-
int * swig_create_int_p() {
203-
return (int *) av_malloc(sizeof(int *));
204-
}
205-
206-
int swig_get_int(int * p, int index) {
207-
return p[index];
208-
}
209-
210-
void swig_set_int(int * p, int index, int value) {
211-
p[index] = value;
212-
}
213-
214171
SWIGEXPORT void JNICALL Java_com_nextbreakpoint_ffmpeg4java_FFmpeg4JavaJNI_swig_1get_1bytes(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
215172
jbyte buf[1024];
216173
uint8_t *data = (uint8_t *) jarg1;
@@ -13759,17 +13716,7 @@ int swr_config_frame(SwrContext *swr, const AVFrame *out, const AVFrame *in);
1375913716

1376013717
/* glue */
1376113718

13762-
struct AVFrame ** swig_create_frame_p_p(AVFrame * p);
13763-
struct AVDictionary ** swig_create_dictionary_p_p();
13764-
struct AVFormatContext ** swig_create_format_context_p_p();
13765-
struct URLContext ** swig_create_url_context_p_p();
13766-
13767-
struct AVDictionary * swig_get_dictionary(struct AVDictionary ** p);
13768-
struct AVFormatContext * swig_get_format_context(struct AVFormatContext ** p);
13769-
struct URLContext * swig_get_url_context(struct URLContext ** p);
13770-
1377113719
struct AVStream * swig_get_stream_p(struct AVStream **streams, int index);
1377213720

13773-
int * swig_create_int_p();
13774-
int swig_get_int(int * p, int index);
13775-
void swig_set_int(int * p, int index, int value);
13721+
void ** swig_from_p_to_p_p(void * p);
13722+
void * swig_from_p_p_to_p(void ** p);

0 commit comments

Comments
 (0)