[FFmpeg-soc] [soc]: r4481 - rtmp/rtmpdec.c

kostya subversion at mplayerhq.hu
Thu Jun 18 06:35:26 CEST 2009


Author: kostya
Date: Thu Jun 18 06:35:26 2009
New Revision: 4481

Log:
Server reply to 'connect' call contains channel ID which should be used
in subsequent calls; so extract, save and use it where applicable.

Modified:
   rtmp/rtmpdec.c

Modified: rtmp/rtmpdec.c
==============================================================================
--- rtmp/rtmpdec.c	Thu Jun 18 06:30:49 2009	(r4480)
+++ rtmp/rtmpdec.c	Thu Jun 18 06:35:26 2009	(r4481)
@@ -48,6 +48,7 @@ typedef struct RTMPState {
     RTMPPacketHistory rhist, whist;
     char playpath[256];
     ClientState state;
+    int main_stream_id;
 } RTMPState;
 
 #define PLAYER_KEY_OPEN_PART_LEN 30
@@ -147,6 +148,7 @@ static void gen_play(AVFormatContext *s,
     av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath);
     rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0,
                        29 + strlen(rt->playpath));
+    pkt.extra = rt->main_stream_id;
 
     num = 0.0;
     p = pkt.data;
@@ -511,6 +513,11 @@ static int rtmp_parse_result(AVFormatCon
                 rt->state = STATE_CONNECTING;
                 break;
             case STATE_CONNECTING:
+                //extract a number from result
+                if (pkt->data[10] || pkt->data[19] != 5 || pkt->data[20])
+                    av_log(s, AV_LOG_WARNING, "Unexpected reply on connect()\n");
+                else
+                    rt->main_stream_id = (int) av_int2dbl(AV_RB64(pkt->data + 21));
                 gen_play(s, rt);
                 rt->state = STATE_PLAYING;
                 break;


More information about the FFmpeg-soc mailing list