zergon321/reisen

Re-enable macOS support

Closed this issue · 6 comments

Thanks for the great project. I used the tagged version but wanted to contribute so switched to master, where I had some trouble:

On master the project no longer works on darwin, but it does in 0.1.1.
The change for a windows fix moved audio.go (and video.go) to a -windows and -linux suffix, but there is no -darwin so compile fails.

Uploaded the fix to master. Should work now.

Thank you, that fixes the Go compile error.
However there is still an issue in the CGo compilation - not sure exactly why.
I'm using Big Sur on an Intel Mac.

# github.com/zergon321/reisen
../../../.go/pkg/mod/github.com/zergon321/reisen@v0.1.2-0.20211117093043-7b9e910bde82/audio.go:61:9: cannot use _Ctype_long(audio.baseStream.codecCtx.channel_layout) (type _Ctype_long) as type _Ctype_longlong in argument to _Cfunc_swr_alloc_set_opts

Ok...

Well, I had the same problem on Windows. It required explicit type conversions with C.longlong. You can see how it's done in audio_windows.go. Apparently, Mac OS requires the same type of fix at some places in the source code.

I don't own a computer by Apple so it's impossible for me to track all the type conversion errors (more of them can emerge during the fixing process). Could you please first create a PR with type conversions fixed? The only thing that is required to do is to create separate versions of audio.go and video.go (if necessary) for darwin just like I did it for Windows.

Oh, OK - I was worried about the large duplication it would create, but if that is the right thing I can do that.

I opened a PR that did this whilst removing the duplication, I hope that is OK.
I have not tested all OS yet, but the changes per-platform should now be cleaner so it should be easier to maintain when these things happen.

Tested now on macOS and Linux :)