Export to GitHub

google-gdata - issue #553

YouTubeQuery VideoFormat in c# doesn't match the c library


Posted on Nov 2, 2011 by Massive Ox

If you look at the code the enum in c# is:

public enum VideoFormat { FormatUndefined, RTSP, Embeddable, Mobile, }

(in c) typedef enum { GDATA_YOUTUBE_FORMAT_UNKNOWN = 0, GDATA_YOUTUBE_FORMAT_RTSP_H263_AMR = 1, GDATA_YOUTUBE_FORMAT_HTTP_SWF = 5, GDATA_YOUTUBE_FORMAT_RTSP_MPEG4_AAC = 6 } GDataYouTubeFormat;


so, when doing something like this:

int flv = (int)YouTubeQuery.VideoFormat.Embeddable;

flv gets set to 2 instead of 5.

Should the c# code be this?

public enum VideoFormat { FormatUndefined = 0, RTSP = 1, Embeddable = 5, Mobile = 6, }

Comment #1

Posted on Nov 2, 2011 by Swift Monkey

The appropriate conversions to/from int are performed in the CalculateQuery and ParseUri methods.

However, I agree that the C# code you suggest will simplify that logic. Thanks for the suggestion, I'll have that included in one of the future releases.

Comment #2

Posted on Nov 2, 2011 by Swift Monkey

(No comment was entered for this change.)

Comment #3

Posted on Nov 3, 2011 by Swift Monkey

This has been fixed in rev. 1141.

Status: Fixed