Derivation
Application
(x, y) = (OQ × cos(ϕ-α), OQ × sin(ϕ-α))
= (x cos(α) + y sin(α), y cos(α) - x sin(α))
Accredited eccentric computer dilettante wasting time on internet.
(x, y) = (OQ × cos(ϕ-α), OQ × sin(ϕ-α))
= (x cos(α) + y sin(α), y cos(α) - x sin(α))
FFmpeg, one of the finest open source software which is a swiss-army knife of multimedia, being used by virtually every media transcoder or player in the world has no guides on how to use the API and provides out of date examples.
Out of the entire framework, libswresample would be the most miserable thing to work with. Its documentation is not clear about how resampling should be done and due to outdated examples none can figure out the elegant way out.
Ironically, the elegant way without swr_delay()
calculation is in its fork, Libav. Combining that with the modern libswresample AVFrame API, I was able to get it working.
Despite all this libswresample provides FFmpeg framework interoperability and sample-format conversion or channel re-matrixing or up/downmixing, which most other libraries don't all at once.
swr_alloc_set_opts()
or the AVOptions API. It's not that you can't change the resampler parameters once you've configured it, you can with the AVOptions API.int ret; SwrContext *swr = swr_alloc_set_opts(NULL, // we're allocating a new context AV_CH_LAYOUT_STEREO, // out_ch_layout AV_SAMPLE_FMT_S16, // out_sample_fmt 44100, // out_sample_rate AV_CH_LAYOUT_MONO, // in_ch_layout AV_SAMPLE_FMT_S16P, // in_sample_fmt 48000, // in_sample_rate 0, // [ignore these NULL); // we dont need] // assume returning of -1 as error if(swr != NULL) return -1; ret = swr_init(swr); if(ret != 0) return -1; AVFrame* out = av_frame_alloc(); out->format = AV_SAMPLE_FMT_S16; out->channel_layout = AV_CH_LAYOUT_STEREO; out->sample_rate = 44100; out->nb_samples = 666;
// if you input supply ends stop feeding it data. { ret = swr_convert_frame(swr, NULL, in); // if in a rare circumstance the audio config changes, reconfigure then convert. // you should ignore this if you can assure that your input never changes. if(ret == AVERROR_INPUT_CHANGED) { av_opt_set_channel_layout(swr, "icl", in->channel_layout, 0); av_opt_set_sample_fmt(swr, "isf", in->format, 0); av_opt_set_int(swr, "isr", in>sample_rate, 0); ret |= swr_convert_frame(swr, NULL, in); } if(ret != 0) return -1; } // keep taking out data, until it exhausts. ret = swr_convert_frame(swr, out, NULL); if(ret != 0) reutrn -1;
swr_free(&swr)
and av_frame_free(&out)
to ensure no memory leaks.In a JavaScript interpreter the expression 1/x when x is 0 is Infinity. At a first glance, it may seem an innocent bad design choice of ECMA (as has been through the entire lifetime of it) but little people do realize the subliminal political preference underlaid, unless they're Byomkesh Bakshi-grade detective mathematicians that seek truth (like me).
So in today's article we prove that how this "simple" and apparently "bad design" is a pushing a political agenda. I advice the leftists who've been using it; to just simply switch to Python if they care about their ideals and not their web-developer certificate.
What is SSH?
I don't need to introduce it. Let's be honest, every "modern day" UNIX user knows about SSH. It was basically a security extension to RSH by the OpenBSD people. A user only ever uses SSH to spawn a shell remotely and administrate that particular system.
Though, as we know, every project only ever becomes unnecessarily complex and complicated as time passes; it's like a exponential function of time.
What is wrong with it?
Why does it violate the UNIX philosophy? Because it does:
X11 forwarding can be done without SSH by just setting the DISPLAY variable. This security feature should be in X.org (yes, it's the only implementation of X11) and not in SSH.
Port forwarding (NAT) is done with special kernel level subsystems like netfilter and iptables (Linux) or eBPF or PF in Linux and OpenBSD. It is a low-level I/O job dealt with accounting for flexibility and latency, thus kernel-to-user and user-to-kernel operations induce more CPU and memory usage whereas the kernel would just move the pages around.
Tunneling, solved problem. OpenVPN, IPSec, IKEv2 exist and specialized for the purpose.
SFTP, again; a solved problem. It is solved by FTPS, which uses SSL ensuring backwards compatibility with existing FTP infrastructure.
SSHFS. SSH only ever solves solved problems. NFSv4 mandates security, SAMBA has too, other sophisticated solutions might exist too.
But why are you writing this?
To dump what I've collected and compiled in my mind, I don't really care if anyone reads this or not. Also, there are absolutely no articles criticizing it so someone had it do it.
I'm not a UNIX purist but it's to make you purists (yes, you) aware of this.
What should I use now?
Talking about alternatives, I didn't see any except RSH. If you know put that in the comments.
Other resources on this