On date Wednesday 2008-03-19 08:43:30 -0400, Mike wrote:
> 
> ----- Original Message ----- 
> From: "Matteo Battaglio" <[EMAIL PROTECTED]>
> To: "ffmpeg" <[email protected]>
> Sent: Tuesday, March 18, 2008 1:11 PM
> Subject: [libav-user] Syntax problem in Windows
> 
> 
> > Hi,
> > I'm encountering a problem in using some ffmpeg code in my Visual
> > Studio 2005 C++ project.
> > It's a syntax error: I have the PixFmtInfo struct declaration, and
> > after it I have the declaration and initialization of an array of
> > PixFmtInfo elements, but it seams that the visual c++ compiler doesn't
> > allow a declaration of an array in wich it is specified the element
> > position before the element initialization:
> >
> > Here is the code of the struct declaration:
> >
> > typedef struct PixFmtInfo {
> >    const char *name;
> >    uint8_t nb_channels;     /**< number of channels (including alpha) */
> >    uint8_t color_type;      /**< color type (see FF_COLOR_xxx constants) 
> > */
> >    uint8_t pixel_type;      /**< pixel storage type (see FF_PIXEL_xxx
> > constants) */
> >    uint8_t is_alpha : 1;    /**< true if alpha can be specified */
> >    uint8_t x_chroma_shift;  /**< X chroma subsampling factor is 2 ^ shift 
> > */
> >    uint8_t y_chroma_shift;  /**< Y chroma subsampling factor is 2 ^ shift 
> > */
> >    uint8_t depth;           /**< bit depth of the color components */
> > } PixFmtInfo;
> >
> > And here is the code of the array decl. and init.
> > The compiler founds a syntax error at the [ symbol of [PIX_FMT_YUV420P]
> >
> > /* this table gives more information about formats */
> > static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
> >    /* YUV formats */
> >        [PIX_FMT_YUV420P] = {
> >        .name = "yuv420p",
> >        .nb_channels = 3,
> >        .color_type = FF_COLOR_YUV,
> >        .pixel_type = FF_PIXEL_PLANAR,
> >        .depth = 8,
> >        .x_chroma_shift = 1, .y_chroma_shift = 1,
> >    },
[...]
> >    [PIX_FMT_RGB32_1] = {
> >        .name = "rgb32_1",
> >        .nb_channels = 4, .is_alpha = 1,
> >        .color_type = FF_COLOR_RGB,
> >        .pixel_type = FF_PIXEL_PACKED,
> >        .depth = 8,
> >        .x_chroma_shift = 0, .y_chroma_shift = 0,
> >    },
> > };

Hi, I'm not sure if this syntax is a gcc-ism or a C99 feature (anyway
MSVC isn't expicitily supposed to be a ISO C99 compiler), and the
recommended way to compile FFmpeg under Windows is by using the Mingw
environment.

[...]
> You should be able to declare the array in a header file and populate it in 
> a cpp file. 

Regards.
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to