diff options
| author | Comment <tim@gray.(none)> | 2013-04-20 02:01:32 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-04-20 02:01:32 +0100 |
| commit | da05e29b124b2f6d553dedb1c63a4a655fc4f7b6 (patch) | |
| tree | 3453530d4d7fee2fd165b399ed9ded9fc5abb471 | |
| parent | 3608a44b8222cfd76b8ba789e1f5ea6b7020a3e9 (diff) | |
audio muxer ongoing
| -rw-r--r-- | rotord/libavexporter.cpp | 1 | ||||
| -rw-r--r-- | rotord/libavexporter.h | 4 | ||||
| -rwxr-xr-x | rotord/rotor.cpp | 2 | ||||
| -rwxr-xr-x | rotord/rotor.h | 89 |
4 files changed, 50 insertions, 46 deletions
diff --git a/rotord/libavexporter.cpp b/rotord/libavexporter.cpp index 72ca180..3e977a1 100644 --- a/rotord/libavexporter.cpp +++ b/rotord/libavexporter.cpp @@ -4,6 +4,7 @@ bool libav::exporter::setup(int w,int h, int bitRate, int frameRate, std::string // Initialize libavcodec, and register all codecs and formats. // av_register_all(); + this->w=w; this->h=h; this->bitRate=bitRate; diff --git a/rotord/libavexporter.h b/rotord/libavexporter.h index c9984cb..df28c90 100644 --- a/rotord/libavexporter.h +++ b/rotord/libavexporter.h @@ -346,10 +346,10 @@ namespace libav { sws_flags, NULL, NULL, NULL); avpicture_fill(&src_picture, pixels, PIX_FMT_RGB24, c->width,c->height); - avpicture_fill(&dst_picture, outPixels, PIX_FMT_YUV420P, c->width,c->height); + //avpicture_fill(&dst_picture, outPixels, PIX_FMT_YUV420P, c->width,c->height); sws_scale(sws_ctx, src_picture.data, src_picture.linesize, 0, c->height, dst_picture.data, dst_picture.linesize); - + //fill_yuv_image(&dst_picture, frame_count, c->width, c->height); if (oc->oformat->flags & AVFMT_RAWPICTURE) { // Raw video case - directly store the picture in the packet // AVPacket pkt; diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index 4c1146e..787b943 100755 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -769,7 +769,9 @@ bool Video_output::render(const float duration, const float framerate,const stri int frameRate=25; AVCodecID codecId=AV_CODEC_ID_MPEG4; std::string container ="mov"; + std::string input ="01.wav"; + bool usingaudio=audio_loader.setup(input); if (exporter->setup(outW,outH,bitRate,frameRate,container)) { //codecId, if (exporter->record(output_filename)) { diff --git a/rotord/rotor.h b/rotord/rotor.h index d808dd8..d27914e 100755 --- a/rotord/rotor.h +++ b/rotord/rotor.h @@ -97,8 +97,10 @@ extern "C" { #include "vampHost.h" #include "xmlIO.h" +#include "libavaudioloader.h" #include "libavexporter.h" + namespace Rotor { #define IDLE 0 #define ANALYSING_AUDIO 1 @@ -144,7 +146,48 @@ namespace Rotor { AVPacket packet; }; - + class Image{ + public: + Image(){ + zero(); + }; + Image(int _w,int _h){ + zero(); + setup(_w,_h); + }; + ~Image() { + free(); + }; + void free(){ + if (RGBdata) delete[] RGBdata; + if (Adata) delete[] Adata; + if (Zdata) delete[] Zdata; + zero(); + } + void zero(){ + RGBdata=nullptr; + Adata=nullptr; + Zdata=nullptr; + w=0; + h=0; + } + bool setup(int _w,int _h){ + if (w!=_w||h!=_h){ + free(); + w=_w; + h=_h; + RGBdata=new uint8_t[w*h*3]; + Adata=new uint8_t[w*h]; + Zdata=new uint16_t[w*h]; + return true; + } + else return false; + } + uint8_t *RGBdata; + uint8_t *Adata; + uint16_t *Zdata; + int h,w; + }; class Time_spec{ public: Time_spec(float _seconds,float _framerate){ seconds=_seconds; framerate=_framerate; }; @@ -216,49 +259,6 @@ namespace Rotor { ID=check(settings,"ID"); } }; - class Image{ - public: - Image(){ - zero(); - }; - Image(int _w,int _h){ - zero(); - setup(_w,_h); - }; - ~Image() { - free(); - }; - void free(){ - if (RGBdata) delete[] RGBdata; - if (Adata) delete[] Adata; - if (Zdata) delete[] Zdata; - zero(); - } - void zero(){ - RGBdata=nullptr; - Adata=nullptr; - Zdata=nullptr; - w=0; - h=0; - } - bool setup(int _w,int _h){ - if (w!=_w||h!=_h){ - free(); - w=_w; - h=_h; - RGBdata=new uint8_t[w*h*3]; - Adata=new uint8_t[w*h]; - Zdata=new uint16_t[w*h]; - return true; - } - else return false; - } - uint8_t *RGBdata; - uint8_t *Adata; - uint16_t *Zdata; - private: - int h,w; - }; class Signal_node: public Node{ public: virtual float get_output(const Time_spec &time) { return 0.0f; }; @@ -414,6 +414,7 @@ namespace Rotor { private: //ofxMovieExporter *exporter; libav::exporter *exporter; + libav::audioloader audio_loader; }; //------------------------------------------------------------------- class Node_factory{ |
