We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating flims longer than 10 minutes is impractical, due to the memory consumption of flimmaker.
The text was updated successfully, but these errors were encountered:
From this reddit comment: https://www.reddit.com/r/cpp/comments/s980ik/a_highlevel_coroutine_explanation/htsa1m4/
Here is an example of how to implement coroutines for video/audio: https://godbolt.org/z/Y7aEP9aoo
Using the generator from: https://github.com/lewissbaker/cppcoro
Copy of the code:
#include <cppcoro/generator.hpp> #include <iostream> #include <random> #include <tuple> #include <vector> using video_frame = int; using audio_frame = double; using data_packet = std::tuple<std::vector<video_frame>, audio_frame>; cppcoro::generator<data_packet> decoder() { std::random_device r; std::default_random_engine engine{r()}; std::uniform_int_distribution<video_frame> uniform_dist(-100, 100); std::vector<video_frame> buffer{}; for (std::size_t iter{1}; iter < 100; ++iter) { if (iter % 10 != 0) { buffer.push_back(uniform_dist(engine)); } else { co_yield data_packet{buffer, 10.6 * iter}; buffer.clear(); } } } int main() { for (auto const& [video_buffer, audio_buffer] : decoder()) { std::cout << "Audio " << audio_buffer << "\nVideo "; for (auto frame : video_buffer) { std::cout << frame << ","; } std::cout << "\n"; } return 0; }
Sorry, something went wrong.
No branches or pull requests
Creating flims longer than 10 minutes is impractical, due to the memory consumption of flimmaker.
The text was updated successfully, but these errors were encountered: