package/dhcp/S80dhcp-server: allow empty INTERFACES
[buildroot-gz.git] / package / mplayer / 0002-mpdemux-live555-async-interface.patch
blob5a62a18710331188fc1cb860bd29535f568845b0
1 From d3195ea13f4a9aae546ff996e53681349a1a3cdb Mon Sep 17 00:00:00 2001
2 From: sherpya <sherpya@netfarm.it>
3 Date: Fri, 14 Jun 2013 05:25:38 +0200
4 Subject: [PATCH 25/27] mpdemux: live555 async interface
6 From: https://raw.github.com/sherpya/mplayer-be/master/patches/mp/0025-mpdemux-live555-async-interface.patch
8 Adjust live555 interface code for modern versions of live555.
10 Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
11 ---
12 libmpdemux/demux_rtp.cpp | 51 ++++++++++++++++++++++++++++++++----------------
13 2 files changed, 35 insertions(+), 22 deletions(-)
15 diff --git a/libmpdemux/demux_rtp.cpp b/libmpdemux/demux_rtp.cpp
16 index ad7a7f1..05d06e0 100644
17 --- a/libmpdemux/demux_rtp.cpp
18 +++ b/libmpdemux/demux_rtp.cpp
19 @@ -19,8 +19,6 @@
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 -#define RTSPCLIENT_SYNCHRONOUS_INTERFACE 1
25 extern "C" {
26 // on MinGW, we must include windows.h before the things it conflicts
27 #ifdef __MINGW32__ // with. they are each protected from
28 @@ -94,15 +92,6 @@ struct RTPState {
30 extern "C" char* network_username;
31 extern "C" char* network_password;
32 -static char* openURL_rtsp(RTSPClient* client, char const* url) {
33 - // If we were given a user name (and optional password), then use them:
34 - if (network_username != NULL) {
35 - char const* password = network_password == NULL ? "" : network_password;
36 - return client->describeWithPassword(url, network_username, password);
37 - } else {
38 - return client->describeURL(url);
39 - }
42 static char* openURL_sip(SIPClient* client, char const* url) {
43 // If we were given a user name (and optional password), then use them:
44 @@ -118,6 +107,19 @@ static char* openURL_sip(SIPClient* client, char const* url) {
45 extern AVCodecContext *avcctx;
46 #endif
48 +static char fWatchVariableForSyncInterface;
49 +static char* fResultString;
50 +static int fResultCode;
52 +static void responseHandlerForSyncInterface(RTSPClient* rtspClient, int responseCode, char* responseString) {
53 + // Set result values:
54 + fResultCode = responseCode;
55 + fResultString = responseString;
57 + // Signal a break from the event loop (thereby returning from the blocking command):
58 + fWatchVariableForSyncInterface = ~0;
61 extern "C" int audio_id, video_id, dvdsub_id;
62 extern "C" demuxer_t* demux_open_rtp(demuxer_t* demuxer) {
63 Boolean success = False;
64 @@ -146,13 +148,19 @@ extern "C" demuxer_t* demux_open_rtp(demuxer_t* demuxer) {
65 rtsp_transport_http = demuxer->stream->streaming_ctrl->url->port;
66 rtsp_transport_tcp = 1;
68 - rtspClient = RTSPClient::createNew(*env, verbose, "MPlayer", rtsp_transport_http);
69 + rtspClient = RTSPClient::createNew(*env, url, verbose, "MPlayer", rtsp_transport_http);
70 if (rtspClient == NULL) {
71 fprintf(stderr, "Failed to create RTSP client: %s\n",
72 env->getResultMsg());
73 break;
75 - sdpDescription = openURL_rtsp(rtspClient, url);
76 + fWatchVariableForSyncInterface = 0;
77 + rtspClient->sendDescribeCommand(responseHandlerForSyncInterface);
78 + env->taskScheduler().doEventLoop(&fWatchVariableForSyncInterface);
79 + if (fResultCode == 0)
80 + sdpDescription = fResultString;
81 + else
82 + delete[] fResultString;
83 } else { // SIP
84 unsigned char desiredAudioType = 0; // PCMU (use 3 for GSM)
85 sipClient = SIPClient::createNew(*env, desiredAudioType, NULL,
86 @@ -236,8 +244,12 @@ extern "C" demuxer_t* demux_open_rtp(demuxer_t* demuxer) {
88 if (rtspClient != NULL) {
89 // Issue a RTSP "SETUP" command on the chosen subsession:
90 - if (!rtspClient->setupMediaSubsession(*subsession, False,
91 - rtsp_transport_tcp)) break;
92 + fWatchVariableForSyncInterface = 0;
93 + rtspClient->sendSetupCommand(*subsession, responseHandlerForSyncInterface, False, rtsp_transport_tcp);
94 + env->taskScheduler().doEventLoop(&fWatchVariableForSyncInterface);
95 + delete[] fResultString;
96 + if (fResultCode != 0) break;
98 if (!strcmp(subsession->mediumName(), "audio"))
99 audiofound = 1;
100 if (!strcmp(subsession->mediumName(), "video"))
101 @@ -248,7 +260,11 @@ extern "C" demuxer_t* demux_open_rtp(demuxer_t* demuxer) {
103 if (rtspClient != NULL) {
104 // Issue a RTSP aggregate "PLAY" command on the whole session:
105 - if (!rtspClient->playMediaSession(*mediaSession)) break;
106 + fWatchVariableForSyncInterface = 0;
107 + rtspClient->sendPlayCommand(*mediaSession, responseHandlerForSyncInterface);
108 + env->taskScheduler().doEventLoop(&fWatchVariableForSyncInterface);
109 + delete[] fResultString;
110 + if (fResultCode != 0) break;
111 } else if (sipClient != NULL) {
112 sipClient->sendACK(); // to start the stream flowing
114 @@ -637,7 +653,8 @@ static void teardownRTSPorSIPSession(RTPState* rtpState) {
115 MediaSession* mediaSession = rtpState->mediaSession;
116 if (mediaSession == NULL) return;
117 if (rtpState->rtspClient != NULL) {
118 - rtpState->rtspClient->teardownMediaSession(*mediaSession);
119 + fWatchVariableForSyncInterface = 0;
120 + rtpState->rtspClient->sendTeardownCommand(*mediaSession, NULL);
121 } else if (rtpState->sipClient != NULL) {
122 rtpState->sipClient->sendBYE();
125 1.8.5.2