summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xhttp3
-rwxr-xr-xrotord/libavwrapper.cpp17
-rwxr-xr-xrotord/rotor.cpp15
-rwxr-xr-xrotord/rotor.h32
4 files changed, 56 insertions, 11 deletions
diff --git a/http b/http
index 0c0314f..39a285b 100755
--- a/http
+++ b/http
@@ -5,8 +5,9 @@ parser = argparse.ArgumentParser()
parser.add_argument("method",default="GET",nargs='?')
parser.add_argument("path",default="/",nargs='?')
parser.add_argument("body",default="body",nargs='?')
+parser.add_argument("ip",default="127.0.0.1:9000",nargs='?')
args=parser.parse_args()
-connection = httplib.HTTPConnection('127.0.0.1:9000')
+connection = httplib.HTTPConnection(args.ip)
connection.request(args.method, args.path, args.body)
print connection.getresponse().read()
diff --git a/rotord/libavwrapper.cpp b/rotord/libavwrapper.cpp
index 21a329c..7f99668 100755
--- a/rotord/libavwrapper.cpp
+++ b/rotord/libavwrapper.cpp
@@ -127,7 +127,7 @@ libav::decoder::decoder(PixelFormat pixelFormat)
void libav::decoder::cleanup(){
-
+
mutex.lock();
if (NULL != Sctx) {
sws_freeContext(Sctx);
@@ -382,11 +382,18 @@ bool libav::decoder::readNextFrameWithPacket(int targetFrameIndex, AVPacket& pac
#endif
if(!finished) {
if (packet.pts == AV_NOPTS_VALUE)
- throw std::runtime_error("");
+ packet.pts = 0;
+ //throw std::runtime_error("");
+ //why does it want to throw an error here, isn't the frame succesfully decoded?
+ //
+ //when we allow these packets through we get
+ //[swscaler @ 0x9ef0c80] bad src image pointers
+ //trying to ignore timestamp below
if (packet.size == 0) // packet.size==0 usually means EOF
break;
}
- } while ( (!finished) || (pYuv->best_effort_timestamp < targetFrameIndex));
+ //} while ( (!finished) || (pYuv->best_effort_timestamp < targetFrameIndex));
+ } while (!finished);
av_free_packet(&packet);
@@ -653,7 +660,7 @@ libav::encoder::encoder(const char * file_name, int width, int height, float _fr
if (aCtx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)
audio_input_frame_size = 10000;
else
- audio_input_frame_size = aCtx->frame_size;
+ audio_input_frame_size = aCtx->frame_size;
if (container->oformat->flags & AVFMT_GLOBALHEADER)
@@ -1581,7 +1588,7 @@ bool libav::audioloader::setup(const std::string &filename){
//where is audio grunge coming from? signed/ unsigned? doesn't seem to be byte order..
// add +1 to data subscript with no effect
-
+
//which? must be determined by format or layout of the channels
//ALSO some kind of HEINOUS memory leak??
buffer[((sample_end+i)*frame->channels)+j]=s;
diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp
index 887fc9f..1c0345d 100755
--- a/rotord/rotor.cpp
+++ b/rotord/rotor.cpp
@@ -27,6 +27,7 @@ Node_factory::Node_factory(){
add_type("image_arithmetic",new Image_arithmetic());
add_type("random",new Random());
add_type("blend",new Blend());
+ //add_type("mirror",new Mirror());
}
bool Signal_input::connect(Signal_node* source) {
@@ -254,7 +255,7 @@ bool Video_output::render(const float duration, const float framerate,const stri
AVCodecID codecId=AV_CODEC_ID_H264; //MPEG4;
std::string container ="mp4";
-
+
//at the moment it crashes if you render before audio is loaded and also on 2nd render
libav::exporter exporter;
@@ -285,7 +286,7 @@ bool Video_output::render(const float duration, const float framerate,const stri
}
}
-
+
//[mp3 @ 0x7fffe40330e0] max_analyze_duration 5000000 reached at 5015510 microseconds
//[mp3 @ 0x7fffe4033ec0] Insufficient thread locking around avcodec_open/close()
//[mp3 @ 0x7fffe40330e0] Estimating duration from bitrate, this may be inaccurate
@@ -293,8 +294,8 @@ bool Video_output::render(const float duration, const float framerate,const stri
//[libx264 @ 0x7fffe8003940] profile High, level 3.0
//[libx264 @ 0x7fffe8003940] 264 - core 123 r2189 35cf912 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=10 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=abr mbtree=1 bitrate=400 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
//Assertion ff_avcodec_locked failed at libavcodec/utils.c:2967
-
-
+
+
Image* i=get_output(Frame_spec(vf,framerate,duration,outW,outH));
if (i) {
@@ -381,6 +382,12 @@ Image* Video_loader::output(const Frame_spec &frame){
if (isLoaded){
int wanted=((int) (frame.time*frame.framerate))%(player.getNumberOfFrames()); //-2?? this would give division by zero
+
+
+ //if (wanted==99){
+ // cerr<<"videoloader: near the end"<<endl;
+ //}
+
if (!player.fetchFrame(frame.w,frame.h,wanted)) { cerr<<"Rotor: frame returned false"<<endl; return nullptr; };
image.setup_fromRGB(frame.w,frame.h,player.pFrameRGB->data[0]);
return &image;
diff --git a/rotord/rotor.h b/rotord/rotor.h
index cb1e815..da7e875 100755
--- a/rotord/rotor.h
+++ b/rotord/rotor.h
@@ -1200,7 +1200,6 @@ namespace Rotor {
if (_mode=="screen") mode=BLEND_screen;
if (_mode=="multiply") mode=BLEND_multiply;
if (_mode=="blend") mode=BLEND_blend;
- cerr<<"blend node: mode: "<<mode<<" amount: "<<amount<<endl;
};
void link_params() {
for (auto p:parameter_inputs){
@@ -1245,6 +1244,37 @@ namespace Rotor {
int mode;
float amount; //for blend
};
+ #define MIRROR_horiz 1
+ #define MIRROR_vert 1
+ /*
+ class Mirror: public Image_node {
+ public:
+ Mirror(){};
+ Mirror(map<string,string> &settings) {
+ base_settings(settings);
+ image=new Image();
+ amount=find_setting(settings,"amount",1.0f);
+ string _mode=find_setting(settings,"mode","screen");
+ if (_mode=="horiz") mode=BLEND_screen;
+ if (_mode=="vert") mode=BLEND_multiply;
+ };
+ ~Mirror(){ delete image;};
+ Mirror* clone(map<string,string> &_settings) { return new Mirror(_settings);};
+ Image *output(const Frame_spec &frame){
+ if (image_inputs.size()) {
+ if (image_inputs[0]->connection){
+
+ //if there aren't 2 image inputs connected just return the first
+ return (((Image_node*)image_inputs[0]->connection)->get_output(frame));
+ }
+ }
+ return nullptr;
+ }
+ private:
+ Image *image; //is an image generator
+ int mode;
+ };
+ */
//-------------------------------------------------------------------
class Node_factory{
public: