Add javadoc, add another patch to compile ffmpeg on 64-bit (relocation problem => visibility hidden) and update JNI ffmpeg README.

cusax-fix
Sebastien Vincent 16 years ago
parent 3452403edd
commit 4aa53d8155

@ -66,6 +66,8 @@ Note: mingw64-make failed to work (segmentation fault) that's why we fallback to
- Linux, FreeBSD
Note: remove --enable-pic for x86 architecture.
./configure \
--enable-pic \
--enable-static --disable-shared --shlibdir=. \
@ -79,7 +81,11 @@ Note: mingw64-make failed to work (segmentation fault) that's why we fallback to
--disable-ffserver --disable-ffplay --disable-ffmpeg \
--enable-pthreads
- Mac OS X(removed from configure script the option to add -mdynamic-no-pic)
- Mac OS X
Note: removed from configure script the option to add -mdynamic-no-pic unless you compile
for i386 architecture (intel 32-bit).
./configure \
--enable-static --disable-shared --shlibdir=. \
--disable-encoders --disable-decoders --disable-muxers --disable-demuxers \
@ -102,9 +108,10 @@ make (gmake on FreeBSD)
Note:
If compilation errors related to "relocation" occured, you
have to patch ffmpeg (more specifically libswscale) and x264.
have to patch ffmpeg, libswscale and x264.
Apply the following patches in the relevant directory:
- x264-20091208-visibility-hidden.patch
- ffmpeg-visibility-hidden.patch
- ffmpeg-libswcale-visibility-hidden.patch

@ -0,0 +1,61 @@
Index: libavcodec/x86/dsputil_mmx.c
===================================================================
--- libavcodec/x86/dsputil_mmx.c (révision 20783)
+++ libavcodec/x86/dsputil_mmx.c (copie de travail)
@@ -46,32 +46,32 @@
DECLARE_ALIGNED_16(const uint64_t, ff_pdw_80000000[2]) =
{0x8000000080000000ULL, 0x8000000080000000ULL};
-DECLARE_ALIGNED_8 (const uint64_t, ff_pw_3 ) = 0x0003000300030003ULL;
-DECLARE_ALIGNED_8 (const uint64_t, ff_pw_4 ) = 0x0004000400040004ULL;
-DECLARE_ALIGNED_16(const xmm_reg, ff_pw_5 ) = {0x0005000500050005ULL, 0x0005000500050005ULL};
-DECLARE_ALIGNED_16(const xmm_reg, ff_pw_8 ) = {0x0008000800080008ULL, 0x0008000800080008ULL};
-DECLARE_ALIGNED_8 (const uint64_t, ff_pw_15 ) = 0x000F000F000F000FULL;
-DECLARE_ALIGNED_16(const xmm_reg, ff_pw_16 ) = {0x0010001000100010ULL, 0x0010001000100010ULL};
-DECLARE_ALIGNED_8 (const uint64_t, ff_pw_20 ) = 0x0014001400140014ULL;
-DECLARE_ALIGNED_16(const xmm_reg, ff_pw_28 ) = {0x001C001C001C001CULL, 0x001C001C001C001CULL};
-DECLARE_ALIGNED_16(const xmm_reg, ff_pw_32 ) = {0x0020002000200020ULL, 0x0020002000200020ULL};
-DECLARE_ALIGNED_8 (const uint64_t, ff_pw_42 ) = 0x002A002A002A002AULL;
-DECLARE_ALIGNED_16(const xmm_reg, ff_pw_64 ) = {0x0040004000400040ULL, 0x0040004000400040ULL};
-DECLARE_ALIGNED_8 (const uint64_t, ff_pw_96 ) = 0x0060006000600060ULL;
-DECLARE_ALIGNED_8 (const uint64_t, ff_pw_128) = 0x0080008000800080ULL;
-DECLARE_ALIGNED_8 (const uint64_t, ff_pw_255) = 0x00ff00ff00ff00ffULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pw_3 )__attribute__((visibility("hidden"))) = 0x0003000300030003ULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pw_4 )__attribute__((visibility("hidden"))) = 0x0004000400040004ULL;
+DECLARE_ALIGNED_16(const xmm_reg, ff_pw_5 )__attribute__((visibility("hidden"))) = {0x0005000500050005ULL, 0x0005000500050005ULL};
+DECLARE_ALIGNED_16(const xmm_reg, ff_pw_8 )__attribute__((visibility("hidden"))) = {0x0008000800080008ULL, 0x0008000800080008ULL};
+DECLARE_ALIGNED_8 (const uint64_t, ff_pw_15 )__attribute__((visibility("hidden"))) = 0x000F000F000F000FULL;
+DECLARE_ALIGNED_16(const xmm_reg, ff_pw_16 )__attribute__((visibility("hidden"))) = {0x0010001000100010ULL, 0x0010001000100010ULL};
+DECLARE_ALIGNED_8 (const uint64_t, ff_pw_20 )__attribute__((visibility("hidden"))) = 0x0014001400140014ULL;
+DECLARE_ALIGNED_16(const xmm_reg, ff_pw_28 )__attribute__((visibility("hidden"))) = {0x001C001C001C001CULL, 0x001C001C001C001CULL};
+DECLARE_ALIGNED_16(const xmm_reg, ff_pw_32 )__attribute__((visibility("hidden"))) = {0x0020002000200020ULL, 0x0020002000200020ULL};
+DECLARE_ALIGNED_8 (const uint64_t, ff_pw_42 )__attribute__((visibility("hidden"))) = 0x002A002A002A002AULL;
+DECLARE_ALIGNED_16(const xmm_reg, ff_pw_64 )__attribute__((visibility("hidden"))) = {0x0040004000400040ULL, 0x0040004000400040ULL};
+DECLARE_ALIGNED_8 (const uint64_t, ff_pw_96 )__attribute__((visibility("hidden"))) = 0x0060006000600060ULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pw_128)__attribute__((visibility("hidden"))) = 0x0080008000800080ULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pw_255)__attribute__((visibility("hidden"))) = 0x00ff00ff00ff00ffULL;
-DECLARE_ALIGNED_8 (const uint64_t, ff_pb_1 ) = 0x0101010101010101ULL;
-DECLARE_ALIGNED_8 (const uint64_t, ff_pb_3 ) = 0x0303030303030303ULL;
-DECLARE_ALIGNED_8 (const uint64_t, ff_pb_7 ) = 0x0707070707070707ULL;
-DECLARE_ALIGNED_8 (const uint64_t, ff_pb_1F ) = 0x1F1F1F1F1F1F1F1FULL;
-DECLARE_ALIGNED_8 (const uint64_t, ff_pb_3F ) = 0x3F3F3F3F3F3F3F3FULL;
-DECLARE_ALIGNED_8 (const uint64_t, ff_pb_81 ) = 0x8181818181818181ULL;
-DECLARE_ALIGNED_8 (const uint64_t, ff_pb_A1 ) = 0xA1A1A1A1A1A1A1A1ULL;
-DECLARE_ALIGNED_8 (const uint64_t, ff_pb_FC ) = 0xFCFCFCFCFCFCFCFCULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pb_1 )__attribute__((visibility("hidden"))) = 0x0101010101010101ULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pb_3 )__attribute__((visibility("hidden"))) = 0x0303030303030303ULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pb_7 )__attribute__((visibility("hidden"))) = 0x0707070707070707ULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pb_1F )__attribute__((visibility("hidden"))) = 0x1F1F1F1F1F1F1F1FULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pb_3F )__attribute__((visibility("hidden"))) = 0x3F3F3F3F3F3F3F3FULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pb_81 )__attribute__((visibility("hidden"))) = 0x8181818181818181ULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pb_A1 )__attribute__((visibility("hidden"))) = 0xA1A1A1A1A1A1A1A1ULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pb_FC )__attribute__((visibility("hidden"))) = 0xFCFCFCFCFCFCFCFCULL;
-DECLARE_ALIGNED_16(const double, ff_pd_1[2]) = { 1.0, 1.0 };
-DECLARE_ALIGNED_16(const double, ff_pd_2[2]) = { 2.0, 2.0 };
+DECLARE_ALIGNED_16(const double, ff_pd_1[2])__attribute__((visibility("hidden"))) = { 1.0, 1.0 };
+DECLARE_ALIGNED_16(const double, ff_pd_2[2])__attribute__((visibility("hidden"))) = { 2.0, 2.0 };
#define JUMPALIGN() __asm__ volatile (ASMALIGN(3)::)
#define MOVQ_ZERO(regd) __asm__ volatile ("pxor %%" #regd ", %%" #regd ::)

@ -23,6 +23,9 @@
public class AVFrameFormat
extends VideoFormat
{
/**
* Native FFMPEG format used.
*/
private int pixFmt;
/**
@ -61,6 +64,11 @@ public Object clone()
return f;
}
/**
* Copy specified <tt>Format</tt>.
*
* @param f <tt>Format</tt> to be copied
*/
@Override
protected void copy(Format f)
{
@ -97,6 +105,11 @@ public boolean equals(Object obj)
return false;
}
/**
* Get the native FFMPEG format.
*
* @return native format
*/
public int getPixFmt()
{
return pixFmt;

@ -26,26 +26,40 @@
public class JNIDecoder
extends AbstractCodec
{
/**
* Plugin name.
*/
private static final String PLUGIN_NAME = "H.264 Decoder";
private static final int RED_MASK = 0xff0000;
private static final int GREEN_MASK = 0x00ff00;
private static final int BLUE_MASK = 0x0000ff;
/**
* The default output <tt>VideoFormat</tt>.
*/
private static final VideoFormat[] DEFAULT_OUTPUT_FORMATS
= new VideoFormat[] { new AVFrameFormat() };
// The codec we will use
/**
* The codec context native pointer we will use.
*/
private long avcontext;
// The decoded data is stored in avpicture in native ffmpeg format (YUV)
/**
* The decoded data is stored in avpicture in native ffmpeg format (YUV).
*/
private long avframe;
/**
* If decoder has got a picture.
*/
private final boolean[] got_picture = new boolean[1];
/**
* Array of output <tt>VideoFormat</tt>s.
*/
private final VideoFormat[] outputFormats;
// current width of video, so we can detect changes in video size
/**
* Current width of video, so we can detect changes in video size.
*/
private int width;
/**
@ -69,11 +83,20 @@ public JNIDecoder()
width = outputFormats[0].getSize().width;
}
/**
* Check <tt>Format</tt>.
*
* @param format <tt>Format</tt> to check
* @return true if <tt>Format</tt> is H264_RTP
*/
public boolean checkFormat(Format format)
{
return format.getEncoding().equals(Constants.H264_RTP);
}
/**
* Close <tt>Codec</tt>.
*/
@Override
public synchronized void close()
{
@ -91,11 +114,24 @@ public synchronized void close()
}
}
/**
* Ensure frame rate.
*
* @param frameRate frame rate
* @return frame rate
*/
private float ensureFrameRate(float frameRate)
{
return frameRate;
}
/**
* Get matching outputs for a specified input <tt>Format</tt>.
*
* @param in input <tt>Format</tt>
* @return array of matching outputs or null if there are no matching
* outputs.
*/
protected Format[] getMatchingOutputFormats(Format in)
{
VideoFormat ivf = (VideoFormat) in;
@ -123,15 +159,24 @@ protected Format[] getMatchingOutputFormats(Format in)
};
}
/**
* Get plugin name.
*
* @return "H.264 Decoder"
*/
@Override
public String getName()
{
return PLUGIN_NAME;
}
/**
* Get all supported output <tt>Format</tt>s.
*
* @return array of supported <tt>Format</tt>
*/
public Format[] getSupportedOutputFormats(Format in)
{
// null input format
if (in == null)
return DEFAULT_OUTPUT_FORMATS;
@ -169,6 +214,14 @@ public synchronized void open()
super.open();
}
/**
* Process input <tt>Buffer</tt>.
*
* @param inputBuffer input <tt>Buffer</tt>
* @param inputBuffer output <tt>Buffer</tt>
* @return <tt>BUFFER_PROCESSED_OK</tt> if buffer has been successfully
* processed
*/
public synchronized int process(Buffer inputBuffer, Buffer outputBuffer)
{
if (!checkInputBuffer(inputBuffer))

Loading…
Cancel
Save