📄 sdp_dump.c
字号:
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2000, 2001. All Rights Reserved.
*
* Contributor(s):
* Bill May wmay@cisco.com
*/
/*
* sdp_dump.c
*
* dump SDP structure to stdout
*
* October, 2000
* Bill May (wmay@cisco.com)
* Cisco Systems, Inc.
*/
#include "sdp.h"
#include "sdp_decode_private.h"
static void time_repeat_dump (time_repeat_desc_t *trptr)
{
int morethan1;
char buffer[80], *start;
int cnt;
uint32_t ix;
morethan1 = trptr != NULL && trptr->next != NULL;
cnt = 0;
while (trptr != NULL) {
if (morethan1) {
/* Rtsp_Printf("Repeat %d:\n", cnt + 1);
*/
start = "\t";
} else {
start = "";
}
cnt++;
sdp_time_offset_to_str(trptr->repeat_interval, buffer, sizeof(buffer));
/* Rtsp_Printf("%sRepeat Interval: %s\n", start, buffer);
*/
sdp_time_offset_to_str(trptr->active_duration, buffer, sizeof(buffer));
/* Rtsp_Printf("%sDuration of session: %s\n", start, buffer);
Rtsp_Printf("%sOffsets: \n", start);
*/
for (ix = 0; ix < trptr->offset_cnt; ix++) {
sdp_time_offset_to_str(trptr->offsets[ix], buffer, sizeof(buffer));
/* Rtsp_Printf("%s\t", buffer);
if ((ix % 8) == 0) {
Rtsp_Printf("\n%s", start);
}
*/
}
trptr = trptr->next;
}
}
static void time_dump (session_time_desc_t *tptr) {
while (tptr != NULL) {
if (tptr->end_time == 0 &&
tptr->start_time == 0) {
/* Rtsp_Printf("Start/End time is 0\n");
*/
} else {
if (tptr->start_time != 0) {
/* Rtsp_Printf("Start Time: %s\n", ctime(&tptr->start_time));
*/
} else {
/* Rtsp_Printf("Start Time is 0\n");
*/
}
if (tptr->end_time != 0) {
/* Rtsp_Printf("End Time: %s\n", ctime(&tptr->end_time));
*/
} else {
/* Rtsp_Printf("End Time is 0\n");
*/
}
}
time_repeat_dump(tptr->repeat);
tptr = tptr->next;
}
}
static void time_adj_dump (time_adj_desc_t *taptr)
{
while (taptr != NULL) {
/* Rtsp_Printf("Adjustment of %d on %s\n", taptr->offset, ctime(&taptr->adj_time));
*/
taptr = taptr->next;
}
}
static void unparsed_dump (string_list_t *uptr,
char *start)
{
/* Rtsp_Printf("%sUnparsed lines:\n", start);
*/
while (uptr != NULL) {
/* Rtsp_Printf("\t%s%s\n", start, uptr->string_val);
*/
uptr = uptr->next;
}
}
static void bandwidth_dump (bandwidth_t *bptr, char *start)
{
while (bptr != NULL) {
/* Rtsp_Printf("%s Bandwidth: %ld \n", start, bptr->bandwidth);
*/
if (bptr->modifier == BANDWIDTH_MODIFIER_USER) {
/* Rtsp_Printf("(%s)", bptr->user_band);
*/
} else {
/* Rtsp_Printf("(%s)",
bptr->modifier == BANDWIDTH_MODIFIER_AS ? "AS type" : "CT type");
*/
}
/* Rtsp_Printf("\n");
*/
bptr = bptr->next;
}
}
static void category_dump (category_list_t *cptr)
{
/* int ix = 0;
if (cptr == NULL)
return;
Rtsp_Printf("Category: ");
while (cptr != NULL) {
Rtsp_Printf("%lld ", cptr->category);
ix++;
if (ix >= 8) {
Rtsp_Printf("\n");
ix = 0;
}
cptr = cptr->next;
}
if (ix != 0) Rtsp_Printf("\n");
*/
}
static void key_dump (key_desc_t *sptr)
{
switch (sptr->key_type) {
case KEY_TYPE_PROMPT:
/* Rtsp_Printf("Key: prompt\n");
*/
break;
case KEY_TYPE_CLEAR:
/* Rtsp_Printf("Key: clear : %s\n", sptr->key);
*/
break;
case KEY_TYPE_BASE64:
/* Rtsp_Printf("Key: base64\n");
*/
break;
case KEY_TYPE_URI:
/* Rtsp_Printf("Key: uri : %s\n", sptr->key);
*/
break;
default:
break;
}
}
static void range_dump (range_desc_t *rptr, const char *start)
{
/* char buffer[80];
if (rptr->have_range == FALSE) return;
Rtsp_Printf("%sRange is ", start);
if (rptr->range_is_npt) {
Rtsp_Printf("npt - start %d, end ", rptr->range_start);
if (rptr->range_end_infinite) {
Rtsp_Printf("infinite\n");
} else {
Rtsp_Printf("%l\n", rptr->range_end);
}
} else if(!rptr->range_is_pts) {
Rtsp_Printf("smtpe - start ");
sdp_smpte_to_str(rptr->range_start, rptr->range_smpte_fps, buffer);
Rtsp_Printf("%s, end ", buffer);
if (rptr->range_end_infinite) {
Rtsp_Printf("infinite\n");
} else {
sdp_smpte_to_str(rptr->range_end, rptr->range_smpte_fps, buffer);
Rtsp_Printf("%s\n", buffer);
}
}else{
Rtsp_Printf("pts - start %l, end ", rptr->range_start);
if (rptr->range_end_infinite) {
Rtsp_Printf("infinite\n");
} else {
Rtsp_Printf("%l\n", rptr->range_end);
}
}
*/
}
static void media_dump (media_desc_t *mptr)
{
/* format_list_t *fptr;
int ix;
Rtsp_Printf("\tMedia type: %s\n", mptr->media);
Rtsp_Printf("\tMedia proto: %s\n", mptr->proto);
if (mptr->media_desc)
Rtsp_Printf("\tMedia description: %s\n", mptr->media_desc);
if (mptr->media_connect.used) {
Rtsp_Printf("\tMedia Address: %s", mptr->media_connect.conn_addr);
if (strcmp(mptr->media_connect.conn_type, "IP4") != 0) {
Rtsp_Printf("(address type %s)", mptr->media_connect.conn_type);
}
if (mptr->media_connect.num_addr > 0) {
Rtsp_Printf("(%u addresses)", mptr->media_connect.num_addr);
}
Rtsp_Printf("\n\tMedia TTL: %u\n", mptr->media_connect.ttl);
}
Rtsp_Printf("\tMedia port number: %d", mptr->port);
if (mptr->num_ports > 1) {
Rtsp_Printf("/%d", mptr->num_ports);
}
Rtsp_Printf("\n");
bandwidth_dump(mptr->media_bandwidth, "\n\tMedia");
if (mptr->recvonly) {
Rtsp_Printf("\tReceive Only Set\n");
}
if (mptr->sendrecv) {
Rtsp_Printf("\tSend/Receive Set\n");
}
if (mptr->sendonly) {
Rtsp_Printf("\tSend Only Set\n");
}
if (mptr->ptime_present) {
Rtsp_Printf("\tPacket Time: %d\n", mptr->ptime);
}
if (mptr->quality_present) {
Rtsp_Printf("\tQuality: %d\n", mptr->quality);
}
if (mptr->framerate_present) {
Rtsp_Printf("\tFramerate: %d\n", mptr->framerate);
}
if (mptr->control_string) {
Rtsp_Printf("\tControl: %s\n", mptr->control_string);
}
range_dump(&mptr->media_range, "\t");
Rtsp_Printf("\tMedia formats: ");
fptr = mptr->fmt;
ix = 0;
while (fptr != NULL) {
if (ix >= 6) {
Rtsp_Printf("\n\t\t");
ix = 0;
}
Rtsp_Printf("%s", fptr->fmt);
if (fptr->rtpmap != NULL) {
Rtsp_Printf("(%s %u", fptr->rtpmap->encode_name, fptr->rtpmap->clock_rate);
if (fptr->rtpmap->encode_param != 0){
Rtsp_Printf(" %u", fptr->rtpmap->encode_param);
}
Rtsp_Printf(")");
ix += 2;
}
if (fptr->fmt_param != NULL) {
Rtsp_Printf("(%s)", fptr->fmt_param);
ix += 4;
}
Rtsp_Printf(" ");
ix++;
fptr = fptr->next;
}
Rtsp_Printf("\n");
*/
unparsed_dump(mptr->unparsed_a_lines, "\t");
}
void session_dump_one (session_desc_t *sptr)
{
/*
int ix;
media_desc_t *media;
string_list_t *strptr;
Rtsp_Printf("Session name: %s\n", sptr->session_name);
if (sptr->session_desc != NULL) {
Rtsp_Printf("Description: %s\n", sptr->session_desc);
}
if (sptr->uri != NULL) {
Rtsp_Printf("URI: %s\n", sptr->uri);
}
if (sptr->orig_username) {
Rtsp_Printf("Origin username: %s\n", sptr->orig_username);
}
Rtsp_Printf("Session id: %lld\nSession version: %lld\n",
sptr->session_id,
sptr->session_version);
if (sptr->create_addr)
Rtsp_Printf("Session created by: %s\n", sptr->create_addr);
if (sptr->create_addr_type &&
strcmp(sptr->create_addr_type, "IP4") != 0) {
Rtsp_Printf("address type %s\n", sptr->create_addr_type);
}
Rtsp_Printf("\n");
if (sptr->conf_type != CONFERENCE_TYPE_NONE) {
Rtsp_Printf("Conference type: %s\n",
sptr->conf_type < CONFERENCE_TYPE_OTHER ?
type_values[sptr->conf_type - 1] : sptr->conf_type_user);
}
if (sptr->keywds) Rtsp_Printf("Keywords: %s\n", sptr->keywds);
if (sptr->tool) Rtsp_Printf("Tool: %s\n", sptr->tool);
category_dump(sptr->category_list);
strptr = sptr->admin_email;
while (strptr != NULL) {
Rtsp_Printf("Admin email: %s\n", strptr->string_val);
strptr = strptr->next;
}
strptr = sptr->admin_phone;
while (strptr != NULL) {
Rtsp_Printf("Admin phone: %s\n", strptr->string_val);
strptr = strptr->next;
}
key_dump(&sptr->key);
time_dump(sptr->time_desc);
time_adj_dump(sptr->time_adj_desc);
if (sptr->session_connect.used) {
Rtsp_Printf("Session Address: %s\n", sptr->session_connect.conn_addr);
if (strcmp(sptr->session_connect.conn_type, "IP4") != 0) {
Rtsp_Printf("(address type %s)\n", sptr->session_connect.conn_type);
}
if (sptr->session_connect.num_addr > 0) {
Rtsp_Printf("(%u addresses)\n", sptr->session_connect.num_addr);
}
Rtsp_Printf("\ntSession TTL: %u\n", sptr->session_connect.ttl);
}
range_dump(&sptr->session_range, "");
bandwidth_dump(sptr->session_bandwidth, "Session");
if (sptr->control_string) {
Rtsp_Printf("Control: %s\n", sptr->control_string);
}
*/
/*unparsed_dump(sptr->unparsed_a_lines, "");*/
/* ix = 0;
media = sptr->media;
while (media != NULL) {
Rtsp_Printf("Media description %d:\n", ix + 1);
media_dump(media);
media = media->next;
ix++;
}
if (ix == 0) {
Rtsp_Printf("No media descriptions for session\n");
}
*/
}
void session_dump_list (session_desc_t *sptr)
{
/*
while (sptr != NULL) {
session_dump_one(sptr);
Rtsp_Printf("\n");
sptr = sptr->next;
if (sptr) {
Rtsp_Printf("------------------------------------------------------\n");
}
}
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -