<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body><br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Hi. When I try to compile the following line of code</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">av_channel_layout_copy(&c->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">taken from mux.c example I obtain the error:</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">/home/denis/Cpp/ffmpeg-6.0/libavutil/channel_layout.h:362: <strong>error: taking address of rvalue [-fpermissive]</strong></p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">../../ffmpeg-6.0/libavutil/channel_layout.h:362:5: error: taking address of rvalue [-fpermissive]</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">  362 |     { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = (nb), .u = { .mask = (m) }}</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">../../ffmpeg-6.0/libavutil/channel_layout.h:369:45: note: in expansion of macro ‘AV_CHANNEL_LAYOUT_MASK’</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">  369 | #define AV_CHANNEL_LAYOUT_STEREO            AV_CHANNEL_LAYOUT_MASK(2,  AV_CH_LAYOUT_STEREO)</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">      |                                             ^~~~~~~~~~~~~~~~~~~~~~</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">../ffmpegTest/main.cpp:157:65: note: in expansion of macro ‘AV_CHANNEL_LAYOUT_STEREO’</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">  157 |         av_channel_layout_copy(&c->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">      |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">How can I translate it to work in Windows, Linux and Mac?</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Something like this?</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">        AVChannelLayout a= AV_CHANNEL_LAYOUT_STEREO;</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">        av_channel_layout_copy(&c->ch_layout, &a);</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><br />-- </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><span style="background-color:#ffffff;"><span style="font-size:-0.083em;"><span style="color:#232629;">+39.347.4070897</span></span></span></p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><a href="http://www.labcsp.com">http://www.labcsp.com</a><span style="color:#232629;"> </span></p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><a href="http://www.denisgottardello.it">http://www.denisgottardello.it</a><span style="color:#232629;"> </span></p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><span style="background-color:#ffffff;"><span style="color:#232629;">GMT+1</span></span></p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><span style="background-color:#ffffff;"><span style="color:#232629;">Skype: mrdebug</span></span></p>
</body>
</html>