[Libav-user] Using av_channel_layout_copy() function in Win, Linux, Mac (c++)

Denis Gottardello info at denisgottardello.it
Wed Aug 30 16:39:08 EEST 2023


Hi. When I try to compile the following line of code

av_channel_layout_copy(&c->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);

taken from mux.c example I obtain the error:

/home/denis/Cpp/ffmpeg-6.0/libavutil/channel_layout.h:362: *error: taking address of rvalue [-fpermissive]*
../../ffmpeg-6.0/libavutil/channel_layout.h:362:5: error: taking address of rvalue [-fpermissive]
  362 |     { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = (nb), .u = { .mask = (m) }}
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../ffmpeg-6.0/libavutil/channel_layout.h:369:45: note: in expansion of macro ‘AV_CHANNEL_LAYOUT_MASK’
  369 | #define AV_CHANNEL_LAYOUT_STEREO            AV_CHANNEL_LAYOUT_MASK(2,  AV_CH_LAYOUT_STEREO)
      |                                             ^~~~~~~~~~~~~~~~~~~~~~
../ffmpegTest/main.cpp:157:65: note: in expansion of macro ‘AV_CHANNEL_LAYOUT_STEREO’
  157 |         av_channel_layout_copy(&c->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);
      |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~

How can I translate it to work in Windows, Linux and Mac?
Something like this?

        AVChannelLayout a= AV_CHANNEL_LAYOUT_STEREO;
        av_channel_layout_copy(&c->ch_layout, &a);

-- 
+39.347.4070897
http://www.labcsp.com[1] 
http://www.denisgottardello.it[2] 
GMT+1
Skype: mrdebug

--------
[1] http://www.labcsp.com
[2] http://www.denisgottardello.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20230830/a3142b01/attachment.htm>


More information about the Libav-user mailing list