[FFmpeg-cvslog] avcodec/jni: fix mixed declaration and code

2024-04-21 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Thu Apr 
 4 22:01:10 2024 +0200| [8cdf1bae942c29a39a9b921449f6dc77cd17f3ba] | committer: 
Matthieu Bouron

avcodec/jni: fix mixed declaration and code

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8cdf1bae942c29a39a9b921449f6dc77cd17f3ba
---

 libavcodec/jni.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/jni.c b/libavcodec/jni.c
index 1193c608c3..fcb4837413 100644
--- a/libavcodec/jni.c
+++ b/libavcodec/jni.c
@@ -84,11 +84,13 @@ void *av_jni_get_java_vm(void *log_ctx)
 int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx)
 {
 #if CONFIG_JNI
+jobjectRefType type;
+
 JNIEnv *env = ff_jni_get_env(log_ctx);
 if (!env)
 return AVERROR(EINVAL);
 
-jobjectRefType type = (*env)->GetObjectRefType(env, app_ctx);
+type = (*env)->GetObjectRefType(env, app_ctx);
 if (type != JNIGlobalRefType) {
 av_log(log_ctx, AV_LOG_ERROR, "Application context must be passed as a 
global reference");
 return AVERROR(EINVAL);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] Changelog: add Android content URIs protocol entry

2024-03-26 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Mon Mar 
25 09:13:08 2024 +0100| [87ace5c4daa2c473a1ff09004df7e510cfdd19a0] | committer: 
Matthieu Bouron

Changelog: add Android content URIs protocol entry

Signed-off-by: Matthieu Bouron 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=87ace5c4daa2c473a1ff09004df7e510cfdd19a0
---

 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index 934241a965..e4373ff991 100644
--- a/Changelog
+++ b/Changelog
@@ -37,6 +37,7 @@ version :
 - Support PacketTypeMetadata of PacketType in enhanced flv format
 - ffplay with hwaccel decoding support (depends on vulkan renderer via 
libplacebo)
 - dnn filter libtorch backend
+- Android content URIs protocol
 
 
 version 6.1:

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/mediacodec_wrapper: use an OFFSET() macro where relevant

2024-03-23 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Tue Feb 
13 12:00:57 2024 +0100| [b1a683a2fdeaa84a8f6a2a3c64ca859a65e8b50e] | committer: 
Matthieu Bouron

avcodec/mediacodec_wrapper: use an OFFSET() macro where relevant

Reduces a bit the horizontal spacing.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b1a683a2fdeaa84a8f6a2a3c64ca859a65e8b50e
---

 libavcodec/mediacodec_wrapper.c | 138 +---
 1 file changed, 72 insertions(+), 66 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 0880ddd3ef..78cd28f53d 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -60,31 +60,33 @@ struct JNIAMediaCodecListFields {
 jfieldID level_id;
 };
 
+#define OFFSET(x) offsetof(struct JNIAMediaCodecListFields, x)
 static const struct FFJniField jni_amediacodeclist_mapping[] = {
-{ "android/media/MediaCodecList", NULL, NULL, FF_JNI_CLASS, 
offsetof(struct JNIAMediaCodecListFields, mediacodec_list_class), 1 },
-{ "android/media/MediaCodecList", "", "(I)V", FF_JNI_METHOD, 
offsetof(struct JNIAMediaCodecListFields, init_id), 0 },
-{ "android/media/MediaCodecList", "findDecoderForFormat", 
"(Landroid/media/MediaFormat;)Ljava/lang/String;", FF_JNI_METHOD, 
offsetof(struct JNIAMediaCodecListFields, find_decoder_for_format_id), 0 },
+{ "android/media/MediaCodecList", NULL, NULL, FF_JNI_CLASS, 
OFFSET(mediacodec_list_class), 1 },
+{ "android/media/MediaCodecList", "", "(I)V", FF_JNI_METHOD, 
OFFSET(init_id), 0 },
+{ "android/media/MediaCodecList", "findDecoderForFormat", 
"(Landroid/media/MediaFormat;)Ljava/lang/String;", FF_JNI_METHOD, 
OFFSET(find_decoder_for_format_id), 0 },
 
-{ "android/media/MediaCodecList", "getCodecCount", "()I", 
FF_JNI_STATIC_METHOD, offsetof(struct JNIAMediaCodecListFields, 
get_codec_count_id), 1 },
-{ "android/media/MediaCodecList", "getCodecInfoAt", 
"(I)Landroid/media/MediaCodecInfo;", FF_JNI_STATIC_METHOD, offsetof(struct 
JNIAMediaCodecListFields, get_codec_info_at_id), 1 },
+{ "android/media/MediaCodecList", "getCodecCount", "()I", 
FF_JNI_STATIC_METHOD, OFFSET(get_codec_count_id), 1 },
+{ "android/media/MediaCodecList", "getCodecInfoAt", 
"(I)Landroid/media/MediaCodecInfo;", FF_JNI_STATIC_METHOD, 
OFFSET(get_codec_info_at_id), 1 },
 
-{ "android/media/MediaCodecInfo", NULL, NULL, FF_JNI_CLASS, 
offsetof(struct JNIAMediaCodecListFields, mediacodec_info_class), 1 },
-{ "android/media/MediaCodecInfo", "getName", "()Ljava/lang/String;", 
FF_JNI_METHOD, offsetof(struct JNIAMediaCodecListFields, get_name_id), 1 },
-{ "android/media/MediaCodecInfo", "getCapabilitiesForType", 
"(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;", 
FF_JNI_METHOD, offsetof(struct JNIAMediaCodecListFields, 
get_codec_capabilities_id), 1 },
-{ "android/media/MediaCodecInfo", "getSupportedTypes", 
"()[Ljava/lang/String;", FF_JNI_METHOD, offsetof(struct 
JNIAMediaCodecListFields, get_supported_types_id), 1 },
-{ "android/media/MediaCodecInfo", "isEncoder", "()Z", FF_JNI_METHOD, 
offsetof(struct JNIAMediaCodecListFields, is_encoder_id), 1 },
-{ "android/media/MediaCodecInfo", "isSoftwareOnly", "()Z", 
FF_JNI_METHOD, offsetof(struct JNIAMediaCodecListFields, is_software_only_id), 
0 },
+{ "android/media/MediaCodecInfo", NULL, NULL, FF_JNI_CLASS, 
OFFSET(mediacodec_info_class), 1 },
+{ "android/media/MediaCodecInfo", "getName", "()Ljava/lang/String;", 
FF_JNI_METHOD, OFFSET(get_name_id), 1 },
+{ "android/media/MediaCodecInfo", "getCapabilitiesForType", 
"(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;", 
FF_JNI_METHOD, OFFSET(get_codec_capabilities_id), 1 },
+{ "android/media/MediaCodecInfo", "getSupportedTypes", 
"()[Ljava/lang/String;", FF_JNI_METHOD, OFFSET(get_supported_types_id), 1 },
+{ "android/media/MediaCodecInfo", "isEncoder", "()Z", FF_JNI_METHOD, 
OFFSET(is_encoder_id), 1 },
+{ "android/media/MediaCodecInfo", "isSoftwareOnly", "()Z", 
FF_JNI_METHOD, OFFSET(is_software_only_id), 0 },
 
-{ "android/media/MediaCodecInfo$CodecCapabilities", NULL, NULL, 
FF_JNI_CLASS, offsetof(struct JNIAMediaCodecListFields, 
codec_capabilities_class), 1 },
-{ "android/media/MediaCodecInfo$CodecCapabilities

[FFmpeg-cvslog] avcodec/mediacodec_wrapper: remove unnecessary NULL checks before calling Delete{Global,Local}Ref()

2024-03-23 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Tue Feb 
13 12:15:03 2024 +0100| [ad227a41d42f480e3e57baa72f48a5f6e8227271] | committer: 
Matthieu Bouron

avcodec/mediacodec_wrapper: remove unnecessary NULL checks before calling 
Delete{Global,Local}Ref()

Delete{Global,Local}Ref already handle NULL.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ad227a41d42f480e3e57baa72f48a5f6e8227271
---

 libavcodec/mediacodec_wrapper.c | 189 ++--
 1 file changed, 47 insertions(+), 142 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 78cd28f53d..306359071e 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -549,10 +549,8 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
*mime, int profile, int e
 goto done;
 }
 
-if (codec_name) {
-(*env)->DeleteLocalRef(env, codec_name);
-codec_name = NULL;
-}
+(*env)->DeleteLocalRef(env, codec_name);
+codec_name = NULL;
 
 /* Skip software decoders */
 if (
@@ -616,10 +614,8 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
*mime, int profile, int e
 
 found_codec = profile == supported_profile;
 
-if (profile_level) {
-(*env)->DeleteLocalRef(env, profile_level);
-profile_level = NULL;
-}
+(*env)->DeleteLocalRef(env, profile_level);
+profile_level = NULL;
 
 if (found_codec) {
 break;
@@ -627,20 +623,14 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
*mime, int profile, int e
 }
 
 done_with_type:
-if (profile_levels) {
-(*env)->DeleteLocalRef(env, profile_levels);
-profile_levels = NULL;
-}
+(*env)->DeleteLocalRef(env, profile_levels);
+profile_levels = NULL;
 
-if (capabilities) {
-(*env)->DeleteLocalRef(env, capabilities);
-capabilities = NULL;
-}
+(*env)->DeleteLocalRef(env, capabilities);
+capabilities = NULL;
 
-if (type) {
-(*env)->DeleteLocalRef(env, type);
-type = NULL;
-}
+(*env)->DeleteLocalRef(env, type);
+type = NULL;
 
 av_freep(_type);
 
@@ -650,15 +640,11 @@ done_with_type:
 }
 
 done_with_info:
-if (info) {
-(*env)->DeleteLocalRef(env, info);
-info = NULL;
-}
+(*env)->DeleteLocalRef(env, info);
+info = NULL;
 
-if (types) {
-(*env)->DeleteLocalRef(env, types);
-types = NULL;
-}
+(*env)->DeleteLocalRef(env, types);
+types = NULL;
 
 if (found_codec) {
 break;
@@ -668,33 +654,13 @@ done_with_info:
 }
 
 done:
-if (codec_name) {
-(*env)->DeleteLocalRef(env, codec_name);
-}
-
-if (info) {
-(*env)->DeleteLocalRef(env, info);
-}
-
-if (type) {
-(*env)->DeleteLocalRef(env, type);
-}
-
-if (types) {
-(*env)->DeleteLocalRef(env, types);
-}
-
-if (capabilities) {
-(*env)->DeleteLocalRef(env, capabilities);
-}
-
-if (profile_level) {
-(*env)->DeleteLocalRef(env, profile_level);
-}
-
-if (profile_levels) {
-(*env)->DeleteLocalRef(env, profile_levels);
-}
+(*env)->DeleteLocalRef(env, codec_name);
+(*env)->DeleteLocalRef(env, info);
+(*env)->DeleteLocalRef(env, type);
+(*env)->DeleteLocalRef(env, types);
+(*env)->DeleteLocalRef(env, capabilities);
+(*env)->DeleteLocalRef(env, profile_level);
+(*env)->DeleteLocalRef(env, profile_levels);
 
 av_freep(_type);
 
@@ -741,9 +707,7 @@ static FFAMediaFormat *mediaformat_jni_new(void)
 }
 
 fail:
-if (object) {
-(*env)->DeleteLocalRef(env, object);
-}
+(*env)->DeleteLocalRef(env, object);
 
 if (!format->object) {
 ff_jni_reset_jfields(env, >jfields, jni_amediaformat_mapping, 
1, format);
@@ -828,9 +792,7 @@ static char* mediaformat_jni_toString(FFAMediaFormat* ctx)
 
 ret = ff_jni_jstring_to_utf_chars(env, description, format);
 fail:
-if (description) {
-(*env)->DeleteLocalRef(env, description);
-}
+(*env)->DeleteLocalRef(env, description);
 
 return ret;
 }
@@ -867,9 +829,7 @@ static int mediaformat_jni_getInt32(FFAMediaFormat* ctx, 
const char *name, int32
 
 ret = 1;
 fail:
-if (key) {
-(*env)->DeleteLocalRef(env, key);
-}
+(*env)->DeleteLocalRef(env, key);
 
 return ret;
 }
@@ -906,9 +866,7 @@ static int mediaformat_jni_getInt64(FFAMediaFormat* ctx, 
const char *name, int64
 
 ret = 1

[FFmpeg-cvslog] avcodec/jni: remove unnecessary NULL checks before calling DeleteLocalRef()

2024-03-23 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Tue Feb 
13 11:05:45 2024 +0100| [dab4124350a0f2838e7105043abc1f7d3ccb5b0a] | committer: 
Matthieu Bouron

avcodec/jni: remove unnecessary NULL checks before calling DeleteLocalRef()

Delete{Global,Local}Ref() already handle NULL.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dab4124350a0f2838e7105043abc1f7d3ccb5b0a
---

 libavcodec/ffjni.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/libavcodec/ffjni.c b/libavcodec/ffjni.c
index e3cf24d3e2..69d9a9faa3 100644
--- a/libavcodec/ffjni.c
+++ b/libavcodec/ffjni.c
@@ -236,17 +236,9 @@ done:
 av_free(name);
 av_free(message);
 
-if (class_class) {
-(*env)->DeleteLocalRef(env, class_class);
-}
-
-if (exception_class) {
-(*env)->DeleteLocalRef(env, exception_class);
-}
-
-if (string) {
-(*env)->DeleteLocalRef(env, string);
-}
+(*env)->DeleteLocalRef(env, class_class);
+(*env)->DeleteLocalRef(env, exception_class);
+(*env)->DeleteLocalRef(env, string);
 
 return ret;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/jni: use size_t to store structure offsets

2024-03-23 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Tue Feb 
13 11:03:22 2024 +0100| [70ba15d2cfbbc376d3774342f88333129a9d55f5] | committer: 
Matthieu Bouron

avcodec/jni: use size_t to store structure offsets

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=70ba15d2cfbbc376d3774342f88333129a9d55f5
---

 libavcodec/ffjni.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ffjni.h b/libavcodec/ffjni.h
index 6027bac0ab..d1e86f8329 100644
--- a/libavcodec/ffjni.h
+++ b/libavcodec/ffjni.h
@@ -24,6 +24,7 @@
 #define AVCODEC_FFJNI_H
 
 #include 
+#include 
 
 /*
  * Attach permanently a JNI environment to the current thread and retrieve it.
@@ -105,7 +106,7 @@ struct FFJniField {
 const char *method;
 const char *signature;
 enum FFJniFieldType type;
-int offset;
+size_t offset;
 int mandatory;
 
 };

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec: add av_jni_{get,set}_android_app_ctx() helpers

2024-03-23 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Mon Feb 
12 23:13:09 2024 +0100| [f17e18d2922645f56a35d276b5e75cfdaf20ab7e] | committer: 
Matthieu Bouron

avcodec: add av_jni_{get,set}_android_app_ctx() helpers

This will allow users to pass the Android ApplicationContext which is mandatory
to retrieve the ContentResolver responsible to resolve/open Android content 
URIS.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f17e18d2922645f56a35d276b5e75cfdaf20ab7e
---

 doc/APIchanges   |  3 +++
 libavcodec/jni.c | 43 +++
 libavcodec/jni.h | 21 +
 3 files changed, 67 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index 9694947e63..2796b4d0c2 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-03-xx - xx - lavc 61.3.100 - jni.h
+  Add av_jni_set_android_app_ctx() and av_jni_get_android_app_ctx().
+
 2024-03-22 - xx - lavu 59.4.100 - frame.h
   Constified the first-level pointee of av_frame_side_data_get()
   and renamed it to av_frame_side_data_get_c(). From now on,
diff --git a/libavcodec/jni.c b/libavcodec/jni.c
index ae6490de9d..1193c608c3 100644
--- a/libavcodec/jni.c
+++ b/libavcodec/jni.c
@@ -35,6 +35,7 @@
 #include "ffjni.h"
 
 static void *java_vm;
+static void *android_app_ctx;
 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 
 int av_jni_set_java_vm(void *vm, void *log_ctx)
@@ -77,3 +78,45 @@ void *av_jni_get_java_vm(void *log_ctx)
 }
 
 #endif
+
+#if defined(__ANDROID__)
+
+int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx)
+{
+#if CONFIG_JNI
+JNIEnv *env = ff_jni_get_env(log_ctx);
+if (!env)
+return AVERROR(EINVAL);
+
+jobjectRefType type = (*env)->GetObjectRefType(env, app_ctx);
+if (type != JNIGlobalRefType) {
+av_log(log_ctx, AV_LOG_ERROR, "Application context must be passed as a 
global reference");
+return AVERROR(EINVAL);
+}
+
+pthread_mutex_lock();
+android_app_ctx = app_ctx;
+pthread_mutex_unlock();
+
+return 0;
+#else
+return AVERROR(ENOSYS);
+#endif
+}
+
+void *av_jni_get_android_app_ctx(void)
+{
+#if CONFIG_JNI
+void *ctx;
+
+pthread_mutex_lock();
+ctx = android_app_ctx;
+pthread_mutex_unlock();
+
+return ctx;
+#else
+return NULL;
+#endif
+}
+
+#endif
diff --git a/libavcodec/jni.h b/libavcodec/jni.h
index dd99e92611..955cd28096 100644
--- a/libavcodec/jni.h
+++ b/libavcodec/jni.h
@@ -43,4 +43,25 @@ int av_jni_set_java_vm(void *vm, void *log_ctx);
  */
 void *av_jni_get_java_vm(void *log_ctx);
 
+/*
+ * Set the Android application context which will be used to retrieve the 
Android
+ * content resolver to handle content uris.
+ *
+ * This function is only available on Android.
+ *
+ * @param app_ctx global JNI reference to the Android application context
+ * @return 0 on success, < 0 otherwise
+ */
+int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx);
+
+/*
+ * Get the Android application context that has been set with
+ * av_jni_set_android_app_ctx.
+ *
+ * This function is only available on Android.
+ *
+ * @return a pointer the the Android application context
+ */
+void *av_jni_get_android_app_ctx(void);
+
 #endif /* AVCODEC_JNI_H */

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat: add Android content resolver protocol support

2024-03-23 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Mon Feb 
12 23:14:35 2024 +0100| [6567516a5ef90e61accf8ef117d6e2d062a4bb76] | committer: 
Matthieu Bouron

avformat: add Android content resolver protocol support

Handles Android content URIs starting with content://.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6567516a5ef90e61accf8ef117d6e2d062a4bb76
---

 configure   |   2 +
 libavformat/Makefile|   1 +
 libavformat/file.c  | 160 
 libavformat/protocols.c |   1 +
 4 files changed, 164 insertions(+)

diff --git a/configure b/configure
index 343edb38ab..b9fa8652c4 100755
--- a/configure
+++ b/configure
@@ -3711,6 +3711,8 @@ xcbgrab_indev_suggest="libxcb_shm libxcb_shape 
libxcb_xfixes"
 xv_outdev_deps="xlib_xv xlib_x11 xlib_xext"
 
 # protocols
+android_content_protocol_deps="jni"
+android_content_protocol_select="file_protocol"
 async_protocol_deps="threads"
 bluray_protocol_deps="libbluray"
 ffrtmpcrypt_protocol_conflict="librtmp_protocol"
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 94a949f555..44aa485029 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -658,6 +658,7 @@ OBJS-$(CONFIG_LIBOPENMPT_DEMUXER)+= libopenmpt.o
 OBJS-$(CONFIG_VAPOURSYNTH_DEMUXER)   += vapoursynth.o
 
 # protocols I/O
+OBJS-$(CONFIG_ANDROID_CONTENT_PROTOCOL)  += file.o
 OBJS-$(CONFIG_ASYNC_PROTOCOL)+= async.o
 OBJS-$(CONFIG_APPLEHTTP_PROTOCOL)+= hlsproto.o
 OBJS-$(CONFIG_BLURAY_PROTOCOL)   += bluray.o
diff --git a/libavformat/file.c b/libavformat/file.c
index 64df7ff6fb..dd5819c06f 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -40,6 +40,12 @@
 #include 
 #include "os_support.h"
 #include "url.h"
+#if CONFIG_ANDROID_CONTENT_PROTOCOL
+#include 
+#include "libavcodec/jni.h"
+#include "libavcodec/ffjni.c"
+#endif
+
 
 /* Some systems may not have S_ISFIFO */
 #ifndef S_ISFIFO
@@ -101,6 +107,21 @@ typedef struct FileContext {
 int64_t initial_pos;
 } FileContext;
 
+
+#if CONFIG_ANDROID_CONTENT_PROTOCOL
+static const AVOption android_content_options[] = {
+{ "blocksize", "set I/O operation maximum block size", 
offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+{ NULL }
+};
+
+static const AVClass android_content_class = {
+.class_name = "android_content",
+.item_name  = av_default_item_name,
+.option = android_content_options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+#endif
+
 static const AVOption file_options[] = {
 { "truncate", "truncate existing files on write", offsetof(FileContext, 
trunc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
 { "blocksize", "set I/O operation maximum block size", 
offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
@@ -524,3 +545,142 @@ const URLProtocol ff_fd_protocol = {
 };
 
 #endif /* CONFIG_FD_PROTOCOL */
+
+#if CONFIG_ANDROID_CONTENT_PROTOCOL
+
+typedef struct JFields {
+jclass uri_class;
+jmethodID parse_id;
+
+jclass context_class;
+jmethodID get_content_resolver_id;
+
+jclass content_resolver_class;
+jmethodID open_file_descriptor_id;
+
+jclass parcel_file_descriptor_class;
+jmethodID detach_fd_id;
+} JFields;
+
+#define OFFSET(x) offsetof(JFields, x)
+static const struct FFJniField jfields_mapping[] = {
+{ "android/net/Uri", NULL, NULL, FF_JNI_CLASS, OFFSET(uri_class), 1 },
+{ "android/net/Uri", "parse", "(Ljava/lang/String;)Landroid/net/Uri;", 
FF_JNI_STATIC_METHOD, OFFSET(parse_id), 1 },
+
+{ "android/content/Context", NULL, NULL, FF_JNI_CLASS, 
OFFSET(context_class), 1 },
+{ "android/content/Context", "getContentResolver", 
"()Landroid/content/ContentResolver;", FF_JNI_METHOD, 
OFFSET(get_content_resolver_id), 1 },
+
+{ "android/content/ContentResolver", NULL, NULL, FF_JNI_CLASS, 
OFFSET(content_resolver_class), 1 },
+{ "android/content/ContentResolver", "openFileDescriptor", 
"(Landroid/net/Uri;Ljava/lang/String;)Landroid/os/ParcelFileDescriptor;", 
FF_JNI_METHOD, OFFSET(open_file_descriptor_id), 1 },
+
+{ "android/os/ParcelFileDescriptor", NULL, NULL, FF_JNI_CLASS, 
OFFSET(parcel_file_descriptor_class), 1 },
+{ "android/os/ParcelFileDescriptor", "detachFd", "()I", FF_JNI_METHOD, 
OFFSET(detach_fd_id), 1 },
+
+{ NULL }
+};
+#undef OFFSET
+
+static int android_content_open(URLContext *h, const char *filename, int flags)
+{
+FileContext *c = h->priv_data;
+int fd, ret;
+struct stat st;
+const char

[FFmpeg-cvslog] swscale: add NV16 input/output

2022-07-19 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Wed Jun 
 1 22:33:37 2022 +0200| [0a6bb7da55709d82b1cbb12d420db2d1fbb867d7] | committer: 
Anton Khirnov

swscale: add NV16 input/output

Signed-off-by: Anton Khirnov 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a6bb7da55709d82b1cbb12d420db2d1fbb867d7
---

 libswscale/input.c   | 1 +
 libswscale/utils.c   | 1 +
 libswscale/version.h | 2 +-
 tests/ref/fate/filter-pixdesc-nv16   | 1 +
 tests/ref/fate/filter-pixfmts-copy   | 1 +
 tests/ref/fate/filter-pixfmts-crop   | 1 +
 tests/ref/fate/filter-pixfmts-field  | 1 +
 tests/ref/fate/filter-pixfmts-fieldorder | 1 +
 tests/ref/fate/filter-pixfmts-hflip  | 1 +
 tests/ref/fate/filter-pixfmts-il | 1 +
 tests/ref/fate/filter-pixfmts-null   | 1 +
 tests/ref/fate/filter-pixfmts-pad| 1 +
 tests/ref/fate/filter-pixfmts-scale  | 1 +
 tests/ref/fate/filter-pixfmts-vflip  | 1 +
 14 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/libswscale/input.c b/libswscale/input.c
index fe0c27d743..750367b28b 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -1101,6 +1101,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 c->chrToYV12 = uyvyToUV_c;
 break;
 case AV_PIX_FMT_NV12:
+case AV_PIX_FMT_NV16:
 case AV_PIX_FMT_NV24:
 c->chrToYV12 = nv12ToUV_c;
 break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index cb4f5b521c..c0504a6dfc 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -257,6 +257,7 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_P216LE]  = { 1, 1 },
 [AV_PIX_FMT_P416BE]  = { 1, 1 },
 [AV_PIX_FMT_P416LE]  = { 1, 1 },
+[AV_PIX_FMT_NV16]= { 1, 1 },
 };
 
 int ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos,
diff --git a/libswscale/version.h b/libswscale/version.h
index c0610fec1e..bb7e324876 100644
--- a/libswscale/version.h
+++ b/libswscale/version.h
@@ -29,7 +29,7 @@
 #include "version_major.h"
 
 #define LIBSWSCALE_VERSION_MINOR   8
-#define LIBSWSCALE_VERSION_MICRO 100
+#define LIBSWSCALE_VERSION_MICRO 101
 
 #define LIBSWSCALE_VERSION_INT  AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
LIBSWSCALE_VERSION_MINOR, \
diff --git a/tests/ref/fate/filter-pixdesc-nv16 
b/tests/ref/fate/filter-pixdesc-nv16
new file mode 100644
index 00..4c4587c833
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-nv16
@@ -0,0 +1 @@
+pixdesc-nv16cbbc5d904b8eebad3705a325c3ec5734
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index f06fa1574e..3cd0002e4e 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -56,6 +56,7 @@ grayf32le   fb6ea85bfbc8cd21c51fc0e110197294
 monob   8b04f859fee6a0be856be184acd7a0b5
 monow   54d16d2c01abfd72ecdb5e51e283937c
 nv128e24feb2c544dc26a20047a71e4c27aa
+nv1622b1916c0694c4e2979bab8eb71f3d6b
 nv21335d85c9af6110f26ae9e187a82ed2cf
 nv24f30fc8d0ac40af69e119ea919a314572
 nv4229a212f70f8780fe0eb99abcae81894d
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index 8b26ab9c53..1a0f0c79ed 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -54,6 +54,7 @@ gray9le 4d1932d4968a248584f5e39c25f1dd43
 grayf32be   cf40ec06a8abe54852b7f85a00549eec
 grayf32le   b672526c9da9c8959ab881f242f6890a
 nv1292cda427f794374731ec0321ee00caac
+nv163264b16aaae554c21f052102b491c13b
 nv211bcfc197f4fb95de85ba58182d8d2f69
 nv24514c8f12082f0737e558778cbe7de258
 nv42ece9baae1c5de579dac2c66a89e08ef3
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index c4838d1446..27a74eaef3 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -56,6 +56,7 @@ grayf32le   6b856bdbf2a2bfcd2bc7d50f109daaf0
 monob   2129cc72a484d7e10a44de9117aa9f80
 monow   03d783611d265cae78293f88ea126ea1
 nv1216f7a46708ef25ebd0b72e47920cc11e
+nv1634f36b03f5fccf4eac147b26bbc0a5e5
 nv217294574037cc7f9373ef5695d8ebe809
 nv243b100fb527b64ee2b2d7120da573faf5
 nv421841ce853152d86b27c130f319ea0db2
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder 
b/tests/ref/fate/filter-pixfmts-fieldorder
index 32c06bae4c..ab080d1a37 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -53,6 +53,7 @@ gray9be ec877f5bcf0ea275a6f36c12cc9adf11
 gray9le fba944fde7923d5089f4f52d12988b9e
 grayf32be   1aa7960131f880c54fe3c77f

[FFmpeg-cvslog] libavformat/tls_libtls: handle TLS_WANT_{POLLIN, POLLOUT} in read/write functions

2022-06-08 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Mon May 
23 12:44:33 2022 +0200| [6dd6c58d8976d9c43828af45d7c47ab7f0c983e6] | committer: 
Marton Balint

libavformat/tls_libtls: handle TLS_WANT_{POLLIN, POLLOUT} in read/write 
functions

According to the tls documentation: tls_read() and tls_write() can
return TLS_WANT_POLLIN and TLS_WANT_POLLOUT which indicates that the
same operation must be repeated immediately.

This commit prevents the libtls backend from failing when libtls returns
TLS_WANT_POLLIN or TLS_WANT_POLLOUT with the following error:

[tls @ 0x7f6e20005a00] (null)

Signed-off-by: Marton Balint 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6dd6c58d8976d9c43828af45d7c47ab7f0c983e6
---

 libavformat/tls_libtls.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/tls_libtls.c b/libavformat/tls_libtls.c
index 911c8094b0..22858d4867 100644
--- a/libavformat/tls_libtls.c
+++ b/libavformat/tls_libtls.c
@@ -158,6 +158,8 @@ static int ff_tls_read(URLContext *h, uint8_t *buf, int 
size)
 return ret;
 else if (ret == 0)
 return AVERROR_EOF;
+else if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT)
+return AVERROR(EAGAIN);
 av_log(h, AV_LOG_ERROR, "%s\n", tls_error(p->ctx));
 return AVERROR(EIO);
 }
@@ -171,6 +173,8 @@ static int ff_tls_write(URLContext *h, const uint8_t *buf, 
int size)
 return ret;
 else if (ret == 0)
 return AVERROR_EOF;
+else if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT)
+return AVERROR(EAGAIN);
 av_log(h, AV_LOG_ERROR, "%s\n", tls_error(p->ctx));
 return AVERROR(EIO);
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/mov: adjust skip_samples according to seek timestamp

2021-01-09 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Fri Oct 
30 15:38:51 2020 +0100| [2e174354805ea220b6a57f6b8755347c7f240077] | committer: 
Marton Balint

avformat/mov: adjust skip_samples according to seek timestamp

Currently skip_samples is set to start_pad if sample_time is lesser or
equal to 0. This can cause issues if the stream starts with packets that
have negative pts. Calling avformat_seek_file() with ts set to 0 on such
streams makes the mov demuxer return the right corresponding packets
(near the 0 timestamp) but set skip_samples to start_pad which is
incorrect as the audio decoder will discard the returned samples
according to skip_samples from the first packet it receives (which has
its timestamp near 0).

For example, considering the following audio stream with start_pad=1344:

 [PKT pts=-1344] [PKT pts=-320] [PKT pts=704] [PKT pts=1728] [...]

Calling avformat_seek_file() with ts=0 makes the next call to
av_read_frame() return the packet with pts=-320 and a skip samples
side data set to 1344 (start_pad). This makes the audio decoder
incorrectly discard (1344 - 320) samples.

This commit makes the move demuxer adjust skip_samples according to the
stream start_pad, seek timestamp and first sample timestamp.

The above example will now result in av_read_frame() still returning the
packet with pts=-320 but with a skip samples side data set to 320
(src_pad - (seek_timestamp - first_timestamp)). This makes the audio
decoder only discard 320 samples (from pts=-320 to pts=0).

Signed-off-by: Marton Balint 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2e174354805ea220b6a57f6b8755347c7f240077
---

 libavformat/mov.c | 23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index c6a2d9c388..3215b53636 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -8122,6 +8122,22 @@ static int mov_seek_stream(AVFormatContext *s, AVStream 
*st, int64_t timestamp,
 return sample;
 }
 
+static int64_t mov_get_skip_samples(AVStream *st, int sample)
+{
+MOVStreamContext *sc = st->priv_data;
+int64_t first_ts = st->internal->index_entries[0].timestamp;
+int64_t ts = st->internal->index_entries[sample].timestamp;
+int64_t off;
+
+if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO)
+return 0;
+
+/* compute skip samples according to stream start_pad, seek ts and first 
ts */
+off = av_rescale_q(ts - first_ts, st->time_base,
+   (AVRational){1, st->codecpar->sample_rate});
+return FFMAX(sc->start_pad - off, 0);
+}
+
 static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t 
sample_time, int flags)
 {
 MOVContext *mc = s->priv_data;
@@ -8140,18 +8156,19 @@ static int mov_read_seek(AVFormatContext *s, int 
stream_index, int64_t sample_ti
 if (mc->seek_individually) {
 /* adjust seek timestamp to found sample timestamp */
 int64_t seek_timestamp = st->internal->index_entries[sample].timestamp;
+st->internal->skip_samples = mov_get_skip_samples(st, sample);
 
 for (i = 0; i < s->nb_streams; i++) {
 int64_t timestamp;
-MOVStreamContext *sc = s->streams[i]->priv_data;
 st = s->streams[i];
-st->internal->skip_samples = (sample_time <= 0) ? sc->start_pad : 
0;
 
 if (stream_index == i)
 continue;
 
 timestamp = av_rescale_q(seek_timestamp, 
s->streams[stream_index]->time_base, st->time_base);
-mov_seek_stream(s, st, timestamp, flags);
+sample = mov_seek_stream(s, st, timestamp, flags);
+if (sample >= 0)
+st->internal->skip_samples = mov_get_skip_samples(st, sample);
 }
 } else {
 for (i = 0; i < s->nb_streams; i++) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodec_wrapper: use MediaFormat to probe frame color characteristics

2020-05-25 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Mon Aug 
26 15:15:05 2019 +0200| [6268034b5d03580f86e9ff5a1879ebd56f35db40] | committer: 
Matthieu Bouron

avcodec/mediacodec_wrapper: use MediaFormat to probe frame color characteristics

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6268034b5d03580f86e9ff5a1879ebd56f35db40
---

 libavcodec/mediacodecdec_common.c | 100 ++
 1 file changed, 100 insertions(+)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index f0752fa626..404ed28227 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -85,6 +85,85 @@
 #define OUTPUT_DEQUEUE_TIMEOUT_US 8000
 #define OUTPUT_DEQUEUE_BLOCK_TIMEOUT_US 100
 
+enum {
+COLOR_RANGE_FULL= 0x1,
+COLOR_RANGE_LIMITED = 0x2,
+};
+
+static enum AVColorRange mcdec_get_color_range(int color_range)
+{
+switch (color_range) {
+case COLOR_RANGE_FULL:
+return AVCOL_RANGE_JPEG;
+case COLOR_RANGE_LIMITED:
+return AVCOL_RANGE_MPEG;
+default:
+return AVCOL_RANGE_UNSPECIFIED;
+}
+}
+
+enum {
+COLOR_STANDARD_BT709  = 0x1,
+COLOR_STANDARD_BT601_PAL  = 0x2,
+COLOR_STANDARD_BT601_NTSC = 0x4,
+COLOR_STANDARD_BT2020 = 0x6,
+};
+
+static enum AVColorSpace mcdec_get_color_space(int color_standard)
+{
+switch (color_standard) {
+case COLOR_STANDARD_BT709:
+return AVCOL_SPC_BT709;
+case COLOR_STANDARD_BT601_PAL:
+return AVCOL_SPC_BT470BG;
+case COLOR_STANDARD_BT601_NTSC:
+return AVCOL_SPC_SMPTE170M;
+case COLOR_STANDARD_BT2020:
+return AVCOL_SPC_BT2020_NCL;
+default:
+return AVCOL_SPC_UNSPECIFIED;
+}
+}
+
+static enum AVColorPrimaries mcdec_get_color_pri(int color_standard)
+{
+switch (color_standard) {
+case COLOR_STANDARD_BT709:
+return AVCOL_PRI_BT709;
+case COLOR_STANDARD_BT601_PAL:
+return AVCOL_PRI_BT470BG;
+case COLOR_STANDARD_BT601_NTSC:
+return AVCOL_PRI_SMPTE170M;
+case COLOR_STANDARD_BT2020:
+return AVCOL_PRI_BT2020;
+default:
+return AVCOL_PRI_UNSPECIFIED;
+}
+}
+
+enum {
+COLOR_TRANSFER_LINEAR= 0x1,
+COLOR_TRANSFER_SDR_VIDEO = 0x3,
+COLOR_TRANSFER_ST2084= 0x6,
+COLOR_TRANSFER_HLG   = 0x7,
+};
+
+static enum AVColorTransferCharacteristic mcdec_get_color_trc(int 
color_transfer)
+{
+switch (color_transfer) {
+case COLOR_TRANSFER_LINEAR:
+return AVCOL_TRC_LINEAR;
+case COLOR_TRANSFER_SDR_VIDEO:
+return AVCOL_TRC_SMPTE170M;
+case COLOR_TRANSFER_ST2084:
+return AVCOL_TRC_SMPTEST2084;
+case COLOR_TRANSFER_HLG:
+return AVCOL_TRC_ARIB_STD_B67;
+default:
+return AVCOL_TRC_UNSPECIFIED;
+}
+}
+
 enum {
 COLOR_FormatYUV420Planar  = 0x13,
 COLOR_FormatYUV420SemiPlanar  = 0x15,
@@ -220,6 +299,10 @@ FF_DISABLE_DEPRECATION_WARNINGS
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 frame->pkt_dts = AV_NOPTS_VALUE;
+frame->color_range = avctx->color_range;
+frame->color_primaries = avctx->color_primaries;
+frame->color_trc = avctx->color_trc;
+frame->colorspace = avctx->colorspace;
 
 buffer = av_mallocz(sizeof(AVMediaCodecBuffer));
 if (!buffer) {
@@ -368,6 +451,9 @@ static int mediacodec_dec_parse_format(AVCodecContext 
*avctx, MediaCodecDecConte
 int ret = 0;
 int width = 0;
 int height = 0;
+int color_range = 0;
+int color_standard = 0;
+int color_transfer = 0;
 char *format = NULL;
 
 if (!s->format) {
@@ -426,6 +512,20 @@ static int mediacodec_dec_parse_format(AVCodecContext 
*avctx, MediaCodecDecConte
 ff_set_sar(avctx, sar);
 }
 
+AMEDIAFORMAT_GET_INT32(color_range, "color-range", 0);
+if (color_range)
+avctx->color_range = mcdec_get_color_range(color_range);
+
+AMEDIAFORMAT_GET_INT32(color_standard, "color-standard", 0);
+if (color_standard) {
+avctx->colorspace = mcdec_get_color_space(color_standard);
+avctx->color_primaries = mcdec_get_color_pri(color_standard);
+}
+
+AMEDIAFORMAT_GET_INT32(color_transfer, "color-transfer", 0);
+if (color_transfer)
+avctx->color_trc = mcdec_get_color_trc(color_transfer);
+
 av_log(avctx, AV_LOG_INFO,
 "Output crop parameters top=%d bottom=%d left=%d right=%d, "
 "resulting dimensions width=%d height=%d\n",

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodec_wrapper: fix {input,output}_buffers global reference leak

2020-05-20 Thread Matthieu Bouron
ffmpeg | branch: release/4.2 | Matthieu Bouron  | 
Thu Apr  9 16:53:21 2020 +0200| [a7b0ab2a23ad461d73072f61ac05feb36c498f36] | 
committer: Matthieu Bouron

avcodec/mediacodec_wrapper: fix {input,output}_buffers global reference leak

Fixes ticket #8607.

Signed-off-by: Matthieu Bouron 
(cherry picked from commit 5216edbc54c79869ce630579199e53454f96df96)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7b0ab2a23ad461d73072f61ac05feb36c498f36
---

 libavcodec/mediacodec_wrapper.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 5213cf640a..79abc8b6aa 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1303,6 +1303,12 @@ int ff_AMediaCodec_delete(FFAMediaCodec* codec)
 ret = AVERROR_EXTERNAL;
 }
 
+(*env)->DeleteGlobalRef(env, codec->input_buffers);
+codec->input_buffers = NULL;
+
+(*env)->DeleteGlobalRef(env, codec->output_buffers);
+codec->output_buffers = NULL;
+
 (*env)->DeleteGlobalRef(env, codec->object);
 codec->object = NULL;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodec_wrapper: fix {input,output}_buffers global reference leak

2020-04-15 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Thu Apr 
 9 16:53:21 2020 +0200| [5216edbc54c79869ce630579199e53454f96df96] | committer: 
Matthieu Bouron

avcodec/mediacodec_wrapper: fix {input,output}_buffers global reference leak

Fixes ticket #8607.

Signed-off-by: Matthieu Bouron 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5216edbc54c79869ce630579199e53454f96df96
---

 libavcodec/mediacodec_wrapper.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 5213cf640a..79abc8b6aa 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1303,6 +1303,12 @@ int ff_AMediaCodec_delete(FFAMediaCodec* codec)
 ret = AVERROR_EXTERNAL;
 }
 
+(*env)->DeleteGlobalRef(env, codec->input_buffers);
+codec->input_buffers = NULL;
+
+(*env)->DeleteGlobalRef(env, codec->output_buffers);
+codec->output_buffers = NULL;
+
 (*env)->DeleteGlobalRef(env, codec->object);
 codec->object = NULL;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avformat/mov: parse sdtp atom and set the pkt disposable flag accordingly

2019-10-12 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Fri Sep 
27 14:57:09 2019 +0200| [1921f866ecf27b8b2b2764c24450d85577ff96c7] | committer: 
Matthieu Bouron

avformat/mov: parse sdtp atom and set the pkt disposable flag accordingly

Allows the creation of the sdtp atom while remuxing MP4 to MP4. This
atom is required by Apple devices (iPhone, Apple TV) in order to accept
2160p medias.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1921f866ecf27b8b2b2764c24450d85577ff96c7
---

 libavformat/isom.h |  2 ++
 libavformat/mov.c  | 41 ++
 .../ref/fate/hapqa-extract-snappy1-to-hapalphaonly |  2 +-
 tests/ref/fate/hapqa-extract-snappy1-to-hapq   |  2 +-
 .../fate/hapqa-extract-snappy16-to-hapalphaonly|  2 +-
 tests/ref/fate/hapqa-extract-snappy16-to-hapq  |  2 +-
 6 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 69452cae8e..4943b80ccf 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -163,6 +163,8 @@ typedef struct MOVStreamContext {
 int64_t *chunk_offsets;
 unsigned int stts_count;
 MOVStts *stts_data;
+unsigned int sdtp_count;
+uint8_t *sdtp_data;
 unsigned int ctts_count;
 unsigned int ctts_allocated_size;
 MOVStts *ctts_data;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 8e916a28c6..4f69664eaf 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2959,6 +2959,40 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return 0;
 }
 
+static int mov_read_sdtp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+AVStream *st;
+MOVStreamContext *sc;
+int64_t i, entries;
+
+if (c->fc->nb_streams < 1)
+return 0;
+st = c->fc->streams[c->fc->nb_streams - 1];
+sc = st->priv_data;
+
+avio_r8(pb); /* version */
+avio_rb24(pb); /* flags */
+entries = atom.size - 4;
+
+av_log(c->fc, AV_LOG_TRACE, "track[%u].sdtp.entries = %" PRId64 "\n",
+   c->fc->nb_streams - 1, entries);
+
+if (sc->sdtp_data)
+av_log(c->fc, AV_LOG_WARNING, "Duplicated SDTP atom\n");
+av_freep(>sdtp_data);
+sc->sdtp_count = 0;
+
+sc->sdtp_data = av_mallocz(entries);
+if (!sc->sdtp_data)
+return AVERROR(ENOMEM);
+
+for (i = 0; i < entries && !pb->eof_reached; i++)
+sc->sdtp_data[i] = avio_r8(pb);
+sc->sdtp_count = i;
+
+return 0;
+}
+
 static void mov_update_dts_shift(MOVStreamContext *sc, int duration)
 {
 if (duration < 0) {
@@ -6767,6 +6801,7 @@ static const MOVParseTableEntry mov_default_parse_table[] 
= {
 { MKTAG('s','t','s','z'), mov_read_stsz }, /* sample size */
 { MKTAG('s','t','t','s'), mov_read_stts },
 { MKTAG('s','t','z','2'), mov_read_stsz }, /* compact sample size */
+{ MKTAG('s','d','t','p'), mov_read_sdtp }, /* independent and disposable 
samples */
 { MKTAG('t','k','h','d'), mov_read_tkhd }, /* track header */
 { MKTAG('t','f','d','t'), mov_read_tfdt },
 { MKTAG('t','f','h','d'), mov_read_tfhd }, /* track fragment header */
@@ -7231,6 +7266,7 @@ static int mov_read_close(AVFormatContext *s)
 av_freep(>sample_sizes);
 av_freep(>keyframes);
 av_freep(>stts_data);
+av_freep(>sdtp_data);
 av_freep(>stps_data);
 av_freep(>elst_data);
 av_freep(>rap_group);
@@ -7820,6 +7856,11 @@ static int mov_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 }
 if (st->discard == AVDISCARD_ALL)
 goto retry;
+if (sc->sdtp_data && sc->current_sample <= sc->sdtp_count) {
+uint8_t sample_flags = sc->sdtp_data[sc->current_sample - 1];
+uint8_t sample_is_depended_on = (sample_flags >> 2) & 0x3;
+pkt->flags |= sample_is_depended_on == MOV_SAMPLE_DEPENDENCY_NO ? 
AV_PKT_FLAG_DISPOSABLE : 0;
+}
 pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0;
 pkt->pos = sample->pos;
 
diff --git a/tests/ref/fate/hapqa-extract-snappy1-to-hapalphaonly 
b/tests/ref/fate/hapqa-extract-snappy1-to-hapalphaonly
index 9ab123f09d..7edd5fa65b 100644
--- a/tests/ref/fate/hapqa-extract-snappy1-to-hapalphaonly
+++ b/tests/ref/fate/hapqa-extract-snappy1-to-hapalphaonly
@@ -3,4 +3,4 @@
 #codec_id 0: hap
 #dimensions 0: 127x71
 #sar 0: 1/1
-0,  0,  0,1, 3044, 0xcaf6ddd0
+0,  0,  0,1, 3044, 0xcaf6ddd0, F=0x11
diff --git a/tests/ref/fate/hapqa-extract-snappy1-to-hapq 
b/tests/ref/fate/hapqa-extract-snappy1-to-hapq
index f658b1c0b4..1340f77bf5 100644
--- a/tests/ref/fate/hapqa-extract-snappy1-to-hapq
+++ b/tests/ref/fate/hapqa-extract-snappy1-to-hapq
@@ -3,4 +3,4 @@
 #codec_id 0: hap
 #dimensions 0: 127x71
 #sar 0: 1/1
-0,  0,  0,1, 8217,

[FFmpeg-cvslog] avcodec/mediacodec_wrapper: remove unused local variables in ff_AMediaCodec_getCodecNameByType()

2019-07-26 Thread Matthieu Bouron
ffmpeg | branch: release/4.2 | Matthieu Bouron  | 
Fri Apr 26 10:32:31 2019 +0200| [1df4a99e892f65e3d1554a343b946313d7fee18c] | 
committer: Matthieu Bouron

avcodec/mediacodec_wrapper: remove unused local variables in 
ff_AMediaCodec_getCodecNameByType()

(cherry picked from commit 817235b195f55746893629bd8e6fa3501ea7b38e)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1df4a99e892f65e3d1554a343b946313d7fee18c
---

 libavcodec/mediacodec_wrapper.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 70e1e7cae1..5213cf640a 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -392,8 +392,6 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
*mime, int profile, int e
 struct JNIAMediaCodecListFields jfields = { 0 };
 struct JNIAMediaFormatFields mediaformat_jfields = { 0 };
 
-jobject format = NULL;
-jobject codec = NULL;
 jobject codec_name = NULL;
 
 jobject info = NULL;
@@ -571,14 +569,6 @@ done_with_info:
 }
 
 done:
-if (format) {
-(*env)->DeleteLocalRef(env, format);
-}
-
-if (codec) {
-(*env)->DeleteLocalRef(env, codec);
-}
-
 if (codec_name) {
 (*env)->DeleteLocalRef(env, codec_name);
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodec_wrapper: fix a local reference leak in ff_AMediaCodec_getName()

2019-07-26 Thread Matthieu Bouron
ffmpeg | branch: release/4.2 | Matthieu Bouron  | 
Thu Apr 25 17:40:55 2019 +0200| [a3d986ff47b15dcfdda3060d1b9ea3ae81a3d7ad] | 
committer: Matthieu Bouron

avcodec/mediacodec_wrapper: fix a local reference leak in 
ff_AMediaCodec_getName()

(cherry picked from commit 9cb8875c165e6377a3eebdce9743c5579f131248)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a3d986ff47b15dcfdda3060d1b9ea3ae81a3d7ad
---

 libavcodec/mediacodec_wrapper.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index a024e3bdb1..e2df07cb41 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1337,6 +1337,10 @@ char *ff_AMediaCodec_getName(FFAMediaCodec *codec)
 ret = ff_jni_jstring_to_utf_chars(env, name, codec);
 
 fail:
+if (name) {
+(*env)->DeleteLocalRef(env, name);
+}
+
 return ret;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodec_wrapper: fix a potential local reference leak in ff_AMediaCodec_getCodecNameByType()

2019-07-26 Thread Matthieu Bouron
ffmpeg | branch: release/4.2 | Matthieu Bouron  | 
Thu Apr 25 17:12:32 2019 +0200| [3abec7f39735a1cda83c002937abe107bb47caa9] | 
committer: Matthieu Bouron

avcodec/mediacodec_wrapper: fix a potential local reference leak in 
ff_AMediaCodec_getCodecNameByType()

(cherry picked from commit 3f232d713db3cb665c265387c7009904c2e85e58)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3abec7f39735a1cda83c002937abe107bb47caa9
---

 libavcodec/mediacodec_wrapper.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index e2df07cb41..70e1e7cae1 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -469,6 +469,11 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
*mime, int profile, int e
 goto done;
 }
 
+if (codec_name) {
+(*env)->DeleteLocalRef(env, codec_name);
+codec_name = NULL;
+}
+
 /* Skip software decoders */
 if (
 strstr(name, "OMX.google") ||

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodec_wrapper: add missing "avcodec.h" include

2019-07-26 Thread Matthieu Bouron
ffmpeg | branch: release/4.2 | Matthieu Bouron  | 
Mon Apr 29 11:24:37 2019 +0200| [65434823a1eed14733580e75b0f0706731885b90] | 
committer: Matthieu Bouron

avcodec/mediacodec_wrapper: add missing "avcodec.h" include

(cherry picked from commit 6251ad89a77566254b934fbf95159d66e29328a8)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=65434823a1eed14733580e75b0f0706731885b90
---

 libavcodec/mediacodec_wrapper.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.h b/libavcodec/mediacodec_wrapper.h
index f0de16d669..b106ff315a 100644
--- a/libavcodec/mediacodec_wrapper.h
+++ b/libavcodec/mediacodec_wrapper.h
@@ -26,6 +26,8 @@
 #include 
 #include 
 
+#include "avcodec.h"
+
 /**
  * The following API around MediaCodec and MediaFormat is based on the
  * NDK one provided by Google since Android 5.0.

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodec_wrapper: add missing "avcodec.h" include

2019-07-22 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Mon Apr 
29 11:24:37 2019 +0200| [6251ad89a77566254b934fbf95159d66e29328a8] | committer: 
Matthieu Bouron

avcodec/mediacodec_wrapper: add missing "avcodec.h" include

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6251ad89a77566254b934fbf95159d66e29328a8
---

 libavcodec/mediacodec_wrapper.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.h b/libavcodec/mediacodec_wrapper.h
index f0de16d669..b106ff315a 100644
--- a/libavcodec/mediacodec_wrapper.h
+++ b/libavcodec/mediacodec_wrapper.h
@@ -26,6 +26,8 @@
 #include 
 #include 
 
+#include "avcodec.h"
+
 /**
  * The following API around MediaCodec and MediaFormat is based on the
  * NDK one provided by Google since Android 5.0.

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodec_wrapper: remove unused local variables in ff_AMediaCodec_getCodecNameByType()

2019-07-22 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Fri Apr 
26 10:32:31 2019 +0200| [817235b195f55746893629bd8e6fa3501ea7b38e] | committer: 
Matthieu Bouron

avcodec/mediacodec_wrapper: remove unused local variables in 
ff_AMediaCodec_getCodecNameByType()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=817235b195f55746893629bd8e6fa3501ea7b38e
---

 libavcodec/mediacodec_wrapper.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 70e1e7cae1..5213cf640a 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -392,8 +392,6 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
*mime, int profile, int e
 struct JNIAMediaCodecListFields jfields = { 0 };
 struct JNIAMediaFormatFields mediaformat_jfields = { 0 };
 
-jobject format = NULL;
-jobject codec = NULL;
 jobject codec_name = NULL;
 
 jobject info = NULL;
@@ -571,14 +569,6 @@ done_with_info:
 }
 
 done:
-if (format) {
-(*env)->DeleteLocalRef(env, format);
-}
-
-if (codec) {
-(*env)->DeleteLocalRef(env, codec);
-}
-
 if (codec_name) {
 (*env)->DeleteLocalRef(env, codec_name);
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodec_wrapper: fix a potential local reference leak in ff_AMediaCodec_getCodecNameByType()

2019-07-22 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Thu Apr 
25 17:12:32 2019 +0200| [3f232d713db3cb665c265387c7009904c2e85e58] | committer: 
Matthieu Bouron

avcodec/mediacodec_wrapper: fix a potential local reference leak in 
ff_AMediaCodec_getCodecNameByType()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f232d713db3cb665c265387c7009904c2e85e58
---

 libavcodec/mediacodec_wrapper.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index e2df07cb41..70e1e7cae1 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -469,6 +469,11 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
*mime, int profile, int e
 goto done;
 }
 
+if (codec_name) {
+(*env)->DeleteLocalRef(env, codec_name);
+codec_name = NULL;
+}
+
 /* Skip software decoders */
 if (
 strstr(name, "OMX.google") ||

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodec_wrapper: fix a local reference leak in ff_AMediaCodec_getName()

2019-07-22 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Thu Apr 
25 17:40:55 2019 +0200| [9cb8875c165e6377a3eebdce9743c5579f131248] | committer: 
Matthieu Bouron

avcodec/mediacodec_wrapper: fix a local reference leak in 
ff_AMediaCodec_getName()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9cb8875c165e6377a3eebdce9743c5579f131248
---

 libavcodec/mediacodec_wrapper.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index a024e3bdb1..e2df07cb41 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1337,6 +1337,10 @@ char *ff_AMediaCodec_getName(FFAMediaCodec *codec)
 ret = ff_jni_jstring_to_utf_chars(env, name, codec);
 
 fail:
+if (name) {
+(*env)->DeleteLocalRef(env, name);
+}
+
 return ret;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodecdec: try to receive a frame after signaling EOF to the codec

2019-06-13 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Wed Apr 
24 09:59:28 2019 +0200| [d83985ce11d0f68d293e52fdccfc62fe9d28d54f] | committer: 
Matthieu Bouron

avcodec/mediacodecdec: try to receive a frame after signaling EOF to the codec

Avoids returning EAGAIN after signaling EOF to the codec in
ff_mediacodec_dec_send() so we can try to receive a frame before
returning in mediacodec_receive_frame().

This helps avoiding an extra round-trip between avcodec_send_frame() and
avcodec_receive_frame() while draining the remaining frames.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d83985ce11d0f68d293e52fdccfc62fe9d28d54f
---

 libavcodec/mediacodecdec.c| 1 +
 libavcodec/mediacodecdec_common.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 3a4240aa95..e353e34bd5 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -461,6 +461,7 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
 ret = ff_mediacodec_dec_send(avctx, s->ctx, _pkt, true);
 if (ret < 0)
 return ret;
+return ff_mediacodec_dec_receive(avctx, s->ctx, frame, true);
 } else if (ret == AVERROR(EAGAIN) && s->ctx->current_input_buffer < 0) 
{
 return ff_mediacodec_dec_receive(avctx, s->ctx, frame, true);
 } else if (ret < 0) {
diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index 7c2661f672..f7a06cdc6d 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -631,7 +631,7 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, 
MediaCodecDecContext *s,
"Queued input buffer %zd size=%zd ts=%"PRIi64"\n", index, 
size, pts);
 
 s->draining = 1;
-break;
+return 0;
 } else {
 size = FFMIN(pkt->size - offset, size);
 memcpy(data, pkt->data + offset, size);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodecdec: remove unneeded else block in ff_mediacodec_dec_send()

2019-06-13 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Wed Apr 
24 09:59:29 2019 +0200| [fef5ba40231db053afd611874ebbadbead6cbf8e] | committer: 
Matthieu Bouron

avcodec/mediacodecdec: remove unneeded else block in ff_mediacodec_dec_send()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fef5ba40231db053afd611874ebbadbead6cbf8e
---

 libavcodec/mediacodecdec_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index f7a06cdc6d..f90e2f1a23 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -632,7 +632,8 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 
 s->draining = 1;
 return 0;
-} else {
+}
+
 size = FFMIN(pkt->size - offset, size);
 memcpy(data, pkt->data + offset, size);
 offset += size;
@@ -645,7 +646,6 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 
 av_log(avctx, AV_LOG_TRACE,
"Queued input buffer %zd size=%zd ts=%"PRIi64"\n", index, 
size, pts);
-}
 }
 
 if (offset == 0)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/mediacodecdec: re-indent after previous commit

2019-06-13 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Wed Apr 
24 09:59:30 2019 +0200| [7c2c5c4940a61311d153ef4e4a61fa827c341615] | committer: 
Matthieu Bouron

avcodec/mediacodecdec: re-indent after previous commit

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c2c5c4940a61311d153ef4e4a61fa827c341615
---

 libavcodec/mediacodecdec_common.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index f90e2f1a23..1656cd6664 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -634,18 +634,18 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 return 0;
 }
 
-size = FFMIN(pkt->size - offset, size);
-memcpy(data, pkt->data + offset, size);
-offset += size;
+size = FFMIN(pkt->size - offset, size);
+memcpy(data, pkt->data + offset, size);
+offset += size;
 
-status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, size, 
pts, 0);
-if (status < 0) {
-av_log(avctx, AV_LOG_ERROR, "Failed to queue input buffer 
(status = %d)\n", status);
-return AVERROR_EXTERNAL;
-}
+status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, size, pts, 
0);
+if (status < 0) {
+av_log(avctx, AV_LOG_ERROR, "Failed to queue input buffer (status 
= %d)\n", status);
+return AVERROR_EXTERNAL;
+}
 
-av_log(avctx, AV_LOG_TRACE,
-   "Queued input buffer %zd size=%zd ts=%"PRIi64"\n", index, 
size, pts);
+av_log(avctx, AV_LOG_TRACE,
+   "Queued input buffer %zd size=%zd ts=%"PRIi64"\n", index, size, 
pts);
 }
 
 if (offset == 0)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] RELEASE: update for git after 4.0 branchpoint

2018-09-25 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Tue Sep 
25 11:30:50 2018 +0200| [e294b5cf6464e3d8ee0d0bdedcfb4ca0ad0297ed] | committer: 
Matthieu Bouron

RELEASE: update for git after 4.0 branchpoint

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e294b5cf6464e3d8ee0d0bdedcfb4ca0ad0297ed
---

 RELEASE | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/RELEASE b/RELEASE
index 9b601acc0d..ff2c9d1a30 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1 +1 @@
-3.4.git
+4.0.git

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/mediacodecdec_common: make stride and slice-height non-mandatory fields

2018-04-19 Thread Matthieu Bouron
ffmpeg | branch: release/4.0 | Matthieu Bouron <matthieu.bou...@gmail.com> | 
Wed Apr 11 10:28:56 2018 +0200| [9b7111424797e458aa51f7569dc132d44b18fd79] | 
committer: Matthieu Bouron

avcodec/mediacodecdec_common: make stride and slice-height non-mandatory fields

Fixes decoding on the Samsung Chromebook Pro which do not set the codec
output format stride and slice-height fields.

(cherry picked from commit 67d0911f27e29d551865dbca3af5c49abe029885)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b7111424797e458aa51f7569dc132d44b18fd79
---

 libavcodec/mediacodecdec_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index e31adb487c..e59cf19aad 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -385,10 +385,10 @@ static int mediacodec_dec_parse_format(AVCodecContext 
*avctx, MediaCodecDecConte
 AMEDIAFORMAT_GET_INT32(s->width,  "width", 1);
 AMEDIAFORMAT_GET_INT32(s->height, "height", 1);
 
-AMEDIAFORMAT_GET_INT32(s->stride, "stride", 1);
+AMEDIAFORMAT_GET_INT32(s->stride, "stride", 0);
 s->stride = s->stride > 0 ? s->stride : s->width;
 
-AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 1);
+AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 0);
 s->slice_height = s->slice_height > 0 ? s->slice_height : s->height;
 
 if (strstr(s->codec_name, "OMX.Nvidia.")) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/mediacodecdec_common: make stride and slice-height non-mandatory fields

2018-04-19 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed Apr 
11 10:28:56 2018 +0200| [67d0911f27e29d551865dbca3af5c49abe029885] | committer: 
Matthieu Bouron

avcodec/mediacodecdec_common: make stride and slice-height non-mandatory fields

Fixes decoding on the Samsung Chromebook Pro which do not set the codec
output format stride and slice-height fields.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67d0911f27e29d551865dbca3af5c49abe029885
---

 libavcodec/mediacodecdec_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index e31adb487c..e59cf19aad 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -385,10 +385,10 @@ static int mediacodec_dec_parse_format(AVCodecContext 
*avctx, MediaCodecDecConte
 AMEDIAFORMAT_GET_INT32(s->width,  "width", 1);
 AMEDIAFORMAT_GET_INT32(s->height, "height", 1);
 
-AMEDIAFORMAT_GET_INT32(s->stride, "stride", 1);
+AMEDIAFORMAT_GET_INT32(s->stride, "stride", 0);
 s->stride = s->stride > 0 ? s->stride : s->width;
 
-AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 1);
+AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 0);
 s->slice_height = s->slice_height > 0 ? s->slice_height : s->height;
 
 if (strstr(s->codec_name, "OMX.Nvidia.")) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/mediacodecdec: factorize common extradata functions

2018-03-03 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Fri Mar 
 2 10:36:08 2018 +0100| [af167d970bbf86c5741e4ba8d524be77085c30ae] | committer: 
Matthieu Bouron

avcodec/mediacodecdec: factorize common extradata functions

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af167d970bbf86c5741e4ba8d524be77085c30ae
---

 libavcodec/mediacodecdec.c | 41 +
 1 file changed, 9 insertions(+), 32 deletions(-)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index ad09d16398..4579da1fa5 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -264,34 +264,11 @@ done:
 }
 #endif
 
-#if CONFIG_MPEG2_MEDIACODEC_DECODER
-static int mpeg2_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
-{
-int ret = 0;
-
-if (avctx->extradata) {
-ff_AMediaFormat_setBuffer(format, "csd-0", avctx->extradata, 
avctx->extradata_size);
-}
-
-return ret;
-}
-#endif
-
-#if CONFIG_MPEG4_MEDIACODEC_DECODER
-static int mpeg4_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
-{
-int ret = 0;
-
-if (avctx->extradata) {
-ff_AMediaFormat_setBuffer(format, "csd-0", avctx->extradata, 
avctx->extradata_size);
-}
-
-return ret;
-}
-#endif
-
-#if CONFIG_VP8_MEDIACODEC_DECODER || CONFIG_VP9_MEDIACODEC_DECODER
-static int vpx_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
+#if CONFIG_MPEG2_MEDIACODEC_DECODER || \
+CONFIG_MPEG4_MEDIACODEC_DECODER || \
+CONFIG_VP8_MEDIACODEC_DECODER   || \
+CONFIG_VP9_MEDIACODEC_DECODER
+static int common_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
 {
 int ret = 0;
 
@@ -342,7 +319,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext 
*avctx)
 case AV_CODEC_ID_MPEG2VIDEO:
 codec_mime = "video/mpeg2";
 
-ret = mpeg2_set_extradata(avctx, format);
+ret = common_set_extradata(avctx, format);
 if (ret < 0)
 goto done;
 break;
@@ -351,7 +328,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext 
*avctx)
 case AV_CODEC_ID_MPEG4:
 codec_mime = "video/mp4v-es",
 
-ret = mpeg4_set_extradata(avctx, format);
+ret = common_set_extradata(avctx, format);
 if (ret < 0)
 goto done;
 break;
@@ -360,7 +337,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext 
*avctx)
 case AV_CODEC_ID_VP8:
 codec_mime = "video/x-vnd.on2.vp8";
 
-ret = vpx_set_extradata(avctx, format);
+ret = common_set_extradata(avctx, format);
 if (ret < 0)
 goto done;
 break;
@@ -369,7 +346,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext 
*avctx)
 case AV_CODEC_ID_VP9:
 codec_mime = "video/x-vnd.on2.vp9";
 
-ret = vpx_set_extradata(avctx, format);
+ret = common_set_extradata(avctx, format);
 if (ret < 0)
 goto done;
 break;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/mediacodecdec: add missing "libavutil/internal.h" include

2018-03-03 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Fri Mar 
 2 12:04:30 2018 +0100| [535e020225486514dd3cd2f4e3b59f0cc42c54f7] | committer: 
Matthieu Bouron

avcodec/mediacodecdec: add missing "libavutil/internal.h" include

libavutil/internal.h defines NULL_IF_CONFIG_SMALL.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=535e020225486514dd3cd2f4e3b59f0cc42c54f7
---

 libavcodec/mediacodecdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 363e12427e..ad09d16398 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -28,6 +28,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/pixfmt.h"
+#include "libavutil/internal.h"
 
 #include "avcodec.h"
 #include "decode.h"

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/mediacodecdec_common: refactor mediacodec_dec_parse_format()

2018-03-03 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Mon Feb 
19 16:13:00 2018 +0100| [a079eaba8ee20bc3869852df658f2f6cc11875e3] | committer: 
Matthieu Bouron

avcodec/mediacodecdec_common: refactor mediacodec_dec_parse_format()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a079eaba8ee20bc3869852df658f2f6cc11875e3
---

 libavcodec/mediacodecdec_common.c | 82 ++-
 1 file changed, 30 insertions(+), 52 deletions(-)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index b44abaef7f..ab26df04bd 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -339,11 +339,22 @@ done:
 return ret;
 }
 
+#define AMEDIAFORMAT_GET_INT32(name, key, mandatory) do {  
\
+int32_t value = 0; 
\
+if (ff_AMediaFormat_getInt32(s->format, key, )) {
\
+(name) = value;
\
+} else if (mandatory) {
\
+av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", key, 
format); \
+ret = AVERROR_EXTERNAL;
\
+goto fail; 
\
+}  
\
+} while (0)
\
+
 static int mediacodec_dec_parse_format(AVCodecContext *avctx, 
MediaCodecDecContext *s)
 {
+int ret = 0;
 int width = 0;
 int height = 0;
-int32_t value = 0;
 char *format = NULL;
 
 if (!s->format) {
@@ -356,40 +367,16 @@ static int mediacodec_dec_parse_format(AVCodecContext 
*avctx, MediaCodecDecConte
 return AVERROR_EXTERNAL;
 }
 av_log(avctx, AV_LOG_DEBUG, "Parsing MediaFormat %s\n", format);
-av_freep();
 
 /* Mandatory fields */
-if (!ff_AMediaFormat_getInt32(s->format, "width", )) {
-format = ff_AMediaFormat_toString(s->format);
-av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", 
"width", format);
-av_freep();
-return AVERROR_EXTERNAL;
-}
-s->width = value;
+AMEDIAFORMAT_GET_INT32(s->width,  "width", 1);
+AMEDIAFORMAT_GET_INT32(s->height, "height", 1);
 
-if (!ff_AMediaFormat_getInt32(s->format, "height", )) {
-format = ff_AMediaFormat_toString(s->format);
-av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", 
"height", format);
-av_freep();
-return AVERROR_EXTERNAL;
-}
-s->height = value;
+AMEDIAFORMAT_GET_INT32(s->stride, "stride", 1);
+s->stride = s->stride > 0 ? s->stride : s->width;
 
-if (!ff_AMediaFormat_getInt32(s->format, "stride", )) {
-format = ff_AMediaFormat_toString(s->format);
-av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", 
"stride", format);
-av_freep();
-return AVERROR_EXTERNAL;
-}
-s->stride = value > 0 ? value : s->width;
-
-if (!ff_AMediaFormat_getInt32(s->format, "slice-height", )) {
-format = ff_AMediaFormat_toString(s->format);
-av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", 
"slice-height", format);
-av_freep();
-return AVERROR_EXTERNAL;
-}
-s->slice_height = value > 0 ? value : s->height;
+AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 1);
+s->slice_height = s->slice_height > 0 ? s->slice_height : s->height;
 
 if (strstr(s->codec_name, "OMX.Nvidia.")) {
 s->slice_height = FFALIGN(s->height, 16);
@@ -398,32 +385,19 @@ static int mediacodec_dec_parse_format(AVCodecContext 
*avctx, MediaCodecDecConte
 s->stride = avctx->width;
 }
 
-if (!ff_AMediaFormat_getInt32(s->format, "color-format", )) {
-format = ff_AMediaFormat_toString(s->format);
-av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", 
"color-format", format);
-av_freep();
-return AVERROR_EXTERNAL;
-}
-s->color_format = value;
-
-s->pix_fmt = avctx->pix_fmt = mcdec_map_color_format(avctx, s, value);
+AMEDIAFORMAT_GET_INT32(s->color_format, "color-format", 1);
+s->pix_fmt = avctx->pix_fmt = mcdec_map_color_format(avctx, s, 
s->color_format);
 if (avctx->pix_fmt == AV_PIX_FMT_NONE) {
   

[FFmpeg-cvslog] avcodec/mediacodecdec_common: remove unused field from MediaCodecDecContext

2018-03-03 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Tue Feb 
20 11:08:01 2018 +0100| [cc9875dc29383dd2c82dee3736e0cf53008a865e] | committer: 
Matthieu Bouron

avcodec/mediacodecdec_common: remove unused field from MediaCodecDecContext

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc9875dc29383dd2c82dee3736e0cf53008a865e
---

 libavcodec/mediacodecdec_common.c | 2 +-
 libavcodec/mediacodecdec_common.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index 195cc70ba7..929db78361 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -386,7 +386,7 @@ static int mediacodec_dec_parse_format(AVCodecContext 
*avctx, MediaCodecDecConte
 }
 
 AMEDIAFORMAT_GET_INT32(s->color_format, "color-format", 1);
-s->pix_fmt = avctx->pix_fmt = mcdec_map_color_format(avctx, s, 
s->color_format);
+avctx->pix_fmt = mcdec_map_color_format(avctx, s, s->color_format);
 if (avctx->pix_fmt == AV_PIX_FMT_NONE) {
 av_log(avctx, AV_LOG_ERROR, "Output color format is not supported\n");
 ret = AVERROR(EINVAL);
diff --git a/libavcodec/mediacodecdec_common.h 
b/libavcodec/mediacodecdec_common.h
index 32d16d3e3a..85df507ffb 100644
--- a/libavcodec/mediacodecdec_common.h
+++ b/libavcodec/mediacodecdec_common.h
@@ -55,7 +55,6 @@ typedef struct MediaCodecDecContext {
 int stride;
 int slice_height;
 int color_format;
-enum AVPixelFormat pix_fmt;
 int crop_top;
 int crop_bottom;
 int crop_left;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/mediacodecdec_common: remove spurious space

2018-03-03 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Mon Feb 
19 16:13:51 2018 +0100| [5d69e249c81ec71630b4cb536907cc831fadef6b] | committer: 
Matthieu Bouron

avcodec/mediacodecdec_common: remove spurious space

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d69e249c81ec71630b4cb536907cc831fadef6b
---

 libavcodec/mediacodecdec_common.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index ab26df04bd..195cc70ba7 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -415,7 +415,6 @@ fail:
 return ret;
 }
 
-
 static int mediacodec_dec_flush_codec(AVCodecContext *avctx, 
MediaCodecDecContext *s)
 {
 FFAMediaCodec *codec = s->codec;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/mediacodec_wrapper: load and use MediaFormat.constainsKey()

2018-03-03 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed Feb 
21 14:15:42 2018 +0100| [c55ba52a6a0698e0d6a9f7698f7dcc384764505a] | committer: 
Matthieu Bouron

avcodec/mediacodec_wrapper: load and use MediaFormat.constainsKey()

Avoids triggering an exception in MediaFormat getter functions if the
key does not exist.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c55ba52a6a0698e0d6a9f7698f7dcc384764505a
---

 libavcodec/mediacodec_wrapper.c | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index dbc37bf463..9436b3c994 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -111,6 +111,8 @@ struct JNIAMediaFormatFields {
 
 jmethodID init_id;
 
+jmethodID contains_key_id;
+
 jmethodID get_integer_id;
 jmethodID get_long_id;
 jmethodID get_float_id;
@@ -132,6 +134,8 @@ static const struct FFJniField jni_amediaformat_mapping[] = 
{
 
 { "android/media/MediaFormat", "", "()V", FF_JNI_METHOD, 
offsetof(struct JNIAMediaFormatFields, init_id), 1 },
 
+{ "android/media/MediaFormat", "containsKey", "(Ljava/lang/String;)Z", 
FF_JNI_METHOD,offsetof(struct JNIAMediaFormatFields, contains_key_id), 1 },
+
 { "android/media/MediaFormat", "getInteger", "(Ljava/lang/String;)I", 
FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_integer_id), 1 },
 { "android/media/MediaFormat", "getLong", "(Ljava/lang/String;)J", 
FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_long_id), 1 },
 { "android/media/MediaFormat", "getFloat", "(Ljava/lang/String;)F", 
FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_float_id), 1 },
@@ -738,6 +742,7 @@ int ff_AMediaFormat_getInt32(FFAMediaFormat* format, const 
char *name, int32_t *
 
 JNIEnv *env = NULL;
 jstring key = NULL;
+jboolean contains_key;
 
 av_assert0(format != NULL);
 
@@ -749,6 +754,12 @@ int ff_AMediaFormat_getInt32(FFAMediaFormat* format, const 
char *name, int32_t *
 goto fail;
 }
 
+contains_key = (*env)->CallBooleanMethod(env, format->object, 
format->jfields.contains_key_id, key);
+if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) {
+ret = 0;
+goto fail;
+}
+
 *out = (*env)->CallIntMethod(env, format->object, 
format->jfields.get_integer_id, key);
 if ((ret = ff_jni_exception_check(env, 1, format)) < 0) {
 ret = 0;
@@ -770,6 +781,7 @@ int ff_AMediaFormat_getInt64(FFAMediaFormat* format, const 
char *name, int64_t *
 
 JNIEnv *env = NULL;
 jstring key = NULL;
+jboolean contains_key;
 
 av_assert0(format != NULL);
 
@@ -781,6 +793,12 @@ int ff_AMediaFormat_getInt64(FFAMediaFormat* format, const 
char *name, int64_t *
 goto fail;
 }
 
+contains_key = (*env)->CallBooleanMethod(env, format->object, 
format->jfields.contains_key_id, key);
+if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) {
+ret = 0;
+goto fail;
+}
+
 *out = (*env)->CallLongMethod(env, format->object, 
format->jfields.get_long_id, key);
 if ((ret = ff_jni_exception_check(env, 1, format)) < 0) {
 ret = 0;
@@ -802,6 +820,7 @@ int ff_AMediaFormat_getFloat(FFAMediaFormat* format, const 
char *name, float *ou
 
 JNIEnv *env = NULL;
 jstring key = NULL;
+jboolean contains_key;
 
 av_assert0(format != NULL);
 
@@ -813,6 +832,12 @@ int ff_AMediaFormat_getFloat(FFAMediaFormat* format, const 
char *name, float *ou
 goto fail;
 }
 
+contains_key = (*env)->CallBooleanMethod(env, format->object, 
format->jfields.contains_key_id, key);
+if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) {
+ret = 0;
+goto fail;
+}
+
 *out = (*env)->CallFloatMethod(env, format->object, 
format->jfields.get_float_id, key);
 if ((ret = ff_jni_exception_check(env, 1, format)) < 0) {
 ret = 0;
@@ -834,6 +859,7 @@ int ff_AMediaFormat_getBuffer(FFAMediaFormat* format, const 
char *name, void** d
 
 JNIEnv *env = NULL;
 jstring key = NULL;
+jboolean contains_key;
 jobject result = NULL;
 
 av_assert0(format != NULL);
@@ -846,6 +872,12 @@ int ff_AMediaFormat_getBuffer(FFAMediaFormat* format, 
const char *name, void** d
 goto fail;
 }
 
+contains_key = (*env)->CallBooleanMethod(env, format->object, 
format->jfields.contains_key_id, key);
+if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) {
+ret = 0;
+goto fail;
+}
+
 result = (*env)->CallObjectMethod(env, format->object, 
format->jfields

[FFmpeg-cvslog] avcodec/mediacodecdec: factorize codec declarations

2018-03-03 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Fri Mar 
 2 12:06:19 2018 +0100| [2238e54ef02b7a7ce3ddf614280d7d883ed2a9e6] | committer: 
Matthieu Bouron

avcodec/mediacodecdec: factorize codec declarations

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2238e54ef02b7a7ce3ddf614280d7d883ed2a9e6
---

 libavcodec/mediacodecdec.c | 116 ++---
 1 file changed, 24 insertions(+), 92 deletions(-)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 4579da1fa5..0fe14846c3 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -485,112 +485,44 @@ static const AVCodecHWConfigInternal 
*mediacodec_hw_configs[] = {
 NULL
 };
 
+#define DECLARE_MEDIACODEC_VDEC(short_name, full_name, codec_id, bsf)  
\
+AVCodec ff_##short_name##_mediacodec_decoder = {   
\
+.name   = #short_name "_mediacodec",   
\
+.long_name  = NULL_IF_CONFIG_SMALL(full_name " Android MediaCodec 
decoder"),   \
+.type   = AVMEDIA_TYPE_VIDEO,  
\
+.id = codec_id,
\
+.priv_data_size = sizeof(MediaCodecH264DecContext),
\
+.init   = mediacodec_decode_init,  
\
+.receive_frame  = mediacodec_receive_frame,
\
+.flush  = mediacodec_decode_flush, 
\
+.close  = mediacodec_decode_close, 
\
+.capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | 
AV_CODEC_CAP_HARDWARE, \
+.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,   
\
+.bsfs   = bsf, 
\
+.hw_configs = mediacodec_hw_configs,   
\
+.wrapper_name   = "mediacodec",
\
+}; 
\
+
 #if CONFIG_H264_MEDIACODEC_DECODER
-AVCodec ff_h264_mediacodec_decoder = {
-.name   = "h264_mediacodec",
-.long_name  = NULL_IF_CONFIG_SMALL("H.264 Android MediaCodec decoder"),
-.type   = AVMEDIA_TYPE_VIDEO,
-.id = AV_CODEC_ID_H264,
-.priv_data_size = sizeof(MediaCodecH264DecContext),
-.init   = mediacodec_decode_init,
-.receive_frame  = mediacodec_receive_frame,
-.flush  = mediacodec_decode_flush,
-.close  = mediacodec_decode_close,
-.capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | 
AV_CODEC_CAP_HARDWARE,
-.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
-.bsfs   = "h264_mp4toannexb",
-.hw_configs = mediacodec_hw_configs,
-.wrapper_name   = "mediacodec",
-};
+DECLARE_MEDIACODEC_VDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb")
 #endif
 
 #if CONFIG_HEVC_MEDIACODEC_DECODER
-AVCodec ff_hevc_mediacodec_decoder = {
-.name   = "hevc_mediacodec",
-.long_name  = NULL_IF_CONFIG_SMALL("H.265 Android MediaCodec decoder"),
-.type   = AVMEDIA_TYPE_VIDEO,
-.id = AV_CODEC_ID_HEVC,
-.priv_data_size = sizeof(MediaCodecH264DecContext),
-.init   = mediacodec_decode_init,
-.receive_frame  = mediacodec_receive_frame,
-.flush  = mediacodec_decode_flush,
-.close  = mediacodec_decode_close,
-.capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | 
AV_CODEC_CAP_HARDWARE,
-.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
-.bsfs   = "hevc_mp4toannexb",
-.hw_configs = mediacodec_hw_configs,
-.wrapper_name   = "mediacodec",
-};
+DECLARE_MEDIACODEC_VDEC(hevc, "H.265", AV_CODEC_ID_HEVC, "hevc_mp4toannexb")
 #endif
 
 #if CONFIG_MPEG2_MEDIACODEC_DECODER
-AVCodec ff_mpeg2_mediacodec_decoder = {
-.name   = "mpeg2_mediacodec",
-.long_name  = NULL_IF_CONFIG_SMALL("MPEG-2 Android MediaCodec 
decoder"),
-.type   = AVMEDIA_TYPE_VIDEO,
-.id = AV_CODEC_ID_MPEG2VIDEO,
-.priv_data_size = sizeof(MediaCodecH264DecContext),
-.init   = mediacodec_decode_init,
-.receive_frame  = mediacodec_receive_frame,
-.flush  = mediacodec_decode_flush,
-.close  = mediacodec_decode_close,
-.capabilities   = AV_CODEC_CAP_DELAY | AV_C

[FFmpeg-cvslog] lavc/mediacodecdec: remove mediacodec_process_data() indirection

2018-01-06 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed Jan 
 3 13:10:58 2018 +0100| [d19174c673b8788de825a936d8d7c9340aefcd56] | committer: 
Matthieu Bouron

lavc/mediacodecdec: remove mediacodec_process_data() indirection

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d19174c673b8788de825a936d8d7c9340aefcd56
---

 libavcodec/mediacodecdec.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 35a9e34861..6c5d3ddd79 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -416,15 +416,6 @@ done:
 return ret;
 }
 
-
-static int mediacodec_process_data(AVCodecContext *avctx, AVFrame *frame,
-   int *got_frame, AVPacket *pkt)
-{
-MediaCodecH264DecContext *s = avctx->priv_data;
-
-return ff_mediacodec_dec_decode(avctx, s->ctx, frame, got_frame, pkt);
-}
-
 static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
 {
 MediaCodecH264DecContext *s = avctx->priv_data;
@@ -505,7 +496,7 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
 av_fifo_generic_read(s->fifo, >buffered_pkt, 
sizeof(s->buffered_pkt), NULL);
 }
 
-ret = mediacodec_process_data(avctx, frame, _frame, 
>buffered_pkt);
+ret = ff_mediacodec_dec_decode(avctx, s->ctx, frame, _frame, 
>buffered_pkt);
 if (ret < 0)
 return ret;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mediacodec_wrapper: allocate MediaCodec.BufferInfo once

2018-01-06 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed Jan 
 3 13:54:34 2018 +0100| [e30b46b1aeea03fc5cbcecc03f7103cf204090f0] | committer: 
Matthieu Bouron

lavc/mediacodec_wrapper: allocate MediaCodec.BufferInfo once

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e30b46b1aeea03fc5cbcecc03f7103cf204090f0
---

 libavcodec/mediacodec_wrapper.c | 61 +++--
 1 file changed, 34 insertions(+), 27 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index d9f0e27a7d..dbc37bf463 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -274,6 +274,7 @@ struct FFAMediaCodec {
 struct JNIAMediaCodecFields jfields;
 
 jobject object;
+jobject buffer_info;
 
 jobject input_buffers;
 jobject output_buffers;
@@ -1143,6 +1144,7 @@ static inline FFAMediaCodec *codec_create(int method, 
const char *arg)
 FFAMediaCodec *codec = NULL;
 jstring jarg = NULL;
 jobject object = NULL;
+jobject buffer_info = NULL;
 jmethodID create_id = NULL;
 
 codec = av_mallocz(sizeof(FFAMediaCodec));
@@ -1195,6 +1197,16 @@ static inline FFAMediaCodec *codec_create(int method, 
const char *arg)
 codec->has_get_i_o_buffer = 1;
 }
 
+buffer_info = (*env)->NewObject(env, codec->jfields.mediainfo_class, 
codec->jfields.init_id);
+if (ff_jni_exception_check(env, 1, codec) < 0) {
+goto fail;
+}
+
+codec->buffer_info = (*env)->NewGlobalRef(env, buffer_info);
+if (!codec->buffer_info) {
+goto fail;
+}
+
 ret = 0;
 fail:
 if (jarg) {
@@ -1205,10 +1217,19 @@ fail:
 (*env)->DeleteLocalRef(env, object);
 }
 
+if (buffer_info) {
+(*env)->DeleteLocalRef(env, buffer_info);
+}
+
 if (ret < 0) {
 if (codec->object) {
 (*env)->DeleteGlobalRef(env, codec->object);
 }
+
+if (codec->buffer_info) {
+(*env)->DeleteGlobalRef(env, codec->buffer_info);
+}
+
 ff_jni_reset_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec);
 av_freep();
 }
@@ -1246,6 +1267,9 @@ int ff_AMediaCodec_delete(FFAMediaCodec* codec)
 (*env)->DeleteGlobalRef(env, codec->object);
 codec->object = NULL;
 
+(*env)->DeleteGlobalRef(env, codec->buffer_info);
+codec->buffer_info = NULL;
+
 ff_jni_reset_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec);
 
 av_freep();
@@ -1413,48 +1437,31 @@ ssize_t 
ff_AMediaCodec_dequeueOutputBuffer(FFAMediaCodec* codec, FFAMediaCodecBu
 int ret = 0;
 JNIEnv *env = NULL;
 
-jobject mediainfo = NULL;
-
 JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL);
 
-mediainfo = (*env)->NewObject(env, codec->jfields.mediainfo_class, 
codec->jfields.init_id);
+ret = (*env)->CallIntMethod(env, codec->object, 
codec->jfields.dequeue_output_buffer_id, codec->buffer_info, timeoutUs);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
-ret = AVERROR_EXTERNAL;
-goto fail;
+return AVERROR_EXTERNAL;
 }
 
-ret = (*env)->CallIntMethod(env, codec->object, 
codec->jfields.dequeue_output_buffer_id, mediainfo, timeoutUs);
+info->flags = (*env)->GetIntField(env, codec->buffer_info, 
codec->jfields.flags_id);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
-ret = AVERROR_EXTERNAL;
-goto fail;
+return AVERROR_EXTERNAL;
 }
 
-info->flags = (*env)->GetIntField(env, mediainfo, codec->jfields.flags_id);
+info->offset = (*env)->GetIntField(env, codec->buffer_info, 
codec->jfields.offset_id);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
-ret = AVERROR_EXTERNAL;
-goto fail;
+return AVERROR_EXTERNAL;
 }
 
-info->offset = (*env)->GetIntField(env, mediainfo, 
codec->jfields.offset_id);
+info->presentationTimeUs = (*env)->GetLongField(env, codec->buffer_info, 
codec->jfields.presentation_time_us_id);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
-ret = AVERROR_EXTERNAL;
-goto fail;
+return AVERROR_EXTERNAL;
 }
 
-info->presentationTimeUs = (*env)->GetLongField(env, mediainfo, 
codec->jfields.presentation_time_us_id);
+info->size = (*env)->GetIntField(env, codec->buffer_info, 
codec->jfields.size_id);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
-ret = AVERROR_EXTERNAL;
-goto fail;
-}
-
-info->size = (*env)->GetIntField(env, mediainfo, codec->jfields.size_id);
-if (ff_jni_exception_check(env, 1, codec) < 0) {
-ret = AVERROR_EXTERNAL;
-goto fail;
-}
-fail:
-if (mediainfo) {
-(*env)->DeleteLocalRef(env, mediainfo);
+return AVERROR_EXTERNAL;
 }
 
 return ret;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mediacodec_wrapper: factorize MediaCodec creation functions

2017-12-15 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed Dec 
13 13:49:58 2017 +0100| [f3cffd121b990717996d8ddd646bd555c1db135b] | committer: 
Matthieu Bouron

lavc/mediacodec_wrapper: factorize MediaCodec creation functions

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3cffd121b990717996d8ddd646bd555c1db135b
---

 libavcodec/mediacodec_wrapper.c | 162 +++-
 1 file changed, 29 insertions(+), 133 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index f34450a6d8..329a5eb896 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1132,13 +1132,18 @@ fail:
 return ret;
 }
 
-FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name)
+#define CREATE_CODEC_BY_NAME   0
+#define CREATE_DECODER_BY_TYPE 1
+#define CREATE_ENCODER_BY_TYPE 2
+
+static inline FFAMediaCodec *codec_create(int method, const char *arg)
 {
 int ret = -1;
 JNIEnv *env = NULL;
 FFAMediaCodec *codec = NULL;
-jstring codec_name = NULL;
+jstring jarg = NULL;
 jobject object = NULL;
+jmethodID create_id = NULL;
 
 codec = av_mallocz(sizeof(FFAMediaCodec));
 if (!codec) {
@@ -1156,77 +1161,23 @@ FFAMediaCodec* ff_AMediaCodec_createCodecByName(const 
char *name)
 goto fail;
 }
 
-codec_name = ff_jni_utf_chars_to_jstring(env, name, codec);
-if (!codec_name) {
-goto fail;
-}
-
-object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, 
codec_name);
-if (ff_jni_exception_check(env, 1, codec) < 0) {
-goto fail;
-}
-
-codec->object = (*env)->NewGlobalRef(env, object);
-if (!codec->object) {
-goto fail;
-}
-
-if (codec_init_static_fields(codec) < 0) {
-goto fail;
-}
-
-if (codec->jfields.get_input_buffer_id && 
codec->jfields.get_output_buffer_id) {
-codec->has_get_i_o_buffer = 1;
-}
-
-ret = 0;
-fail:
-if (codec_name) {
-(*env)->DeleteLocalRef(env, codec_name);
-}
-
-if (object) {
-(*env)->DeleteLocalRef(env, object);
-}
-
-if (ret < 0) {
-ff_jni_reset_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec);
-av_freep();
-}
-
-return codec;
-}
-
-FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime)
-{
-int ret = -1;
-JNIEnv *env = NULL;
-FFAMediaCodec *codec = NULL;
-jstring mime_type = NULL;
-jobject object = NULL;
-
-codec = av_mallocz(sizeof(FFAMediaCodec));
-if (!codec) {
-return NULL;
-}
-codec->class = _class;
-
-env = ff_jni_get_env(codec);
-if (!env) {
-av_freep();
-return NULL;
-}
-
-if (ff_jni_init_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec) < 0) {
+jarg = ff_jni_utf_chars_to_jstring(env, arg, codec);
+if (!jarg) {
 goto fail;
 }
 
-mime_type = ff_jni_utf_chars_to_jstring(env, mime, codec);
-if (!mime_type) {
-goto fail;
+switch (method) {
+case CREATE_CODEC_BY_NAME:   create_id = 
codec->jfields.create_by_codec_name_id;   break;
+case CREATE_DECODER_BY_TYPE: create_id = 
codec->jfields.create_decoder_by_type_id; break;
+case CREATE_ENCODER_BY_TYPE: create_id = 
codec->jfields.create_encoder_by_type_id; break;
+default:
+av_assert0(0);
 }
 
-object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, 
mime_type);
+object = (*env)->CallStaticObjectMethod(env,
+codec->jfields.mediacodec_class,
+create_id,
+jarg);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
@@ -1246,8 +1197,8 @@ FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const 
char *mime)
 
 ret = 0;
 fail:
-if (mime_type) {
-(*env)->DeleteLocalRef(env, mime_type);
+if (jarg) {
+(*env)->DeleteLocalRef(env, jarg);
 }
 
 if (object) {
@@ -1262,70 +1213,15 @@ fail:
 return codec;
 }
 
-FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime)
-{
-int ret = -1;
-JNIEnv *env = NULL;
-FFAMediaCodec *codec = NULL;
-jstring mime_type = NULL;
-jobject object = NULL;
+#define DECLARE_FF_AMEDIACODEC_CREATE_FUNC(name, method) \
+FFAMediaCodec *ff_AMediaCodec_##name(const char *arg)\
+{\
+return codec_create(method, arg);\
+}\
 
-codec = av_mallocz(sizeof(FFAMediaCodec));
-if (!codec) {
-return NULL;
-}
-codec->cla

[FFmpeg-cvslog] lavc/mediacodec_wrapper: fix potential jni global reference leak

2017-12-15 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Sat Dec 
16 00:16:02 2017 +0100| [1f1207145a0f2d26e5e3525bea6cc417a3ec39cf] | committer: 
Matthieu Bouron

lavc/mediacodec_wrapper: fix potential jni global reference leak

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f1207145a0f2d26e5e3525bea6cc417a3ec39cf
---

 libavcodec/mediacodec_wrapper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 329a5eb896..d9f0e27a7d 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1206,6 +1206,9 @@ fail:
 }
 
 if (ret < 0) {
+if (codec->object) {
+(*env)->DeleteGlobalRef(env, codec->object);
+}
 ff_jni_reset_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec);
 av_freep();
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mediacodec_wrapper: fix jni vaargs types

2017-09-15 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Fri Sep 
15 13:45:47 2017 +0200| [dd8ffb191fd24f5b783b9722f63019120d61c48c] | committer: 
Matthieu Bouron

lavc/mediacodec_wrapper: fix jni vaargs types

Fixes decoding on 32-bit devices with Android NDK >= 15.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd8ffb191fd24f5b783b9722f63019120d61c48c
---

 libavcodec/mediacodec_wrapper.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 4a37cd7cd7..f34450a6d8 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1448,7 +1448,7 @@ int ff_AMediaCodec_releaseOutputBuffer(FFAMediaCodec* 
codec, size_t idx, int ren
 
 JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL);
 
-(*env)->CallVoidMethod(env, codec->object, 
codec->jfields.release_output_buffer_id, idx, render);
+(*env)->CallVoidMethod(env, codec->object, 
codec->jfields.release_output_buffer_id, (jint)idx, (jboolean)render);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 ret = AVERROR_EXTERNAL;
 goto fail;
@@ -1465,7 +1465,7 @@ int 
ff_AMediaCodec_releaseOutputBufferAtTime(FFAMediaCodec *codec, size_t idx, i
 
 JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL);
 
-(*env)->CallVoidMethod(env, codec->object, 
codec->jfields.release_output_buffer_at_time_id, idx, timestampNs);
+(*env)->CallVoidMethod(env, codec->object, 
codec->jfields.release_output_buffer_at_time_id, (jint)idx, timestampNs);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 ret = AVERROR_EXTERNAL;
 goto fail;
@@ -1499,7 +1499,7 @@ int ff_AMediaCodec_queueInputBuffer(FFAMediaCodec* codec, 
size_t idx, off_t offs
 
 JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL);
 
-(*env)->CallVoidMethod(env, codec->object, 
codec->jfields.queue_input_buffer_id, idx, offset, size, time, flags);
+(*env)->CallVoidMethod(env, codec->object, 
codec->jfields.queue_input_buffer_id, (jint)idx, (jint)offset, (jint)size, 
time, flags);
 if ((ret = ff_jni_exception_check(env, 1, codec)) < 0) {
 ret = AVERROR_EXTERNAL;
 goto fail;
@@ -1572,7 +1572,7 @@ uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* 
codec, size_t idx, size_t
 JNI_GET_ENV_OR_RETURN(env, codec, NULL);
 
 if (codec->has_get_i_o_buffer) {
-buffer = (*env)->CallObjectMethod(env, codec->object, 
codec->jfields.get_input_buffer_id, idx);
+buffer = (*env)->CallObjectMethod(env, codec->object, 
codec->jfields.get_input_buffer_id, (jint)idx);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
@@ -1620,7 +1620,7 @@ uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* 
codec, size_t idx, size_t
 JNI_GET_ENV_OR_RETURN(env, codec, NULL);
 
 if (codec->has_get_i_o_buffer) {
-buffer = (*env)->CallObjectMethod(env, codec->object, 
codec->jfields.get_output_buffer_id, idx);
+buffer = (*env)->CallObjectMethod(env, codec->object, 
codec->jfields.get_output_buffer_id, (jint)idx);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/aarch64: add sbrdsp neon implementation

2017-07-03 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Tue May 
23 14:29:35 2017 +| [0a24d7ca831b85db18593e5f18d765adb40e5cd9] | committer: 
Matthieu Bouron

lavc/aarch64: add sbrdsp neon implementation

autocorrelate_c: 644.0
autocorrelate_neon: 420.0
hf_apply_noise_0_c: 1688.5
hf_apply_noise_0_neon: 1498.6
hf_apply_noise_1_c: 1691.2
hf_apply_noise_1_neon: 1500.6
hf_apply_noise_2_c: 1688.1
hf_apply_noise_2_neon: 1500.3
hf_apply_noise_3_c: 1696.6
hf_apply_noise_3_neon: 1502.2
hf_g_filt_c: 2117.8
hf_g_filt_neon: 1218.7
hf_gen_c: 4573.4
hf_gen_neon: 2461.0
neg_odd_64_c: 72.0
neg_odd_64_neon: 64.7
qmf_deint_bfly_c: 1107.6
qmf_deint_bfly_neon: 291.6
qmf_deint_neg_c: 210.4
qmf_deint_neg_neon: 107.4
qmf_post_shuffle_c: 163.0
qmf_post_shuffle_neon: 107.7
qmf_pre_shuffle_c: 120.5
qmf_pre_shuffle_neon: 110.7
sum64x5_c: 1361.6
sum64x5_neon: 435.4
sum_square_c: 1686.4
sum_square_neon: 787.2

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a24d7ca831b85db18593e5f18d765adb40e5cd9
---

 libavcodec/aarch64/Makefile  |   4 +-
 libavcodec/aarch64/sbrdsp_init_aarch64.c |  70 +++
 libavcodec/aarch64/sbrdsp_neon.S | 327 +++
 libavcodec/sbrdsp.h  |   1 +
 libavcodec/sbrdsp_template.c |   2 +
 5 files changed, 403 insertions(+), 1 deletion(-)

diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile
index d440b1b18a..72080c2dbb 100644
--- a/libavcodec/aarch64/Makefile
+++ b/libavcodec/aarch64/Makefile
@@ -11,7 +11,8 @@ OBJS-$(CONFIG_NEON_CLOBBER_TEST)+= aarch64/neontest.o
 OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp_init.o
 
 # decoders/encoders
-OBJS-$(CONFIG_AAC_DECODER)  += aarch64/aacpsdsp_init_aarch64.o
+OBJS-$(CONFIG_AAC_DECODER)  += aarch64/aacpsdsp_init_aarch64.o \
+   aarch64/sbrdsp_init_aarch64.o
 OBJS-$(CONFIG_DCA_DECODER)  += aarch64/synth_filter_init.o
 OBJS-$(CONFIG_RV40_DECODER) += aarch64/rv40dsp_init_aarch64.o
 OBJS-$(CONFIG_VC1DSP)   += aarch64/vc1dsp_init_aarch64.o
@@ -28,6 +29,7 @@ ARMV8-OBJS-$(CONFIG_VIDEODSP)   += aarch64/videodsp.o
 # NEON optimizations
 
 # subsystems
+NEON-OBJS-$(CONFIG_AAC_DECODER) += aarch64/sbrdsp_neon.o
 NEON-OBJS-$(CONFIG_FFT) += aarch64/fft_neon.o
 NEON-OBJS-$(CONFIG_FMTCONVERT)  += aarch64/fmtconvert_neon.o
 NEON-OBJS-$(CONFIG_H264CHROMA)  += aarch64/h264cmc_neon.o
diff --git a/libavcodec/aarch64/sbrdsp_init_aarch64.c 
b/libavcodec/aarch64/sbrdsp_init_aarch64.c
new file mode 100644
index 00..9c967990df
--- /dev/null
+++ b/libavcodec/aarch64/sbrdsp_init_aarch64.c
@@ -0,0 +1,70 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "libavutil/aarch64/cpu.h"
+#include "libavutil/attributes.h"
+#include "libavcodec/sbrdsp.h"
+
+void ff_sbr_sum64x5_neon(float *z);
+float ff_sbr_sum_square_neon(float (*x)[2], int n);
+void ff_sbr_neg_odd_64_neon(float *x);
+void ff_sbr_qmf_pre_shuffle_neon(float *z);
+void ff_sbr_qmf_post_shuffle_neon(float W[32][2], const float *z);
+void ff_sbr_qmf_deint_neg_neon(float *v, const float *src);
+void ff_sbr_qmf_deint_bfly_neon(float *v, const float *src0, const float 
*src1);
+void ff_sbr_hf_g_filt_neon(float (*Y)[2], const float (*X_high)[40][2],
+   const float *g_filt, int m_max, intptr_t ixh);
+void ff_sbr_hf_gen_neon(float (*X_high)[2], const float (*X_low)[2],
+const float alpha0[2], const float alpha1[2],
+float bw, int start, int end);
+void ff_sbr_autocorrelate_neon(const float x[40][2], float phi[3][2][2]);
+void ff_sbr_hf_apply_noise_0_neon(float Y[64][2], const float *s_m,
+  const float *q_filt, int noise,
+  int kx, int m_max);
+void ff_sbr_hf_apply_noise_1_neon(float Y[64][2], const float *s_m,
+  const float *q_filt, int noise,
+  int kx, int m_max);
+void ff_sbr_hf_apply_noise_2_neon(float Y[64][2], const float *s_m,
+   

[FFmpeg-cvslog] checkasm: add sbrdsp tests

2017-07-03 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Fri Jun 
 9 09:34:12 2017 +| [7864e07f4af248d35a1e81d6d5c435f4cd2023e1] | committer: 
Matthieu Bouron

checkasm: add sbrdsp tests

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7864e07f4af248d35a1e81d6d5c435f4cd2023e1
---

 tests/checkasm/Makefile   |   3 +-
 tests/checkasm/checkasm.c |   1 +
 tests/checkasm/checkasm.h |   1 +
 tests/checkasm/sbrdsp.c   | 298 ++
 4 files changed, 302 insertions(+), 1 deletion(-)

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 638e811931..60e80ab738 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -13,7 +13,8 @@ AVCODECOBJS-$(CONFIG_VP8DSP)+= vp8dsp.o
 AVCODECOBJS-$(CONFIG_VIDEODSP)  += videodsp.o
 
 # decoders/encoders
-AVCODECOBJS-$(CONFIG_AAC_DECODER)   += aacpsdsp.o
+AVCODECOBJS-$(CONFIG_AAC_DECODER)   += aacpsdsp.o \
+   sbrdsp.o
 AVCODECOBJS-$(CONFIG_ALAC_DECODER)  += alacdsp.o
 AVCODECOBJS-$(CONFIG_DCA_DECODER)   += synth_filter.o
 AVCODECOBJS-$(CONFIG_JPEG2000_DECODER)  += jpeg2000dsp.o
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index e66744b162..29f201b1b3 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -67,6 +67,7 @@ static const struct {
 #if CONFIG_AVCODEC
 #if CONFIG_AAC_DECODER
 { "aacpsdsp", checkasm_check_aacpsdsp },
+{ "sbrdsp",   checkasm_check_sbrdsp },
 #endif
 #if CONFIG_ALAC_DECODER
 { "alacdsp", checkasm_check_alacdsp },
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index dfb0ce561c..fa51e71e4b 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -50,6 +50,7 @@ void checkasm_check_hevc_idct(void);
 void checkasm_check_jpeg2000dsp(void);
 void checkasm_check_llviddsp(void);
 void checkasm_check_pixblockdsp(void);
+void checkasm_check_sbrdsp(void);
 void checkasm_check_synth_filter(void);
 void checkasm_check_v210enc(void);
 void checkasm_check_vp8dsp(void);
diff --git a/tests/checkasm/sbrdsp.c b/tests/checkasm/sbrdsp.c
new file mode 100644
index 00..038318e021
--- /dev/null
+++ b/tests/checkasm/sbrdsp.c
@@ -0,0 +1,298 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "libavcodec/sbrdsp.h"
+
+#include "checkasm.h"
+
+#define randomize(buf, len) do {\
+int i;  \
+for (i = 0; i < len; i++) { \
+const INTFLOAT f = (INTFLOAT)rnd() / UINT_MAX;  \
+(buf)[i] = f;   \
+}   \
+} while (0)
+
+#define EPS 0.0001
+
+static void test_sum64x5(void)
+{
+LOCAL_ALIGNED_16(INTFLOAT, dst0, [64 + 256]);
+LOCAL_ALIGNED_16(INTFLOAT, dst1, [64 + 256]);
+
+declare_func(void, INTFLOAT *z);
+
+randomize((INTFLOAT *)dst0, 64 + 256);
+memcpy(dst1, dst0, (64 + 256) * sizeof(INTFLOAT));
+call_ref(dst0);
+call_new(dst1);
+if (!float_near_abs_eps_array(dst0, dst1, EPS, 64 + 256))
+fail();
+bench_new(dst1);
+}
+
+static void test_sum_square(void)
+{
+INTFLOAT res0;
+INTFLOAT res1;
+LOCAL_ALIGNED_16(INTFLOAT, src, [256], [2]);
+
+declare_func(INTFLOAT, INTFLOAT (*x)[2], int n);
+
+randomize((INTFLOAT *)src, 256 * 2);
+res0 = call_ref(src, 256);
+res1 = call_new(src, 256);
+if (!float_near_abs_eps(res0, res1, EPS))
+fail();
+bench_new(src, 256);
+}
+
+static void test_neg_odd_64(void)
+{
+LOCAL_ALIGNED_16(INTFLOAT, dst0, [64]);
+LOCAL_ALIGNED_16(INTFLOAT, dst1, [64]);
+
+declare_func(void, INTFLOAT *x);
+
+randomize((INTFLOAT *)dst0, 64);
+memcpy(dst1, dst0, (64) * sizeof(INTFLOAT));
+call_ref(dst0);
+call_new(dst1);
+if (!float_near_abs_eps_array(dst0, dst1, EPS, 64))
+fail();
+bench_new(dst1);
+}
+
+static void test_qmf_pre_shuffle(void)
+{
+LOCAL_ALIGNED_16(INTFLOAT, dst0, [128]);
+LOCAL_ALIGNED_16(INTFLOAT, dst1, [128]);
+
+declare_func(void, INTF

[FFmpeg-cvslog] lavc/x86: clear r2 higher bits in ff_sbr_sum_square

2017-06-26 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Fri Jun 
23 16:32:31 2017 +0200| [db5bf64b214d9888c8cf30a8235d0655a63139d7] | committer: 
Matthieu Bouron

lavc/x86: clear r2 higher bits in ff_sbr_sum_square

Suggested-by: James Almer <jamr...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=db5bf64b214d9888c8cf30a8235d0655a63139d7
---

 libavcodec/x86/sbrdsp.asm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/x86/sbrdsp.asm b/libavcodec/x86/sbrdsp.asm
index 07a412b2ae..d0f774b277 100644
--- a/libavcodec/x86/sbrdsp.asm
+++ b/libavcodec/x86/sbrdsp.asm
@@ -38,7 +38,7 @@ SECTION .text
 
 INIT_XMM sse
 cglobal sbr_sum_square, 2, 3, 6
-mov r2, r1
+movr2d, r1d
 xorps   m0, m0
 xorps   m1, m1
 sar r2, 3

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] checkasm/aarch64: fix tests returning a float

2017-06-22 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Mon Jun 
19 10:55:28 2017 +0200| [067e42b851a707924a154c4757516cc488985eb3] | committer: 
Matthieu Bouron

checkasm/aarch64: fix tests returning a float

Avoids overriding the v0 register (which containins the result of the
tested function) in checkasm_call_checked.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=067e42b851a707924a154c4757516cc488985eb3
---

 tests/checkasm/aarch64/checkasm.S | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/checkasm/aarch64/checkasm.S 
b/tests/checkasm/aarch64/checkasm.S
index 53a2a478dc..75a9a56143 100644
--- a/tests/checkasm/aarch64/checkasm.S
+++ b/tests/checkasm/aarch64/checkasm.S
@@ -112,10 +112,10 @@ function checkasm_checked_call, export=1
 moviv3.8h,  #0
 
 .macro check_reg_neon reg1, reg2
-ldr q0,  [x9], #16
-uzp1v1.2d,  v\reg1\().2d, v\reg2\().2d
-eor v0.16b, v0.16b, v1.16b
-orr v3.16b, v3.16b, v0.16b
+ldr q1,  [x9], #16
+uzp1v2.2d,  v\reg1\().2d, v\reg2\().2d
+eor v1.16b, v1.16b, v2.16b
+orr v3.16b, v3.16b, v1.16b
 .endm
 check_reg_neon  8,  9
 check_reg_neon  10, 11

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/aarch64/simple_idct: fix build with Xcode 7.2

2017-06-14 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed Jun 
14 13:28:18 2017 +0200| [204008354f7f18fa9e64a6d487f65495f1cc9885] | committer: 
Matthieu Bouron

lavc/aarch64/simple_idct: fix build with Xcode 7.2

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=204008354f7f18fa9e64a6d487f65495f1cc9885
---

 libavcodec/aarch64/simple_idct_neon.S | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/libavcodec/aarch64/simple_idct_neon.S 
b/libavcodec/aarch64/simple_idct_neon.S
index 5bd31e5be9..5e4d021a97 100644
--- a/libavcodec/aarch64/simple_idct_neon.S
+++ b/libavcodec/aarch64/simple_idct_neon.S
@@ -92,10 +92,10 @@ endconst
 .endm
 
 .macro idct_row4_neon y1, y2, y3, y4, pass
-ld1 {\y1\().2D-\y2\().2D}, [x2], #32
+ld1 {\y1\().2D,\y2\().2D}, [x2], #32
 moviv23.4S, #1<<2, lsl #8
 orr v5.16B, \y1\().16B, \y2\().16B
-ld1 {\y3\().2D, \y4\().2D}, [x2], #32
+ld1 {\y3\().2D,\y4\().2D}, [x2], #32
 orr v6.16B, \y3\().16B, \y4\().16B
 orr v5.16B, v5.16B, v6.16B
 mov x3, v5.D[1]
@@ -104,7 +104,7 @@ endconst
 idct_col4_top   \y1, \y2, \y3, \y4, 1, .4H
 
 cmp x3, #0
-beq \pass\()f
+b.eq\pass\()f
 
 smull2  v7.4S, \y1\().8H, z4
 smlal2  v17.4S, \y2\().8H, z5
@@ -169,7 +169,7 @@ function idct_col4_neon\i
 mov x4, v28.D[\i - 1]
 mov x5, v29.D[\i - 1]
 cmp x4, #0
-beq 1f
+b.eq1f
 
 smull\i v7.4S,  v28\l,  z4
 add v19.4S, v19.4S, v7.4S
@@ -179,7 +179,7 @@ function idct_col4_neon\i
 
 1:  mov x4, v30.D[\i - 1]
 cmp x5, #0
-beq 2f
+b.eq2f
 
 smlal\i v17.4S, v29\l, z5
 smlsl\i v18.4S, v29\l, z1
@@ -188,7 +188,7 @@ function idct_col4_neon\i
 
 2:  mov x5, v31.D[\i - 1]
 cmp x4, #0
-beq 3f
+b.eq3f
 
 smull\i v7.4S,  v30\l, z6
 smull\i v16.4S, v30\l, z2
@@ -198,7 +198,7 @@ function idct_col4_neon\i
 add v21.4S, v21.4S, v16.4S
 
 3:  cmp x5, #0
-beq 4f
+b.eq4f
 
 smlal\i v17.4S, v31\l, z7
 smlsl\i v18.4S, v31\l, z5
@@ -267,14 +267,14 @@ function ff_simple_idct_add_neon, export=1
 idct_row4_neon  v28, v29, v30, v31, 2
 bl  idct_col4_neon1
 
-sshrv1.8H, V7.8H, #COL_SHIFT-16
+sshrv1.8H, v7.8H, #COL_SHIFT-16
 sshrv2.8H, v16.8H, #COL_SHIFT-16
 sshrv3.8H, v17.8H, #COL_SHIFT-16
 sshrv4.8H, v18.8H, #COL_SHIFT-16
 
 bl  idct_col4_neon2
 
-sshrv7.8H, V7.8H, #COL_SHIFT-16
+sshrv7.8H, v7.8H, #COL_SHIFT-16
 sshrv16.8H, v16.8H, #COL_SHIFT-16
 sshrv17.8H, v17.8H, #COL_SHIFT-16
 sshrv18.8H, v18.8H, #COL_SHIFT-16
@@ -330,7 +330,7 @@ function ff_simple_idct_neon, export=1
 mov x2,  x0
 idct_row4_neon  v24, v25, v26, v27, 1
 idct_row4_neon  v28, v29, v30, v31, 2
-add x2, x2, #-128
+sub x2, x2, #128
 bl  idct_col4_neon1
 
 sshrv1.8H, v7.8H, #COL_SHIFT-16
@@ -347,16 +347,16 @@ function ff_simple_idct_neon, export=1
 
 zip1v23.2D, v1.2D, v7.2D
 zip2v24.2D, v1.2D, v7.2D
-st1 {v23.2D,V24.2D}, [x2], #32
+st1 {v23.2D,v24.2D}, [x2], #32
 zip1v25.2D, v2.2D, v16.2D
 zip2v26.2D, v2.2D, v16.2D
-st1 {v25.2D,V26.2D}, [x2], #32
+st1 {v25.2D,v26.2D}, [x2], #32
 zip1v27.2D, v3.2D, v17.2D
 zip2v28.2D, v3.2D, v17.2D
-st1 {v27.2D,V28.2D}, [x2], #32
+st1 {v27.2D,v28.2D}, [x2], #32
 zip1v29.2D, v4.2D, v18.2D
 zip2v30.2D, v4.2D, v18.2D
-st1 {v29.2D,V30.2D}, [x2], #32
+st1 {v29.2D,v30.2D}, [x2], #32
 
 idct_end
 endfunc

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/aarch64/simple_idct: fix idct_col4_top coefficient

2017-06-13 Thread Matthieu Bouron
ffmpeg | branch: release/3.3 | Matthieu Bouron <matthieu.bou...@gmail.com> | 
Tue Jun 13 17:19:51 2017 +0200| [20f5e2c17785ef84db565e658420faf6f8ca0807] | 
committer: Matthieu Bouron

lavc/aarch64/simple_idct: fix idct_col4_top coefficient

Fixes regression introduced by 5d0b8b1ae307951310c7d9a8fa282fbca9b997cd.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=20f5e2c17785ef84db565e658420faf6f8ca0807
---

 libavcodec/aarch64/simple_idct_neon.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aarch64/simple_idct_neon.S 
b/libavcodec/aarch64/simple_idct_neon.S
index 92987985d2..5bd31e5be9 100644
--- a/libavcodec/aarch64/simple_idct_neon.S
+++ b/libavcodec/aarch64/simple_idct_neon.S
@@ -74,7 +74,7 @@ endconst
 .endm
 
 .macro idct_col4_top y1, y2, y3, y4, i, l
-smull\i v7.4S,  \y3\l, z1
+smull\i v7.4S,  \y3\l, z2
 smull\i v16.4S, \y3\l, z6
 smull\i v17.4S, \y2\l, z1
 add v19.4S, v23.4S, v7.4S

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/aarch64/simple_idct: fix idct_col4_top coefficient

2017-06-13 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Tue Jun 
13 17:19:51 2017 +0200| [8aa60606fb64b8280627935b0df55d4d2aeca5d1] | committer: 
Matthieu Bouron

lavc/aarch64/simple_idct: fix idct_col4_top coefficient

Fixes regression introduced by 5d0b8b1ae307951310c7d9a8fa282fbca9b997cd.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8aa60606fb64b8280627935b0df55d4d2aeca5d1
---

 libavcodec/aarch64/simple_idct_neon.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aarch64/simple_idct_neon.S 
b/libavcodec/aarch64/simple_idct_neon.S
index 92987985d2..5bd31e5be9 100644
--- a/libavcodec/aarch64/simple_idct_neon.S
+++ b/libavcodec/aarch64/simple_idct_neon.S
@@ -74,7 +74,7 @@ endconst
 .endm
 
 .macro idct_col4_top y1, y2, y3, y4, i, l
-smull\i v7.4S,  \y3\l, z1
+smull\i v7.4S,  \y3\l, z2
 smull\i v16.4S, \y3\l, z6
 smull\i v17.4S, \y2\l, z1
 add v19.4S, v23.4S, v7.4S

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mediacodecdec: switch to the new generic filtering mechanism

2017-06-13 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Sat Jun 
10 00:41:07 2017 +0200| [3839580b71345ec7a8245dc5faa562eb9903cb22] | committer: 
Matthieu Bouron

lavc/mediacodecdec: switch to the new generic filtering mechanism

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3839580b71345ec7a8245dc5faa562eb9903cb22
---

 libavcodec/mediacodecdec.c | 74 --
 1 file changed, 13 insertions(+), 61 deletions(-)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 5bdeb6c1d7..6962ce2474 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -41,11 +41,9 @@ typedef struct MediaCodecH264DecContext {
 
 MediaCodecDecContext *ctx;
 
-AVBSFContext *bsf;
-
 AVFifoBuffer *fifo;
 
-AVPacket filtered_pkt;
+AVPacket buffered_pkt;
 
 } MediaCodecH264DecContext;
 
@@ -58,8 +56,7 @@ static av_cold int mediacodec_decode_close(AVCodecContext 
*avctx)
 
 av_fifo_free(s->fifo);
 
-av_bsf_free(>bsf);
-av_packet_unref(>filtered_pkt);
+av_packet_unref(>buffered_pkt);
 
 return 0;
 }
@@ -312,9 +309,6 @@ static av_cold int mediacodec_decode_init(AVCodecContext 
*avctx)
 
 const char *codec_mime = NULL;
 
-const char *bsf_name = NULL;
-const AVBitStreamFilter *bsf = NULL;
-
 FFAMediaFormat *format = NULL;
 MediaCodecH264DecContext *s = avctx->priv_data;
 
@@ -329,7 +323,6 @@ static av_cold int mediacodec_decode_init(AVCodecContext 
*avctx)
 #if CONFIG_H264_MEDIACODEC_DECODER
 case AV_CODEC_ID_H264:
 codec_mime = "video/avc";
-bsf_name = "h264_mp4toannexb";
 
 ret = h264_set_extradata(avctx, format);
 if (ret < 0)
@@ -339,7 +332,6 @@ static av_cold int mediacodec_decode_init(AVCodecContext 
*avctx)
 #if CONFIG_HEVC_MEDIACODEC_DECODER
 case AV_CODEC_ID_HEVC:
 codec_mime = "video/hevc";
-bsf_name = "hevc_mp4toannexb";
 
 ret = hevc_set_extradata(avctx, format);
 if (ret < 0)
@@ -410,25 +402,6 @@ static av_cold int mediacodec_decode_init(AVCodecContext 
*avctx)
 goto done;
 }
 
-if (bsf_name) {
-bsf = av_bsf_get_by_name(bsf_name);
-if(!bsf) {
-ret = AVERROR_BSF_NOT_FOUND;
-goto done;
-}
-
-if ((ret = av_bsf_alloc(bsf, >bsf))) {
-goto done;
-}
-
-if (((ret = avcodec_parameters_from_context(s->bsf->par_in, avctx)) < 0) ||
-((ret = av_bsf_init(s->bsf)) < 0)) {
-  goto done;
-}
-}
-
-av_init_packet(>filtered_pkt);
-
 done:
 if (format) {
 ff_AMediaFormat_delete(format);
@@ -502,11 +475,9 @@ static int mediacodec_decode_frame(AVCodecContext *avctx, 
void *data,
 
 /* process buffered data */
 while (!*got_frame) {
-/* prepare the input data -- convert to Annex B if needed */
-if (s->filtered_pkt.size <= 0) {
-AVPacket input_pkt = { 0 };
-
-av_packet_unref(>filtered_pkt);
+/* prepare the input data */
+if (s->buffered_pkt.size <= 0) {
+av_packet_unref(>buffered_pkt);
 
 /* no more data */
 if (av_fifo_size(s->fifo) < sizeof(AVPacket)) {
@@ -514,38 +485,17 @@ static int mediacodec_decode_frame(AVCodecContext *avctx, 
void *data,
 ff_mediacodec_dec_decode(avctx, s->ctx, frame, got_frame, 
avpkt);
 }
 
-av_fifo_generic_read(s->fifo, _pkt, sizeof(input_pkt), NULL);
-
-if (s->bsf) {
-ret = av_bsf_send_packet(s->bsf, _pkt);
-if (ret < 0) {
-return ret;
-}
-
-ret = av_bsf_receive_packet(s->bsf, >filtered_pkt);
-if (ret == AVERROR(EAGAIN)) {
-goto done;
-}
-} else {
-av_packet_move_ref(>filtered_pkt, _pkt);
-}
-
-/* {h264,hevc}_mp4toannexb are used here and do not require 
flushing */
-av_assert0(ret != AVERROR_EOF);
-
-if (ret < 0) {
-return ret;
-}
+av_fifo_generic_read(s->fifo, >buffered_pkt, 
sizeof(s->buffered_pkt), NULL);
 }
 
-ret = mediacodec_process_data(avctx, frame, got_frame, 
>filtered_pkt);
+ret = mediacodec_process_data(avctx, frame, got_frame, 
>buffered_pkt);
 if (ret < 0)
 return ret;
 
-s->filtered_pkt.size -= ret;
-s->filtered_pkt.data += ret;
+s->buffered_pkt.size -= ret;
+s->buffered_pkt.data += ret;
 }
-done:
+
 return avpkt->size;
 }
 
@@ -560,7 +510,7 @@ static void mediacodec_decode_flush(AVCodecContext *avctx)
 }
 av_fifo_reset(s->fifo);
 
-av_packet_unref(>filtered_pkt);
+av_packet_unref(>buffered_pkt);
 
 ff_medi

[FFmpeg-cvslog] lavf/mov: make invalid m{d,v}hd time_scale default to 1 instead of erroring out

2017-05-23 Thread Matthieu Bouron
ffmpeg | branch: release/3.3 | Matthieu Bouron <matthieu.bou...@gmail.com> | 
Thu May 11 15:16:22 2017 +0200| [6ee4b20f4ae3e726868d3efa038ed3103f69d2a2] | 
committer: Matthieu Bouron

lavf/mov: make invalid m{d,v}hd time_scale default to 1 instead of erroring out

Some samples have their metadata track time_scale incorrectly set to 0
and the check introduced by a398f054fdb9b0f0b5a91c231fba6ce014143f71
prevents playback of those samples. Setting the time_scale to 1 fixes
playback.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ee4b20f4ae3e726868d3efa038ed3103f69d2a2
---

 libavformat/mov.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f2296f8917..036693a652 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1232,8 +1232,8 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 sc->time_scale = avio_rb32(pb);
 if (sc->time_scale <= 0) {
-av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d\n", 
sc->time_scale);
-return AVERROR_INVALIDDATA;
+av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d, defaulting to 
1\n", sc->time_scale);
+sc->time_scale = 1;
 }
 st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration 
*/
 
@@ -1262,8 +1262,8 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 mov_metadata_creation_time(>fc->metadata, creation_time);
 c->time_scale = avio_rb32(pb); /* time scale */
 if (c->time_scale <= 0) {
-av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d\n", 
c->time_scale);
-return AVERROR_INVALIDDATA;
+av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d, defaulting to 
1\n", c->time_scale);
+c->time_scale = 1;
 }
 av_log(c->fc, AV_LOG_TRACE, "time scale = %i\n", c->time_scale);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/ffjni: add missing '\n'

2017-05-23 Thread Matthieu Bouron
ffmpeg | branch: release/3.3 | Matthieu Bouron <matthieu.bou...@gmail.com> | 
Sun May 21 17:44:12 2017 +0200| [3e38bf95c53714f5b5d8c5214481073aedf7d11d] | 
committer: Matthieu Bouron

lavc/ffjni: add missing '\n'

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e38bf95c53714f5b5d8c5214481073aedf7d11d
---

 libavcodec/ffjni.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ffjni.c b/libavcodec/ffjni.c
index b2bcae9602..f5b581f0f6 100644
--- a/libavcodec/ffjni.c
+++ b/libavcodec/ffjni.c
@@ -85,7 +85,7 @@ JNIEnv *ff_jni_get_env(void *log_ctx)
 av_log(log_ctx, AV_LOG_ERROR, "The specified JNI version is not 
supported\n");
 break;
 default:
-av_log(log_ctx, AV_LOG_ERROR, "Failed to get the JNI environment 
attached to this thread");
+av_log(log_ctx, AV_LOG_ERROR, "Failed to get the JNI environment 
attached to this thread\n");
 break;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mediacodec_wrapper: fix local reference leaks

2017-05-23 Thread Matthieu Bouron
ffmpeg | branch: release/3.3 | Matthieu Bouron <matthieu.bou...@gmail.com> | 
Sun May 21 16:48:30 2017 +0200| [2fb25e2dd6ff6bf7803fd2ebc2716ffc540bd19a] | 
committer: Matthieu Bouron

lavc/mediacodec_wrapper: fix local reference leaks

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2fb25e2dd6ff6bf7803fd2ebc2716ffc540bd19a
---

 libavcodec/mediacodec_wrapper.c | 37 ++---
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 43fbb511fd..5e1beed43a 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -608,6 +608,7 @@ FFAMediaFormat *ff_AMediaFormat_new(void)
 {
 JNIEnv *env = NULL;
 FFAMediaFormat *format = NULL;
+jobject object = NULL;
 
 format = av_mallocz(sizeof(FFAMediaFormat));
 if (!format) {
@@ -625,23 +626,27 @@ FFAMediaFormat *ff_AMediaFormat_new(void)
 goto fail;
 }
 
-format->object = (*env)->NewObject(env, format->jfields.mediaformat_class, 
format->jfields.init_id);
-if (!format->object) {
+object = (*env)->NewObject(env, format->jfields.mediaformat_class, 
format->jfields.init_id);
+if (!object) {
 goto fail;
 }
 
-format->object = (*env)->NewGlobalRef(env, format->object);
+format->object = (*env)->NewGlobalRef(env, object);
 if (!format->object) {
 goto fail;
 }
 
-return format;
 fail:
-ff_jni_reset_jfields(env, >jfields, jni_amediaformat_mapping, 1, 
format);
+if (object) {
+(*env)->DeleteLocalRef(env, object);
+}
 
-av_freep();
+if (!format->object) {
+ff_jni_reset_jfields(env, >jfields, jni_amediaformat_mapping, 
1, format);
+av_freep();
+}
 
-return NULL;
+return format;
 }
 
 static FFAMediaFormat *ff_AMediaFormat_newFromObject(void *object)
@@ -1562,6 +1567,7 @@ uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* 
codec, size_t idx, size_t
 JNIEnv *env = NULL;
 
 jobject buffer = NULL;
+jobject input_buffers = NULL;
 
 JNI_GET_ENV_OR_RETURN(env, codec, NULL);
 
@@ -1572,12 +1578,12 @@ uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* 
codec, size_t idx, size_t
 }
 } else {
 if (!codec->input_buffers) {
-codec->input_buffers = (*env)->CallObjectMethod(env, 
codec->object, codec->jfields.get_input_buffers_id);
+input_buffers = (*env)->CallObjectMethod(env, codec->object, 
codec->jfields.get_input_buffers_id);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
 
-codec->input_buffers = (*env)->NewGlobalRef(env, 
codec->input_buffers);
+codec->input_buffers = (*env)->NewGlobalRef(env, input_buffers);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
@@ -1596,6 +1602,10 @@ fail:
 (*env)->DeleteLocalRef(env, buffer);
 }
 
+if (input_buffers) {
+(*env)->DeleteLocalRef(env, input_buffers);
+}
+
 return ret;
 }
 
@@ -1605,6 +1615,7 @@ uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* 
codec, size_t idx, size_t
 JNIEnv *env = NULL;
 
 jobject buffer = NULL;
+jobject output_buffers = NULL;
 
 JNI_GET_ENV_OR_RETURN(env, codec, NULL);
 
@@ -1615,12 +1626,12 @@ uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* 
codec, size_t idx, size_t
 }
 } else {
 if (!codec->output_buffers) {
-codec->output_buffers = (*env)->CallObjectMethod(env, 
codec->object, codec->jfields.get_output_buffers_id);
+output_buffers = (*env)->CallObjectMethod(env, codec->object, 
codec->jfields.get_output_buffers_id);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
 
-codec->output_buffers = (*env)->NewGlobalRef(env, 
codec->output_buffers);
+codec->output_buffers = (*env)->NewGlobalRef(env, output_buffers);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
@@ -1639,6 +1650,10 @@ fail:
 (*env)->DeleteLocalRef(env, buffer);
 }
 
+if (output_buffers) {
+(*env)->DeleteLocalRef(env, output_buffers);
+}
+
 return ret;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mediacodec_wrapper: do not declare JNIAMedia{Codec,CodecList,Format}Fields on the stack

2017-05-23 Thread Matthieu Bouron
ffmpeg | branch: release/3.3 | Matthieu Bouron <matthieu.bou...@gmail.com> | 
Sun May 21 17:48:05 2017 +0200| [cbae648eb8b2789eeb624959e8451967ea9e263a] | 
committer: Matthieu Bouron

lavc/mediacodec_wrapper: do not declare JNIAMedia{Codec,CodecList,Format}Fields 
on the stack

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cbae648eb8b2789eeb624959e8451967ea9e263a
---

 libavcodec/mediacodec_wrapper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 5e1beed43a..4a37cd7cd7 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -66,7 +66,7 @@ struct JNIAMediaCodecListFields {
 jfieldID hevc_profile_main10_id;
 jfieldID hevc_profile_main10_hdr10_id;
 
-} JNIAMediaCodecListFields;
+};
 
 static const struct FFJniField jni_amediacodeclist_mapping[] = {
 { "android/media/MediaCodecList", NULL, NULL, FF_JNI_CLASS, 
offsetof(struct JNIAMediaCodecListFields, mediacodec_list_class), 1 },
@@ -125,7 +125,7 @@ struct JNIAMediaFormatFields {
 
 jmethodID to_string_id;
 
-} JNIAMediaFormatFields;
+};
 
 static const struct FFJniField jni_amediaformat_mapping[] = {
 { "android/media/MediaFormat", NULL, NULL, FF_JNI_CLASS, offsetof(struct 
JNIAMediaFormatFields, mediaformat_class), 1 },
@@ -210,7 +210,7 @@ struct JNIAMediaCodecFields {
 jfieldID presentation_time_us_id;
 jfieldID size_id;
 
-} JNIAMediaCodecFields;
+};
 
 static const struct FFJniField jni_amediacodec_mapping[] = {
 { "android/media/MediaCodec", NULL, NULL, FF_JNI_CLASS, offsetof(struct 
JNIAMediaCodecFields, mediacodec_class), 1 },

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/ffjni: add missing '\n'

2017-05-23 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Sun May 
21 17:44:12 2017 +0200| [37de7f71758bd0ce2e3912bd70b223a718602e09] | committer: 
Matthieu Bouron

lavc/ffjni: add missing '\n'

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37de7f71758bd0ce2e3912bd70b223a718602e09
---

 libavcodec/ffjni.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ffjni.c b/libavcodec/ffjni.c
index b2bcae9602..f5b581f0f6 100644
--- a/libavcodec/ffjni.c
+++ b/libavcodec/ffjni.c
@@ -85,7 +85,7 @@ JNIEnv *ff_jni_get_env(void *log_ctx)
 av_log(log_ctx, AV_LOG_ERROR, "The specified JNI version is not 
supported\n");
 break;
 default:
-av_log(log_ctx, AV_LOG_ERROR, "Failed to get the JNI environment 
attached to this thread");
+av_log(log_ctx, AV_LOG_ERROR, "Failed to get the JNI environment 
attached to this thread\n");
 break;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mediacodec_wrapper: do not declare JNIAMedia{Codec,CodecList,Format}Fields on the stack

2017-05-23 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Sun May 
21 17:48:05 2017 +0200| [fb3228bee8fe55c48bc8c7d3a5342497ae78b730] | committer: 
Matthieu Bouron

lavc/mediacodec_wrapper: do not declare JNIAMedia{Codec,CodecList,Format}Fields 
on the stack

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fb3228bee8fe55c48bc8c7d3a5342497ae78b730
---

 libavcodec/mediacodec_wrapper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 5e1beed43a..4a37cd7cd7 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -66,7 +66,7 @@ struct JNIAMediaCodecListFields {
 jfieldID hevc_profile_main10_id;
 jfieldID hevc_profile_main10_hdr10_id;
 
-} JNIAMediaCodecListFields;
+};
 
 static const struct FFJniField jni_amediacodeclist_mapping[] = {
 { "android/media/MediaCodecList", NULL, NULL, FF_JNI_CLASS, 
offsetof(struct JNIAMediaCodecListFields, mediacodec_list_class), 1 },
@@ -125,7 +125,7 @@ struct JNIAMediaFormatFields {
 
 jmethodID to_string_id;
 
-} JNIAMediaFormatFields;
+};
 
 static const struct FFJniField jni_amediaformat_mapping[] = {
 { "android/media/MediaFormat", NULL, NULL, FF_JNI_CLASS, offsetof(struct 
JNIAMediaFormatFields, mediaformat_class), 1 },
@@ -210,7 +210,7 @@ struct JNIAMediaCodecFields {
 jfieldID presentation_time_us_id;
 jfieldID size_id;
 
-} JNIAMediaCodecFields;
+};
 
 static const struct FFJniField jni_amediacodec_mapping[] = {
 { "android/media/MediaCodec", NULL, NULL, FF_JNI_CLASS, offsetof(struct 
JNIAMediaCodecFields, mediacodec_class), 1 },

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mediacodec_wrapper: fix local reference leaks

2017-05-23 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Sun May 
21 16:48:30 2017 +0200| [224bb46fb857dab589597bdab302ba8ba012008c] | committer: 
Matthieu Bouron

lavc/mediacodec_wrapper: fix local reference leaks

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=224bb46fb857dab589597bdab302ba8ba012008c
---

 libavcodec/mediacodec_wrapper.c | 37 ++---
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 43fbb511fd..5e1beed43a 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -608,6 +608,7 @@ FFAMediaFormat *ff_AMediaFormat_new(void)
 {
 JNIEnv *env = NULL;
 FFAMediaFormat *format = NULL;
+jobject object = NULL;
 
 format = av_mallocz(sizeof(FFAMediaFormat));
 if (!format) {
@@ -625,23 +626,27 @@ FFAMediaFormat *ff_AMediaFormat_new(void)
 goto fail;
 }
 
-format->object = (*env)->NewObject(env, format->jfields.mediaformat_class, 
format->jfields.init_id);
-if (!format->object) {
+object = (*env)->NewObject(env, format->jfields.mediaformat_class, 
format->jfields.init_id);
+if (!object) {
 goto fail;
 }
 
-format->object = (*env)->NewGlobalRef(env, format->object);
+format->object = (*env)->NewGlobalRef(env, object);
 if (!format->object) {
 goto fail;
 }
 
-return format;
 fail:
-ff_jni_reset_jfields(env, >jfields, jni_amediaformat_mapping, 1, 
format);
+if (object) {
+(*env)->DeleteLocalRef(env, object);
+}
 
-av_freep();
+if (!format->object) {
+ff_jni_reset_jfields(env, >jfields, jni_amediaformat_mapping, 
1, format);
+av_freep();
+}
 
-return NULL;
+return format;
 }
 
 static FFAMediaFormat *ff_AMediaFormat_newFromObject(void *object)
@@ -1562,6 +1567,7 @@ uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* 
codec, size_t idx, size_t
 JNIEnv *env = NULL;
 
 jobject buffer = NULL;
+jobject input_buffers = NULL;
 
 JNI_GET_ENV_OR_RETURN(env, codec, NULL);
 
@@ -1572,12 +1578,12 @@ uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* 
codec, size_t idx, size_t
 }
 } else {
 if (!codec->input_buffers) {
-codec->input_buffers = (*env)->CallObjectMethod(env, 
codec->object, codec->jfields.get_input_buffers_id);
+input_buffers = (*env)->CallObjectMethod(env, codec->object, 
codec->jfields.get_input_buffers_id);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
 
-codec->input_buffers = (*env)->NewGlobalRef(env, 
codec->input_buffers);
+codec->input_buffers = (*env)->NewGlobalRef(env, input_buffers);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
@@ -1596,6 +1602,10 @@ fail:
 (*env)->DeleteLocalRef(env, buffer);
 }
 
+if (input_buffers) {
+(*env)->DeleteLocalRef(env, input_buffers);
+}
+
 return ret;
 }
 
@@ -1605,6 +1615,7 @@ uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* 
codec, size_t idx, size_t
 JNIEnv *env = NULL;
 
 jobject buffer = NULL;
+jobject output_buffers = NULL;
 
 JNI_GET_ENV_OR_RETURN(env, codec, NULL);
 
@@ -1615,12 +1626,12 @@ uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* 
codec, size_t idx, size_t
 }
 } else {
 if (!codec->output_buffers) {
-codec->output_buffers = (*env)->CallObjectMethod(env, 
codec->object, codec->jfields.get_output_buffers_id);
+output_buffers = (*env)->CallObjectMethod(env, codec->object, 
codec->jfields.get_output_buffers_id);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
 
-codec->output_buffers = (*env)->NewGlobalRef(env, 
codec->output_buffers);
+codec->output_buffers = (*env)->NewGlobalRef(env, output_buffers);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
@@ -1639,6 +1650,10 @@ fail:
 (*env)->DeleteLocalRef(env, buffer);
 }
 
+if (output_buffers) {
+(*env)->DeleteLocalRef(env, output_buffers);
+}
+
 return ret;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavf/mov: make invalid m{d,v}hd time_scale default to 1 instead of erroring out

2017-05-20 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Thu May 
11 15:16:22 2017 +0200| [ab61b79b1c707a9ea0512238d837ea3e8b8395ed] | committer: 
Matthieu Bouron

lavf/mov: make invalid m{d,v}hd time_scale default to 1 instead of erroring out

Some samples have their metadata track time_scale incorrectly set to 0
and the check introduced by a398f054fdb9b0f0b5a91c231fba6ce014143f71
prevents playback of those samples. Setting the time_scale to 1 fixes
playback.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ab61b79b1c707a9ea0512238d837ea3e8b8395ed
---

 libavformat/mov.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index afef53b79a..90b0ab1de7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1236,8 +1236,8 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 sc->time_scale = avio_rb32(pb);
 if (sc->time_scale <= 0) {
-av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d\n", 
sc->time_scale);
-return AVERROR_INVALIDDATA;
+av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d, defaulting to 
1\n", sc->time_scale);
+sc->time_scale = 1;
 }
 st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration 
*/
 
@@ -1266,8 +1266,8 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 mov_metadata_creation_time(>fc->metadata, creation_time);
 c->time_scale = avio_rb32(pb); /* time scale */
 if (c->time_scale <= 0) {
-av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d\n", 
c->time_scale);
-return AVERROR_INVALIDDATA;
+av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d, defaulting to 
1\n", c->time_scale);
+c->time_scale = 1;
 }
 av_log(c->fc, AV_LOG_TRACE, "time scale = %i\n", c->time_scale);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mediacodec_wrapper: fix local reference leaks

2017-05-14 Thread Matthieu Bouron
ffmpeg | branch: release/3.3 | Matthieu Bouron <matthieu.bou...@gmail.com> | 
Wed May 10 15:59:41 2017 +0200| [1d37fe95e85806f02b8c79dba459eede3fa239f4] | 
committer: Matthieu Bouron

lavc/mediacodec_wrapper: fix local reference leaks

Reviewed-by: Clément Bœsch <u...@pkh.me>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1d37fe95e85806f02b8c79dba459eede3fa239f4
---

 libavcodec/mediacodec_wrapper.c | 63 +++--
 1 file changed, 42 insertions(+), 21 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index c2af950f39..43fbb511fd 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1129,9 +1129,11 @@ fail:
 
 FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name)
 {
+int ret = -1;
 JNIEnv *env = NULL;
 FFAMediaCodec *codec = NULL;
 jstring codec_name = NULL;
+jobject object = NULL;
 
 codec = av_mallocz(sizeof(FFAMediaCodec));
 if (!codec) {
@@ -1154,12 +1156,12 @@ FFAMediaCodec* ff_AMediaCodec_createCodecByName(const 
char *name)
 goto fail;
 }
 
-codec->object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, 
codec_name);
+object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, 
codec_name);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
 
-codec->object = (*env)->NewGlobalRef(env, codec->object);
+codec->object = (*env)->NewGlobalRef(env, object);
 if (!codec->object) {
 goto fail;
 }
@@ -1172,24 +1174,31 @@ FFAMediaCodec* ff_AMediaCodec_createCodecByName(const 
char *name)
 codec->has_get_i_o_buffer = 1;
 }
 
-return codec;
+ret = 0;
 fail:
-ff_jni_reset_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec);
-
 if (codec_name) {
 (*env)->DeleteLocalRef(env, codec_name);
 }
 
-av_freep();
+if (object) {
+(*env)->DeleteLocalRef(env, object);
+}
 
-return NULL;
+if (ret < 0) {
+ff_jni_reset_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec);
+av_freep();
+}
+
+return codec;
 }
 
 FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime)
 {
+int ret = -1;
 JNIEnv *env = NULL;
 FFAMediaCodec *codec = NULL;
 jstring mime_type = NULL;
+jobject object = NULL;
 
 codec = av_mallocz(sizeof(FFAMediaCodec));
 if (!codec) {
@@ -1212,12 +1221,12 @@ FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const 
char *mime)
 goto fail;
 }
 
-codec->object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, 
mime_type);
+object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, 
mime_type);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
 
-codec->object = (*env)->NewGlobalRef(env, codec->object);
+codec->object = (*env)->NewGlobalRef(env, object);
 if (!codec->object) {
 goto fail;
 }
@@ -1230,24 +1239,31 @@ FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const 
char *mime)
 codec->has_get_i_o_buffer = 1;
 }
 
-return codec;
+ret = 0;
 fail:
-ff_jni_reset_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec);
-
 if (mime_type) {
 (*env)->DeleteLocalRef(env, mime_type);
 }
 
-av_freep();
+if (object) {
+(*env)->DeleteLocalRef(env, object);
+}
 
-return NULL;
+if (ret < 0) {
+ff_jni_reset_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec);
+av_freep();
+}
+
+return codec;
 }
 
 FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime)
 {
+int ret = -1;
 JNIEnv *env = NULL;
 FFAMediaCodec *codec = NULL;
 jstring mime_type = NULL;
+jobject object = NULL;
 
 codec = av_mallocz(sizeof(FFAMediaCodec));
 if (!codec) {
@@ -1270,12 +1286,12 @@ FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const 
char *mime)
 goto fail;
 }
 
-codec->object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_encoder_by_type_id, 
mime_type);
+object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_encoder_by_type_id, 
mime_type);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
 
-codec->object = (*env)->NewGlobalRef(env, codec->object);
+codec->object = (*env)->NewGlobalRef(env, object);
 if (!codec->object) {
 goto fail;
 }
@@ -1288,17 +1304,22 @@ FFAMediaCodec* ff_AM

[FFmpeg-cvslog] lavc/aarch64/simple_idct: fix iOS build without gas-preprocessor

2017-05-14 Thread Matthieu Bouron
ffmpeg | branch: release/3.3 | Matthieu Bouron <matthieu.bou...@gmail.com> | 
Fri Apr 28 21:58:55 2017 +0200| [d8afd8d371ec0dc05baa2585caffba100ca45cec] | 
committer: Matthieu Bouron

lavc/aarch64/simple_idct: fix iOS build without gas-preprocessor

Separates macro arguments with commas and passes .4H/.8H as macro
arguments instead of 4H/8H (the later form being interpreted as an
hexadecimal value).

Fixes ticket #6324.

Suggested-by: Martin Storsjö <mar...@martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d8afd8d371ec0dc05baa2585caffba100ca45cec
---

 libavcodec/aarch64/simple_idct_neon.S | 74 +--
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/libavcodec/aarch64/simple_idct_neon.S 
b/libavcodec/aarch64/simple_idct_neon.S
index 52273420f9..92987985d2 100644
--- a/libavcodec/aarch64/simple_idct_neon.S
+++ b/libavcodec/aarch64/simple_idct_neon.S
@@ -61,37 +61,37 @@ endconst
 br  x10
 .endm
 
-.macro smull1 a b c
+.macro smull1 a, b, c
 smull   \a, \b, \c
 .endm
 
-.macro smlal1 a b c
+.macro smlal1 a, b, c
 smlal   \a, \b, \c
 .endm
 
-.macro smlsl1 a b c
+.macro smlsl1 a, b, c
 smlsl   \a, \b, \c
 .endm
 
-.macro idct_col4_top y1 y2 y3 y4 i l
-smull\i v7.4S,  \y3\().\l, z2
-smull\i v16.4S, \y3\().\l, z6
-smull\i v17.4S, \y2\().\l, z1
+.macro idct_col4_top y1, y2, y3, y4, i, l
+smull\i v7.4S,  \y3\l, z1
+smull\i v16.4S, \y3\l, z6
+smull\i v17.4S, \y2\l, z1
 add v19.4S, v23.4S, v7.4S
-smull\i v18.4S, \y2\().\l, z3
+smull\i v18.4S, \y2\l, z3
 add v20.4S, v23.4S, v16.4S
-smull\i v5.4S,  \y2\().\l, z5
+smull\i v5.4S,  \y2\l, z5
 sub v21.4S, v23.4S, v16.4S
-smull\i v6.4S,  \y2\().\l, z7
+smull\i v6.4S,  \y2\l, z7
 sub v22.4S, v23.4S, v7.4S
 
-smlal\i v17.4S, \y4\().\l, z3
-smlsl\i v18.4S, \y4\().\l, z7
-smlsl\i v5.4S,  \y4\().\l, z1
-smlsl\i v6.4S,  \y4\().\l, z5
+smlal\i v17.4S, \y4\l, z3
+smlsl\i v18.4S, \y4\l, z7
+smlsl\i v5.4S,  \y4\l, z1
+smlsl\i v6.4S,  \y4\l, z5
 .endm
 
-.macro idct_row4_neon y1 y2 y3 y4 pass
+.macro idct_row4_neon y1, y2, y3, y4, pass
 ld1 {\y1\().2D-\y2\().2D}, [x2], #32
 moviv23.4S, #1<<2, lsl #8
 orr v5.16B, \y1\().16B, \y2\().16B
@@ -101,7 +101,7 @@ endconst
 mov x3, v5.D[1]
 smlal   v23.4S, \y1\().4H, z4
 
-idct_col4_top   \y1 \y2 \y3 \y4 1 4H
+idct_col4_top   \y1, \y2, \y3, \y4, 1, .4H
 
 cmp x3, #0
 beq \pass\()f
@@ -153,7 +153,7 @@ endconst
 trn2\y4\().4S, v17.4S, v19.4S
 .endm
 
-.macro declare_idct_col4_neon i l
+.macro declare_idct_col4_neon i, l
 function idct_col4_neon\i
 dup v23.4H, z4c
 .if \i == 1
@@ -164,14 +164,14 @@ function idct_col4_neon\i
 .endif
 smull   v23.4S, v23.4H, z4
 
-idct_col4_top   v24 v25 v26 v27 \i \l
+idct_col4_top   v24, v25, v26, v27, \i, \l
 
 mov x4, v28.D[\i - 1]
 mov x5, v29.D[\i - 1]
 cmp x4, #0
 beq 1f
 
-smull\i v7.4S,  v28.\l, z4
+smull\i v7.4S,  v28\l,  z4
 add v19.4S, v19.4S, v7.4S
 sub v20.4S, v20.4S, v7.4S
 sub v21.4S, v21.4S, v7.4S
@@ -181,17 +181,17 @@ function idct_col4_neon\i
 cmp x5, #0
 beq 2f
 
-smlal\i v17.4S, v29.\l, z5
-smlsl\i v18.4S, v29.\l, z1
-smlal\i v5.4S,  v29.\l, z7
-smlal\i v6.4S,  v29.\l, z3
+smlal\i v17.4S, v29\l, z5
+smlsl\i v18.4S, v29\l, z1
+smlal\i v5.4S,  v29\l, z7
+smlal\i v6.4S,  v29\l, z3
 
 2:  mov x5, v31.D[\i - 1]
 cmp x4, #0
 beq 3f
 
-smull\i v7.4S,  v30.\l, z6
-smull\i v16.4S, v30.\l, z2
+smull\i v7.4S,  v30\l, z6
+smull\i v16.4S, v30\l, z2
 add v19.4S, v19.4S, v7.4S
 sub v22.4S, v22.4S, v7.4S
 sub v20.4S, v20.4S, v16.4S
@@ -200,10 +200,10 @@ function idct_col4_neon\i
 3:  cmp x5, #0
 beq 4f
 
-smlal\i v17.4S, v31.\l, z7
-smlsl\i v18.4S, v31.\l, z5
-smlal\i v5.4S,  v31.\l, z3
-smlsl\i v6.4S,  v31.\l, z1
+smlal\i 

[FFmpeg-cvslog] lavc/mediacodec_wrapper: fix local reference leaks

2017-05-11 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed May 
10 15:59:41 2017 +0200| [1795dccde0ad22fc8201142f92fb8d58c234f3e4] | committer: 
Matthieu Bouron

lavc/mediacodec_wrapper: fix local reference leaks

Reviewed-by: Clément Bœsch <u...@pkh.me>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1795dccde0ad22fc8201142f92fb8d58c234f3e4
---

 libavcodec/mediacodec_wrapper.c | 63 +++--
 1 file changed, 42 insertions(+), 21 deletions(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index c2af950f39..43fbb511fd 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1129,9 +1129,11 @@ fail:
 
 FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name)
 {
+int ret = -1;
 JNIEnv *env = NULL;
 FFAMediaCodec *codec = NULL;
 jstring codec_name = NULL;
+jobject object = NULL;
 
 codec = av_mallocz(sizeof(FFAMediaCodec));
 if (!codec) {
@@ -1154,12 +1156,12 @@ FFAMediaCodec* ff_AMediaCodec_createCodecByName(const 
char *name)
 goto fail;
 }
 
-codec->object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, 
codec_name);
+object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, 
codec_name);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
 
-codec->object = (*env)->NewGlobalRef(env, codec->object);
+codec->object = (*env)->NewGlobalRef(env, object);
 if (!codec->object) {
 goto fail;
 }
@@ -1172,24 +1174,31 @@ FFAMediaCodec* ff_AMediaCodec_createCodecByName(const 
char *name)
 codec->has_get_i_o_buffer = 1;
 }
 
-return codec;
+ret = 0;
 fail:
-ff_jni_reset_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec);
-
 if (codec_name) {
 (*env)->DeleteLocalRef(env, codec_name);
 }
 
-av_freep();
+if (object) {
+(*env)->DeleteLocalRef(env, object);
+}
 
-return NULL;
+if (ret < 0) {
+ff_jni_reset_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec);
+av_freep();
+}
+
+return codec;
 }
 
 FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime)
 {
+int ret = -1;
 JNIEnv *env = NULL;
 FFAMediaCodec *codec = NULL;
 jstring mime_type = NULL;
+jobject object = NULL;
 
 codec = av_mallocz(sizeof(FFAMediaCodec));
 if (!codec) {
@@ -1212,12 +1221,12 @@ FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const 
char *mime)
 goto fail;
 }
 
-codec->object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, 
mime_type);
+object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, 
mime_type);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
 
-codec->object = (*env)->NewGlobalRef(env, codec->object);
+codec->object = (*env)->NewGlobalRef(env, object);
 if (!codec->object) {
 goto fail;
 }
@@ -1230,24 +1239,31 @@ FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const 
char *mime)
 codec->has_get_i_o_buffer = 1;
 }
 
-return codec;
+ret = 0;
 fail:
-ff_jni_reset_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec);
-
 if (mime_type) {
 (*env)->DeleteLocalRef(env, mime_type);
 }
 
-av_freep();
+if (object) {
+(*env)->DeleteLocalRef(env, object);
+}
 
-return NULL;
+if (ret < 0) {
+ff_jni_reset_jfields(env, >jfields, jni_amediacodec_mapping, 1, 
codec);
+av_freep();
+}
+
+return codec;
 }
 
 FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime)
 {
+int ret = -1;
 JNIEnv *env = NULL;
 FFAMediaCodec *codec = NULL;
 jstring mime_type = NULL;
+jobject object = NULL;
 
 codec = av_mallocz(sizeof(FFAMediaCodec));
 if (!codec) {
@@ -1270,12 +1286,12 @@ FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const 
char *mime)
 goto fail;
 }
 
-codec->object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_encoder_by_type_id, 
mime_type);
+object = (*env)->CallStaticObjectMethod(env, 
codec->jfields.mediacodec_class, codec->jfields.create_encoder_by_type_id, 
mime_type);
 if (ff_jni_exception_check(env, 1, codec) < 0) {
 goto fail;
 }
 
-codec->object = (*env)->NewGlobalRef(env, codec->object);
+codec->object = (*env)->NewGlobalRef(env, object);
 if (!codec->object) {
 goto fail;
 }
@@ -1288,17 +1304,22 @@ FFAMediaCodec* ff_AM

[FFmpeg-cvslog] lavc/ffjni: fix local reference leak

2017-05-11 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed May 
10 15:57:57 2017 +0200| [2f43897f657974d8f94d0d075eb67dac1147ddde] | committer: 
Matthieu Bouron

lavc/ffjni: fix local reference leak

Reviewed-by: Clément Bœsch <u...@pkh.me>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2f43897f657974d8f94d0d075eb67dac1147ddde
---

 libavcodec/ffjni.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/ffjni.c b/libavcodec/ffjni.c
index 3f4c380673..b2bcae9602 100644
--- a/libavcodec/ffjni.c
+++ b/libavcodec/ffjni.c
@@ -303,6 +303,11 @@ int ff_jni_init_jfields(JNIEnv *env, void *jfields, const 
struct FFJniField *jfi
 
 last_clazz = *(jclass*)((uint8_t*)jfields + 
jfields_mapping[i].offset) =
 global ? (*env)->NewGlobalRef(env, clazz) : clazz;
+
+if (global) {
+(*env)->DeleteLocalRef(env, clazz);
+}
+
 } else {
 
 if (!last_clazz) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/aarch64/simple_idct: fix iOS build without gas-preprocessor

2017-05-11 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Fri Apr 
28 21:58:55 2017 +0200| [5d0b8b1ae307951310c7d9a8fa282fbca9b997cd] | committer: 
Matthieu Bouron

lavc/aarch64/simple_idct: fix iOS build without gas-preprocessor

Separates macro arguments with commas and passes .4H/.8H as macro
arguments instead of 4H/8H (the later form being interpreted as an
hexadecimal value).

Fixes ticket #6324.

Suggested-by: Martin Storsjö <mar...@martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d0b8b1ae307951310c7d9a8fa282fbca9b997cd
---

 libavcodec/aarch64/simple_idct_neon.S | 74 +--
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/libavcodec/aarch64/simple_idct_neon.S 
b/libavcodec/aarch64/simple_idct_neon.S
index 52273420f9..92987985d2 100644
--- a/libavcodec/aarch64/simple_idct_neon.S
+++ b/libavcodec/aarch64/simple_idct_neon.S
@@ -61,37 +61,37 @@ endconst
 br  x10
 .endm
 
-.macro smull1 a b c
+.macro smull1 a, b, c
 smull   \a, \b, \c
 .endm
 
-.macro smlal1 a b c
+.macro smlal1 a, b, c
 smlal   \a, \b, \c
 .endm
 
-.macro smlsl1 a b c
+.macro smlsl1 a, b, c
 smlsl   \a, \b, \c
 .endm
 
-.macro idct_col4_top y1 y2 y3 y4 i l
-smull\i v7.4S,  \y3\().\l, z2
-smull\i v16.4S, \y3\().\l, z6
-smull\i v17.4S, \y2\().\l, z1
+.macro idct_col4_top y1, y2, y3, y4, i, l
+smull\i v7.4S,  \y3\l, z1
+smull\i v16.4S, \y3\l, z6
+smull\i v17.4S, \y2\l, z1
 add v19.4S, v23.4S, v7.4S
-smull\i v18.4S, \y2\().\l, z3
+smull\i v18.4S, \y2\l, z3
 add v20.4S, v23.4S, v16.4S
-smull\i v5.4S,  \y2\().\l, z5
+smull\i v5.4S,  \y2\l, z5
 sub v21.4S, v23.4S, v16.4S
-smull\i v6.4S,  \y2\().\l, z7
+smull\i v6.4S,  \y2\l, z7
 sub v22.4S, v23.4S, v7.4S
 
-smlal\i v17.4S, \y4\().\l, z3
-smlsl\i v18.4S, \y4\().\l, z7
-smlsl\i v5.4S,  \y4\().\l, z1
-smlsl\i v6.4S,  \y4\().\l, z5
+smlal\i v17.4S, \y4\l, z3
+smlsl\i v18.4S, \y4\l, z7
+smlsl\i v5.4S,  \y4\l, z1
+smlsl\i v6.4S,  \y4\l, z5
 .endm
 
-.macro idct_row4_neon y1 y2 y3 y4 pass
+.macro idct_row4_neon y1, y2, y3, y4, pass
 ld1 {\y1\().2D-\y2\().2D}, [x2], #32
 moviv23.4S, #1<<2, lsl #8
 orr v5.16B, \y1\().16B, \y2\().16B
@@ -101,7 +101,7 @@ endconst
 mov x3, v5.D[1]
 smlal   v23.4S, \y1\().4H, z4
 
-idct_col4_top   \y1 \y2 \y3 \y4 1 4H
+idct_col4_top   \y1, \y2, \y3, \y4, 1, .4H
 
 cmp x3, #0
 beq \pass\()f
@@ -153,7 +153,7 @@ endconst
 trn2\y4\().4S, v17.4S, v19.4S
 .endm
 
-.macro declare_idct_col4_neon i l
+.macro declare_idct_col4_neon i, l
 function idct_col4_neon\i
 dup v23.4H, z4c
 .if \i == 1
@@ -164,14 +164,14 @@ function idct_col4_neon\i
 .endif
 smull   v23.4S, v23.4H, z4
 
-idct_col4_top   v24 v25 v26 v27 \i \l
+idct_col4_top   v24, v25, v26, v27, \i, \l
 
 mov x4, v28.D[\i - 1]
 mov x5, v29.D[\i - 1]
 cmp x4, #0
 beq 1f
 
-smull\i v7.4S,  v28.\l, z4
+smull\i v7.4S,  v28\l,  z4
 add v19.4S, v19.4S, v7.4S
 sub v20.4S, v20.4S, v7.4S
 sub v21.4S, v21.4S, v7.4S
@@ -181,17 +181,17 @@ function idct_col4_neon\i
 cmp x5, #0
 beq 2f
 
-smlal\i v17.4S, v29.\l, z5
-smlsl\i v18.4S, v29.\l, z1
-smlal\i v5.4S,  v29.\l, z7
-smlal\i v6.4S,  v29.\l, z3
+smlal\i v17.4S, v29\l, z5
+smlsl\i v18.4S, v29\l, z1
+smlal\i v5.4S,  v29\l, z7
+smlal\i v6.4S,  v29\l, z3
 
 2:  mov x5, v31.D[\i - 1]
 cmp x4, #0
 beq 3f
 
-smull\i v7.4S,  v30.\l, z6
-smull\i v16.4S, v30.\l, z2
+smull\i v7.4S,  v30\l, z6
+smull\i v16.4S, v30\l, z2
 add v19.4S, v19.4S, v7.4S
 sub v22.4S, v22.4S, v7.4S
 sub v20.4S, v20.4S, v16.4S
@@ -200,10 +200,10 @@ function idct_col4_neon\i
 3:  cmp x5, #0
 beq 4f
 
-smlal\i v17.4S, v31.\l, z7
-smlsl\i v18.4S, v31.\l, z5
-smlal\i v5.4S,  v31.\l, z3
-smlsl\i v6.4S,  v31.\l, z1
+smlal\i 

[FFmpeg-cvslog] doc/examples/extract_mvs: re-indent after previous commit

2017-04-04 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Mon Apr 
 3 16:32:50 2017 +0200| [400378b7b3a4fb34991c7267beb09272615fdea2] | committer: 
Matthieu Bouron

doc/examples/extract_mvs: re-indent after previous commit

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=400378b7b3a4fb34991c7267beb09272615fdea2
---

 doc/examples/extract_mvs.c | 56 +++---
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c
index 552a733..7ae934e 100644
--- a/doc/examples/extract_mvs.c
+++ b/doc/examples/extract_mvs.c
@@ -35,40 +35,40 @@ static int video_frame_count = 0;
 
 static int decode_packet(const AVPacket *pkt)
 {
-int ret = avcodec_send_packet(video_dec_ctx, pkt);
-if (ret < 0) {
-fprintf(stderr, "Error while sending a packet to the decoder: 
%s\n", av_err2str(ret));
+int ret = avcodec_send_packet(video_dec_ctx, pkt);
+if (ret < 0) {
+fprintf(stderr, "Error while sending a packet to the decoder: %s\n", 
av_err2str(ret));
+return ret;
+}
+
+while (ret >= 0)  {
+ret = avcodec_receive_frame(video_dec_ctx, frame);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
+break;
+} else if (ret < 0) {
+fprintf(stderr, "Error while receiving a frame from the decoder: 
%s\n", av_err2str(ret));
 return ret;
 }
 
-while (ret >= 0)  {
-ret = avcodec_receive_frame(video_dec_ctx, frame);
-if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
-break;
-} else if (ret < 0) {
-fprintf(stderr, "Error while receiving a frame from the 
decoder: %s\n", av_err2str(ret));
-return ret;
-}
-
-if (ret >= 0) {
-int i;
-AVFrameSideData *sd;
-
-video_frame_count++;
-sd = av_frame_get_side_data(frame, 
AV_FRAME_DATA_MOTION_VECTORS);
-if (sd) {
-const AVMotionVector *mvs = (const AVMotionVector 
*)sd->data;
-for (i = 0; i < sd->size / sizeof(*mvs); i++) {
-const AVMotionVector *mv = [i];
-printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n",
-video_frame_count, mv->source,
-mv->w, mv->h, mv->src_x, mv->src_y,
-mv->dst_x, mv->dst_y, mv->flags);
-}
+if (ret >= 0) {
+int i;
+AVFrameSideData *sd;
+
+video_frame_count++;
+sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS);
+if (sd) {
+const AVMotionVector *mvs = (const AVMotionVector *)sd->data;
+for (i = 0; i < sd->size / sizeof(*mvs); i++) {
+const AVMotionVector *mv = [i];
+printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n",
+video_frame_count, mv->source,
+mv->w, mv->h, mv->src_x, mv->src_y,
+mv->dst_x, mv->dst_y, mv->flags);
 }
-av_frame_unref(frame);
 }
+av_frame_unref(frame);
 }
+}
 
 return 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] doc/examples/extract_mvs: make pkt local to the main function

2017-04-04 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Mon Apr 
 3 16:15:58 2017 +0200| [1cf93196fc6993541194c06a67bd59e45a4b3a44] | committer: 
Matthieu Bouron

doc/examples/extract_mvs: make pkt local to the main function

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1cf93196fc6993541194c06a67bd59e45a4b3a44
---

 doc/examples/extract_mvs.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c
index d6730db..552a733 100644
--- a/doc/examples/extract_mvs.c
+++ b/doc/examples/extract_mvs.c
@@ -31,13 +31,11 @@ static const char *src_filename = NULL;
 
 static int video_stream_idx = -1;
 static AVFrame *frame = NULL;
-static AVPacket pkt;
 static int video_frame_count = 0;
 
-static int decode_packet(void)
+static int decode_packet(const AVPacket *pkt)
 {
-if (pkt.stream_index == video_stream_idx) {
-int ret = avcodec_send_packet(video_dec_ctx, );
+int ret = avcodec_send_packet(video_dec_ctx, pkt);
 if (ret < 0) {
 fprintf(stderr, "Error while sending a packet to the decoder: 
%s\n", av_err2str(ret));
 return ret;
@@ -71,7 +69,6 @@ static int decode_packet(void)
 av_frame_unref(frame);
 }
 }
-}
 
 return 0;
 }
@@ -124,6 +121,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, 
enum AVMediaType type)
 int main(int argc, char **argv)
 {
 int ret = 0;
+AVPacket pkt = { 0 };
 
 if (argc != 2) {
 fprintf(stderr, "Usage: %s \n", argv[0]);
@@ -162,21 +160,17 @@ int main(int argc, char **argv)
 
 printf("framenum,source,blockw,blockh,srcx,srcy,dstx,dsty,flags\n");
 
-/* initialize packet, set data to NULL, let the demuxer fill it */
-av_init_packet();
-
 /* read frames from the file */
 while (av_read_frame(fmt_ctx, ) >= 0) {
-ret = decode_packet();
+if (pkt.stream_index == video_stream_idx)
+ret = decode_packet();
 av_packet_unref();
 if (ret < 0)
 break;
 }
 
 /* flush cached frames */
-pkt.data = NULL;
-pkt.size = 0;
-decode_packet();
+decode_packet(NULL);
 
 end:
 avcodec_free_context(_dec_ctx);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] doc/examples/extract_mvs: switch to new decoding API

2017-04-04 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Mon Apr 
 3 15:25:09 2017 +0200| [82116bd8a45c9c5ad8874233ebc2f5583170856f] | committer: 
Matthieu Bouron

doc/examples/extract_mvs: switch to new decoding API

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=82116bd8a45c9c5ad8874233ebc2f5583170856f
---

 doc/examples/extract_mvs.c | 72 ++
 1 file changed, 35 insertions(+), 37 deletions(-)

diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c
index 8b22b40..d6730db 100644
--- a/doc/examples/extract_mvs.c
+++ b/doc/examples/extract_mvs.c
@@ -34,39 +34,46 @@ static AVFrame *frame = NULL;
 static AVPacket pkt;
 static int video_frame_count = 0;
 
-static int decode_packet(int *got_frame, int cached)
+static int decode_packet(void)
 {
-int decoded = pkt.size;
-
-*got_frame = 0;
-
 if (pkt.stream_index == video_stream_idx) {
-int ret = avcodec_decode_video2(video_dec_ctx, frame, got_frame, );
+int ret = avcodec_send_packet(video_dec_ctx, );
 if (ret < 0) {
-fprintf(stderr, "Error decoding video frame (%s)\n", 
av_err2str(ret));
+fprintf(stderr, "Error while sending a packet to the decoder: 
%s\n", av_err2str(ret));
 return ret;
 }
 
-if (*got_frame) {
-int i;
-AVFrameSideData *sd;
-
-video_frame_count++;
-sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS);
-if (sd) {
-const AVMotionVector *mvs = (const AVMotionVector *)sd->data;
-for (i = 0; i < sd->size / sizeof(*mvs); i++) {
-const AVMotionVector *mv = [i];
-printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n",
-   video_frame_count, mv->source,
-   mv->w, mv->h, mv->src_x, mv->src_y,
-   mv->dst_x, mv->dst_y, mv->flags);
+while (ret >= 0)  {
+ret = avcodec_receive_frame(video_dec_ctx, frame);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
+break;
+} else if (ret < 0) {
+fprintf(stderr, "Error while receiving a frame from the 
decoder: %s\n", av_err2str(ret));
+return ret;
+}
+
+if (ret >= 0) {
+int i;
+AVFrameSideData *sd;
+
+video_frame_count++;
+sd = av_frame_get_side_data(frame, 
AV_FRAME_DATA_MOTION_VECTORS);
+if (sd) {
+const AVMotionVector *mvs = (const AVMotionVector 
*)sd->data;
+for (i = 0; i < sd->size / sizeof(*mvs); i++) {
+const AVMotionVector *mv = [i];
+printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n",
+video_frame_count, mv->source,
+mv->w, mv->h, mv->src_x, mv->src_y,
+mv->dst_x, mv->dst_y, mv->flags);
+}
 }
+av_frame_unref(frame);
 }
 }
 }
 
-return decoded;
+return 0;
 }
 
 static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
@@ -116,7 +123,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, 
enum AVMediaType type)
 
 int main(int argc, char **argv)
 {
-int ret = 0, got_frame;
+int ret = 0;
 
 if (argc != 2) {
 fprintf(stderr, "Usage: %s \n", argv[0]);
@@ -157,28 +164,19 @@ int main(int argc, char **argv)
 
 /* initialize packet, set data to NULL, let the demuxer fill it */
 av_init_packet();
-pkt.data = NULL;
-pkt.size = 0;
 
 /* read frames from the file */
 while (av_read_frame(fmt_ctx, ) >= 0) {
-AVPacket orig_pkt = pkt;
-do {
-ret = decode_packet(_frame, 0);
-if (ret < 0)
-break;
-pkt.data += ret;
-pkt.size -= ret;
-} while (pkt.size > 0);
-av_packet_unref(_pkt);
+ret = decode_packet();
+av_packet_unref();
+if (ret < 0)
+break;
 }
 
 /* flush cached frames */
 pkt.data = NULL;
 pkt.size = 0;
-do {
-decode_packet(_frame, 1);
-} while (got_frame);
+decode_packet();
 
 end:
 avcodec_free_context(_dec_ctx);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mediacodecdec: switch to AV_CODEC_CAP_DELAY

2017-04-04 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Tue Apr 
 4 09:07:54 2017 +0200| [6ffaf90b32e42b6114cf558ed92bbd4fa93c6f49] | committer: 
Matthieu Bouron

lavc/mediacodecdec: switch to AV_CODEC_CAP_DELAY

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ffaf90b32e42b6114cf558ed92bbd4fa93c6f49
---

 libavcodec/mediacodecdec.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 79a51ec..4cbec09 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -552,7 +552,7 @@ AVCodec ff_h264_mediacodec_decoder = {
 .decode = mediacodec_decode_frame,
 .flush  = mediacodec_decode_flush,
 .close  = mediacodec_decode_close,
-.capabilities   = CODEC_CAP_DELAY,
+.capabilities   = AV_CODEC_CAP_DELAY,
 .caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
 };
 #endif
@@ -568,7 +568,7 @@ AVCodec ff_hevc_mediacodec_decoder = {
 .decode = mediacodec_decode_frame,
 .flush  = mediacodec_decode_flush,
 .close  = mediacodec_decode_close,
-.capabilities   = CODEC_CAP_DELAY,
+.capabilities   = AV_CODEC_CAP_DELAY,
 .caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
 };
 #endif
@@ -584,7 +584,7 @@ AVCodec ff_mpeg4_mediacodec_decoder = {
 .decode = mediacodec_decode_frame,
 .flush  = mediacodec_decode_flush,
 .close  = mediacodec_decode_close,
-.capabilities   = CODEC_CAP_DELAY,
+.capabilities   = AV_CODEC_CAP_DELAY,
 .caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
 };
 #endif
@@ -600,7 +600,7 @@ AVCodec ff_vp8_mediacodec_decoder = {
 .decode = mediacodec_decode_frame,
 .flush  = mediacodec_decode_flush,
 .close  = mediacodec_decode_close,
-.capabilities   = CODEC_CAP_DELAY,
+.capabilities   = AV_CODEC_CAP_DELAY,
 .caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
 };
 #endif
@@ -616,7 +616,7 @@ AVCodec ff_vp9_mediacodec_decoder = {
 .decode = mediacodec_decode_frame,
 .flush  = mediacodec_decode_flush,
 .close  = mediacodec_decode_close,
-.capabilities   = CODEC_CAP_DELAY,
+.capabilities   = AV_CODEC_CAP_DELAY,
 .caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
 };
 #endif

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] doc/examples/filtering_audio: switch to new decoding API

2017-03-30 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed Mar 
29 16:25:24 2017 +0200| [03372d0a90c01ad4e74f7f35cb0022d6bc681575] | committer: 
Matthieu Bouron

doc/examples/filtering_audio: switch to new decoding API

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=03372d0a90c01ad4e74f7f35cb0022d6bc681575
---

 doc/examples/filtering_audio.c | 63 --
 1 file changed, 30 insertions(+), 33 deletions(-)

diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c
index c6a930b..679218c 100644
--- a/doc/examples/filtering_audio.c
+++ b/doc/examples/filtering_audio.c
@@ -216,10 +216,9 @@ static void print_frame(const AVFrame *frame)
 int main(int argc, char **argv)
 {
 int ret;
-AVPacket packet0, packet;
+AVPacket packet;
 AVFrame *frame = av_frame_alloc();
 AVFrame *filt_frame = av_frame_alloc();
-int got_frame;
 
 if (!frame || !filt_frame) {
 perror("Could not allocate frame");
@@ -239,50 +238,48 @@ int main(int argc, char **argv)
 goto end;
 
 /* read all packets */
-packet0.data = NULL;
-packet.data = NULL;
 while (1) {
-if (!packet0.data) {
-if ((ret = av_read_frame(fmt_ctx, )) < 0)
-break;
-packet0 = packet;
-}
+if ((ret = av_read_frame(fmt_ctx, )) < 0)
+break;
 
 if (packet.stream_index == audio_stream_index) {
-got_frame = 0;
-ret = avcodec_decode_audio4(dec_ctx, frame, _frame, );
+ret = avcodec_send_packet(dec_ctx, );
 if (ret < 0) {
-av_log(NULL, AV_LOG_ERROR, "Error decoding audio\n");
-continue;
+av_log(NULL, AV_LOG_ERROR, "Error while sending a packet to 
the decoder\n");
+break;
 }
-packet.size -= ret;
-packet.data += ret;
 
-if (got_frame) {
-/* push the audio data from decoded frame into the filtergraph 
*/
-if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, 0) < 0) 
{
-av_log(NULL, AV_LOG_ERROR, "Error while feeding the audio 
filtergraph\n");
+while (ret >= 0) {
+ret = avcodec_receive_frame(dec_ctx, frame);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
 break;
+} else if (ret < 0) {
+av_log(NULL, AV_LOG_ERROR, "Error while receiving a frame 
from the decoder\n");
+goto end;
 }
 
-/* pull filtered audio from the filtergraph */
-while (1) {
-ret = av_buffersink_get_frame(buffersink_ctx, filt_frame);
-if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+if (ret >= 0) {
+/* push the audio data from decoded frame into the 
filtergraph */
+if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, 
AV_BUFFERSRC_FLAG_KEEP_REF) < 0) {
+av_log(NULL, AV_LOG_ERROR, "Error while feeding the 
audio filtergraph\n");
 break;
-if (ret < 0)
-goto end;
-print_frame(filt_frame);
-av_frame_unref(filt_frame);
+}
+
+/* pull filtered audio from the filtergraph */
+while (1) {
+ret = av_buffersink_get_frame(buffersink_ctx, 
filt_frame);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+break;
+if (ret < 0)
+goto end;
+print_frame(filt_frame);
+av_frame_unref(filt_frame);
+}
+av_frame_unref(frame);
 }
 }
-
-if (packet.size <= 0)
-av_packet_unref();
-} else {
-/* discard non-wanted packets */
-av_packet_unref();
 }
+av_packet_unref();
 }
 end:
 avfilter_graph_free(_graph);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] doc/examples/filtering_video: switch to new decoding API

2017-03-30 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed Mar 
29 14:58:01 2017 +0200| [afd257b43feb6ba60d823b65f02b283f404a7e13] | committer: 
Matthieu Bouron

doc/examples/filtering_video: switch to new decoding API

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=afd257b43feb6ba60d823b65f02b283f404a7e13
---

 doc/examples/filtering_video.c | 46 +-
 1 file changed, 27 insertions(+), 19 deletions(-)

diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c
index 15116d3..4d97302 100644
--- a/doc/examples/filtering_video.c
+++ b/doc/examples/filtering_video.c
@@ -213,7 +213,6 @@ int main(int argc, char **argv)
 AVPacket packet;
 AVFrame *frame = av_frame_alloc();
 AVFrame *filt_frame = av_frame_alloc();
-int got_frame;
 
 if (!frame || !filt_frame) {
 perror("Could not allocate frame");
@@ -238,33 +237,42 @@ int main(int argc, char **argv)
 break;
 
 if (packet.stream_index == video_stream_index) {
-got_frame = 0;
-ret = avcodec_decode_video2(dec_ctx, frame, _frame, );
+ret = avcodec_send_packet(dec_ctx, );
 if (ret < 0) {
-av_log(NULL, AV_LOG_ERROR, "Error decoding video\n");
+av_log(NULL, AV_LOG_ERROR, "Error while sending a packet to 
the decoder\n");
 break;
 }
 
-if (got_frame) {
-frame->pts = av_frame_get_best_effort_timestamp(frame);
-
-/* push the decoded frame into the filtergraph */
-if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, 
AV_BUFFERSRC_FLAG_KEEP_REF) < 0) {
-av_log(NULL, AV_LOG_ERROR, "Error while feeding the 
filtergraph\n");
+while (ret >= 0) {
+ret = avcodec_receive_frame(dec_ctx, frame);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
 break;
+} else if (ret < 0) {
+av_log(NULL, AV_LOG_ERROR, "Error while receiving a frame 
from the decoder\n");
+goto end;
 }
 
-/* pull filtered frames from the filtergraph */
-while (1) {
-ret = av_buffersink_get_frame(buffersink_ctx, filt_frame);
-if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+if (ret >= 0) {
+frame->pts = av_frame_get_best_effort_timestamp(frame);
+
+/* push the decoded frame into the filtergraph */
+if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, 
AV_BUFFERSRC_FLAG_KEEP_REF) < 0) {
+av_log(NULL, AV_LOG_ERROR, "Error while feeding the 
filtergraph\n");
 break;
-if (ret < 0)
-goto end;
-display_frame(filt_frame, 
buffersink_ctx->inputs[0]->time_base);
-av_frame_unref(filt_frame);
+}
+
+/* pull filtered frames from the filtergraph */
+while (1) {
+ret = av_buffersink_get_frame(buffersink_ctx, 
filt_frame);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+break;
+if (ret < 0)
+goto end;
+display_frame(filt_frame, 
buffersink_ctx->inputs[0]->time_base);
+av_frame_unref(filt_frame);
+}
+av_frame_unref(frame);
 }
-av_frame_unref(frame);
 }
 }
 av_packet_unref();

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '7e2561fa8313982aa21f7657953eedeeb33b210d'

2017-03-29 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed Mar 
29 23:31:20 2017 +0200| [78e871ebbcc6f3c877e7292c4dda0c9979f8ede4] | committer: 
Matthieu Bouron

Merge commit '7e2561fa8313982aa21f7657953eedeeb33b210d'

* commit '7e2561fa8313982aa21f7657953eedeeb33b210d':
  lavfi: Use ff_get_video_buffer in all filters using hwframes
  vf_hwupload_cuda: Fix build error

Merged-by: Matthieu Bouron <matthieu.bou...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=78e871ebbcc6f3c877e7292c4dda0c9979f8ede4
---

 libavfilter/vf_deinterlace_qsv.c | 10 --
 libavfilter/vf_hwupload.c|  9 ++---
 libavfilter/vf_hwupload_cuda.c   |  8 ++--
 libavfilter/vf_scale_qsv.c   |  6 +-
 libavfilter/vf_scale_vaapi.c | 11 +++
 5 files changed, 12 insertions(+), 32 deletions(-)

diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c
index e7491e1..2fe74c1 100644
--- a/libavfilter/vf_deinterlace_qsv.c
+++ b/libavfilter/vf_deinterlace_qsv.c
@@ -434,13 +434,11 @@ static int process_frame(AVFilterContext *ctx, const 
AVFrame *in,
 mfxStatus err;
 int ret, again = 0;
 
-out = av_frame_alloc();
-if (!out)
-return AVERROR(ENOMEM);
-
-ret = av_hwframe_get_buffer(s->hw_frames_ctx, out, 0);
-if (ret < 0)
+out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
+if (!out) {
+ret = AVERROR(ENOMEM);
 goto fail;
+}
 
 surf_out = (mfxFrameSurface1*)out->data[3];
 surf_out->Info.CropW = outlink->w;
diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c
index f54ce9f..9237253 100644
--- a/libavfilter/vf_hwupload.c
+++ b/libavfilter/vf_hwupload.c
@@ -159,15 +159,10 @@ static int hwupload_filter_frame(AVFilterLink *link, 
AVFrame *input)
 if (input->format == outlink->format)
 return ff_filter_frame(outlink, input);
 
-output = av_frame_alloc();
+output = ff_get_video_buffer(outlink, outlink->w, outlink->h);
 if (!output) {
-err = AVERROR(ENOMEM);
-goto fail;
-}
-
-err = av_hwframe_get_buffer(ctx->hwframes_ref, output, 0);
-if (err < 0) {
 av_log(ctx, AV_LOG_ERROR, "Failed to allocate frame to upload to.\n");
+err = AVERROR(ENOMEM);
 goto fail;
 }
 
diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c
index 49f34b6..1e47ada 100644
--- a/libavfilter/vf_hwupload_cuda.c
+++ b/libavfilter/vf_hwupload_cuda.c
@@ -113,21 +113,17 @@ static int cudaupload_config_output(AVFilterLink *outlink)
 static int cudaupload_filter_frame(AVFilterLink *link, AVFrame *in)
 {
 AVFilterContext   *ctx = link->dst;
-CudaUploadContext   *s = ctx->priv;
+AVFilterLink  *outlink = ctx->outputs[0];
 
 AVFrame *out = NULL;
 int ret;
 
-out = av_frame_alloc();
+out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
 if (!out) {
 ret = AVERROR(ENOMEM);
 goto fail;
 }
 
-ret = av_hwframe_get_buffer(s->hwframe, out, 0);
-if (ret < 0)
-goto fail;
-
 out->width  = in->width;
 out->height = in->height;
 
diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c
index 88fca8b..52e3ef9 100644
--- a/libavfilter/vf_scale_qsv.c
+++ b/libavfilter/vf_scale_qsv.c
@@ -530,16 +530,12 @@ static int qsvscale_filter_frame(AVFilterLink *link, 
AVFrame *in)
 AVFrame *out = NULL;
 int ret = 0;
 
-out = av_frame_alloc();
+out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
 if (!out) {
 ret = AVERROR(ENOMEM);
 goto fail;
 }
 
-ret = av_hwframe_get_buffer(s->out_frames_ref, out, 0);
-if (ret < 0)
-goto fail;
-
 do {
 err = MFXVideoVPP_RunFrameVPPAsync(s->session,
(mfxFrameSurface1*)in->data[3],
diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
index 8221849..c4334c7 100644
--- a/libavfilter/vf_scale_vaapi.c
+++ b/libavfilter/vf_scale_vaapi.c
@@ -32,6 +32,7 @@
 #include "formats.h"
 #include "internal.h"
 #include "scale.h"
+#include "video.h"
 
 typedef struct ScaleVAAPIContext {
 const AVClass *class;
@@ -288,19 +289,13 @@ static int scale_vaapi_filter_frame(AVFilterLink *inlink, 
AVFrame *input_frame)
 av_log(ctx, AV_LOG_DEBUG, "Using surface %#x for scale input.\n",
input_surface);
 
-output_frame = av_frame_alloc();
+output_frame = ff_get_video_buffer(outlink, ctx->output_width,
+   ctx->output_height);
 if (!output_frame) {
-av_log(ctx, AV_LOG_ERROR, "Failed to allocate output frame.");
 err = AVERROR(ENOMEM);
 goto fail;
 }
 
-err = av_hwframe_get_buffer(ctx->output_frames_ref, output_fram

[FFmpeg-cvslog] Merge commit '7433feb82f75827884d909de34d341a1c4401d4a'

2017-03-29 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed Mar 
29 23:11:10 2017 +0200| [b265e5ba50b86f2ca640e3a565bd54f7e4292bb0] | committer: 
Matthieu Bouron

Merge commit '7433feb82f75827884d909de34d341a1c4401d4a'

* commit '7433feb82f75827884d909de34d341a1c4401d4a':
  lavfi: Make default get_video_buffer work with hardware frames

Merged-by: Matthieu Bouron <matthieu.bou...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b265e5ba50b86f2ca640e3a565bd54f7e4292bb0
---

 libavfilter/video.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/libavfilter/video.c b/libavfilter/video.c
index fabdafd..6f9020b 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -25,6 +25,7 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/buffer.h"
+#include "libavutil/hwcontext.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/mem.h"
 
@@ -47,6 +48,21 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int 
w, int h)
 int pool_align = 0;
 enum AVPixelFormat pool_format = AV_PIX_FMT_NONE;
 
+if (link->hw_frames_ctx &&
+((AVHWFramesContext*)link->hw_frames_ctx->data)->format == 
link->format) {
+int ret;
+AVFrame *frame = av_frame_alloc();
+
+if (!frame)
+return NULL;
+
+ret = av_hwframe_get_buffer(link->hw_frames_ctx, frame, 0);
+if (ret < 0)
+av_frame_free();
+
+return frame;
+}
+
 if (!link->frame_pool) {
 link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h,
 link->format, 
BUFFER_ALIGN);


==

diff --cc libavfilter/video.c
index fabdafd,533946a..6f9020b
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@@ -23,8 -19,8 +23,9 @@@
  #include 
  #include 
  
 +#include "libavutil/avassert.h"
  #include "libavutil/buffer.h"
+ #include "libavutil/hwcontext.h"
  #include "libavutil/imgutils.h"
  #include "libavutil/mem.h"
  
@@@ -40,37 -33,31 +41,52 @@@ AVFrame *ff_null_get_video_buffer(AVFil
  return ff_get_video_buffer(link->dst->outputs[0], w, h);
  }
  
 -/* TODO: set the buffer's priv member to a context structure for the whole
 - * filter chain.  This will allow for a buffer pool instead of the constant
 - * alloc & free cycle currently implemented. */
  AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
  {
 -AVFrame *frame = av_frame_alloc();
 -int ret;
 -
 -if (!frame)
 -return NULL;
 +int pool_width = 0;
 +int pool_height = 0;
 +int pool_align = 0;
 +enum AVPixelFormat pool_format = AV_PIX_FMT_NONE;
  
+ if (link->hw_frames_ctx &&
+ ((AVHWFramesContext*)link->hw_frames_ctx->data)->format == 
link->format) {
++int ret;
++AVFrame *frame = av_frame_alloc();
++
++if (!frame)
++return NULL;
++
+ ret = av_hwframe_get_buffer(link->hw_frames_ctx, frame, 0);
++if (ret < 0)
++av_frame_free();
++
++return frame;
++}
++
 +if (!link->frame_pool) {
 +link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h,
 +link->format, 
BUFFER_ALIGN);
 +if (!link->frame_pool)
 +return NULL;
  } else {
 -frame->width  = w;
 -frame->height = h;
 -frame->format = link->format;
 +if (ff_frame_pool_get_video_config(link->frame_pool,
 +   _width, _height,
 +   _format, _align) < 0) {
 +return NULL;
 +}
 +
 +if (pool_width != w || pool_height != h ||
 +pool_format != link->format || pool_align != BUFFER_ALIGN) {
  
 -ret = av_frame_get_buffer(frame, 32);
 +ff_frame_pool_uninit((FFFramePool **)>frame_pool);
 +link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, 
h,
 +link->format, 
BUFFER_ALIGN);
 +if (!link->frame_pool)
 +return NULL;
 +}
  }
 -if (ret < 0)
 -av_frame_free();
  
 -return frame;
 +return ff_frame_pool_get(link->frame_pool);
  }
  
  AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] doc/examples/extract_mvs: switch to codecpar

2017-03-28 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Tue Mar 
28 13:46:36 2017 +0200| [64b553998567141b05239dcf11ad4d24aeaead8e] | committer: 
Matthieu Bouron

doc/examples/extract_mvs: switch to codecpar

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=64b553998567141b05239dcf11ad4d24aeaead8e
---

 doc/examples/extract_mvs.c | 37 -
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c
index 975189c..8b22b40 100644
--- a/doc/examples/extract_mvs.c
+++ b/doc/examples/extract_mvs.c
@@ -69,8 +69,7 @@ static int decode_packet(int *got_frame, int cached)
 return decoded;
 }
 
-static int open_codec_context(int *stream_idx,
-  AVFormatContext *fmt_ctx, enum AVMediaType type)
+static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
 {
 int ret;
 AVStream *st;
@@ -78,24 +77,27 @@ static int open_codec_context(int *stream_idx,
 AVCodec *dec = NULL;
 AVDictionary *opts = NULL;
 
-ret = av_find_best_stream(fmt_ctx, type, -1, -1, NULL, 0);
+ret = av_find_best_stream(fmt_ctx, type, -1, -1, , 0);
 if (ret < 0) {
 fprintf(stderr, "Could not find %s stream in input file '%s'\n",
 av_get_media_type_string(type), src_filename);
 return ret;
 } else {
-*stream_idx = ret;
-st = fmt_ctx->streams[*stream_idx];
-
-/* find decoder for the stream */
-dec_ctx = st->codec;
-dec = avcodec_find_decoder(dec_ctx->codec_id);
-if (!dec) {
-fprintf(stderr, "Failed to find %s codec\n",
-av_get_media_type_string(type));
+int stream_idx = ret;
+st = fmt_ctx->streams[stream_idx];
+
+dec_ctx = avcodec_alloc_context3(dec);
+if (!dec_ctx) {
+fprintf(stderr, "Failed to allocate codec\n");
 return AVERROR(EINVAL);
 }
 
+ret = avcodec_parameters_to_context(dec_ctx, st->codecpar);
+if (ret < 0) {
+fprintf(stderr, "Failed to copy codec parameters to codec 
context\n");
+return ret;
+}
+
 /* Init the video decoder */
 av_dict_set(, "flags2", "+export_mvs", 0);
 if ((ret = avcodec_open2(dec_ctx, dec, )) < 0) {
@@ -103,6 +105,10 @@ static int open_codec_context(int *stream_idx,
 av_get_media_type_string(type));
 return ret;
 }
+
+video_stream_idx = stream_idx;
+video_stream = fmt_ctx->streams[video_stream_idx];
+video_dec_ctx = dec_ctx;
 }
 
 return 0;
@@ -130,10 +136,7 @@ int main(int argc, char **argv)
 exit(1);
 }
 
-if (open_codec_context(_stream_idx, fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 
0) {
-video_stream = fmt_ctx->streams[video_stream_idx];
-video_dec_ctx = video_stream->codec;
-}
+open_codec_context(fmt_ctx, AVMEDIA_TYPE_VIDEO);
 
 av_dump_format(fmt_ctx, 0, src_filename, 0);
 
@@ -178,7 +181,7 @@ int main(int argc, char **argv)
 } while (got_frame);
 
 end:
-avcodec_close(video_dec_ctx);
+avcodec_free_context(_dec_ctx);
 avformat_close_input(_ctx);
 av_frame_free();
 return ret < 0;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] doc/examples/remuxing: switch to codecpar

2017-03-28 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Tue Mar 
28 11:57:26 2017 +0200| [4a946aca7cf3c03d232953852405577e85f4da71] | committer: 
Matthieu Bouron

doc/examples/remuxing: switch to codecpar

Also limits remuxing to audio, video and subtitle streams.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a946aca7cf3c03d232953852405577e85f4da71
---

 doc/examples/remuxing.c | 42 +++---
 1 file changed, 35 insertions(+), 7 deletions(-)

diff --git a/doc/examples/remuxing.c b/doc/examples/remuxing.c
index 65437d9..5959418 100644
--- a/doc/examples/remuxing.c
+++ b/doc/examples/remuxing.c
@@ -50,6 +50,9 @@ int main(int argc, char **argv)
 AVPacket pkt;
 const char *in_filename, *out_filename;
 int ret, i;
+int stream_index = 0;
+int *stream_mapping = NULL;
+int stream_mapping_size = 0;
 
 if (argc < 3) {
 printf("usage: %s input output\n"
@@ -83,25 +86,42 @@ int main(int argc, char **argv)
 goto end;
 }
 
+stream_mapping_size = ifmt_ctx->nb_streams;
+stream_mapping = av_mallocz_array(stream_mapping_size, 
sizeof(*stream_mapping));
+if (!stream_mapping) {
+ret = AVERROR(ENOMEM);
+goto end;
+}
+
 ofmt = ofmt_ctx->oformat;
 
 for (i = 0; i < ifmt_ctx->nb_streams; i++) {
+AVStream *out_stream;
 AVStream *in_stream = ifmt_ctx->streams[i];
-AVStream *out_stream = avformat_new_stream(ofmt_ctx, 
in_stream->codec->codec);
+AVCodecParameters *in_codecpar = in_stream->codecpar;
+
+if (in_codecpar->codec_type != AVMEDIA_TYPE_AUDIO &&
+in_codecpar->codec_type != AVMEDIA_TYPE_VIDEO &&
+in_codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE) {
+stream_mapping[i] = -1;
+continue;
+}
+
+stream_mapping[i] = stream_index++;
+
+out_stream = avformat_new_stream(ofmt_ctx, NULL);
 if (!out_stream) {
 fprintf(stderr, "Failed allocating output stream\n");
 ret = AVERROR_UNKNOWN;
 goto end;
 }
 
-ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
+ret = avcodec_parameters_copy(out_stream->codecpar, in_codecpar);
 if (ret < 0) {
-fprintf(stderr, "Failed to copy context from input to output 
stream codec context\n");
+fprintf(stderr, "Failed to copy codec parameters\n");
 goto end;
 }
-out_stream->codec->codec_tag = 0;
-if (ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
-out_stream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+out_stream->codecpar->codec_tag = 0;
 }
 av_dump_format(ofmt_ctx, 0, out_filename, 1);
 
@@ -127,8 +147,14 @@ int main(int argc, char **argv)
 break;
 
 in_stream  = ifmt_ctx->streams[pkt.stream_index];
-out_stream = ofmt_ctx->streams[pkt.stream_index];
+if (pkt.stream_index >= stream_mapping_size ||
+stream_mapping[pkt.stream_index] < 0) {
+av_packet_unref();
+continue;
+}
 
+pkt.stream_index = stream_mapping[pkt.stream_index];
+out_stream = ofmt_ctx->streams[pkt.stream_index];
 log_packet(ifmt_ctx, , "in");
 
 /* copy packet */
@@ -156,6 +182,8 @@ end:
 avio_closep(_ctx->pb);
 avformat_free_context(ofmt_ctx);
 
+av_freep(_mapping);
+
 if (ret < 0 && ret != AVERROR_EOF) {
 fprintf(stderr, "Error occurred: %s\n", av_err2str(ret));
 return 1;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] doc/examples/muxing: re-indent block

2017-03-28 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Tue Mar 
28 12:38:41 2017 +0200| [7e3e0f87e6e911250855f03dd2fa8b4533a3e654] | committer: 
Matthieu Bouron

doc/examples/muxing: re-indent block

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e3e0f87e6e911250855f03dd2fa8b4533a3e654
---

 doc/examples/muxing.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index 1df5912..e1a4770 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -335,15 +335,15 @@ static int write_audio_frame(AVFormatContext *oc, 
OutputStream *ost)
 if (ret < 0)
 exit(1);
 
-/* convert to destination format */
-ret = swr_convert(ost->swr_ctx,
-  ost->frame->data, dst_nb_samples,
-  (const uint8_t **)frame->data, 
frame->nb_samples);
-if (ret < 0) {
-fprintf(stderr, "Error while converting\n");
-exit(1);
-}
-frame = ost->frame;
+/* convert to destination format */
+ret = swr_convert(ost->swr_ctx,
+  ost->frame->data, dst_nb_samples,
+  (const uint8_t **)frame->data, frame->nb_samples);
+if (ret < 0) {
+fprintf(stderr, "Error while converting\n");
+exit(1);
+}
+frame = ost->frame;
 
 frame->pts = av_rescale_q(ost->samples_count, (AVRational){1, 
c->sample_rate}, c->time_base);
 ost->samples_count += dst_nb_samples;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] configure: error out if jni is enabled and cannot be found

2017-03-20 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Wed Mar 
15 15:23:34 2017 +0100| [d839c4716cdcecf3b46d05d0aec8f460cdb4ce23] | committer: 
Matthieu Bouron

configure: error out if jni is enabled and cannot be found

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d839c4716cdcecf3b46d05d0aec8f460cdb4ce23
---

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index e1b7c61..3232b9f 100755
--- a/configure
+++ b/configure
@@ -5751,7 +5751,7 @@ enabled frei0r&& { check_header frei0r.h || 
die "ERROR: frei0r.h hea
 enabled gmp   && require gmp gmp.h mpz_export -lgmp
 enabled gnutls&& require_pkg_config gnutls gnutls/gnutls.h 
gnutls_global_init
 enabled jni   && { [ $target_os = "android" ] && check_header 
jni.h && enabled pthreads &&
-   check_lib "dlfcn.h" dlopen -ldl; }
+   check_lib "dlfcn.h" dlopen -ldl || die "ERROR: 
jni not found"; }
 enabled ladspa&& { check_header ladspa.h || die "ERROR: ladspa.h 
header not found"; }
 enabled libiec61883   && require libiec61883 libiec61883/iec61883.h 
iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
 enabled libass&& require_pkg_config libass ass/ass.h 
ass_library_init

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '0638b99cdba52554691fc668d9e477bc184c7a33'

2017-03-17 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Fri Mar 
17 13:31:03 2017 +0100| [e2adbcbd97de1595b26a116ca22475b6f9acdf07] | committer: 
Matthieu Bouron

Merge commit '0638b99cdba52554691fc668d9e477bc184c7a33'

* commit '0638b99cdba52554691fc668d9e477bc184c7a33':
aiff: Skip padding byte for odd-sized chunks

Also removes to odd-size checks from get_aiff_header and get_meta to use
the generic path introduced by the original commit.

Merged-by: Matthieu Bouron <matthieu.bou...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2adbcbd97de1595b26a116ca22475b6f9acdf07
---

 libavformat/aiffdec.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 9e7a39c..3bbe4a0 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -330,10 +330,14 @@ static int aiff_read_header(AVFormatContext *s)
 if (offset > 0 && st->codecpar->block_align) // COMM && SSND
 goto got_sound;
 default: /* Jump */
-if (size & 1)   /* Always even aligned */
-size++;
 avio_skip(pb, size);
 }
+
+/* Skip required padding byte for odd-sized chunks. */
+if (size & 1) {
+filesize--;
+avio_skip(pb, 1);
+}
 }
 
 got_sound:


==

diff --cc libavformat/aiffdec.c
index 9e7a39c,3c45c61..3bbe4a0
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@@ -299,41 -260,21 +299,45 @@@ static int aiff_read_header(AVFormatCon
  case MKTAG('w', 'a', 'v', 'e'):
  if ((uint64_t)size > (1<<30))
  return -1;
 -st->codecpar->extradata = av_mallocz(size + 
AV_INPUT_BUFFER_PADDING_SIZE);
 -if (!st->codecpar->extradata)
 +if (ff_get_extradata(s, st->codecpar, pb, size) < 0)
  return AVERROR(ENOMEM);
 -st->codecpar->extradata_size = size;
 -avio_read(pb, st->codecpar->extradata, size);
 +if (   (st->codecpar->codec_id == AV_CODEC_ID_QDMC || 
st->codecpar->codec_id == AV_CODEC_ID_QDM2)
 +&& size>=12*4 && !st->codecpar->block_align) {
 +st->codecpar->block_align = 
AV_RB32(st->codecpar->extradata+11*4);
 +aiff->block_duration = AV_RB32(st->codecpar->extradata+9*4);
 +} else if (st->codecpar->codec_id == AV_CODEC_ID_QCELP) {
 +char rate = 0;
 +if (size >= 25)
 +rate = st->codecpar->extradata[24];
 +switch (rate) {
 +case 'H': // RATE_HALF
 +st->codecpar->block_align = 17;
 +break;
 +case 'F': // RATE_FULL
 +default:
 +st->codecpar->block_align = 35;
 +}
 +aiff->block_duration = 160;
 +st->codecpar->bit_rate = (int64_t)st->codecpar->sample_rate * 
(st->codecpar->block_align << 3) /
 + aiff->block_duration;
 +}
  break;
 +case MKTAG('C','H','A','N'):
 +if(ff_mov_read_chan(s, pb, st, size) < 0)
 +return AVERROR_INVALIDDATA;
 +break;
 +case 0:
 +if (offset > 0 && st->codecpar->block_align) // COMM && SSND
 +goto got_sound;
  default: /* Jump */
- if (size & 1)   /* Always even aligned */
- size++;
  avio_skip(pb, size);
  }
+ 
+ /* Skip required padding byte for odd-sized chunks. */
+ if (size & 1) {
+ filesize--;
+ avio_skip(pb, 1);
+ }
  }
  
  got_sound:

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/aarch64: add ff_simple_idct{, _add, _put}_neon functions

2017-03-16 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Fri Jan 
27 11:55:48 2017 +| [4c8e528d19a37d796a9808908e5b5cb0ce039fb2] | committer: 
Matthieu Bouron

lavc/aarch64: add ff_simple_idct{,_add,_put}_neon functions

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c8e528d19a37d796a9808908e5b5cb0ce039fb2
---

 libavcodec/aarch64/Makefile   |   2 +
 libavcodec/aarch64/idct.h |  28 +++
 libavcodec/aarch64/idctdsp_init_aarch64.c |  41 
 libavcodec/aarch64/simple_idct_neon.S | 362 ++
 libavcodec/idctdsp.c  |   2 +
 libavcodec/idctdsp.h  |   2 +
 6 files changed, 437 insertions(+)

diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile
index 37666b4..104bc67 100644
--- a/libavcodec/aarch64/Makefile
+++ b/libavcodec/aarch64/Makefile
@@ -36,6 +36,8 @@ NEON-OBJS-$(CONFIG_H264PRED)+= 
aarch64/h264pred_neon.o
 NEON-OBJS-$(CONFIG_H264QPEL)+= aarch64/h264qpel_neon.o 
\
aarch64/hpeldsp_neon.o
 NEON-OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_neon.o
+NEON-OBJS-$(CONFIG_IDCTDSP) += aarch64/idctdsp_init_aarch64.o  
\
+   aarch64/simple_idct_neon.o
 NEON-OBJS-$(CONFIG_MDCT)+= aarch64/mdct_neon.o
 NEON-OBJS-$(CONFIG_MPEGAUDIODSP)+= aarch64/mpegaudiodsp_neon.o
 
diff --git a/libavcodec/aarch64/idct.h b/libavcodec/aarch64/idct.h
new file mode 100644
index 000..05699c2
--- /dev/null
+++ b/libavcodec/aarch64/idct.h
@@ -0,0 +1,28 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_AARCH64_IDCT_H
+#define AVCODEC_AARCH64_IDCT_H
+
+#include 
+
+void ff_simple_idct_neon(int16_t *data);
+void ff_simple_idct_put_neon(uint8_t *dest, int line_size, int16_t *data);
+void ff_simple_idct_add_neon(uint8_t *dest, int line_size, int16_t *data);
+
+#endif /* AVCODEC_AARCH64_IDCT_H */
diff --git a/libavcodec/aarch64/idctdsp_init_aarch64.c 
b/libavcodec/aarch64/idctdsp_init_aarch64.c
new file mode 100644
index 000..0406e60
--- /dev/null
+++ b/libavcodec/aarch64/idctdsp_init_aarch64.c
@@ -0,0 +1,41 @@
+/*
+ * ARM-NEON-optimized IDCT functions
+ * Copyright (c) 2008 Mans Rullgard <m...@mansr.com>
+ * Copyright (c) 2017 Matthieu Bouron <matthieu.bou...@gmail.com>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/attributes.h"
+#include "libavcodec/avcodec.h"
+#include "libavcodec/idctdsp.h"
+#include "idct.h"
+
+av_cold void ff_idctdsp_init_aarch64(IDCTDSPContext *c, AVCodecContext *avctx,
+ unsigned high_bit_depth)
+{
+if (!avctx->lowres && !high_bit_depth) {
+if (avctx->idct_algo == FF_IDCT_AUTO ||
+avctx->idct_algo == FF_IDCT_SIMPLEAUTO ||
+avctx->idct_algo == FF_IDCT_SIMPLENEON) {
+c->idct_put  = ff_simple_idct_put_neon;
+c->idct_add  = ff_simple_idct_add_neon;
+c->idct  = ff_simple_idct_neon;
+c->perm_type = FF_IDCT_PERM_PARTTRANS;
+}
+}
+}
diff --git a/libavcodec/aarch64/simple_idct_neon.S 
b/libavcodec/aarch64/simple_idct_neon.S
new file mode 100644
index 000..5227342
--- /dev/null
+++ b/libavcodec/aarch64/simple_idct_neon.S
@@ -0,0 +1,362 @@
+/*
+ * ARM NEON IDCT
+ *
+ * Copyright (c) 2008 Mans Rullgard <

[FFmpeg-cvslog] lavc/tests/dct/aarch64: add ff_simple_idct_neon test

2017-03-16 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Thu Feb 
16 12:34:53 2017 +| [0c6105dde0c42bc64c93e7e7fbf286869c0bffa2] | committer: 
Matthieu Bouron

lavc/tests/dct/aarch64: add ff_simple_idct_neon test

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c6105dde0c42bc64c93e7e7fbf286869c0bffa2
---

 libavcodec/tests/aarch64/dct.c | 30 ++
 libavcodec/tests/dct.c |  4 +++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/libavcodec/tests/aarch64/dct.c b/libavcodec/tests/aarch64/dct.c
new file mode 100644
index 000..032a963
--- /dev/null
+++ b/libavcodec/tests/aarch64/dct.c
@@ -0,0 +1,30 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+
+#include "libavcodec/aarch64/idct.h"
+
+static const struct algo fdct_tab_arch[] = {
+{ 0 }
+};
+
+static const struct algo idct_tab_arch[] = {
+{ "SIMPLE-NEON", ff_simple_idct_neon, FF_IDCT_PERM_PARTTRANS, 
AV_CPU_FLAG_NEON },
+{ 0 }
+};
diff --git a/libavcodec/tests/dct.c b/libavcodec/tests/dct.c
index 5303fdf..4f0e0d9 100644
--- a/libavcodec/tests/dct.c
+++ b/libavcodec/tests/dct.c
@@ -94,7 +94,9 @@ static const struct algo idct_tab[] = {
 #endif /* CONFIG_MPEG4_DECODER */
 };
 
-#if ARCH_ARM
+#if ARCH_AARCH64
+#include "aarch64/dct.c"
+#elif ARCH_ARM
 #include "arm/dct.c"
 #elif ARCH_PPC
 #include "ppc/dct.c"

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/h264dec: use OFFSET macro

2017-03-15 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Mon Feb 
 6 17:14:57 2017 +0100| [1ade4d87bae8db3f2073c18eb322382ad7827bb9] | committer: 
Matthieu Bouron

lavc/h264dec: use OFFSET macro

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1ade4d87bae8db3f2073c18eb322382ad7827bb9
---

 libavcodec/h264dec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 35598ea..9042169 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -1077,8 +1077,8 @@ static int h264_decode_frame(AVCodecContext *avctx, void 
*data,
 #define OFFSET(x) offsetof(H264Context, x)
 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 static const AVOption h264_options[] = {
-{"is_avc", "is avc", offsetof(H264Context, is_avc), AV_OPT_TYPE_BOOL, 
{.i64 = 0}, 0, 1, 0},
-{"nal_length_size", "nal_length_size", offsetof(H264Context, 
nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0},
+{ "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 
0 },
+{ "nal_length_size", "nal_length_size", OFFSET(nal_length_size), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0 },
 { "enable_er", "Enable error resilience on damaged frames (unsafe)", 
OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },
 { NULL },
 };

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] swr/aarch64: add missing ret to ff_resample_common_apply_filter_x8_float_neon

2017-02-16 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Thu Feb 
16 11:50:58 2017 +0100| [5ef2f4f39480dc5caa5e5c9ad19eb49ea0a08e35] | committer: 
Matthieu Bouron

swr/aarch64: add missing ret to ff_resample_common_apply_filter_x8_float_neon

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5ef2f4f39480dc5caa5e5c9ad19eb49ea0a08e35
---

 libswresample/aarch64/resample.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libswresample/aarch64/resample.S b/libswresample/aarch64/resample.S
index b3b1bb9..bbad619 100644
--- a/libswresample/aarch64/resample.S
+++ b/libswresample/aarch64/resample.S
@@ -46,6 +46,7 @@ function ff_resample_common_apply_filter_x8_float_neon, 
export=1
 faddp   v0.4S, v0.4S, v0.4S// pair 
adding of the 4x32-bit accumulated values
 faddp   v0.4S, v0.4S, v0.4S// pair 
adding of the 4x32-bit accumulated values
 st1 {v0.S}[0], [x0], #4// 
write accumulator
+ret
 endfunc
 
 function ff_resample_common_apply_filter_x4_s16_neon, export=1

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'ed9b2a5178d7a7c5a95694da3a808af327f36aff'

2017-02-02 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Thu Feb 
 2 12:05:21 2017 +0100| [d30870cc730337b7017cc194d696f68ee48f7f1d] | committer: 
Matthieu Bouron

Merge commit 'ed9b2a5178d7a7c5a95694da3a808af327f36aff'

* commit 'ed9b2a5178d7a7c5a95694da3a808af327f36aff':
  mov: Rework the check for invalid indexes in stsc

This commit is a noop, see 3c058f570128dcfa3a68f0860e2be7f098e8d6e1.

The proposed fix breaks seeking in multiple_stsd.mp4 (ticket #3962) and
playback of wwwq_cut.mp4 (ticket #2991).

Merged-by: Matthieu Bouron <matthieu.bou...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d30870cc730337b7017cc194d696f68ee48f7f1d
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] mov: Fix stsc_count comparison

2017-02-01 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@stupeflix.com> | Wed 
Jul 20 18:48:08 2016 +0200| [209ee680ce99035202520b900326a57f7fa0aceb] | 
committer: Vittorio Giovara

mov: Fix stsc_count comparison

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=209ee680ce99035202520b900326a57f7fa0aceb
---

 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 14be96e..c0421d2 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3680,7 +3680,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 /* Keep track of the stsc index for the given sample, then check
 * if the stsd index is different from the last used one. */
 sc->stsc_sample++;
-if (sc->stsc_index < sc->stsc_count &&
+if (sc->stsc_index + 1 < sc->stsc_count &&
 mov_get_stsc_samples(sc, sc->stsc_index) == sc->stsc_sample) {
 sc->stsc_index++;
 sc->stsc_sample = 0;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mjpegdec: consume SOS data even if the frame is discarded

2017-01-29 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Sat Jan 
28 13:49:52 2017 +0100| [2ae82788324481dd56bb85f9d815902854c044fd] | committer: 
Matthieu Bouron

lavc/mjpegdec: consume SOS data even if the frame is discarded

Speeds up next marker search when a SOS marker is found but the frame is
discarded (which happens in avformat_find_stream_info).

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2ae82788324481dd56bb85f9d815902854c044fd
---

 libavcodec/mjpegdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 7d17e3d..07988b6 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2247,8 +2247,10 @@ eoi_parser:
 goto the_end;
 case SOS:
 s->cur_scan++;
-if (avctx->skip_frame == AVDISCARD_ALL)
+if (avctx->skip_frame == AVDISCARD_ALL) {
+skip_bits(>gb, get_bits_left(>gb));
 break;
+}
 
 if ((ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL)) < 0 &&
 (avctx->err_recognition & AV_EF_EXPLODE))

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/h264dec: re-indent after previous commit

2017-01-20 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Fri Jan 
20 17:29:09 2017 +0100| [cf3affabb449671ce16cee61d98393c43ff171f4] | committer: 
Matthieu Bouron

lavc/h264dec: re-indent after previous commit

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf3affabb449671ce16cee61d98393c43ff171f4
---

 libavcodec/h264dec.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index f18fb0b..665d3e46 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -680,11 +680,11 @@ again:
 break;
 
 if (h->current_slice == 1) {
-if (avctx->active_thread_type & FF_THREAD_FRAME && 
!h->avctx->hwaccel &&
-i >= nals_needed && !h->setup_finished && h->cur_pic_ptr) {
-ff_thread_finish_setup(avctx);
-h->setup_finished = 1;
-}
+if (avctx->active_thread_type & FF_THREAD_FRAME && 
!h->avctx->hwaccel &&
+i >= nals_needed && !h->setup_finished && h->cur_pic_ptr) {
+ff_thread_finish_setup(avctx);
+h->setup_finished = 1;
+}
 
 if (h->avctx->hwaccel &&
 (ret = h->avctx->hwaccel->start_frame(h->avctx, buf, 
buf_size)) < 0)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/h264dec: make sure a slice is decoded before finishing setup

2017-01-20 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Fri Jan 
20 17:24:52 2017 +0100| [639e26297147866534c093fd39f89fe386d81ebd] | committer: 
Matthieu Bouron

lavc/h264dec: make sure a slice is decoded before finishing setup

Fixes regression in fate-h264-attachment-631 with THREADS=8 introduced
by bdbbb8f11edbf10add874508c5125c174d8939be.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=639e26297147866534c093fd39f89fe386d81ebd
---

 libavcodec/h264dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index c24818b..f18fb0b 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -679,13 +679,13 @@ again:
 if (sl->redundant_pic_count > 0)
 break;
 
+if (h->current_slice == 1) {
 if (avctx->active_thread_type & FF_THREAD_FRAME && 
!h->avctx->hwaccel &&
 i >= nals_needed && !h->setup_finished && h->cur_pic_ptr) {
 ff_thread_finish_setup(avctx);
 h->setup_finished = 1;
 }
 
-if (h->current_slice == 1) {
 if (h->avctx->hwaccel &&
 (ret = h->avctx->hwaccel->start_frame(h->avctx, buf, 
buf_size)) < 0)
 goto end;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'f450cc7bc595155bacdb9f5d2414a076ccf81b4a'

2017-01-17 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Mon Jan 
16 11:33:47 2017 +0100| [bdbbb8f11edbf10add874508c5125c174d8939be] | committer: 
Matthieu Bouron

Merge commit 'f450cc7bc595155bacdb9f5d2414a076ccf81b4a'

* commit 'f450cc7bc595155bacdb9f5d2414a076ccf81b4a':
  h264: eliminate decode_postinit()

Also includes fixes from 1f7b4f9abc and e344e65109.

Original patch replace H264Context.next_output_pic (H264Picture *) by
H264Context.output_frame (AVFrame *). This change is discarded as it
is incompatible with the frame reconstruction and motion vectors
display code which needs the extra information from the H264Picture.

Merged-by: Clément Bœsch <u...@pkh.me>
Merged-by: Matthieu Bouron <matthieu.bou...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bdbbb8f11edbf10add874508c5125c174d8939be
---

 libavcodec/h264_slice.c | 106 +++-
 libavcodec/h264dec.c| 139 +++-
 2 files changed, 111 insertions(+), 134 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 2dc98c1..fe71d57 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -44,6 +44,7 @@
 #include "golomb.h"
 #include "mathops.h"
 #include "mpegutils.h"
+#include "mpegvideo.h"
 #include "rectangle.h"
 #include "thread.h"
 
@@ -1283,6 +1284,105 @@ static int h264_export_frame_props(H264Context *h)
 return 0;
 }
 
+static int h264_select_output_frame(H264Context *h)
+{
+const SPS *sps = h->ps.sps;
+H264Picture *out = h->cur_pic_ptr;
+H264Picture *cur = h->cur_pic_ptr;
+int i, pics, out_of_order, out_idx;
+
+cur->mmco_reset = h->mmco_reset;
+h->mmco_reset = 0;
+
+if (sps->bitstream_restriction_flag ||
+h->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT) {
+h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, 
sps->num_reorder_frames);
+}
+
+for (i = 0; 1; i++) {
+if(i == MAX_DELAYED_PIC_COUNT || cur->poc < h->last_pocs[i]){
+if(i)
+h->last_pocs[i-1] = cur->poc;
+break;
+} else if(i) {
+h->last_pocs[i-1]= h->last_pocs[i];
+}
+}
+out_of_order = MAX_DELAYED_PIC_COUNT - i;
+if(   cur->f->pict_type == AV_PICTURE_TYPE_B
+   || (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && 
h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 
2))
+out_of_order = FFMAX(out_of_order, 1);
+if (out_of_order == MAX_DELAYED_PIC_COUNT) {
+av_log(h->avctx, AV_LOG_VERBOSE, "Invalid POC %d<%d\n", cur->poc, 
h->last_pocs[0]);
+for (i = 1; i < MAX_DELAYED_PIC_COUNT; i++)
+h->last_pocs[i] = INT_MIN;
+h->last_pocs[0] = cur->poc;
+cur->mmco_reset = 1;
+} else if(h->avctx->has_b_frames < out_of_order && 
!sps->bitstream_restriction_flag){
+int loglevel = h->avctx->frame_number > 1 ? AV_LOG_WARNING : 
AV_LOG_VERBOSE;
+av_log(h->avctx, loglevel, "Increasing reorder buffer to %d\n", 
out_of_order);
+h->avctx->has_b_frames = out_of_order;
+}
+
+pics = 0;
+while (h->delayed_pic[pics])
+pics++;
+
+av_assert0(pics <= MAX_DELAYED_PIC_COUNT);
+
+h->delayed_pic[pics++] = cur;
+if (cur->reference == 0)
+cur->reference = DELAYED_PIC_REF;
+
+out = h->delayed_pic[0];
+out_idx = 0;
+for (i = 1; h->delayed_pic[i] &&
+!h->delayed_pic[i]->f->key_frame &&
+!h->delayed_pic[i]->mmco_reset;
+ i++)
+if (h->delayed_pic[i]->poc < out->poc) {
+out = h->delayed_pic[i];
+out_idx = i;
+}
+if (h->avctx->has_b_frames == 0 &&
+(h->delayed_pic[0]->f->key_frame || h->delayed_pic[0]->mmco_reset))
+h->next_outputed_poc = INT_MIN;
+out_of_order = out->poc < h->next_outputed_poc;
+
+if (out_of_order || pics > h->avctx->has_b_frames) {
+out->reference &= ~DELAYED_PIC_REF;
+for (i = out_idx; h->delayed_pic[i]; i++)
+h->delayed_pic[i] = h->delayed_pic[i + 1];
+}
+if (!out_of_order && pics > h->avctx->has_b_frames) {
+h->next_output_pic = out;
+if (out_idx == 0 && h->delayed_pic[0] && 
(h->delayed_pic[0]->f->key_frame || h->delayed_pic[0]->mmco_reset)) {
+h->next_outputed_poc = INT_MIN;
+} else
+h->next_outputed_poc = out->poc;
+
+if (out->recovered) {
+// We have reached an re

[FFmpeg-cvslog] avutil/tests: add aes_ctr, audio_fifo and imgutils to .gitignore

2017-01-17 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Mon Jan 
16 11:41:34 2017 +0100| [adf5dc90a951bd1a94647f3e8bf79271a5e98e0e] | committer: 
Matthieu Bouron

avutil/tests: add aes_ctr, audio_fifo and imgutils to .gitignore

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=adf5dc90a951bd1a94647f3e8bf79271a5e98e0e
---

 libavutil/tests/.gitignore | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore
index d2cc5cb..ae7a0ea 100644
--- a/libavutil/tests/.gitignore
+++ b/libavutil/tests/.gitignore
@@ -1,6 +1,8 @@
 /adler32
 /aes
+/aes_ctr
 /atomic
+/audio_fifo
 /avstring
 /base64
 /blowfish
@@ -21,6 +23,7 @@
 /float_dsp
 /hash
 /hmac
+/imgutils
 /lfg
 /lls
 /log

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] swresample/aarch64: add ff_resample_common_apply_filter_{x4, x8}_{float, s16}_neon

2017-01-13 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Mon Jan 
 9 14:26:37 2017 +| [0265aec5650dcb17a8e3e8b0a36c3979dbd64188] | committer: 
Matthieu Bouron

swresample/aarch64: add ff_resample_common_apply_filter_{x4,x8}_{float,s16}_neon

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0265aec5650dcb17a8e3e8b0a36c3979dbd64188
---

 libswresample/aarch64/Makefile|   6 +-
 libswresample/aarch64/resample.S  |  76 +
 libswresample/aarch64/resample_init.c | 120 ++
 libswresample/resample.h  |   1 +
 libswresample/resample_dsp.c  |   1 +
 5 files changed, 202 insertions(+), 2 deletions(-)

diff --git a/libswresample/aarch64/Makefile b/libswresample/aarch64/Makefile
index 320ed67..5c34f8d 100644
--- a/libswresample/aarch64/Makefile
+++ b/libswresample/aarch64/Makefile
@@ -1,5 +1,7 @@
-OBJS += aarch64/audio_convert_init.o
+OBJS += aarch64/audio_convert_init.o \
+aarch64/resample_init.o
 
 OBJS-$(CONFIG_NEON_CLOBBER_TEST) += aarch64/neontest.o
 
-NEON-OBJS+= aarch64/audio_convert_neon.o
+NEON-OBJS+= aarch64/audio_convert_neon.o \
+aarch64/resample.o
diff --git a/libswresample/aarch64/resample.S b/libswresample/aarch64/resample.S
new file mode 100644
index 000..b3b1bb9
--- /dev/null
+++ b/libswresample/aarch64/resample.S
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2017 Matthieu Bouron 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/aarch64/asm.S"
+
+function ff_resample_common_apply_filter_x4_float_neon, export=1
+moviv0.4S, #0  // 
accumulator
+1:  ld1 {v1.4S}, [x1], #16 // 
src[0..3]
+ld1 {v2.4S}, [x2], #16 // 
filter[0..3]
+fmlav0.4S, v1.4S, v2.4S// 
accumulator += src[0..3] * filter[0..3]
+subsw3, w3, #4 // 
filter_length -= 4
+b.gt1b // loop 
until filter_length
+faddp   v0.4S, v0.4S, v0.4S// pair 
adding of the 4x32-bit accumulated values
+faddp   v0.4S, v0.4S, v0.4S// pair 
adding of the 4x32-bit accumulated values
+st1 {v0.S}[0], [x0], #4// 
write accumulator
+ret
+endfunc
+
+function ff_resample_common_apply_filter_x8_float_neon, export=1
+moviv0.4S, #0  // 
accumulator
+1:  ld1 {v1.4S}, [x1], #16 // 
src[0..3]
+ld1 {v2.4S}, [x2], #16 // 
filter[0..3]
+ld1 {v3.4S}, [x1], #16 // 
src[4..7]
+ld1 {v4.4S}, [x2], #16 // 
filter[4..7]
+fmlav0.4S, v1.4S, v2.4S// 
accumulator += src[0..3] * filter[0..3]
+fmlav0.4S, v3.4S, v4.4S// 
accumulator += src[4..7] * filter[4..7]
+subsw3, w3, #8 // 
filter_length -= 8
+b.gt1b // loop 
until filter_length
+faddp   v0.4S, v0.4S, v0.4S// pair 
adding of the 4x32-bit accumulated values
+faddp   v0.4S, v0.4S, v0.4S// pair 
adding of the 4x32-bit accumulated values
+st1 {v0.S}[0], [x0], #4// 
write accumulator
+endfunc
+
+function ff_resample_common_apply_filter_x4_s16_neon, export=1
+moviv0.4S, #0  // 
accumulator
+1:  ld1 {v1.4H}, [x1], #8  // 
src[0..3]
+ld1   

[FFmpeg-cvslog] swresample/arm: cosmetic fixes

2017-01-13 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Mon Jan 
 9 17:22:40 2017 +0100| [e109c54a697b6cbd2a5b27cb9e8df2729e73351c] | committer: 
Matthieu Bouron

swresample/arm: cosmetic fixes

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e109c54a697b6cbd2a5b27cb9e8df2729e73351c
---

 libswresample/arm/resample.S  | 32 
 libswresample/arm/resample_init.c | 12 ++--
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/libswresample/arm/resample.S b/libswresample/arm/resample.S
index c231301..3ce7623 100644
--- a/libswresample/arm/resample.S
+++ b/libswresample/arm/resample.S
@@ -22,9 +22,9 @@
 
 function ff_resample_common_apply_filter_x4_float_neon, export=1
 vmov.f32q0, #0.0   @ 
accumulator
-1:  vld1.32 {q1}, [r1]!@ src
-vld1.32 {q2}, [r2]!@ filter
-vmla.f32q0, q1, q2 @ 
accumulator += src + {0..3} * filter + {0..3}
+1:  vld1.32 {q1}, [r1]!@ 
src[0..3]
+vld1.32 {q2}, [r2]!@ 
filter[0..3]
+vmla.f32q0, q1, q2 @ 
accumulator += src[0..3] * filter[0..3]
 subsr3, #4 @ 
filter_length -= 4
 bgt 1b @ loop 
until filter_length
 vpadd.f32   d0, d0, d1 @ pair 
adding of the 4x32-bit accumulated values
@@ -35,12 +35,12 @@ endfunc
 
 function ff_resample_common_apply_filter_x8_float_neon, export=1
 vmov.f32q0, #0.0   @ 
accumulator
-1:  vld1.32 {q1}, [r1]!@ src
-vld1.32 {q2}, [r2]!@ filter
-vld1.32 {q8}, [r1]!@ src
-vld1.32 {q9}, [r2]!@ filter
-vmla.f32q0, q1, q2 @ 
accumulator += src + {0..3} * filter + {0..3}
-vmla.f32q0, q8, q9 @ 
accumulator += src + {4..7} * filter + {4..7}
+1:  vld1.32 {q1}, [r1]!@ 
src[0..3]
+vld1.32 {q2}, [r2]!@ 
filter[0..3]
+vld1.32 {q8}, [r1]!@ 
src[4..7]
+vld1.32 {q9}, [r2]!@ 
filter[4..7]
+vmla.f32q0, q1, q2 @ 
accumulator += src[0..3] * filter[0..3]
+vmla.f32q0, q8, q9 @ 
accumulator += src[4..7] * filter[4..7]
 subsr3, #8 @ 
filter_length -= 8
 bgt 1b @ loop 
until filter_length
 vpadd.f32   d0, d0, d1 @ pair 
adding of the 4x32-bit accumulated values
@@ -51,9 +51,9 @@ endfunc
 
 function ff_resample_common_apply_filter_x4_s16_neon, export=1
 vmov.s32q0, #0 @ 
accumulator
-1:  vld1.16 {d2}, [r1]!@ src
-vld1.16 {d4}, [r2]!@ filter
-vmlal.s16   q0, d2, d4 @ 
accumulator += src + {0..3} * filter + {0..3}
+1:  vld1.16 {d2}, [r1]!@ 
src[0..3]
+vld1.16 {d4}, [r2]!@ 
filter[0..3]
+vmlal.s16   q0, d2, d4 @ 
accumulator += src[0..3] * filter[0..3]
 subsr3, #4 @ 
filter_length -= 4
 bgt 1b @ loop 
until filter_length
 vpadd.s32   d0, d0, d1 @ pair 
adding of the 4x32-bit accumulated values
@@ -64,10 +64,10 @@ endfunc
 
 function ff_resample_common_apply_filter_x8_s16_neon, export=1
 vmov.s32q0, #0 @ 
accumulator
-1:  vld1.16 {q1}, [r1]!@ src
-vld1.16 {q2}, [r2]!@ filter
-vmlal.s16   q0, d2, d4 @ 
accumulator += src + {0..3} * filter + {0..3}
-vmlal.s16   q0, d3, d5 @ 
accumulator += src + {4..7}

[FFmpeg-cvslog] lavfi/framepool: cosmetic style fixes

2017-01-12 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Tue Jan 
 3 17:46:24 2017 +0100| [b1ed7957b835eed84fa151487d9014814daefa3d] | committer: 
Matthieu Bouron

lavfi/framepool: cosmetic style fixes

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b1ed7957b835eed84fa151487d9014814daefa3d
---

 libavfilter/framepool.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index 74235d4..e1f1e2c 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -220,9 +220,8 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool)
 break;
 
 frame->buf[i] = av_buffer_pool_get(pool->pools[i]);
-if (!frame->buf[i]) {
+if (!frame->buf[i])
 goto fail;
-}
 
 frame->data[i] = frame->buf[i]->data;
 }
@@ -233,9 +232,8 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool)
 pool->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : 
pool->format;
 
 av_assert0(frame->data[1] != NULL);
-if (avpriv_set_systematic_pal2((uint32_t *)frame->data[1], format) 
< 0) {
+if (avpriv_set_systematic_pal2((uint32_t *)frame->data[1], format) 
< 0)
 goto fail;
-}
 }
 
 frame->extended_data = frame->data;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavfi/framepool: add audio support

2017-01-12 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Tue Jan 
 3 17:44:07 2017 +0100| [eb3368178ed9e1b3401e1f71ceebcb510fbbdf52] | committer: 
Matthieu Bouron

lavfi/framepool: add audio support

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eb3368178ed9e1b3401e1f71ceebcb510fbbdf52
---

 libavfilter/framepool.c | 109 
 libavfilter/framepool.h |  36 +++-
 2 files changed, 144 insertions(+), 1 deletion(-)

diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index 36c6e8f..588dcb6 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -20,6 +20,7 @@
 
 #include "framepool.h"
 #include "libavutil/avassert.h"
+#include "libavutil/avutil.h"
 #include "libavutil/buffer.h"
 #include "libavutil/frame.h"
 #include "libavutil/imgutils.h"
@@ -28,8 +29,18 @@
 
 struct FFFramePool {
 
+enum AVMediaType type;
+
+/* video */
 int width;
 int height;
+
+/* audio */
+int planes;
+int channels;
+int nb_samples;
+
+/* common */
 int format;
 int align;
 int linesize[4];
@@ -54,6 +65,7 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* 
(*alloc)(int size),
 if (!pool)
 return NULL;
 
+pool->type = AVMEDIA_TYPE_VIDEO;
 pool->width = width;
 pool->height = height;
 pool->format = format;
@@ -104,6 +116,44 @@ fail:
 return NULL;
 }
 
+FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(int size),
+  int channels,
+  int nb_samples,
+  enum AVSampleFormat format,
+  int align)
+{
+int ret, planar;
+FFFramePool *pool;
+
+pool = av_mallocz(sizeof(FFFramePool));
+if (!pool)
+return NULL;
+
+planar = av_sample_fmt_is_planar(format);
+
+pool->type = AVMEDIA_TYPE_AUDIO;
+pool->planes = planar ? channels : 1;
+pool->channels = channels;
+pool->nb_samples = nb_samples;
+pool->format = format;
+pool->align = align;
+
+ret = av_samples_get_buffer_size(>linesize[0], channels,
+ nb_samples, format, 0);
+if (ret < 0)
+goto fail;
+
+pool->pools[0] = av_buffer_pool_init(pool->linesize[0], NULL);
+if (!pool->pools[0])
+goto fail;
+
+return pool;
+
+fail:
+ff_frame_pool_uninit();
+return NULL;
+}
+
 int ff_frame_pool_get_video_config(FFFramePool *pool,
int *width,
int *height,
@@ -113,6 +163,8 @@ int ff_frame_pool_get_video_config(FFFramePool *pool,
 if (!pool)
 return AVERROR(EINVAL);
 
+av_assert0(pool->type == AVMEDIA_TYPE_VIDEO);
+
 *width = pool->width;
 *height = pool->height;
 *format = pool->format;
@@ -121,6 +173,24 @@ int ff_frame_pool_get_video_config(FFFramePool *pool,
 return 0;
 }
 
+int ff_frame_pool_get_audio_config(FFFramePool *pool,
+   int *channels,
+   int *nb_samples,
+   enum AVSampleFormat *format,
+   int *align)
+{
+if (!pool)
+return AVERROR(EINVAL);
+
+av_assert0(pool->type == AVMEDIA_TYPE_AUDIO);
+
+*channels = pool->channels;
+*nb_samples = pool->nb_samples;
+*format = pool->format;
+*align = pool->align;
+
+return 0;
+}
 
 AVFrame *ff_frame_pool_get(FFFramePool *pool)
 {
@@ -133,6 +203,8 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool)
 return NULL;
 }
 
+switch(pool->type) {
+case AVMEDIA_TYPE_VIDEO:
 desc = av_pix_fmt_desc_get(pool->format);
 if (!desc) {
 goto fail;
@@ -167,6 +239,43 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool)
 }
 
 frame->extended_data = frame->data;
+break;
+case AVMEDIA_TYPE_AUDIO:
+frame->nb_samples = pool->nb_samples;
+av_frame_set_channels(frame, pool->channels);
+frame->format = pool->format;
+frame->linesize[0] = pool->linesize[0];
+
+if (pool->planes > AV_NUM_DATA_POINTERS) {
+frame->extended_data = av_mallocz_array(pool->planes,
+
sizeof(*frame->extended_data));
+frame->nb_extended_buf = pool->planes - AV_NUM_DATA_POINTERS;
+frame->extended_buf = av_mallocz_array(frame->nb_extended_buf,
+   
sizeof(*frame->extended_buf));
+if (!frame->extended_data || !frame->extended_buf)
+goto fail;
+} else {
+frame->extended_data = frame->data;
+av_asser

[FFmpeg-cvslog] lavfi/framepool: re-indent after previous commit

2017-01-12 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Tue Jan 
 3 17:44:55 2017 +0100| [e2d336cf6499923691baf53b10d193aefa77fa89] | committer: 
Matthieu Bouron

lavfi/framepool: re-indent after previous commit

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2d336cf6499923691baf53b10d193aefa77fa89
---

 libavfilter/framepool.c | 54 -
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index 588dcb6..74235d4 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -205,41 +205,41 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool)
 
 switch(pool->type) {
 case AVMEDIA_TYPE_VIDEO:
-desc = av_pix_fmt_desc_get(pool->format);
-if (!desc) {
-goto fail;
-}
+desc = av_pix_fmt_desc_get(pool->format);
+if (!desc) {
+goto fail;
+}
 
-frame->width = pool->width;
-frame->height = pool->height;
-frame->format = pool->format;
+frame->width = pool->width;
+frame->height = pool->height;
+frame->format = pool->format;
 
-for (i = 0; i < 4; i++) {
-frame->linesize[i] = pool->linesize[i];
-if (!pool->pools[i])
-break;
+for (i = 0; i < 4; i++) {
+frame->linesize[i] = pool->linesize[i];
+if (!pool->pools[i])
+break;
 
-frame->buf[i] = av_buffer_pool_get(pool->pools[i]);
-if (!frame->buf[i]) {
-goto fail;
-}
+frame->buf[i] = av_buffer_pool_get(pool->pools[i]);
+if (!frame->buf[i]) {
+goto fail;
+}
 
-frame->data[i] = frame->buf[i]->data;
-}
+frame->data[i] = frame->buf[i]->data;
+}
 
-if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
-desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
-enum AVPixelFormat format =
-pool->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : pool->format;
+if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
+desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
+enum AVPixelFormat format =
+pool->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : 
pool->format;
 
-av_assert0(frame->data[1] != NULL);
-if (avpriv_set_systematic_pal2((uint32_t *)frame->data[1], format) < 
0) {
-goto fail;
+av_assert0(frame->data[1] != NULL);
+if (avpriv_set_systematic_pal2((uint32_t *)frame->data[1], format) 
< 0) {
+goto fail;
+}
 }
-}
 
-frame->extended_data = frame->data;
-break;
+frame->extended_data = frame->data;
+break;
 case AVMEDIA_TYPE_AUDIO:
 frame->nb_samples = pool->nb_samples;
 av_frame_set_channels(frame, pool->channels);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavfi/framepool: rename FFVideoFramePool to FFFramePool

2017-01-12 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Tue May 
10 17:45:59 2016 +0200| [b1f68f00b12a3706f8aabf68ea714eaecc23b295] | committer: 
Matthieu Bouron

lavfi/framepool: rename FFVideoFramePool to FFFramePool

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b1f68f00b12a3706f8aabf68ea714eaecc23b295
---

 libavfilter/avfilter.c  |  2 +-
 libavfilter/avfilter.h  |  4 ++--
 libavfilter/framepool.c | 24 
 libavfilter/framepool.h | 32 
 libavfilter/video.c | 20 ++--
 5 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 0020ee1..12f12d1 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -179,7 +179,7 @@ void avfilter_link_free(AVFilterLink **link)
 
 av_frame_free(&(*link)->partial_buf);
 ff_framequeue_free(&(*link)->fifo);
-ff_video_frame_pool_uninit((FFVideoFramePool**)&(*link)->video_frame_pool);
+ff_frame_pool_uninit((FFFramePool**)&(*link)->frame_pool);
 
 av_freep(link);
 }
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 828b270..02df8a3 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -531,9 +531,9 @@ struct AVFilterLink {
 int64_t frame_count_in, frame_count_out;
 
 /**
- * A pointer to a FFVideoFramePool struct.
+ * A pointer to a FFFramePool struct.
  */
-void *video_frame_pool;
+void *frame_pool;
 
 /**
  * True if a frame is currently wanted on the output of this filter.
diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index 6df574e..36c6e8f 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -26,7 +26,7 @@
 #include "libavutil/mem.h"
 #include "libavutil/pixfmt.h"
 
-struct FFVideoFramePool {
+struct FFFramePool {
 
 int width;
 int height;
@@ -37,20 +37,20 @@ struct FFVideoFramePool {
 
 };
 
-FFVideoFramePool *ff_video_frame_pool_init(AVBufferRef* (*alloc)(int size),
-   int width,
-   int height,
-   enum AVPixelFormat format,
-   int align)
+FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(int size),
+  int width,
+  int height,
+  enum AVPixelFormat format,
+  int align)
 {
 int i, ret;
-FFVideoFramePool *pool;
+FFFramePool *pool;
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
 
 if (!desc)
 return NULL;
 
-pool = av_mallocz(sizeof(FFVideoFramePool));
+pool = av_mallocz(sizeof(FFFramePool));
 if (!pool)
 return NULL;
 
@@ -100,11 +100,11 @@ FFVideoFramePool *ff_video_frame_pool_init(AVBufferRef* 
(*alloc)(int size),
 return pool;
 
 fail:
-ff_video_frame_pool_uninit();
+ff_frame_pool_uninit();
 return NULL;
 }
 
-int ff_video_frame_pool_get_config(FFVideoFramePool *pool,
+int ff_frame_pool_get_video_config(FFFramePool *pool,
int *width,
int *height,
enum AVPixelFormat *format,
@@ -122,7 +122,7 @@ int ff_video_frame_pool_get_config(FFVideoFramePool *pool,
 }
 
 
-AVFrame *ff_video_frame_pool_get(FFVideoFramePool *pool)
+AVFrame *ff_frame_pool_get(FFFramePool *pool)
 {
 int i;
 AVFrame *frame;
@@ -174,7 +174,7 @@ fail:
 return NULL;
 }
 
-void ff_video_frame_pool_uninit(FFVideoFramePool **pool)
+void ff_frame_pool_uninit(FFFramePool **pool)
 {
 int i;
 
diff --git a/libavfilter/framepool.h b/libavfilter/framepool.h
index 2a6c9e8..4824824 100644
--- a/libavfilter/framepool.h
+++ b/libavfilter/framepool.h
@@ -25,11 +25,11 @@
 #include "libavutil/frame.h"
 
 /**
- * Video frame pool. This structure is opaque and not meant to be accessed
- * directly. It is allocated with ff_video_frame_pool_init() and freed with
- * ff_video_frame_pool_uninit().
+ * Frame pool. This structure is opaque and not meant to be accessed
+ * directly. It is allocated with ff_frame_pool_init() and freed with
+ * ff_frame_pool_uninit().
  */
-typedef struct FFVideoFramePool FFVideoFramePool;
+typedef struct FFFramePool FFFramePool;
 
 /**
  * Allocate and initialize a video frame pool.
@@ -41,21 +41,21 @@ typedef struct FFVideoFramePool FFVideoFramePool;
  * @param height height of each frame in this pool
  * @param format format of each frame in this pool
  * @param align buffers alignement of each frame in this pool
- * @return newly created video frame pool on success, NULL on error.
+ * @return newly created frame pool on success, NULL on error.
  */
-FFVideoFramePool *ff_video_frame_pool_init(AVBufferRef* (*allo

[FFmpeg-cvslog] lavfi: use an audio frame pool for each link of the filtergraph

2017-01-12 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@gmail.com> | Tue Jan 
 3 17:44:14 2017 +0100| [e1f49712099d3b68c35cf8ebb95cc7f34b06ee55] | committer: 
Matthieu Bouron

lavfi: use an audio frame pool for each link of the filtergraph

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e1f49712099d3b68c35cf8ebb95cc7f34b06ee55
---

 libavfilter/audio.c | 50 --
 1 file changed, 36 insertions(+), 14 deletions(-)

diff --git a/libavfilter/audio.c b/libavfilter/audio.c
index a18be89..5996f60 100644
--- a/libavfilter/audio.c
+++ b/libavfilter/audio.c
@@ -27,6 +27,9 @@
 #include "avfilter.h"
 #include "internal.h"
 
+#define BUFFER_ALIGN 0
+
+
 AVFrame *ff_null_get_audio_buffer(AVFilterLink *link, int nb_samples)
 {
 return ff_get_audio_buffer(link->dst->outputs[0], nb_samples);
@@ -34,29 +37,48 @@ AVFrame *ff_null_get_audio_buffer(AVFilterLink *link, int 
nb_samples)
 
 AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples)
 {
-AVFrame *frame = av_frame_alloc();
+AVFrame *frame = NULL;
 int channels = link->channels;
-int ret;
 
 av_assert0(channels == 
av_get_channel_layout_nb_channels(link->channel_layout) || 
!av_get_channel_layout_nb_channels(link->channel_layout));
 
+if (!link->frame_pool) {
+link->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels,
+nb_samples, link->format, 
BUFFER_ALIGN);
+if (!link->frame_pool)
+return NULL;
+} else {
+int pool_channels = 0;
+int pool_nb_samples = 0;
+int pool_align = 0;
+enum AVSampleFormat pool_format = AV_SAMPLE_FMT_NONE;
+
+if (ff_frame_pool_get_audio_config(link->frame_pool,
+   _channels, _nb_samples,
+   _format, _align) < 0) {
+return NULL;
+}
+
+if (pool_channels != channels || pool_nb_samples < nb_samples ||
+pool_format != link->format || pool_align != BUFFER_ALIGN) {
+
+ff_frame_pool_uninit((FFFramePool **)>frame_pool);
+link->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, 
channels,
+nb_samples, 
link->format, BUFFER_ALIGN);
+if (!link->frame_pool)
+return NULL;
+}
+}
+
+frame = ff_frame_pool_get(link->frame_pool);
 if (!frame)
 return NULL;
 
-frame->nb_samples = nb_samples;
-frame->format = link->format;
-av_frame_set_channels(frame, link->channels);
+frame->nb_samples = nb_samples;
 frame->channel_layout = link->channel_layout;
-frame->sample_rate= link->sample_rate;
-ret = av_frame_get_buffer(frame, 0);
-if (ret < 0) {
-av_frame_free();
-return NULL;
-}
-
-av_samples_set_silence(frame->extended_data, 0, nb_samples, channels,
-   link->format);
+frame->sample_rate = link->sample_rate;
 
+av_samples_set_silence(frame->extended_data, 0, nb_samples, channels, 
link->format);
 
 return frame;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] mov: fix stream extradata_size allocation

2016-11-18 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@stupeflix.com> | Fri 
Jul 15 10:00:34 2016 +0200| [61cb9fac47498a38dfe7623f66aa1f3696e9158c] | 
committer: Martin Storsjö

mov: fix stream extradata_size allocation

Signed-off-by: Martin Storsjö <mar...@martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61cb9fac47498a38dfe7623f66aa1f3696e9158c
---

 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0cb3271..14be96e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1900,7 +1900,7 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return AVERROR(ENOMEM);
 
 sc->stsd_count = entries;
-sc->extradata_size = av_mallocz_array(sc->stsd_count, 
sizeof(sc->extradata_size));
+sc->extradata_size = av_mallocz_array(sc->stsd_count, 
sizeof(*sc->extradata_size));
 if (!sc->extradata_size)
 return AVERROR(ENOMEM);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc: add vp8/vp9 mediacodec decoders

2016-10-19 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@stupeflix.com> | Tue 
Oct  4 16:02:59 2016 +0200| [0f7fce87ea9842261076f93bd0f28557fcd065bb] | 
committer: Matthieu Bouron

lavc: add vp8/vp9 mediacodec decoders

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f7fce87ea9842261076f93bd0f28557fcd065bb
---

 Changelog|  4 +--
 configure|  4 +++
 libavcodec/Makefile  |  2 ++
 libavcodec/allcodecs.c   |  4 +++
 libavcodec/mediacodecdec.c   | 14 
 libavcodec/mediacodecdec_h2645.c | 73 +++-
 libavcodec/version.h |  2 +-
 7 files changed, 99 insertions(+), 4 deletions(-)

diff --git a/Changelog b/Changelog
index 32f0bd4..9f1b8e5 100644
--- a/Changelog
+++ b/Changelog
@@ -10,7 +10,7 @@ version :
 - curves filter doesn't automatically insert points at x=0 and x=1 anymore
 - 16-bit support in curves filter and selectivecolor filter
 - OpenH264 decoder wrapper
-- MediaCodec H.264 and HEVC hwaccel
+- MediaCodec H.264/HEVC/VP8/VP9 hwaccel
 - True Audio (TTA) muxer
 - crystalizer audio filter
 - acrusher audio filter
@@ -28,7 +28,7 @@ version :
 - gblur filter
 - avgblur filter
 - sobel and prewitt filter
-- MediaCodec HEVC decoding
+- MediaCodec HEVC/VP8/VP9 decoding
 - Meridian Lossless Packing (MLP) / TrueHD encoder
 - Non-Local Means (nlmeans) denoising filter
 - sdl2 output device and ffplay support
diff --git a/configure b/configure
index 96f575f..294ff64 100755
--- a/configure
+++ b/configure
@@ -2662,10 +2662,14 @@ vc1_vdpau_hwaccel_deps="vdpau"
 vc1_vdpau_hwaccel_select="vc1_decoder"
 vp8_cuvid_hwaccel_deps="cuda cuvid"
 vp9_cuvid_hwaccel_deps="cuda cuvid"
+vp8_mediacodec_decoder_deps="mediacodec"
+vp8_mediacodec_hwaccel_deps="mediacodec"
 vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
 vp9_d3d11va_hwaccel_select="vp9_decoder"
 vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
 vp9_dxva2_hwaccel_select="vp9_decoder"
+vp9_mediacodec_decoder_deps="mediacodec"
+vp9_mediacodec_hwaccel_deps="mediacodec"
 vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9"
 vp9_vaapi_hwaccel_select="vp9_decoder"
 wmv3_crystalhd_decoder_select="crystalhd"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index a1560ba..734c79d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -595,9 +595,11 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o 
vp56data.o \
 OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp56rac.o
 OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp56rac.o
 OBJS-$(CONFIG_VP8_CUVID_DECODER)   += cuvid.o
+OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)  += mediacodecdec_h2645.o
 OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9dsp.o vp56rac.o 
vp9dsp_8bpp.o \
   vp9dsp_10bpp.o vp9dsp_12bpp.o
 OBJS-$(CONFIG_VP9_CUVID_DECODER)   += cuvid.o
+OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER)  += mediacodecdec_h2645.o
 OBJS-$(CONFIG_VPLAYER_DECODER) += textdec.o ass.o
 OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
 OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index fed740a..44f7205 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -115,9 +115,11 @@ void avcodec_register_all(void)
 REGISTER_HWACCEL(VC1_MMAL,  vc1_mmal);
 REGISTER_HWACCEL(VC1_QSV,   vc1_qsv);
 REGISTER_HWACCEL(VP8_CUVID, vp8_cuvid);
+REGISTER_HWACCEL(VP8_MEDIACODEC,vp8_mediacodec);
 REGISTER_HWACCEL(VP9_CUVID, vp9_cuvid);
 REGISTER_HWACCEL(VP9_D3D11VA,   vp9_d3d11va);
 REGISTER_HWACCEL(VP9_DXVA2, vp9_dxva2);
+REGISTER_HWACCEL(VP9_MEDIACODEC,vp9_mediacodec);
 REGISTER_HWACCEL(VP9_VAAPI, vp9_vaapi);
 REGISTER_HWACCEL(WMV3_D3D11VA,  wmv3_d3d11va);
 REGISTER_HWACCEL(WMV3_DXVA2,wmv3_dxva2);
@@ -657,7 +659,9 @@ void avcodec_register_all(void)
 REGISTER_DECODER(MPEG4_CUVID,   mpeg4_cuvid);
 REGISTER_DECODER(VC1_CUVID, vc1_cuvid);
 REGISTER_DECODER(VP8_CUVID, vp8_cuvid);
+REGISTER_DECODER(VP8_MEDIACODEC,vp8_mediacodec);
 REGISTER_DECODER(VP9_CUVID, vp9_cuvid);
+REGISTER_DECODER(VP9_MEDIACODEC,vp9_mediacodec);
 
 /* parsers */
 REGISTER_PARSER(AAC,aac);
diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 8ff1138..e5a8dbc 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -766,3 +766,17 @@ AVHWAccel ff_hevc_mediacodec_hwaccel = {
 .id  = AV_CODEC_ID_HEVC,
 .pix_fmt = AV_PIX_FMT_MEDIACODEC,
 };
+
+AVHWAccel ff_vp8_mediacodec_hwaccel = {
+.name= "mediacodec",
+.type= AVMEDIA_TYPE_VIDEO,
+.id  = AV_CODEC

[FFmpeg-cvslog] lavc/mediacodec: use more meaningful filenames

2016-10-19 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@stupeflix.com> | Wed 
Oct 12 14:44:08 2016 +0200| [d5082a2ce776a2e43e25998aa07541c9ab7af0d3] | 
committer: Matthieu Bouron

lavc/mediacodec: use more meaningful filenames

Adds the following changes:
  * mediacodecdec.{c,h} -> mediacodecdec_common.{c,h}
  * mediacodecdec_h2645.c -> mediacodecdec.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d5082a2ce776a2e43e25998aa07541c9ab7af0d3
---

 libavcodec/Makefile|   14 +-
 libavcodec/mediacodec.c|3 +-
 libavcodec/mediacodec_sw_buffer.c  |2 +-
 libavcodec/mediacodec_sw_buffer.h  |2 +-
 libavcodec/mediacodecdec.c | 1064 +---
 libavcodec/mediacodecdec_common.c  |  789 +++
 .../{mediacodecdec.h => mediacodecdec_common.h}|6 +-
 libavcodec/mediacodecdec_h2645.c   |  623 
 8 files changed, 1252 insertions(+), 1251 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index e8b1b00..f1d5bf1 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -94,7 +94,7 @@ OBJS-$(CONFIG_LSP) += lsp.o
 OBJS-$(CONFIG_LZF) += lzf.o
 OBJS-$(CONFIG_MDCT)+= mdct_fixed.o mdct_float.o 
mdct_fixed_32.o
 OBJS-$(CONFIG_ME_CMP)  += me_cmp.o
-OBJS-$(CONFIG_MEDIACODEC)  += mediacodecdec.o mediacodec_surface.o 
mediacodec_wrapper.o mediacodec_sw_buffer.o
+OBJS-$(CONFIG_MEDIACODEC)  += mediacodecdec_common.o 
mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
 OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o
 OBJS-$(CONFIG_MPEGAUDIO)   += mpegaudio.o mpegaudiodata.o   \
   mpegaudiodecheader.o
@@ -316,7 +316,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264dec.o 
h264_cabac.o h264_cavlc.o \
   h264_slice.o h264data.o h264_parse.o 
\
   h2645_parse.o
 OBJS-$(CONFIG_H264_CUVID_DECODER)  += cuvid.o
-OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec_h2645.o
+OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o
 OBJS-$(CONFIG_H264_MMAL_DECODER)   += mmaldec.o
 OBJS-$(CONFIG_H264_NVENC_ENCODER)  += nvenc_h264.o
 OBJS-$(CONFIG_NVENC_ENCODER)   += nvenc_h264.o
@@ -333,7 +333,7 @@ OBJS-$(CONFIG_HEVC_DECODER)+= hevc.o hevc_mvs.o 
hevc_ps.o hevc_sei.o
   hevc_cabac.o hevc_refs.o hevcpred.o  
  \
   hevcdsp.o hevc_filter.o 
h2645_parse.o hevc_data.o
 OBJS-$(CONFIG_HEVC_CUVID_DECODER)  += cuvid.o
-OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec_h2645.o hevc_parse.o
+OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o hevc_parse.o
 OBJS-$(CONFIG_HEVC_NVENC_ENCODER)  += nvenc_hevc.o
 OBJS-$(CONFIG_NVENC_HEVC_ENCODER)  += nvenc_hevc.o
 OBJS-$(CONFIG_HEVC_QSV_DECODER)+= qsvdec_h2645.o
@@ -413,7 +413,7 @@ OBJS-$(CONFIG_MPEG2_QSV_ENCODER)   += qsvenc_mpeg2.o
 OBJS-$(CONFIG_MPEG2VIDEO_DECODER)  += mpeg12dec.o mpeg12.o mpeg12data.o
 OBJS-$(CONFIG_MPEG2VIDEO_ENCODER)  += mpeg12enc.o mpeg12.o
 OBJS-$(CONFIG_MPEG4_DECODER)   += xvididct.o
-OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec_h2645.o
+OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o
 OBJS-$(CONFIG_MPEG4_OMX_ENCODER)   += omx.o
 OBJS-$(CONFIG_MPL2_DECODER)+= mpl2dec.o ass.o
 OBJS-$(CONFIG_MSA1_DECODER)+= mss3.o
@@ -596,11 +596,11 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o 
vp56data.o \
 OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp56rac.o
 OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp56rac.o
 OBJS-$(CONFIG_VP8_CUVID_DECODER)   += cuvid.o
-OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)  += mediacodecdec_h2645.o
+OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)  += mediacodecdec.o
 OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9dsp.o vp56rac.o 
vp9dsp_8bpp.o \
   vp9dsp_10bpp.o vp9dsp_12bpp.o
 OBJS-$(CONFIG_VP9_CUVID_DECODER)   += cuvid.o
-OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER)  += mediacodecdec_h2645.o
+OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER)  += mediacodecdec.o
 OBJS-$(CONFIG_VPLAYER_DECODER) += textdec.o ass.o
 OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
 OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
@@ -1008,7 +1008,7 @@ SKIPHEADERS-$(CONFIG_JNI)  += ffjni.h
 SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER)  += libschroedinger.h
 SKIPHEADERS-$(CONFIG_LIBVPX)   += libvpx.h
 SKIPHEADERS-$(CONFIG_LIBWEBP_ENCODER)  += libwebpenc_common.h
-SKIPHEADERS-$(CONFIG_MEDIACODEC)   += mediacodecdec.h mediacodec_surface.h 
mediacodec_wrapper.h mediacodec_sw_buffer.h
+SKIPHEADERS-$

[FFmpeg-cvslog] lavc: add mpeg4 mediacodec decoder

2016-10-19 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@stupeflix.com> | Tue 
Oct  4 17:47:44 2016 +0200| [f62c54456db0fdd3ff82397f9142715d5c479354] | 
committer: Matthieu Bouron

lavc: add mpeg4 mediacodec decoder

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f62c54456db0fdd3ff82397f9142715d5c479354
---

 Changelog|  4 ++--
 configure|  2 ++
 libavcodec/Makefile  |  1 +
 libavcodec/allcodecs.c   |  2 ++
 libavcodec/mediacodecdec.c   |  7 +++
 libavcodec/mediacodecdec_h2645.c | 40 +++-
 libavcodec/version.h |  2 +-
 7 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/Changelog b/Changelog
index 9f1b8e5..c319388 100644
--- a/Changelog
+++ b/Changelog
@@ -10,7 +10,7 @@ version :
 - curves filter doesn't automatically insert points at x=0 and x=1 anymore
 - 16-bit support in curves filter and selectivecolor filter
 - OpenH264 decoder wrapper
-- MediaCodec H.264/HEVC/VP8/VP9 hwaccel
+- MediaCodec H.264/HEVC/MPEG-4/VP8/VP9 hwaccel
 - True Audio (TTA) muxer
 - crystalizer audio filter
 - acrusher audio filter
@@ -28,7 +28,7 @@ version :
 - gblur filter
 - avgblur filter
 - sobel and prewitt filter
-- MediaCodec HEVC/VP8/VP9 decoding
+- MediaCodec HEVC/MPEG-4/VP8/VP9 decoding
 - Meridian Lossless Packing (MLP) / TrueHD encoder
 - Non-Local Means (nlmeans) denoising filter
 - sdl2 output device and ffplay support
diff --git a/configure b/configure
index 294ff64..1e6834f 100755
--- a/configure
+++ b/configure
@@ -2630,6 +2630,8 @@ mpeg2_xvmc_hwaccel_deps="xvmc"
 mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
 mpeg4_crystalhd_decoder_select="crystalhd"
 mpeg4_cuvid_hwaccel_deps="cuda cuvid"
+mpeg4_mediacodec_decoder_deps="mediacodec"
+mpeg4_mediacodec_hwaccel_deps="mediacodec"
 mpeg4_mmal_decoder_deps="mmal"
 mpeg4_mmal_decoder_select="mmal"
 mpeg4_mmal_hwaccel_deps="mmal"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 734c79d..e8b1b00 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -413,6 +413,7 @@ OBJS-$(CONFIG_MPEG2_QSV_ENCODER)   += qsvenc_mpeg2.o
 OBJS-$(CONFIG_MPEG2VIDEO_DECODER)  += mpeg12dec.o mpeg12.o mpeg12data.o
 OBJS-$(CONFIG_MPEG2VIDEO_ENCODER)  += mpeg12enc.o mpeg12.o
 OBJS-$(CONFIG_MPEG4_DECODER)   += xvididct.o
+OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec_h2645.o
 OBJS-$(CONFIG_MPEG4_OMX_ENCODER)   += omx.o
 OBJS-$(CONFIG_MPL2_DECODER)+= mpl2dec.o ass.o
 OBJS-$(CONFIG_MSA1_DECODER)+= mss3.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 44f7205..b592aa3 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -103,6 +103,7 @@ void avcodec_register_all(void)
 REGISTER_HWACCEL(MPEG2_VDPAU,   mpeg2_vdpau);
 REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox);
 REGISTER_HWACCEL(MPEG4_CUVID,   mpeg4_cuvid);
+REGISTER_HWACCEL(MPEG4_MEDIACODEC,  mpeg4_mediacodec);
 REGISTER_HWACCEL(MPEG4_MMAL,mpeg4_mmal);
 REGISTER_HWACCEL(MPEG4_VAAPI,   mpeg4_vaapi);
 REGISTER_HWACCEL(MPEG4_VDPAU,   mpeg4_vdpau);
@@ -657,6 +658,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER(MPEG2_CUVID,   mpeg2_cuvid);
 REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
 REGISTER_DECODER(MPEG4_CUVID,   mpeg4_cuvid);
+REGISTER_DECODER(MPEG4_MEDIACODEC,  mpeg4_mediacodec);
 REGISTER_DECODER(VC1_CUVID, vc1_cuvid);
 REGISTER_DECODER(VP8_CUVID, vp8_cuvid);
 REGISTER_DECODER(VP8_MEDIACODEC,vp8_mediacodec);
diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index e5a8dbc..c031de8 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -767,6 +767,13 @@ AVHWAccel ff_hevc_mediacodec_hwaccel = {
 .pix_fmt = AV_PIX_FMT_MEDIACODEC,
 };
 
+AVHWAccel ff_mpeg4_mediacodec_hwaccel = {
+.name= "mediacodec",
+.type= AVMEDIA_TYPE_VIDEO,
+.id  = AV_CODEC_ID_MPEG4,
+.pix_fmt = AV_PIX_FMT_MEDIACODEC,
+};
+
 AVHWAccel ff_vp8_mediacodec_hwaccel = {
 .name= "mediacodec",
 .type= AVMEDIA_TYPE_VIDEO,
diff --git a/libavcodec/mediacodecdec_h2645.c b/libavcodec/mediacodecdec_h2645.c
index c5f5af2..578b10d 100644
--- a/libavcodec/mediacodecdec_h2645.c
+++ b/libavcodec/mediacodecdec_h2645.c
@@ -1,5 +1,5 @@
 /*
- * Android MediaCodec H.264 / H.265 / VP8 / VP9 decoders
+ * Android MediaCodec H.264 / H.265 / MPEG-4 / VP8 / VP9 decoders
  *
  * Copyright (c) 2015-2016 Matthieu Bouron 
  *
@@ -266,6 +266,19 @@ done:
 }
 #endif
 
+#if CONFIG_MPEG4_MEDIACODEC_DECODER
+static int mpeg4_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
+{
+int ret = 0;
+
+if (avctx->extradata) {
+ff_AMediaFormat_setBuffer(format, "csd-0", avctx->extradata, 
avctx-&

[FFmpeg-cvslog] lavc/mediacodec_wrapper: do not discard codecs reporting they do not support any profile

2016-10-19 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@stupeflix.com> | Fri 
Oct  7 11:20:33 2016 +0200| [b8c158a4eddb79ba3964dbe51b0e1db01454f96a] | 
committer: Matthieu Bouron

lavc/mediacodec_wrapper: do not discard codecs reporting they do not support 
any profile

Depending on the device, some (VP8/VP9/...) decoders report that they do
not support any profiles.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8c158a4eddb79ba3964dbe51b0e1db01454f96a
---

 libavcodec/mediacodec_wrapper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 97e3a29..c2af950 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -480,6 +480,9 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
*mime, int profile, int e
 }
 
 profile_count = (*env)->GetArrayLength(env, profile_levels);
+if (!profile_count) {
+found_codec = 1;
+}
 for (k = 0; k < profile_count; k++) {
 int supported_profile = 0;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mediacodecdec: rename dequeued_buffer_nb to output_buffer_count

2016-10-12 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@stupeflix.com> | Thu 
Oct  6 11:56:24 2016 +0200| [cfa3c2655ac2bafe7b76f1e68c8fe6ecee03f1a8] | 
committer: Matthieu Bouron

lavc/mediacodecdec: rename dequeued_buffer_nb to output_buffer_count

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cfa3c2655ac2bafe7b76f1e68c8fe6ecee03f1a8
---

 libavcodec/mediacodecdec.c | 6 +++---
 libavcodec/mediacodecdec.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index e0d71d3..8ff1138 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -437,7 +437,7 @@ static int mediacodec_dec_flush_codec(AVCodecContext 
*avctx, MediaCodecDecContex
 FFAMediaCodec *codec = s->codec;
 int status;
 
-s->dequeued_buffer_nb = 0;
+s->output_buffer_count = 0;
 
 s->draining = 0;
 s->flushing = 0;
@@ -630,7 +630,7 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 /* If the codec is flushing or need to be flushed, block for a fair
  * amount of time to ensure we got a frame */
 output_dequeue_timeout_us = OUTPUT_DEQUEUE_BLOCK_TIMEOUT_US;
-} else if (s->dequeued_buffer_nb == 0) {
+} else if (s->output_buffer_count == 0) {
 /* If the codec hasn't produced any frames, do not block so we
  * can push data to it as fast as possible, and get the first
  * frame */
@@ -670,7 +670,7 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 }
 
 *got_frame = 1;
-s->dequeued_buffer_nb++;
+s->output_buffer_count++;
 } else {
 status = ff_AMediaCodec_releaseOutputBuffer(codec, index, 0);
 if (status < 0) {
diff --git a/libavcodec/mediacodecdec.h b/libavcodec/mediacodecdec.h
index 52c8bf1..7b0b7bb 100644
--- a/libavcodec/mediacodecdec.h
+++ b/libavcodec/mediacodecdec.h
@@ -59,7 +59,7 @@ typedef struct MediaCodecDecContext {
 int crop_left;
 int crop_right;
 
-uint64_t dequeued_buffer_nb;
+uint64_t output_buffer_count;
 
 } MediaCodecDecContext;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc/mediacodecdec: remove first output buffer timing debug log

2016-10-12 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron <matthieu.bou...@stupeflix.com> | Thu 
Oct  6 11:53:13 2016 +0200| [a458ed65b5d1007a9184226edd39fa78d01f694b] | 
committer: Matthieu Bouron

lavc/mediacodecdec: remove first output buffer timing debug log

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a458ed65b5d1007a9184226edd39fa78d01f694b
---

 libavcodec/mediacodecdec.c | 8 
 libavcodec/mediacodecdec.h | 3 ---
 2 files changed, 11 deletions(-)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 6683de7..e0d71d3 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -449,9 +449,6 @@ static int mediacodec_dec_flush_codec(AVCodecContext 
*avctx, MediaCodecDecContex
 return AVERROR_EXTERNAL;
 }
 
-s->first_buffer = 0;
-s->first_buffer_at = av_gettime();
-
 return 0;
 }
 
@@ -468,7 +465,6 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 AV_PIX_FMT_NONE,
 };
 
-s->first_buffer_at = av_gettime();
 s->refcount = 1;
 
 pix_fmt = ff_get_format(avctx, pix_fmts);
@@ -645,10 +641,6 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 if (index >= 0) {
 int ret;
 
-if (!s->first_buffer++) {
-av_log(avctx, AV_LOG_DEBUG, "Got first buffer after %fms\n", 
(av_gettime() - s->first_buffer_at) / 1000);
-}
-
 av_log(avctx, AV_LOG_DEBUG, "Got output buffer %zd"
 " offset=%" PRIi32 " size=%" PRIi32 " ts=%" PRIi64
 " flags=%" PRIu32 "\n", index, info.offset, info.size,
diff --git a/libavcodec/mediacodecdec.h b/libavcodec/mediacodecdec.h
index 8613352..52c8bf1 100644
--- a/libavcodec/mediacodecdec.h
+++ b/libavcodec/mediacodecdec.h
@@ -61,9 +61,6 @@ typedef struct MediaCodecDecContext {
 
 uint64_t dequeued_buffer_nb;
 
-int first_buffer;
-double first_buffer_at;
-
 } MediaCodecDecContext;
 
 int ff_mediacodec_dec_init(AVCodecContext *avctx,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


  1   2   >