summaryrefslogtreecommitdiff
path: root/rotord/rotor.h
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-03-17 19:17:29 +0000
committerComment <tim@gray.(none)>2013-03-17 19:17:29 +0000
commit156f40773fae82ec9fe8b5c7ad2615d8fa60c22e (patch)
treeafb9f5730aac06a59c3ca53adbc0e693269125ba /rotord/rotor.h
parent23fe664dabce0a7aa1890d2968e304b2ea666320 (diff)
implementing decoder
Diffstat (limited to 'rotord/rotor.h')
-rwxr-xr-xrotord/rotor.h37
1 files changed, 33 insertions, 4 deletions
diff --git a/rotord/rotor.h b/rotord/rotor.h
index 18b1f19..c7d25b2 100755
--- a/rotord/rotor.h
+++ b/rotord/rotor.h
@@ -7,6 +7,8 @@ we traverse the graph as recursive function calls until we satisfy all dependenc
NO NODE HAS MORE THAN ONE OUTPUT
WE DON'T LINK TO AN OUTPUT OBJECT WE LINK TO THE NODE - GET_OUTPUT IS THE RENDER FUNCTION
+MORE THAN ONE NODE CAN LINK THE SAME OUTPUT
+NODES CACHE AT LEAST ONE FRAME
??the only node with more than 1 output is audio?
??lets rethink this
@@ -104,6 +106,33 @@ namespace Rotor {
//forward declaration
class Node;
class Signal_node;
+
+ //http://blog.tomaka17.com/2012/03/libavcodeclibavformat-tutorial/
+ struct Packet {
+ explicit Packet(AVFormatContext* ctxt = nullptr) {
+ av_init_packet(&packet);
+ packet.data = nullptr;
+ if (ctxt) reset(ctxt);
+ }
+
+ Packet(Packet&& other) : packet(std::move(other.packet)) {
+ other.packet.data = nullptr;
+ }
+
+ ~Packet() {
+ if (packet.data)
+ av_free_packet(&packet);
+ }
+
+ void reset(AVFormatContext* ctxt) {
+ if (packet.data)
+ av_free_packet(&packet);
+ if (av_read_frame(ctxt, &packet) < 0)
+ packet.data = nullptr;
+ }
+
+ AVPacket packet;
+ };
class Render_status{
@@ -304,14 +333,14 @@ namespace Rotor {
base_audio_processor();
base_audio_processor(int _channels,int _bits);
virtual bool process_chunk(char *data,int num_samples);
+ void init(int _channels,int _bits) {
+ channels=_channels;
+ bits=_bits;
+ };
int channels,bits;
};
class audio_thumbnailer: public base_audio_processor {
public:
- audio_thumbnailer(int _channels,int _bits) {
- channels=_channels;
- bits=_bits;
- };
};
class Render_context: public Poco::Task { //Poco task object
//manages a 'patchbay'