Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sibras committed Jul 31, 2016
2 parents cae135c + cebad64 commit d965ca5
Show file tree
Hide file tree
Showing 93 changed files with 4,694 additions and 2,840 deletions.
3 changes: 3 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ version <next>:
- VP8 in Ogg muxing
- curves filter doesn't automatically insert points at x=0 and x=1 anymore
- 16-bit support in curves filter
- 16-bit support in selectivecolor filter
- OpenH264 decoder wrapper
- MediaCodec hwaccel


version 3.1:
Expand Down
2 changes: 2 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2771,6 +2771,8 @@ libopencore_amrnb_decoder_deps="libopencore_amrnb"
libopencore_amrnb_encoder_deps="libopencore_amrnb"
libopencore_amrnb_encoder_select="audio_frame_queue"
libopencore_amrwb_decoder_deps="libopencore_amrwb"
libopenh264_decoder_deps="libopenh264"
libopenh264_decoder_select="h264_mp4toannexb_bsf"
libopenh264_encoder_deps="libopenh264"
libopenjpeg_decoder_deps="libopenjpeg"
libopenjpeg_encoder_deps="libopenjpeg"
Expand Down
2,422 changes: 1,577 additions & 845 deletions doc/Doxyfile

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions doc/ffprobe.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<xsd:complexType name="frameSideDataType">
<xsd:attribute name="side_data_type" type="xsd:string"/>
<xsd:attribute name="side_data_size" type="xsd:int" />
<xsd:attribute name="timecode" type="xsd:string"/>
</xsd:complexType>

<xsd:complexType name="subtitleType">
Expand Down
6 changes: 6 additions & 0 deletions doc/filters.texi
Original file line number Diff line number Diff line change
Expand Up @@ -6438,6 +6438,9 @@ Scroll from right to left.

@item rscroll
Scroll from left to right.

@item picture
Draw single picture.
@end table

Default is @code{frame}.
Expand Down Expand Up @@ -12351,6 +12354,9 @@ interleaved columns, left eye first

@item icr
interleaved columns, right eye first

@item hdmi
HDMI frame pack
@end table

Default value is @samp{arcd}.
Expand Down
9 changes: 8 additions & 1 deletion doc/general.texi
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,19 @@ enable it.

@section OpenH264

FFmpeg can make use of the OpenH264 library for H.264 encoding.
FFmpeg can make use of the OpenH264 library for H.264 encoding and decoding.

Go to @url{http://www.openh264.org/} and follow the instructions for
installing the library. Then pass @code{--enable-libopenh264} to configure to
enable it.

For decoding, this library is much more limited than the built-in decoder
in libavcodec; currently, this library lacks support for decoding B-frames
and some other main/high profile features. (It currently only supports
constrained baseline profile and CABAC.) Using it is mostly useful for
testing and for taking advantage of Cisco's patent portfolio license
(@url{http://www.openh264.org/BINARY_LICENSE.txt}).

@section x264

FFmpeg can make use of the x264 library for H.264 encoding.
Expand Down
1 change: 1 addition & 0 deletions ffprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -3277,6 +3277,7 @@ int main(int argc, char **argv)
SET_DO_SHOW(FRAME_TAGS, frame_tags);
SET_DO_SHOW(PROGRAM_TAGS, program_tags);
SET_DO_SHOW(STREAM_TAGS, stream_tags);
SET_DO_SHOW(PROGRAM_STREAM_TAGS, stream_tags);
SET_DO_SHOW(PACKET_TAGS, packet_tags);

if (do_bitexact && (do_show_program_version || do_show_library_versions)) {
Expand Down
8 changes: 5 additions & 3 deletions libavcodec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ OBJS-$(CONFIG_H263_DECODER) += h263dec.o h263.o ituh263dec.o \
intelh263dec.o h263data.o
OBJS-$(CONFIG_H263_ENCODER) += mpeg4videoenc.o mpeg4video.o \
h263.o ituh263enc.o flvenc.o h263data.o
OBJS-$(CONFIG_H264_DECODER) += h264.o h264_cabac.o h264_cavlc.o \
OBJS-$(CONFIG_H264_DECODER) += h264dec.o h264_cabac.o h264_cavlc.o \
h264_direct.o h264_loopfilter.o \
h264_mb.o h264_picture.o h264_ps.o \
h264_refs.o h264_sei.o \
Expand Down Expand Up @@ -531,7 +531,8 @@ OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o
OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o svq13.o h263data.o
OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o h263data.o \
h263.o ituh263enc.o
OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o svq13.o mpegutils.o h264_parse.o h264data.o
OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o svq13.o mpegutils.o \
h264_parse.o h264data.o h264_ps.o h2645_parse.o
OBJS-$(CONFIG_TEXT_DECODER) += textdec.o ass.o
OBJS-$(CONFIG_TEXT_ENCODER) += srtenc.o ass_split.o
OBJS-$(CONFIG_TAK_DECODER) += takdec.o tak.o takdsp.o
Expand Down Expand Up @@ -867,7 +868,8 @@ OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o mpegaudiodata.o mpegau
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o
OBJS-$(CONFIG_LIBOPENH264_DECODER) += libopenh264dec.o libopenh264.o
OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o libopenh264.o
OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o
OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o
OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusdec.o libopus.o \
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/allcodecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ void avcodec_register_all(void)

/* external libraries, that shouldn't be used by default if one of the
* above is available */
REGISTER_ENCODER(LIBOPENH264, libopenh264);
REGISTER_ENCDEC (LIBOPENH264, libopenh264);
REGISTER_DECODER(H264_CUVID, h264_cuvid);
REGISTER_ENCODER(H264_NVENC, h264_nvenc);
REGISTER_ENCODER(H264_OMX, h264_omx);
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/crystalhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
#include <libcrystalhd/libcrystalhd_if.h>

#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "internal.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
Expand Down
7 changes: 3 additions & 4 deletions libavcodec/dnxhddata.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "avcodec.h"
#include "dnxhddata.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"

/* The quantization tables below are in zigzag order! */

Expand Down Expand Up @@ -1103,12 +1102,12 @@ int avpriv_dnxhd_get_interlaced(int cid)
return ff_dnxhd_cid_table[i].flags & DNXHD_INTERLACED ? 1 : 0;
}

#if LIBAVCODEC_VERSION_MAJOR < 58
uint64_t avpriv_dnxhd_parse_header_prefix(const uint8_t *buf)
{
uint64_t prefix = AV_RB32(buf);
prefix = (prefix << 16) | buf[4] << 8;
return ff_dnxhd_check_header_prefix(prefix);
return ff_dnxhd_parse_header_prefix(buf);
}
#endif

static int dnxhd_find_hr_cid(AVCodecContext *avctx)
{
Expand Down
11 changes: 11 additions & 0 deletions libavcodec/dnxhddata.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <stdint.h>
#include "avcodec.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"

/** Additional profile info flags */
#define DNXHD_INTERLACED (1<<0)
Expand Down Expand Up @@ -83,7 +84,17 @@ static av_always_inline uint64_t ff_dnxhd_check_header_prefix(uint64_t prefix)
return 0;
}

static av_always_inline uint64_t ff_dnxhd_parse_header_prefix(const uint8_t *buf)
{
uint64_t prefix = AV_RB32(buf);
prefix = (prefix << 16) | buf[4] << 8;
return ff_dnxhd_check_header_prefix(prefix);
}

int avpriv_dnxhd_get_frame_size(int cid);
int avpriv_dnxhd_get_interlaced(int cid);
#if LIBAVCODEC_VERSION_MAJOR < 58
attribute_deprecated
uint64_t avpriv_dnxhd_parse_header_prefix(const uint8_t *buf);
#endif
#endif /* AVCODEC_DNXHDDATA_H */
2 changes: 1 addition & 1 deletion libavcodec/dnxhddec.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
return AVERROR_INVALIDDATA;
}

header_prefix = avpriv_dnxhd_parse_header_prefix(buf);
header_prefix = ff_dnxhd_parse_header_prefix(buf);
if (header_prefix == 0) {
av_log(ctx->avctx, AV_LOG_ERROR,
"unknown header 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n",
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/dxva2_h264.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "libavutil/avassert.h"

#include "h264.h"
#include "h264dec.h"
#include "h264data.h"
#include "mpegutils.h"

Expand Down
43 changes: 26 additions & 17 deletions libavcodec/ffjni.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,42 @@
#include "jni.h"
#include "ffjni.h"

static JavaVM *java_vm = NULL;
static JavaVM *java_vm;
static pthread_key_t current_env;
static pthread_once_t once = PTHREAD_ONCE_INIT;
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;

JNIEnv *ff_jni_attach_env(int *attached, void *log_ctx)
static void jni_detach_env(void *data)
{
if (java_vm) {
(*java_vm)->DetachCurrentThread(java_vm);
}
}

static void jni_create_pthread_key(void)
{
pthread_key_create(&current_env, jni_detach_env);
}

JNIEnv *ff_jni_get_env(void *log_ctx)
{
int ret = 0;
JNIEnv *env = NULL;

*attached = 0;

pthread_mutex_lock(&lock);
if (java_vm == NULL) {
java_vm = av_jni_get_java_vm(log_ctx);
}
pthread_mutex_unlock(&lock);

if (!java_vm) {
av_log(log_ctx, AV_LOG_ERROR, "No Java virtual machine has been registered\n");
return NULL;
goto done;
}

pthread_once(&once, jni_create_pthread_key);

if ((env = pthread_getspecific(current_env)) != NULL) {
goto done;
}

ret = (*java_vm)->GetEnv(java_vm, (void **)&env, JNI_VERSION_1_6);
Expand All @@ -59,7 +76,7 @@ JNIEnv *ff_jni_attach_env(int *attached, void *log_ctx)
av_log(log_ctx, AV_LOG_ERROR, "Failed to attach the JNI environment to the current thread\n");
env = NULL;
} else {
*attached = 1;
pthread_setspecific(current_env, env);
}
break;
case JNI_OK:
Expand All @@ -72,19 +89,11 @@ JNIEnv *ff_jni_attach_env(int *attached, void *log_ctx)
break;
}

done:
pthread_mutex_unlock(&lock);
return env;
}

int ff_jni_detach_env(void *log_ctx)
{
if (java_vm == NULL) {
av_log(log_ctx, AV_LOG_ERROR, "No Java virtual machine has been registered\n");
return AVERROR(EINVAL);
}

return (*java_vm)->DetachCurrentThread(java_vm);
}

char *ff_jni_jstring_to_utf_chars(JNIEnv *env, jstring string, void *log_ctx)
{
char *ret = NULL;
Expand Down
15 changes: 5 additions & 10 deletions libavcodec/ffjni.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,18 @@
#include <jni.h>

/*
* Attach a JNI environment to the current thread.
* Attach permanently a JNI environment to the current thread and retrieve it.
*
* If successfully attached, the JNI environment will automatically be detached
* at thread destruction.
*
* @param attached pointer to an integer that will be set to 1 if the
* environment has been attached to the current thread or 0 if it is
* already attached.
* @param log_ctx context used for logging, can be NULL
* @return the JNI environment on success, NULL otherwise
*/
JNIEnv *ff_jni_attach_env(int *attached, void *log_ctx);

/*
* Detach the JNI environment from the current thread.
*
* @param log_ctx context used for logging, can be NULL
* @return 0 on success, < 0 otherwise
*/
int ff_jni_detach_env(void *log_ctx);
JNIEnv *ff_jni_get_env(void *log_ctx);

/*
* Convert a jstring to its utf characters equivalent.
Expand Down
Loading

0 comments on commit d965ca5

Please sign in to comment.