1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

srs-librtmp: implements the read packet.

This commit is contained in:
winlin 2014-03-02 17:47:53 +08:00
parent c338eb3666
commit efa09102cf
4 changed files with 137 additions and 1 deletions

View file

@ -31,11 +31,16 @@ int main(int argc, char** argv)
{
srs_rtmp_t rtmp;
// packet data
int type, size;
u_int32_t timestamp;
char* data;
printf("suck rtmp stream like rtmpdump\n");
printf("srs(simple-rtmp-server) client librtmp library.\n");
printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision());
rtmp = srs_rtmp_create("rtmp://127.0.0.1:1935/live/show?vhost=__defaultVhost__/livestream");
rtmp = srs_rtmp_create("rtmp://127.0.0.1:1935/live?vhost=__defaultVhost__/livestream");
if (srs_simple_handshake(rtmp) != 0) {
printf("simple handshake failed.\n");
@ -55,6 +60,15 @@ int main(int argc, char** argv)
}
printf("play stream success\n");
for (;;) {
if (srs_read_packet(rtmp, &type, &timestamp, &data, &size) != 0) {
goto rtmp_destroy;
}
printf("got packet: type=%s, time=%d, size=%d\n", srs_type2string(type), timestamp, size);
free(data);
}
rtmp_destroy:
srs_rtmp_destroy(rtmp);