[FFmpeg-devel] [PATCH] ffmpeg doesn't decode track number on some wma files

Patrice Bensoussan patrice.bensoussan
Thu Jun 14 09:54:37 CEST 2007


Hello,

On 14 Jun 2007, at 08:40, Benoit Fouet wrote:

> Hi,
>
> Patrice Bensoussan wrote:
>> Hi,
>>
>> On 14 Jun 2007, at 00:34, Patrice Bensoussan wrote:
>>
>>>
>>> On 14 Jun 2007, at 00:20, Patrice Bensoussan wrote:
>>>
>>>> Hello,
>>>>
>>>> It seems that ffmpeg doesn't decode the track number on some wma
>>>> files. The reason for this is that these files are using strings to
>>>> store this information rather than word/dword.
>>>>
>>>> Here is a patch to fix this problem and properly set the track
>>>> number information for these files.
>>>> Patrice
>>>>
>>>> <fix-wma-track-number.txt>
>>>>
>>>
>>> Forgot to include MS documentation which says that both dword and
>>> string should be supported:
>>>
>>> http://msdn2.microsoft.com/en-au/library/aa392015.aspx
>>>
>>
>> Actually, the same issue is true for WM/Track too:
>>
>> http://msdn2.microsoft.com/en-au/library/aa392014.aspx
>>
>> Here is a new version of the patch which fixes both cases.
>>
>> Patrice
>>
>> --------------------------------------------------------------------- 
>> ---
>>
>> Index: libavformat/asf.c
>> ===================================================================
>> --- libavformat/asf.c	(revision 9304)
>> +++ libavformat/asf.c	(working copy)
>> @@ -389,6 +389,16 @@
>>                          {
>>                                  if     (!strcmp(name,"WM/ 
>> AlbumTitle")) get_str16_nolen(pb, value_len, s->album, sizeof(s- 
>> >album));
>>                                  else if(!strcmp(name,"WM/ 
>> Genre"     )) get_str16_nolen(pb, value_len, s->genre, sizeof(s- 
>> >genre));
>> +                                else if (!strcmp(name,"WM/Track")) {
>> +                                    char track[8];
>> +                                    get_str16_nolen(pb,  
>> value_len, track, sizeof(track));
>> +                                    s->track = strtol(track,  
>> NULL, 10) + 1;
>> +                                }
>> +                                else if (!strcmp(name,"WM/ 
>> TrackNumber")) {
>> +                                    char track[8];
>> +                                    get_str16_nolen(pb,  
>> value_len, track, sizeof(track));
>> +                                    s->track = strtol(track,  
>> NULL, 10);
>> +                                }
>>
>
> you should try to keep the nice alignment
> also, if i read correctly, it is the very same code for the two  
> else if
> you added. Why not add them into a single one ?

The alignment seems to be correct for me (I checked with an hex  
editor and can only see spaces unless I am missing something). I  
didn't add them into a single one because the code is different. WM/ 
Track is zero based, WM/TrackNumber is not). This means I would have  
to test twice WM/Track to know when to add 1 which is kind of ugly  
too...

Patrice





More information about the ffmpeg-devel mailing list