예제 #1
0
        private void ContinueAfterSetup(RTSPClient rtspClient, int resultCode, string resultString)
        {
            do
            {
                var scs = ((OurRtspClient)rtspClient).scs; // alias

                if (resultCode != 0)
                {
                    Console.Error.WriteLine(rtspClient + "Failed to set up the \"" + scs.subsession + "\" subsession: " +
                                            env.GetResultMsg);
                    break;
                }

                Console.Error.WriteLine(rtspClient + "Set up the \"" + scs.subsession
                                        + "\" subsession (client ports " + scs.subsession.ClientPortNum + "-" +
                                        (scs.subsession.ClientPortNum + 1) + ")");

                // Having successfully setup the subsession, create a data sink for it, and call "startPlaying()" on it.
                // (This will prepare the data sink to receive data; the actual flow of data from the client won't start happening until later,
                // after we've sent a RTSP "PLAY" command.)

                scs.subsession.sink = DummySink.CreateNew(env, scs.subsession, rtspClient.Url);
                // perhaps use your own custom "MediaSink" subclass instead
                if (scs.subsession.sink == null)
                {
                    Console.Error.WriteLine(rtspClient + "Failed to create a data sink for the \"" + scs.subsession
                                            + "\" subsession: " + env.GetResultMsg);
                    break;
                }

                Console.Error.WriteLine(rtspClient + "Created a data sink for the \"" + scs.subsession + "\" subsession");
                scs.subsession.miscPtr = rtspClient.Native.Native;
                // a hack to let subsession handle functions get the "RTSPClient" from the subsession
                scs.subsession.sink.StartPlaying(scs.subsession.ReadSource(), SubsessionAfterPlaying,
                                                 scs.subsession.Native.Native);
                // Also set a handler to be called if a RTCP "BYE" arrives for this subsession:
                if (scs.subsession.RtcpInstance() != null)
                {
                    scs.subsession.RtcpInstance().SetByeHandler(subsessionByeHandler, scs.subsession.Native.Native, 1);
                }
            } while (false);

            // Set up the next subsession, if any:
            SetupNextSubsession(rtspClient);
        }
예제 #2
0
        private void afterGettingFrame(IntPtr clientData, uint frameSize, uint numTruncatedBytes, timeval presentationTime, uint durationInMicroseconds)
        {
            var sink = new DummySink(clientData);

            sink.afterGettingFrame(frameSize, numTruncatedBytes, presentationTime, durationInMicroseconds);
        }