tarzanking / javacpp

Automatically exported from code.google.com/p/javacpp
GNU General Public License v2.0
0 stars 0 forks source link

ffmpeg presets produces uncompileable parsed .java file for avdevice.h #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Check out, build and install the latest git head of ffmpeg
2. Build javacpp presets for ffmpeg

What is the expected output? What do you see instead?
The AVAppToDevMessageType and AVDevToAppMessageType enums result in the 
following java code being created:

public static final int public static native @MemberGetter int 
AV_APP_TO_DEV_NONE();

This should simply read:

public static native @MemberGetter int AV_APP_TO_DEV_NONE();

What version of the product are you using? On what operating system?
Latest git head of javacpp and javacpp presets, latest git head of ffmpeg. 
Linux OS.

Please provide any additional information below.
I didn't spend too much time working out how the tokenisation/parsing engine 
works so I can't give a perfect fix. It can however be worked around by adding 
the following code after line 2598 of Parser.h:

decl.text = decl.text.replace("public static final int public static native 
@MemberGetter int", "public static native @MemberGetter int");

Original issue reported on code.google.com by ed.torb...@gmail.com on 6 Mar 2014 at 11:55

GoogleCodeExporter commented 9 years ago
Please note that the latest git head of ffmpeg produces a number of other 
compilation errors that I have not detailed here as most of these are due to 
new compiler definitions that need adding. There is also a change required to 
avformat.h as the order of some #defines within the file currently causes 
uncompileable code to be generated. However, I feel that this is a failing on 
the part of the header file, not javacpp presets.

Original comment by ed.torb...@gmail.com on 6 Mar 2014 at 11:59

GoogleCodeExporter commented 9 years ago
Yes, the header files always change a bit. The current presets work for FFmpeg 
2.1.x. We'll need to adjust them, and possibly fix the Parser, because it's not 
perfect, it's mostly heuristics. It's not possible to map one-to-one C/C++ to 
Java, but I'm doing a lot better than I had hoped just a couple of years ago :)

And BTW, thanks for testing this out!

Original comment by samuel.a...@gmail.com on 8 Mar 2014 at 3:03

GoogleCodeExporter commented 9 years ago
BTW, I've updated the presets to FFmpeg 2.1.4, and didn't need to fix anything 
to get it working:
http://code.google.com/p/javacpp/wiki/Presets#Changes
That comes with most of the recent bug fixes, but uses the "old" 2.1.x API. Is 
there something that you require from the head that doesn't come with 2.1.4?

Original comment by samuel.a...@gmail.com on 23 Mar 2014 at 2:10

GoogleCodeExporter commented 9 years ago
Ok, I've updated the presets to FFmpeg 2.2. I had to fix a couple of problems 
with the parsing of enumerations as well as update the presets themselves, but 
it wasn't anything big. I did not test it, but it should work fine for the 
current HEAD as well. Please let me know if you encounter any problems! Thanks

Original comment by samuel.a...@gmail.com on 30 Mar 2014 at 1:56

GoogleCodeExporter commented 9 years ago
Hi,
I'm having trouble compiling the presets for ffmpeg. Specifically regarding how 
enums are parsed. I downloaded the latest ffmpeg headers and also javacpp 
presets source code from github. The generated code cannot compile looks like 
mostly because the enums are not parsed correctly. For example the following 
line in avutil.java:

public native @ByRef AVColorSpace colorspace(); public native AVFrame 
colorspace(AVColorSpace colorspace);

but there's no type for AVColorSpace, instead, here's the how AVColorSpace is 
parsed :
/**
 * YUV colorspace type.
 */
/** enum AVColorSpace */
public static final int
    AVCOL_SPC_RGB         = 0,
    /** also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B */
    AVCOL_SPC_BT709       = 1,
    AVCOL_SPC_UNSPECIFIED = 2,
    AVCOL_SPC_FCC         = 4,
    /** also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 */
    AVCOL_SPC_BT470BG     = 5,
    /** also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above */
    AVCOL_SPC_SMPTE170M   = 6,
    AVCOL_SPC_SMPTE240M   = 7,
    /** Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 */
    AVCOL_SPC_YCOCG       = 8,
    /** ITU-R BT2020 non-constant luminance system */
    AVCOL_SPC_BT2020_NCL  = 9,
    /** ITU-R BT2020 constant luminance system */
    AVCOL_SPC_BT2020_CL   = 10,
    /** Not part of ABI */
    AVCOL_SPC_NB = 11;
public static final int AVCOL_SPC_YCGCO = AVCOL_SPC_YCOCG;

Please see attached for generated file.

Thanks a lot for your help!
Percy

Original comment by percy.z...@gmail.com on 5 Jun 2014 at 6:20

Attachments:

GoogleCodeExporter commented 9 years ago
Latest version 0.9 builds FFmpeg master just fine. Please reopen on GitHub if 
necessary, and thanks for reporting!

Original comment by samuel.a...@gmail.com on 7 Aug 2014 at 12:34