hyu163 / mp4v2

Automatically exported from code.google.com/p/mp4v2
Other
0 stars 0 forks source link

Genre not found #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,
mp4v2 cant find Genre tag in an mp4 file. I used mp4info compiled with
VS2005 C++

output:
c:\mp4v2-1.9.1\mp4v2-1.9.1\vstudio9.0\mp4info\Release>mp4info.exe "AAC_Ma
préfér
ence.m4a"
mp4info.exe version 1.9.1
AAC_Ma prΘfΘrence.m4a:
Track   Type    Info
1       audio   MPEG-4 AAC LC, 204.474 secs, 128 kbps, 44100 Hz
 Name: Ma préférenceAAC
 Artist: Julien Clerc
 Composer: Composer_JClerc
 Encoded with: iTunes 8.0.0.35, QuickTime 7.5.5
 Release Date: 1988
 Album: Preferences
 Track: 5 of 0
 BPM: 0
 Part of Compilation: no
 Part of Gapless Album: no

iTunes seems to find the genre tag "Vocal"

I am using mp4v2 1.9.1 in a project with the same result. operating system
windows xp, mp4v2 info and library was compiled with VS2005 c++ release profile

File is attached

Original issue reported on code.google.com by razone on 3 Dec 2009 at 2:50

Attachments:

GoogleCodeExporter commented 8 years ago
same issue with trunk-355

Original comment by razone on 3 Dec 2009 at 3:14

GoogleCodeExporter commented 8 years ago
The problem is that there are two ways to specify a genre.  The ~gen atom which
contains a string and the gnre atom which contains a genre number.  It appears 
that
MP4V2 only supports the ~gen atom.  I've created a fix which will support both, 
but
I'm not enlisted so I can't check it in. If you can build the source, go to
src\itmf\tags.cpp, find the line:
    fetchGenre(   cim,                         genreType,         c.genreType );
and after it add:
    if (genre == "") {
        genre = enumGenreType.data[genreType-1].formal;
        c.genre = genre.c_str();
    }
That way if the ~gen atom is empty, it will decode the gnre atom and use it.

If you can't build and would like a fixed DLL, email me at danhi@danhinsley.com.

If someone who understand both the format of MP4 files and this code sees that 
this
is a bad solution, please let me know.

Dan

Original comment by danahins...@gmail.com on 13 Dec 2009 at 9:01

GoogleCodeExporter commented 8 years ago
Thanks, it worked perfect.

razone

Original comment by razone on 14 Dec 2009 at 1:25

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Danahinsley can now commit code. Thanks Dan. Cheers Ed.  

Original comment by eddyg.o....@gmail.com on 14 Dec 2009 at 7:51

GoogleCodeExporter commented 8 years ago
Eddy,  I've tried using the same username/password that I use to log into google
code, but it doesn't like it.  Do I have some other username/password that I 
need to
use?  You can email me directly at danhi@danhinsley.com

Original comment by danahins...@gmail.com on 14 Dec 2009 at 11:57

GoogleCodeExporter commented 8 years ago
Okay, I checked this in, although with one bugfix--it also needs to make sure
genreType isn't GENRE_UNDEFINED:

    // Fix for issue #45 - two different ways to specify a genre string, the
    // ~gen atom which contains a string and the gnre atom, which contains
    // an index.  if our genre is empty and we have a valid genreType,
    // go ahead and populate genre with the correct string.
    if (genre == "" && genreType != GENRE_UNDEFINED) {
        genre = enumGenreType.data[genreType-1].formal;
        c.genre = genre.c_str();
    }

Without the extra check, files that contain either will display an empty genre 
string
in MP4Info.  Hopefully kona can drop in and comment on this change (seems out of
place to me), but it's in r378.

Original comment by kid...@gmail.com on 4 Apr 2010 at 12:56

GoogleCodeExporter commented 8 years ago
Reopening...after discussing this with Kona, I'm going to implement a slightly
different change.  Callers should be checking for both genre and genreType if 
they're
interested in a genre value.  

The basic problem here seems to be there's no way to get a string value that
corresponds with genreType.  The one thing we can do is provide a mapping 
between
string values in the enum and genreType.  But with the way the code currently 
is, it
wouldn't be possible for someone to have an empty genre, which is invalid.

Original comment by kid...@gmail.com on 23 Apr 2010 at 10:20

GoogleCodeExporter commented 8 years ago
okay--turns out you can pretty easily fetch the genreType and convert that into 
its
associated string reference:

            if ( tags->genreType ) {
                string s =
itmf::enumGenreType.toString(static_cast<itmf::GenreType>(*tags->genreType ), 
true);
                fprintf( stdout, " GenreType: %u, %s\n", *tags->genreType, s.c_str() );
            }

...I've updated mp4info to show how to do this--it follows suit with many of the
other enum types in the same file, so nothing too extraordinary here.  

I backed out dana's fix (sorry)--it gives a false impression of what's actually 
in
the file; mp4v2 should respect the fact that there truly is no "genre" tag and 
not
misreport the contents of the file.

changes should be in changeset 384.

Original comment by kid...@gmail.com on 27 Apr 2010 at 5:56

GoogleCodeExporter commented 8 years ago
Also, to the original poster, I should mention one more thing--you'll need to 
use
r355 or trunk to use genreType, I don't believe they're available in 1.9.1.

Original comment by kid...@gmail.com on 27 Apr 2010 at 6:42

GoogleCodeExporter commented 8 years ago
I`m actually using r355 with dana`s fix, tested with a lot of mp4 files and no
problems. I will upgrade to trunk and report if there are new issues.
Thanks

Original comment by razone on 27 Apr 2010 at 7:35

GoogleCodeExporter commented 8 years ago
okay--if you use trunk, please make sure you review the changes in r384--I 
updated
the command line utility to show you how to convert the genreType to its string
value.  genre will still be empty/null.

Original comment by kid...@gmail.com on 27 Apr 2010 at 8:08

GoogleCodeExporter commented 8 years ago
(many years pass)

So, I see the code in mp4info and it works fine.  My question is simply how can 
one easily use this approach in their own code which uses mp4v2.  The 
enumGenreType, toString, and assorted other bits that get called into play are 
all in the non-exposed part of the project.  I tried to use as minimal a subset 
as possible of the code and it just kept snowballing needing more headers and 
cpp files that weren't part of the API.
enumGenreType looks like it is actually in the created lib files, but I don't 
see a clean way to hook into it from outside code.

Original comment by r...@loci.net on 11 May 2015 at 8:29