-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get TagLib 2.0.1 working #143
Conversation
@robinst what do you think about merging |
434d8a7
to
6be8db5
Compare
This isn't quite there yet; we need to fix |
6be8db5
to
5578b75
Compare
I think I fixed this now by replacing a lot of |
5962a86
to
a60bfb4
Compare
Still not sure if I'm handling For now I have told Swig to use |
a60bfb4
to
e147a19
Compare
Sounds good. Also fine with rebasing if that's easier. |
This will help with the switch to TagLib 2 because that version has a dependency in a Git submodule.
bbdd6ed
to
c06a8ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote some note about the changes.
@@ -20,6 +20,7 @@ | |||
|
|||
// Ignore IOStream and all the constructors using it. | |||
%ignore IOStream; | |||
%ignore TagLib::RIFF::AIFF::File::File(IOStream *, bool, Properties::ReadStyle, ID3v2::FrameFactory *); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new constructor we have to ignore because it uses IOStream.
@@ -26,6 +26,7 @@ namespace TagLib { | |||
typedef unsigned char uchar; | |||
typedef unsigned int uint; | |||
typedef unsigned long ulong; | |||
using offset_t = long long; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to do the job of telling Swig that offset_t is an integer type and not a C++ object. On platforms where offset_t is smaller than long long, this will use an intermediate long long variable before converting to offset_t.
@@ -3211,17 +3325,19 @@ _wrap_File_find__SWIG_0(int argc, VALUE *argv, VALUE self) { | |||
tmp2 = ruby_string_to_taglib_bytevector(argv[0]); | |||
arg2 = &tmp2; | |||
} | |||
ecode3 = SWIG_AsVal_long(argv[1], &val3); | |||
ecode3 = SWIG_AsVal_long_SS_long(argv[1], &val3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an example of how the Swig definition of offset_t as long long turns out. First Swig converts a ruby object argv[1]
to a long long stored in val3
.
} | ||
arg3 = static_cast< long >(val3); | ||
arg3 = static_cast< TagLib::offset_t >(val3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here long long val3
is cast to TagLib::offset_t arg3
.
vresult = SWIG_From_long(static_cast< long >(result)); | ||
result = (TagLib::offset_t)(arg1)->find((TagLib::ByteVector const &)*arg2,arg3,(TagLib::ByteVector const &)*arg4); | ||
{ | ||
vresult = taglib_offset_t_to_ruby_int(result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the way out, an offset_t value is passed to our taglib_offset_t_to_ruby_int function which uses the Ruby LL2NUM
or OFFT2NUM
macro depending on the compile constant _WIN32
.
%freefunc TagLib::MP4::File "free_taglib_mp4_file"; | ||
|
||
// Ignore IOStream and all the constructors using it. | ||
%ignore IOStream; | ||
%ignore TagLib::MP4::File::File(IOStream *, bool, Properties::ReadStyle); | ||
%ignore TagLib::MP4::File::File(IOStream *, bool, Properties::ReadStyle, ItemFactory *); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another new constructor for us to ignore.
@@ -14,6 +14,7 @@ | |||
%ignore TagLib::MPEG::Header::operator=; | |||
%include <taglib/xingheader.h> | |||
|
|||
%include <taglib/id3v2.h> | |||
%include <taglib/mpegheader.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As before in id3v2.i we need this new header file.
@@ -30,6 +31,10 @@ | |||
%ignore TagLib::MPEG::File::File(IOStream *, ID3v2::FrameFactory *, bool, Properties::ReadStyle); | |||
%ignore TagLib::MPEG::File::File(IOStream *, ID3v2::FrameFactory *, bool); | |||
%ignore TagLib::MPEG::File::File(IOStream *, ID3v2::FrameFactory *); | |||
%ignore TagLib::MPEG::File::File(IOStream *, bool, Properties::ReadStyle, ID3v2::FrameFactory *); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More ignored IOStream constructors.
@@ -4,8 +4,6 @@ | |||
#include <taglib/oggfile.h> | |||
#include <taglib/flacpicture.h> | |||
#include <taglib/xiphcomment.h> | |||
// Help find FLAC:: | |||
using namespace TagLib; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything still works without this line.
ext/taglib_wav/taglib_wav.i
Outdated
@@ -4,7 +4,7 @@ | |||
#include <taglib/wavfile.h> | |||
#include <taglib/wavproperties.h> | |||
#include <taglib/id3v2tag.h> | |||
using namespace TagLib::RIFF; | |||
using StripTags = TagLib::File::StripTags; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're doing something wrong here. Swig is not "seeing" TagLib::File so it doesn't know what StripTags is. The proper solution would be to %include <taglib/rifffile.h>
but then we run afoul of namespace flattening.
Maybe we need a separate .i for riff?
Since the test pass now, maybe we should fix this in a later PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured out how to do it, it was a matter of %ignore TagLib::RIFF::File
.
c06a8ec
to
2e0a425
Compare
@@ -14,12 +14,16 @@ | |||
%ignore TagLib::RIFF::AIFF::Properties::length; | |||
%ignore TagLib::RIFF::AIFF::Properties::sampleWidth; | |||
|
|||
%ignore TagLib::RIFF::File; | |||
%include <taglib/rifffile.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a Swig warning:
Warning 401: Nothing known about base class 'TagLib::RIFF::File'. Ignored.
@@ -4,7 +4,6 @@ | |||
#include <taglib/wavfile.h> | |||
#include <taglib/wavproperties.h> | |||
#include <taglib/id3v2tag.h> | |||
using namespace TagLib::RIFF; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced this line with %include <taglib/rifffile.h>
below.
@ufleisch I have turned your patch from #129 (comment) into a commit in this PR, I hope that is OK. ee55a43 @robinst I think this PR is ready for review. |
I am not really a great help concerning Ruby and SWIG, so I am just trying to comment about what was discussed concerning TagLib:
|
@ufleisch thanks for taking a look! I didn't mean to complain about Regarding the properties interfaces: I agree it would be good to support them for the reason you state. We never did until now because we wanted to remain compatible with older taglib 1.x versions that didn't have properties. The reason I'm letting SWIG ignore them in this PR is that I don't want to do too many things in one PR. My main question was if you are OK with the fact that I made a commit with your name in it (by feeding the patch you posted to |
Of course this is OK, thanks for all your work! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pulls together various commits into something reasonably clean that: