[FFmpeg-soc] [soc]: r4748 - in rtmp: rtmppkt.c rtmppkt.h rtmpproto.c
kostya
subversion at mplayerhq.hu
Wed Jul 22 07:33:53 CEST 2009
Author: kostya
Date: Wed Jul 22 07:33:53 2009
New Revision: 4748
Log:
Give rtmp_packet_*() an additional ff_ prefix
Modified:
rtmp/rtmppkt.c
rtmp/rtmppkt.h
rtmp/rtmpproto.c
Modified: rtmp/rtmppkt.c
==============================================================================
--- rtmp/rtmppkt.c Wed Jul 22 07:29:39 2009 (r4747)
+++ rtmp/rtmppkt.c Wed Jul 22 07:33:53 2009 (r4748)
@@ -53,7 +53,7 @@ void rtmp_amf_write_tag(uint8_t **dst, A
}
}
-int rtmp_packet_read(URLContext *h, RTMPPacket *p,
+int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
int chunk_size, RTMPPacket *prev_pkt)
{
uint8_t hdr, t, buf[16];
@@ -92,7 +92,7 @@ int rtmp_packet_read(URLContext *h, RTMP
extra = prev_pkt[channel_id].extra;
}
}
- rtmp_packet_create(p, channel_id, type, timestamp, data_size);
+ ff_rtmp_packet_create(p, channel_id, type, timestamp, data_size);
p->extra = extra;
// save history
prev_pkt[channel_id].channel_id = channel_id;
@@ -104,7 +104,7 @@ int rtmp_packet_read(URLContext *h, RTMP
int toread = FFMIN(data_size, chunk_size);
int r;
if ((r = url_read_complete(h, p->data + offset, toread)) != toread) {
- rtmp_packet_destroy(p);
+ ff_rtmp_packet_destroy(p);
return AVERROR(EIO);
}
data_size -= chunk_size;
@@ -118,7 +118,7 @@ int rtmp_packet_read(URLContext *h, RTMP
return 0;
}
-int rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
+int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
int chunk_size, RTMPPacket *prev_pkt)
{
uint8_t pkt_hdr[16], *p = pkt_hdr;
@@ -150,7 +150,7 @@ int rtmp_packet_write(URLContext *h, RTM
return 0;
}
-int rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
+int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
int timestamp, int size)
{
pkt->data = av_malloc(size);
@@ -165,7 +165,7 @@ int rtmp_packet_create(RTMPPacket *pkt,
return 0;
}
-void rtmp_packet_destroy(RTMPPacket *pkt)
+void ff_rtmp_packet_destroy(RTMPPacket *pkt)
{
if (!pkt)
return;
Modified: rtmp/rtmppkt.h
==============================================================================
--- rtmp/rtmppkt.h Wed Jul 22 07:29:39 2009 (r4747)
+++ rtmp/rtmppkt.h Wed Jul 22 07:33:53 2009 (r4748)
@@ -115,7 +115,7 @@ typedef struct RTMPPacket {
* @param size packet size
* @return zero on success, -1 otherwise
*/
-int rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
+int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
int timestamp, int size);
/**
@@ -123,7 +123,7 @@ int rtmp_packet_create(RTMPPacket *pkt,
*
* @param pkt packet
*/
-void rtmp_packet_destroy(RTMPPacket *pkt);
+void ff_rtmp_packet_destroy(RTMPPacket *pkt);
/**
* Reads RTMP packet.
@@ -135,7 +135,7 @@ void rtmp_packet_destroy(RTMPPacket *pkt
* (may be needed for restoring incomplete packet header)
* @return zero on success, -1 otherwise
*/
-int rtmp_packet_read(URLContext *h, RTMPPacket *p,
+int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
int chunk_size, RTMPPacket *prev_pkt);
/**
@@ -148,7 +148,7 @@ int rtmp_packet_read(URLContext *h, RTMP
* (may be used for packet header compressing)
* @return zero on success, -1 otherwise
*/
-int rtmp_packet_write(URLContext *h, RTMPPacket *p,
+int ff_rtmp_packet_write(URLContext *h, RTMPPacket *p,
int chunk_size, RTMPPacket *prev_pkt);
/**
Modified: rtmp/rtmpproto.c
==============================================================================
--- rtmp/rtmpproto.c Wed Jul 22 07:29:39 2009 (r4747)
+++ rtmp/rtmpproto.c Wed Jul 22 07:33:53 2009 (r4748)
@@ -98,7 +98,7 @@ static void gen_connect(URLContext *s, R
double num = 1.0;
uint8_t bool;
- rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, 4096);
+ ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, 4096);
p = pkt.data;
snprintf(tcurl, sizeof(tcurl), "%s://%s:%d/%s", proto, host, port, app);
@@ -133,7 +133,7 @@ static void gen_connect(URLContext *s, R
pkt.data_size = p - pkt.data;
- rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
+ ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
}
static void gen_create_stream(URLContext *s, RTMPContext *rt)
@@ -143,7 +143,7 @@ static void gen_create_stream(URLContext
double num;
//av_log(s, AV_LOG_DEBUG, "Creating stream...\n");
- rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, 25);
+ ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, 25);
num = 3.0;
p = pkt.data;
@@ -151,8 +151,8 @@ static void gen_create_stream(URLContext
rtmp_amf_write_tag(&p, AMF_NUMBER, &num);
rtmp_amf_write_tag(&p, AMF_NULL, NULL);
- rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- rtmp_packet_destroy(&pkt);
+ ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
+ ff_rtmp_packet_destroy(&pkt);
}
static void gen_play(URLContext *s, RTMPContext *rt)
@@ -162,7 +162,7 @@ static void gen_play(URLContext *s, RTMP
double num;
//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,
+ ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0,
29 + strlen(rt->playpath));
pkt.extra = rt->main_channel_id;
@@ -175,19 +175,19 @@ static void gen_play(URLContext *s, RTMP
num = 0.0;
rtmp_amf_write_tag(&p, AMF_NUMBER, &num);
- rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- rtmp_packet_destroy(&pkt);
+ ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
+ ff_rtmp_packet_destroy(&pkt);
// set client buffer time disguised in ping packet
- rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING, 1, 10);
+ ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING, 1, 10);
p = pkt.data;
bytestream_put_be16(&p, 3);
bytestream_put_be32(&p, 1);
bytestream_put_be32(&p, 256); //TODO: what is a good value here?
- rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- rtmp_packet_destroy(&pkt);
+ ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
+ ff_rtmp_packet_destroy(&pkt);
}
static void gen_pong(URLContext *s, RTMPContext *rt, RTMPPacket *ppkt)
@@ -195,12 +195,12 @@ static void gen_pong(URLContext *s, RTMP
RTMPPacket pkt;
uint8_t *p;
- rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING, ppkt->timestamp + 1, 6);
+ ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING, ppkt->timestamp + 1, 6);
p = pkt.data;
bytestream_put_be16(&p, 7);
bytestream_put_be32(&p, AV_RB32(ppkt->data+2) + 1);
- rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- rtmp_packet_destroy(&pkt);
+ ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
+ ff_rtmp_packet_destroy(&pkt);
}
//TODO: Move HMAC code somewhere. Eventually.
@@ -431,7 +431,7 @@ static int get_packet(URLContext *s, int
for(;;) {
RTMPPacket rpkt;
int has_data = 0;
- if ((ret = rtmp_packet_read(rt->stream, &rpkt,
+ if ((ret = ff_rtmp_packet_read(rt->stream, &rpkt,
rt->chunk_size, rt->prev_pkt[0])) != 0) {
if (ret > 0) {
nanosleep(&ts, NULL);
@@ -443,15 +443,15 @@ static int get_packet(URLContext *s, int
ret = rtmp_parse_result(s, rt, &rpkt);
if (ret < 0) {//serious error in packet
- rtmp_packet_destroy(&rpkt);
+ ff_rtmp_packet_destroy(&rpkt);
return -1;
}
if (for_header && rt->state == STATE_PLAYING) {
- rtmp_packet_destroy(&rpkt);
+ ff_rtmp_packet_destroy(&rpkt);
return 0;
}
if (!rpkt.data_size) {
- rtmp_packet_destroy(&rpkt);
+ ff_rtmp_packet_destroy(&rpkt);
continue;
}
if (rpkt.type == RTMP_PT_VIDEO || rpkt.type == RTMP_PT_AUDIO
@@ -486,7 +486,7 @@ static int get_packet(URLContext *s, int
memcpy(rt->flv_data, rpkt.data, rpkt.data_size);
has_data = 1;
}
- rtmp_packet_destroy(&rpkt);
+ ff_rtmp_packet_destroy(&rpkt);
if (has_data)
break;
}
More information about the FFmpeg-soc
mailing list