jakemoroni / audio_async_loopback

Real-time S/PDIF PCM/AC3 capture and playback
GNU General Public License v3.0
26 stars 7 forks source link

Binary Compile Request #1

Closed cc452 closed 3 years ago

cc452 commented 3 years ago

Any chance you could provide a compiled binary for Windows? I've been attempting to compile this, and unfortunately, I can't seem to get it to work. (Granted, I'm not used to compiling code on Windows. I mostly work in Linux.)

Here's the output from my latest attempt:

$ gcc -o audio_async_loopback main.c iec_61937.c pcm_sink.c ac3_sink.c -lpulse-simple -lsamplerate -lpthread -lavutil -lavcodec -Wall -O3 -flto -I .
main.c: In function ‘main’:
main.c:220:5: warning: implicit declaration of function ‘avcodec_register_all’ [-Wimplicit-function-declaration]
  220 |     avcodec_register_all();
      |     ^~~~~~~~~~~~~~~~~~~~
ac3_sink.c: In function ‘ac3_sink_open’:
ac3_sink.c:181:5: warning: ‘av_init_packet’ is deprecated [-Wdeprecated-declarations]
  181 |     av_init_packet(&inst->packet);
      |     ^~~~~~~~~~~~~~
In file included from ./libavcodec/bsf.h:30,
                 from ./libavcodec/avcodec.h:44,
                 from ac3_sink.h:27,
                 from ac3_sink.c:30:
./libavcodec/packet.h:474:6: note: declared here
  474 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
ac3_sink.c:186:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  186 |     inst->codec = avcodec_find_decoder(AV_CODEC_ID_AC3);
      |                 ^
ac3_sink.c: In function ‘ac3_sink_process’:
ac3_sink.c:289:13: warning: implicit declaration of function ‘avcodec_decode_audio4’; did you mean ‘avcodec_decode_subtitle2’? [-Wimplicit-function-declaration]
  289 |     error = avcodec_decode_audio4(inst->cctx, inst->frame, &got_one, &inst->packet);
      |             ^~~~~~~~~~~~~~~~~~~~~
      |             avcodec_decode_subtitle2
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lpulse-simple
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lavutil
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lavcodec
collect2: error: ld returned 1 exit status
jakemoroni commented 3 years ago

Did you manage to figure this out?

It looks like maybe some of the libraries are missing from your toolchain.

That said, even if you’re able to get it to build for Windows (assuming with Cygwin), I’m not sure if it will actually work mainly because I’m not sure about how audio is handled with Cygwin. My program sort of assumes that Pulseaudio is the main sound server and that there’s no resampling or volume control happening on the input. I’m sure Windows can be configured for this (with Pulseaudio sitting on top from Cygwin), but I’m not sure how.