$ git clone http://tcclient.ion.nu/tc_client.git
commit b5fc4a13bea7823ad2e213ea6cdde20374aea264
Author: Alicia <...>
Date: Fri Oct 28 17:01:58 2016 +0200
Added a /disablesnapshots command to disable capturing outgoing cams for the flash client's "snapshot" feature, /enablesnapshots to re-enable.
diff --git a/ChangeLog b/ChangeLog
index 1cbb0ea..425c99d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
0.41:
Added some compatibility code for OSX.
Enabled compiling in a directory separate from the source directory.
+Added a /disablesnapshots command to disable capturing outgoing cams for the flash client's "snapshot" feature, /enablesnapshots to re-enable.
tc_client-gtk: bugfix: don't rely on stack allocated variables for GUI callbacks.
tc_client-gtk: install the camera placeholder animation for the 'install' target.
tc_client-gtk: mark outgoing video keyframes as keyframes.
diff --git a/README b/README
index a41b238..0b35e0b 100644
--- a/README
+++ b/README
@@ -20,6 +20,8 @@ Commands supported by tc_client:
/audio <length> = send a <length> bytes long encoded frame, send the frame data after this line
/camdown = close the audio/video stream
/topic <topic> = set the channel topic
+/disablesnapshots = disable flash client's snapshots of our stream.
+/enablesnapshots = re-enable flash client's snapshots of our stream.
/help = list these commands at runtime
Missing features:
diff --git a/client.c b/client.c
index 757ce42..b8ac3e1 100644
--- a/client.c
+++ b/client.c
@@ -520,7 +520,9 @@ int main(int argc, char** argv)
"/video <length> = send a <length> bytes long encoded frame, send the frame data after this line\n"
"/audio <length> = send a <length> bytes long encoded frame, send the frame data after this line\n"
"/topic <topic> = set the channel topic\n"
- "/whois <nick/ID> = check a user's username\n");
+ "/whois <nick/ID> = check a user's username\n"
+ "/disablesnapshots = disable flash client's snapshots of our stream.\n"
+ "/enablesnapshots = re-enable flash client's snapshots of our stream.\n");
fflush(stdout);
continue;
}
@@ -729,6 +731,11 @@ int main(int argc, char** argv)
fflush(stdout);
continue;
}
+ else if(!strcmp(buf, "/disablesnapshots") || !strcmp(buf, "/enablesnapshots"))
+ {
+ setallowsnapshots(sock, buf[1]=='e'); // True for "/enablesnapshots", false for "/disablesnapshots"
+ continue;
+ }
}
char* msg=tonumlist(buf, len);
amfinit(&amf, 3);
diff --git a/media.c b/media.c
index b47aa4a..8d4deb7 100644
--- a/media.c
+++ b/media.c
@@ -24,6 +24,7 @@
struct stream* streams=0;
unsigned int streamcount=0;
+char allowsnapshots=1;
char stream_idtaken(unsigned int id)
{
@@ -92,6 +93,17 @@ void stream_play(struct amf* amf, int sock) // called upon _result
if(streams[i].outgoing){amfstring(&amf, "live");}
amf.msgid=le32(streams[i].streamid);
amfsend(&amf, sock);
+ if(!allowsnapshots && streams[i].outgoing) // Prevent snapshots
+ {
+ amfinit(&amf, 3);
+ amf.type=RTMP_INVOKE;
+ amf.msgid=le32(streams[i].streamid);
+ amfstring(&amf, "|RtmpSampleAccess");
+ amfbool(&amf, 0);
+ amfbool(&amf, 0);
+ amfnull(&amf);
+ amfsend(&amf, sock);
+ }
return;
}
}
@@ -182,3 +194,25 @@ void stream_stopvideo(int sock, unsigned int id)
}
}
}
+
+void setallowsnapshots(int sock, char v)
+{
+ allowsnapshots=v;
+ // Update any active stream as well
+ unsigned int i;
+ for(i=0; i<streamcount; ++i)
+ {
+ if(streams[i].outgoing)
+ {
+ struct rtmp amf;
+ amfinit(&amf, 3);
+ amf.type=RTMP_INVOKE;
+ amf.msgid=le32(streams[i].streamid);
+ amfstring(&amf, "|RtmpSampleAccess");
+ amfbool(&amf, v);
+ amfbool(&amf, v);
+ amfnull(&amf);
+ amfsend(&amf, sock);
+ }
+ }
+}
diff --git a/media.h b/media.h
index 8ce6048..329cb21 100644
--- a/media.h
+++ b/media.h
@@ -33,3 +33,4 @@ extern void stream_handledata(struct rtmp* rtmp);
extern void stream_handlestatus(struct amf* amf, int sock);
extern void stream_sendframe(int sock, void* buf, size_t len, unsigned char type);
extern void stream_stopvideo(int sock, unsigned int id);
+extern void setallowsnapshots(int sock, char v);