Mercurial > mplayer.hg
annotate libmpdemux/demux_rtp.cpp @ 9526:5c2b34c87509
Use css like the rest of documentation. Use polish encoding.
author | eyck |
---|---|
date | Tue, 04 Mar 2003 13:55:25 +0000 |
parents | ea1c0a4520bf |
children | e74916774667 |
rev | line source |
---|---|
9250 | 1 ////////// Routines (with C-linkage) that interface between "MPlayer" |
2 ////////// and the "LIVE.COM Streaming Media" libraries: | |
3 | |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
4 extern "C" { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
5 #include "demux_rtp.h" |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
6 #include "stheader.h" |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
7 } |
9250 | 8 #include "demux_rtp_internal.h" |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
9 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
10 #include "BasicUsageEnvironment.hh" |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
11 #include "liveMedia.hh" |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
12 #include <unistd.h> |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
13 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
14 extern "C" stream_t* stream_open_sdp(int fd, off_t fileSize, |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
15 int* file_format) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
16 *file_format = DEMUXER_TYPE_RTP; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
17 stream_t* newStream = NULL; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
18 do { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
19 char* sdpDescription = (char*)malloc(fileSize+1); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
20 if (sdpDescription == NULL) break; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
21 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
22 ssize_t numBytesRead = read(fd, sdpDescription, fileSize); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
23 if (numBytesRead != fileSize) break; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
24 sdpDescription[fileSize] = '\0'; // to be safe |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
25 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
26 newStream = (stream_t*)calloc(sizeof (stream_t), 1); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
27 if (newStream == NULL) break; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
28 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
29 // Store the SDP description in the 'priv' field, for later use: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
30 newStream->priv = sdpDescription; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
31 } while (0); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
32 return newStream; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
33 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
34 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
35 extern "C" int _rtsp_streaming_seek(int /*fd*/, off_t /*pos*/, |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
36 streaming_ctrl_t* /*streaming_ctrl*/) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
37 return -1; // For now, we don't handle RTSP stream seeking |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
38 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
39 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
40 extern "C" int rtsp_streaming_start(stream_t* stream) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
41 stream->streaming_ctrl->streaming_seek = _rtsp_streaming_seek; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
42 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
43 return 0; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
44 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
45 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
46 // A data structure representing a buffer being read: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
47 class ReadBufferQueue; // forward |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
48 class ReadBuffer { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
49 public: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
50 ReadBuffer(ReadBufferQueue* ourQueue, demux_packet_t* dp); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
51 virtual ~ReadBuffer(); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
52 Boolean enqueue(); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
53 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
54 demux_packet_t* dp() const { return fDP; } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
55 ReadBufferQueue* ourQueue() { return fOurQueue; } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
56 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
57 ReadBuffer* next; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
58 private: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
59 demux_packet_t* fDP; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
60 ReadBufferQueue* fOurQueue; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
61 }; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
62 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
63 class ReadBufferQueue { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
64 public: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
65 ReadBufferQueue(MediaSubsession* subsession, demuxer_t* demuxer, |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
66 char const* tag); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
67 virtual ~ReadBufferQueue(); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
68 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
69 ReadBuffer* dequeue(); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
70 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
71 FramedSource* readSource() const { return fReadSource; } |
7534 | 72 RTPSource* rtpSource() const { return fRTPSource; } |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
73 demuxer_t* ourDemuxer() const { return fOurDemuxer; } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
74 char const* tag() const { return fTag; } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
75 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
76 ReadBuffer* head; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
77 ReadBuffer* tail; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
78 char blockingFlag; // used to implement synchronous reads |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
79 unsigned counter; // used for debugging |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
80 private: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
81 FramedSource* fReadSource; |
7534 | 82 RTPSource* fRTPSource; |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
83 demuxer_t* fOurDemuxer; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
84 char const* fTag; // used for debugging |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
85 }; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
86 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
87 // A structure of RTP-specific state, kept so that we can cleanly |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
88 // reclaim it: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
89 typedef struct RTPState { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
90 char const* sdpDescription; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
91 RTSPClient* rtspClient; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
92 MediaSession* mediaSession; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
93 ReadBufferQueue* audioBufferQueue; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
94 ReadBufferQueue* videoBufferQueue; |
9250 | 95 unsigned flags; |
7534 | 96 struct timeval firstSyncTime; |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
97 }; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
98 |
7664 | 99 int rtspStreamOverTCP = 0; |
100 | |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
101 extern "C" void demux_open_rtp(demuxer_t* demuxer) { |
7664 | 102 if (rtspStreamOverTCP && LIVEMEDIA_LIBRARY_VERSION_INT < 1033689600) { |
103 fprintf(stderr, "TCP streaming of RTP/RTCP requires \"LIVE.COM Streaming Media\" library version 2002.10.04 or later - ignoring the \"-rtsp-stream-over-tcp\" flag\n"); | |
104 rtspStreamOverTCP = 0; | |
105 } | |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
106 do { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
107 TaskScheduler* scheduler = BasicTaskScheduler::createNew(); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
108 if (scheduler == NULL) break; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
109 UsageEnvironment* env = BasicUsageEnvironment::createNew(*scheduler); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
110 if (env == NULL) break; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
111 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
112 RTSPClient* rtspClient = NULL; |
9250 | 113 unsigned flags = 0; |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
114 |
9457
ea1c0a4520bf
Repairing breakage to RTP streaming. Patch by Ross Finlayson <finlayson@live.com>
bertrand
parents:
9370
diff
changeset
|
115 if (demuxer == NULL || demuxer->stream == NULL) break; // shouldn't happen |
ea1c0a4520bf
Repairing breakage to RTP streaming. Patch by Ross Finlayson <finlayson@live.com>
bertrand
parents:
9370
diff
changeset
|
116 demuxer->stream->eof = 0; // just in case |
ea1c0a4520bf
Repairing breakage to RTP streaming. Patch by Ross Finlayson <finlayson@live.com>
bertrand
parents:
9370
diff
changeset
|
117 |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
118 // Look at the stream's 'priv' field to see if we were initiated |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
119 // via a SDP description: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
120 char* sdpDescription = (char*)(demuxer->stream->priv); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
121 if (sdpDescription == NULL) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
122 // We weren't given a SDP description directly, so assume that |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
123 // we were give a RTSP URL |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
124 char const* url = demuxer->stream->streaming_ctrl->url->url; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
125 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
126 extern int verbose; |
9250 | 127 rtspClient = RTSPClient::createNew(*env, verbose, "MPlayer"); |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
128 if (rtspClient == NULL) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
129 fprintf(stderr, "Failed to create RTSP client: %s\n", |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
130 env->getResultMsg()); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
131 break; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
132 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
133 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
134 sdpDescription = rtspClient->describeURL(url); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
135 if (sdpDescription == NULL) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
136 fprintf(stderr, "Failed to get a SDP description from URL \"%s\": %s\n", |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
137 url, env->getResultMsg()); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
138 break; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
139 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
140 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
141 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
142 // Now that we have a SDP description, create a MediaSession from it: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
143 MediaSession* mediaSession = MediaSession::createNew(*env, sdpDescription); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
144 if (mediaSession == NULL) break; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
145 |
9250 | 146 |
147 // Create a 'RTPState' structure containing the state that we just created, | |
148 // and store it in the demuxer's 'priv' field, for future reference: | |
149 RTPState* rtpState = new RTPState; | |
150 rtpState->sdpDescription = sdpDescription; | |
151 rtpState->rtspClient = rtspClient; | |
152 rtpState->mediaSession = mediaSession; | |
9370
88bd19564b64
Motion-JPEG RTP streams can now be played. Some MPEG-4 ES video RTP
arpi
parents:
9250
diff
changeset
|
153 rtpState->audioBufferQueue = rtpState->videoBufferQueue = NULL; |
9250 | 154 rtpState->firstSyncTime.tv_sec = rtpState->firstSyncTime.tv_usec = 0; |
155 demuxer->priv = rtpState; | |
156 | |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
157 // Create RTP receivers (sources) for each subsession: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
158 MediaSubsessionIterator iter(*mediaSession); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
159 MediaSubsession* subsession; |
9250 | 160 unsigned streamType = 0; // 0 => video; 1 => audio |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
161 while ((subsession = iter.next()) != NULL) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
162 // Ignore any subsession that's not audio or video: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
163 if (strcmp(subsession->mediumName(), "audio") == 0) { |
9250 | 164 streamType = 1; |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
165 } else if (strcmp(subsession->mediumName(), "video") == 0) { |
9250 | 166 streamType = 0; |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
167 } else { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
168 continue; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
169 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
170 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
171 if (!subsession->initiate()) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
172 fprintf(stderr, "Failed to initiate \"%s/%s\" RTP subsession: %s\n", subsession->mediumName(), subsession->codecName(), env->getResultMsg()); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
173 } else { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
174 fprintf(stderr, "Initiated \"%s/%s\" RTP subsession\n", subsession->mediumName(), subsession->codecName()); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
175 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
176 if (rtspClient != NULL) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
177 // Issue RTSP "SETUP" and "PLAY" commands on the chosen subsession: |
7664 | 178 if (!rtspClient->setupMediaSubsession(*subsession, False, |
179 rtspStreamOverTCP)) break; | |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
180 if (!rtspClient->playMediaSubsession(*subsession)) break; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
181 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
182 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
183 // Now that the subsession is ready to be read, do additional |
9250 | 184 // MPlayer codec-specific initialization on it: |
185 if (streamType == 0) { // video | |
186 rtpState->videoBufferQueue | |
187 = new ReadBufferQueue(subsession, demuxer, "video"); | |
188 rtpCodecInitialize_video(demuxer, subsession, flags); | |
189 } else { // audio | |
190 rtpState->audioBufferQueue | |
191 = new ReadBufferQueue(subsession, demuxer, "audio"); | |
192 rtpCodecInitialize_audio(demuxer, subsession, flags); | |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
193 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
194 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
195 } |
9250 | 196 rtpState->flags = flags; |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
197 } while (0); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
198 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
199 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
200 extern "C" int demux_is_mpeg_rtp_stream(demuxer_t* demuxer) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
201 // Get the RTP state that was stored in the demuxer's 'priv' field: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
202 RTPState* rtpState = (RTPState*)(demuxer->priv); |
9250 | 203 |
204 return (rtpState->flags&RTPSTATE_IS_MPEG) != 0; | |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
205 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
206 |
9250 | 207 static ReadBuffer* getBuffer(ReadBufferQueue* bufferQueue, |
208 demuxer_t* demuxer); // forward | |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
209 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
210 extern "C" int demux_rtp_fill_buffer(demuxer_t* demuxer, demux_stream_t* ds) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
211 // Get a filled-in "demux_packet" from the RTP source, and deliver it. |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
212 // Note that this is called as a synchronous read operation, so it needs |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
213 // to block in the (hopefully infrequent) case where no packet is |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
214 // immediately available. |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
215 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
216 // Begin by finding the buffer queue that we want to read from: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
217 // (Get this from the RTP state, which we stored in |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
218 // the demuxer's 'priv' field) |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
219 RTPState* rtpState = (RTPState*)(demuxer->priv); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
220 ReadBufferQueue* bufferQueue = NULL; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
221 if (ds == demuxer->video) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
222 bufferQueue = rtpState->videoBufferQueue; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
223 } else if (ds == demuxer->audio) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
224 bufferQueue = rtpState->audioBufferQueue; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
225 } else { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
226 fprintf(stderr, "demux_rtp_fill_buffer: internal error: unknown stream\n"); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
227 return 0; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
228 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
229 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
230 if (bufferQueue == NULL || bufferQueue->readSource() == NULL) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
231 fprintf(stderr, "demux_rtp_fill_buffer failed: no appropriate RTP subsession has been set up\n"); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
232 return 0; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
233 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
234 |
9250 | 235 ReadBuffer* readBuffer = getBuffer(bufferQueue, demuxer); // blocking |
236 if (readBuffer != NULL) ds_add_packet(ds, readBuffer->dp()); | |
237 | |
238 if (demuxer->stream->eof) return 0; // source stream has closed down | |
239 | |
240 return 1; | |
241 } | |
242 | |
243 Boolean awaitRTPPacket(demuxer_t* demuxer, unsigned streamType, | |
244 unsigned char*& packetData, unsigned& packetDataLen) { | |
245 // Begin by finding the buffer queue that we want to read from: | |
246 // (Get this from the RTP state, which we stored in | |
247 // the demuxer's 'priv' field) | |
248 RTPState* rtpState = (RTPState*)(demuxer->priv); | |
249 ReadBufferQueue* bufferQueue = NULL; | |
250 if (streamType == 0) { | |
251 bufferQueue = rtpState->videoBufferQueue; | |
252 } else if (streamType == 1) { | |
253 bufferQueue = rtpState->audioBufferQueue; | |
254 } else { | |
255 fprintf(stderr, "awaitRTPPacket: internal error: unknown streamType %d\n", | |
256 streamType); | |
257 return False; | |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
258 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
259 |
9250 | 260 if (bufferQueue == NULL || bufferQueue->readSource() == NULL) { |
261 fprintf(stderr, "awaitRTPPacket failed: no appropriate RTP subsession has been set up\n"); | |
262 return False; | |
263 } | |
264 | |
265 ReadBuffer* readBuffer = getBuffer(bufferQueue, demuxer); // blocking | |
266 if (readBuffer == NULL) return False; | |
267 | |
268 demux_packet_t* dp = readBuffer->dp(); | |
269 packetData = dp->buffer; | |
270 packetDataLen = dp->len; | |
271 | |
272 return True; | |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
273 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
274 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
275 extern "C" void demux_close_rtp(demuxer_t* demuxer) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
276 // Reclaim all RTP-related state: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
277 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
278 // Get the RTP state that was stored in the demuxer's 'priv' field: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
279 RTPState* rtpState = (RTPState*)(demuxer->priv); |
7143
fdfc10c2e2d2
- Tell the RTSP client code to use the string "mplayer" in RTSP
arpi
parents:
7008
diff
changeset
|
280 if (rtpState == NULL) return; |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
281 UsageEnvironment* env = NULL; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
282 TaskScheduler* scheduler = NULL; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
283 if (rtpState->mediaSession != NULL) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
284 env = &(rtpState->mediaSession->envir()); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
285 scheduler = &(env->taskScheduler()); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
286 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
287 Medium::close(rtpState->mediaSession); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
288 Medium::close(rtpState->rtspClient); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
289 delete rtpState->audioBufferQueue; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
290 delete rtpState->videoBufferQueue; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
291 delete rtpState->sdpDescription; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
292 delete rtpState; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
293 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
294 delete env; delete scheduler; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
295 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
296 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
297 ////////// Extra routines that help implement the above interface functions: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
298 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
299 static void afterReading(void* clientData, unsigned frameSize, |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
300 struct timeval presentationTime); // forward |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
301 static void onSourceClosure(void* clientData); // forward |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
302 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
303 static void scheduleNewBufferRead(ReadBufferQueue* bufferQueue) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
304 if (bufferQueue->readSource()->isCurrentlyAwaitingData()) return; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
305 // a read from this source is already in progress |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
306 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
307 // Allocate a new packet buffer, and arrange to read into it: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
308 unsigned const bufferSize = 30000; // >= the largest conceivable RTP packet |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
309 demux_packet_t* dp = new_demux_packet(bufferSize); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
310 if (dp == NULL) return; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
311 ReadBuffer* readBuffer = new ReadBuffer(bufferQueue, dp); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
312 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
313 // Schedule the read operation: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
314 bufferQueue->readSource()->getNextFrame(dp->buffer, bufferSize, |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
315 afterReading, readBuffer, |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
316 onSourceClosure, readBuffer); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
317 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
318 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
319 static void afterReading(void* clientData, unsigned frameSize, |
7534 | 320 struct timeval presentationTime) { |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
321 ReadBuffer* readBuffer = (ReadBuffer*)clientData; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
322 ReadBufferQueue* bufferQueue = readBuffer->ourQueue(); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
323 demuxer_t* demuxer = bufferQueue->ourDemuxer(); |
7534 | 324 RTPState* rtpState = (RTPState*)(demuxer->priv); |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
325 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
326 if (frameSize > 0) demuxer->stream->eof = 0; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
327 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
328 demux_packet_t* dp = readBuffer->dp(); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
329 dp->len = frameSize; |
7534 | 330 |
331 // Set the packet's presentation time stamp, depending on whether or | |
332 // not our RTP source's timestamps have been synchronized yet: | |
333 { | |
334 Boolean hasBeenSynchronized | |
335 = bufferQueue->rtpSource()->hasBeenSynchronizedUsingRTCP(); | |
336 if (hasBeenSynchronized) { | |
337 struct timeval* fst = &(rtpState->firstSyncTime); // abbrev | |
338 if (fst->tv_sec == 0 && fst->tv_usec == 0) { | |
339 *fst = presentationTime; | |
340 } | |
341 | |
342 // For the "pts" field, use the time differential from the first | |
343 // synchronized time, rather than absolute time, in order to avoid | |
344 // round-off errors when converting to a float: | |
345 dp->pts = presentationTime.tv_sec - fst->tv_sec | |
346 + (presentationTime.tv_usec - fst->tv_usec)/1000000.0; | |
347 } else { | |
348 dp->pts = 0.0; | |
349 } | |
350 } | |
351 | |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
352 dp->pos = demuxer->filepos; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
353 demuxer->filepos += frameSize; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
354 if (!readBuffer->enqueue()) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
355 // The queue is full, so discard the buffer: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
356 delete readBuffer; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
357 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
358 |
9250 | 359 // Signal any pending 'doEventLoop()' call on this queue: |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
360 bufferQueue->blockingFlag = ~0; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
361 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
362 // Finally, arrange to do another read, if appropriate |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
363 scheduleNewBufferRead(bufferQueue); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
364 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
365 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
366 static void onSourceClosure(void* clientData) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
367 ReadBuffer* readBuffer = (ReadBuffer*)clientData; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
368 ReadBufferQueue* bufferQueue = readBuffer->ourQueue(); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
369 demuxer_t* demuxer = bufferQueue->ourDemuxer(); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
370 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
371 demuxer->stream->eof = 1; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
372 |
9250 | 373 // Signal any pending 'doEventLoop()' call on this queue: |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
374 bufferQueue->blockingFlag = ~0; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
375 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
376 |
9250 | 377 static ReadBuffer* getBufferIfAvailable(ReadBufferQueue* bufferQueue) { |
378 ReadBuffer* readBuffer = bufferQueue->dequeue(); | |
379 | |
380 // Arrange to read a new packet into this queue: | |
381 scheduleNewBufferRead(bufferQueue); | |
382 | |
383 return readBuffer; | |
384 } | |
385 | |
386 static ReadBuffer* getBuffer(ReadBufferQueue* bufferQueue, | |
387 demuxer_t* demuxer) { | |
388 // Check whether there's a full buffer to deliver to the client: | |
389 bufferQueue->blockingFlag = 0; | |
390 ReadBuffer* readBuffer; | |
391 while ((readBuffer = getBufferIfAvailable(bufferQueue)) == NULL | |
392 && !demuxer->stream->eof) { | |
393 // Because we weren't able to deliver a buffer to the client immediately, | |
394 // block myself until one comes available: | |
395 TaskScheduler& scheduler | |
396 = bufferQueue->readSource()->envir().taskScheduler(); | |
397 #if USAGEENVIRONMENT_LIBRARY_VERSION_INT >= 1038614400 | |
398 scheduler.doEventLoop(&bufferQueue->blockingFlag); | |
399 #else | |
400 scheduler.blockMyself(&bufferQueue->blockingFlag); | |
401 #endif | |
402 } | |
403 | |
404 return readBuffer; | |
405 } | |
406 | |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
407 ////////// "ReadBuffer" and "ReadBufferQueue" implementation: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
408 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
409 #define MAX_QUEUE_SIZE 5 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
410 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
411 ReadBuffer::ReadBuffer(ReadBufferQueue* ourQueue, demux_packet_t* dp) |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
412 : next(NULL), fDP(dp), fOurQueue(ourQueue) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
413 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
414 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
415 Boolean ReadBuffer::enqueue() { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
416 if (fOurQueue->counter >= MAX_QUEUE_SIZE) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
417 // This queue is full. Clear out an old entry from it, so that |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
418 // this new one will fit: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
419 while (fOurQueue->counter >= MAX_QUEUE_SIZE) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
420 delete fOurQueue->dequeue(); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
421 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
422 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
423 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
424 // Add ourselves to the tail of our queue: |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
425 if (fOurQueue->tail == NULL) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
426 fOurQueue->head = this; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
427 } else { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
428 fOurQueue->tail->next = this; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
429 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
430 fOurQueue->tail = this; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
431 ++fOurQueue->counter; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
432 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
433 return True; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
434 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
435 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
436 ReadBuffer::~ReadBuffer() { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
437 free_demux_packet(fDP); |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
438 delete next; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
439 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
440 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
441 ReadBufferQueue::ReadBufferQueue(MediaSubsession* subsession, |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
442 demuxer_t* demuxer, char const* tag) |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
443 : head(NULL), tail(NULL), counter(0), |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
444 fReadSource(subsession == NULL ? NULL : subsession->readSource()), |
7534 | 445 fRTPSource(subsession == NULL ? NULL : subsession->rtpSource()), |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
446 fOurDemuxer(demuxer), fTag(strdup(tag)) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
447 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
448 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
449 ReadBufferQueue::~ReadBufferQueue() { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
450 delete head; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
451 delete fTag; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
452 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
453 |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
454 ReadBuffer* ReadBufferQueue::dequeue() { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
455 ReadBuffer* readBuffer = head; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
456 if (readBuffer != NULL) { |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
457 head = readBuffer->next; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
458 if (head == NULL) tail = NULL; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
459 --counter; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
460 readBuffer->next = NULL; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
461 } |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
462 return readBuffer; |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
diff
changeset
|
463 } |