summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaromil <jaromil@949728d9-16ea-0310-a75c-cbdf8430a4b8>2006-10-13 13:41:39 (GMT)
committer jaromil <jaromil@949728d9-16ea-0310-a75c-cbdf8430a4b8>2006-10-13 13:41:39 (GMT)
commit6afad8245aed016f5f41dedc177993eb92209bf0 (patch)
treebd0a9fd361bd38588978d8f2946587a9408ca41e
parent0d0d8732a32d91c57c61f1f816fdb50263dab227 (diff)
new Skip and Sync feature working!
now multiple videos can be skipped between positions and re-synced. git-svn-id: svn://dyne.org/montevideo/ivysync@72 949728d9-16ea-0310-a75c-cbdf8430a4b8
-rw-r--r--branches/lydia/cmdline.cpp1
-rwxr-xr-xbranches/lydia/ivysync-remote.py11
-rw-r--r--branches/lydia/xmlrpc.cpp42
-rw-r--r--branches/lydia/xmlrpc.h18
4 files changed, 70 insertions, 2 deletions
diff --git a/branches/lydia/cmdline.cpp b/branches/lydia/cmdline.cpp
index 43d3042..b76166a 100644
--- a/branches/lydia/cmdline.cpp
+++ b/branches/lydia/cmdline.cpp
@@ -324,6 +324,7 @@ int main(int argc, char **argv) {
new Open (xmlrpc, &decoders);
new Quit (xmlrpc, &decoders);
new SyncStart (xmlrpc, &decoders);
+ new SyncOffset(xmlrpc, &decoders);
ivydaemon = new IvySyncDaemon(xmlrpc);
diff --git a/branches/lydia/ivysync-remote.py b/branches/lydia/ivysync-remote.py
index 6523e44..35b9007 100755
--- a/branches/lydia/ivysync-remote.py
+++ b/branches/lydia/ivysync-remote.py
@@ -53,7 +53,7 @@ class xmlrpc_connection:
if __name__ == '__main__':
- commands = ("Play", "SyncStart", "Stop", "Open", "Pause", "Quit", "GetPos", "SetPos", "GetOffset", "SetOffset")
+ commands = ("Play", "SyncStart", "Stop", "Open", "Pause", "Quit", "GetPos", "SetPos", "GetOffset", "SetOffset", "SyncOffset")
connection = xmlrpc_connection()
@@ -76,6 +76,15 @@ if __name__ == '__main__':
else:
answer = "Error in sync starting"
+ elif cmd == "SyncOffset":
+
+ pos = int( sys.argv[2] )
+
+ (res,) = connection.remote(cmd, (pos, 0))
+ if res == 1:
+ answer = "Global sync to offset " + str(pos)
+ else:
+ answer = "Error in SyncOffset"
elif cmd == "Quit":
diff --git a/branches/lydia/xmlrpc.cpp b/branches/lydia/xmlrpc.cpp
index 8e5fd75..06cb228 100644
--- a/branches/lydia/xmlrpc.cpp
+++ b/branches/lydia/xmlrpc.cpp
@@ -70,6 +70,7 @@ SyncStart::SyncStart(XmlRpcServer* srv, Linklist *decoders)
IvySyncPublicMethod(decoders)
{ }
+
Stop::Stop(XmlRpcServer* srv, Linklist *decoders)
: XmlRpcServerMethod("Stop", srv),
IvySyncPublicMethod(decoders)
@@ -90,6 +91,8 @@ SetPos::SetPos(XmlRpcServer* srv, Linklist *decoders)
IvySyncPublicMethod(decoders)
{ }
+
+
GetOffset::GetOffset(XmlRpcServer* srv, Linklist *decoders)
: XmlRpcServerMethod("GetOffset", srv),
IvySyncPublicMethod(decoders)
@@ -100,6 +103,11 @@ SetOffset::SetOffset(XmlRpcServer* srv, Linklist *decoders)
IvySyncPublicMethod(decoders)
{ }
+SyncOffset::SyncOffset(XmlRpcServer* srv, Linklist *decoders)
+ : XmlRpcServerMethod("SyncOffset", srv),
+ IvySyncPublicMethod(decoders)
+{ }
+
Open::Open(XmlRpcServer* src, Linklist *decoders)
: XmlRpcServerMethod("Open", src),
IvySyncPublicMethod(decoders)
@@ -313,7 +321,7 @@ void SetPos::execute(XmlRpcValue &params, XmlRpcValue &result) {
void SetOffset::execute(XmlRpcValue &params, XmlRpcValue &result) {
int decnum;
- double pos;
+ int pos;
if( params.size() < 2) {
E("XMLRPC: SetOffset called with invalid number of arguments (%u)",
@@ -331,3 +339,35 @@ void SetOffset::execute(XmlRpcValue &params, XmlRpcValue &result) {
D("XMLRPC: SetOffset decoder %u to position %d", decnum, pos);
dec->setoffset( (off64_t) pos );
}
+
+void SyncOffset::execute(XmlRpcValue &params, XmlRpcValue &result) {
+ D("syncoffset called");
+ int offset;
+
+ if( params.size() < 1) {
+ E("XMLRPC: SyncOffset called without offset argument");
+ return;
+ }
+
+ offset = (int) params[0];
+
+ Decoder *dec = (Decoder*) decoders->begin();
+
+ while(dec) {
+ dec->stop();
+ dec->setup(&syncer, 0);
+ dec->setoffset( offset );
+ dec->play();
+ dec = (Decoder*) dec->next;
+ }
+
+ N("global seek to offset %u",offset);
+ A("synced start in 3 seconds...");
+ jsleep(3,0);
+
+ syncer = true;
+
+ result = 1.0;
+ A("...start!");
+}
+
diff --git a/branches/lydia/xmlrpc.h b/branches/lydia/xmlrpc.h
index ec30a63..912847d 100644
--- a/branches/lydia/xmlrpc.h
+++ b/branches/lydia/xmlrpc.h
@@ -195,6 +195,24 @@ class SetOffset : public XmlRpcServerMethod, IvySyncPublicMethod {
};
+class SyncOffset : public XmlRpcServerMethod, IvySyncPublicMethod {
+public:
+
+ SyncOffset(XmlRpcServer* srv, Linklist *decoders);
+
+ ~SyncOffset() { };
+
+ void execute(XmlRpcValue &params, XmlRpcValue &result);
+
+ std::string help() {
+ return std::string("Skip all channels to a certain offset and start playing in sync"); }
+
+ private:
+ bool syncer;
+
+};
+
+
class Open : public XmlRpcServerMethod, IvySyncPublicMethod {
public: