[soc]: r4558 - in rtmp: rtmppkt.c rtmppkt.h rtmpproto.c
Author: kostya Date: Wed Jul 1 10:37:36 2009 New Revision: 4558 Log: Rename stream_id to channel_id to avoid confusion with audio/video stream ID Modified: rtmp/rtmppkt.c rtmp/rtmppkt.h rtmp/rtmpproto.c Modified: rtmp/rtmppkt.c ============================================================================== --- rtmp/rtmppkt.c Wed Jul 1 03:51:52 2009 (r4557) +++ rtmp/rtmppkt.c Wed Jul 1 10:37:36 2009 (r4558) @@ -72,13 +72,13 @@ int rtmp_packet_read(URLContext *h, RTMP int chunk_size, RTMPPacket *prev_pkt) { uint8_t hdr, t, buf[16]; - int stream_id, timestamp, data_size, offset = 0, extra = 0; + int channel_id, timestamp, data_size, offset = 0, extra = 0; uint8_t type; if (url_read(h, &hdr, 1) != 1) { return -1; } - stream_id = hdr & 0x3F; + channel_id = hdr & 0x3F; hdr >>= 6; if (hdr == RTMP_PS_ONEBYTE) { @@ -103,22 +103,22 @@ int rtmp_packet_read(URLContext *h, RTMP } extra = AV_RL32(buf); } else { - extra = prev_pkt[stream_id].extra; + extra = prev_pkt[channel_id].extra; } } else { - data_size = prev_pkt[stream_id].data_size; - type = prev_pkt[stream_id].type; - extra = prev_pkt[stream_id].extra; + data_size = prev_pkt[channel_id].data_size; + type = prev_pkt[channel_id].type; + extra = prev_pkt[channel_id].extra; } } - rtmp_packet_create(p, stream_id, type, timestamp, data_size); + rtmp_packet_create(p, channel_id, type, timestamp, data_size); p->extra = extra; // save history - prev_pkt[stream_id].stream_id = type; - prev_pkt[stream_id].type = stream_id; - prev_pkt[stream_id].data_size = data_size; - prev_pkt[stream_id].timestamp = timestamp; - prev_pkt[stream_id].extra = extra; + prev_pkt[channel_id].channel_id = type; + prev_pkt[channel_id].type = channel_id; + prev_pkt[channel_id].data_size = data_size; + prev_pkt[channel_id].timestamp = timestamp; + prev_pkt[channel_id].extra = extra; while (data_size > 0) { int toread = FFMIN(data_size, chunk_size); int r; @@ -130,7 +130,7 @@ int rtmp_packet_read(URLContext *h, RTMP offset += chunk_size; if (data_size > 0) { url_read_complete(h, &t, 1); //marker - if (t != (0xC0 + stream_id)) { + if (t != (0xC0 + channel_id)) { return -1; } } @@ -147,7 +147,7 @@ int rtmp_packet_write(URLContext *h, RTM // if (pkt->type != RTMP_PT_INVOKE) // mode = RTMP_PS_EIGHTBYTES; - bytestream_put_byte(&p, pkt->stream_id | (mode << 6)); + bytestream_put_byte(&p, pkt->channel_id | (mode << 6)); if (mode != RTMP_PS_ONEBYTE) { bytestream_put_be24(&p, pkt->timestamp); if (mode != RTMP_PS_FOURBYTES) { @@ -163,21 +163,21 @@ int rtmp_packet_write(URLContext *h, RTM url_write(h, pkt->data + off, towrite); off += towrite; if (off < pkt->data_size) { - uint8_t marker = 0xC0 | pkt->stream_id; + uint8_t marker = 0xC0 | pkt->channel_id; url_write(h, &marker, 1); } } return 0; } -int rtmp_packet_create(RTMPPacket *pkt, int stream_id, RTMPPacketType type, +int rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type, int timestamp, int size) { pkt->data = av_malloc(size); if (!pkt->data) return -1; pkt->data_size = size; - pkt->stream_id = stream_id; + pkt->channel_id = channel_id; pkt->type = type; pkt->timestamp = timestamp; pkt->extra = 0; @@ -322,12 +322,12 @@ static void parse_amf(const uint8_t *dat void rtmp_packet_inspect(RTMPPacket *pkt) { av_log(NULL,0,"Packet on "); - switch (pkt->stream_id) { + switch (pkt->channel_id) { case RTMP_NETWORK_CHANNEL: av_log(NULL,0,"network channel");break; case RTMP_SYSTEM_CHANNEL: av_log(NULL,0,"system channel");break; case RTMP_VIDEO_CHANNEL: av_log(NULL,0,"video channel");break; case RTMP_AUDIO_CHANNEL: av_log(NULL,0,"audio channel");break; - default: av_log(NULL,0,"channel %d",pkt->stream_id); + default: av_log(NULL,0,"channel %d",pkt->channel_id); } av_log(NULL,0," type "); switch (pkt->type) { Modified: rtmp/rtmppkt.h ============================================================================== --- rtmp/rtmppkt.h Wed Jul 1 03:51:52 2009 (r4557) +++ rtmp/rtmppkt.h Wed Jul 1 10:37:36 2009 (r4558) @@ -98,7 +98,7 @@ typedef enum AMFType { * structure for holding RTMP packets */ typedef struct RTMPPacket { - uint8_t stream_id; ///< stream ID + uint8_t channel_id;///< RTMP channel ID RTMPPacketType type; ///< packet type int timestamp; ///< packet timestamp int extra; ///< additional data @@ -106,7 +106,7 @@ typedef struct RTMPPacket { int data_size; ///< packet payload size } RTMPPacket; -int rtmp_packet_create(RTMPPacket *pkt, int stream_id, RTMPPacketType type, +int rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type, int timestamp, int size); void rtmp_packet_destroy(RTMPPacket *pkt); Modified: rtmp/rtmpproto.c ============================================================================== --- rtmp/rtmpproto.c Wed Jul 1 03:51:52 2009 (r4557) +++ rtmp/rtmpproto.c Wed Jul 1 10:37:36 2009 (r4558) @@ -55,7 +55,7 @@ typedef struct RTMPContext { int chunk_size; char playpath[256]; ClientState state; - int main_stream_id; + int main_channel_id; uint8_t* flv_data; int flv_size; int flv_off; @@ -160,7 +160,7 @@ static void gen_play(URLContext *s, RTMP //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; + pkt.extra = rt->main_channel_id; num = 0.0; p = pkt.data; @@ -381,7 +381,7 @@ static int rtmp_parse_result(URLContext if (pkt->data[10] || pkt->data[19] != 5 || pkt->data[20]) av_log(NULL, AV_LOG_WARNING, "Unexpected reply on connect()\n"); else - rt->main_stream_id = (int) av_int2dbl(AV_RB64(pkt->data + 21)); + rt->main_channel_id = (int) av_int2dbl(AV_RB64(pkt->data + 21)); gen_play(s, rt); rt->state = STATE_READY; break;
participants (1)
-
kostya