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

Benoit Fouet benoit.fouet
Thu Jun 14 09:40:20 CEST 2007


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 ?

Ben
-- 
Purple Labs S.A.
www.purplelabs.com




More information about the ffmpeg-devel mailing list