rtp.c File Reference

#include "libavcodec/bitstream.h"
#include "avformat.h"
#include <unistd.h>
#include "network.h"
#include "rtp_internal.h"

Go to the source code of this file.

Functions

int rtp_get_codec_info (AVCodecContext *codec, int payload_type)
int rtp_get_payload_type (AVCodecContext *codec)
const char * ff_rtp_enc_name (int payload_type)
enum CodecID ff_rtp_codec_id (const char *buf, enum CodecType codec_type)

Variables

struct {
   int   pt
   const char   enc_name [6]
   enum CodecType   codec_type
   enum CodecID   codec_id
   int   clock_rate
   int   audio_channels
AVRtpPayloadTypes []


Function Documentation

enum CodecID ff_rtp_codec_id ( const char *  buf,
enum CodecType  codec_type 
)

Definition at line 123 of file rtp.c.

References AVRtpPayloadTypes, codec_id, CODEC_ID_NONE, and enc_name.

Referenced by sdp_parse_rtpmap().

00124 {
00125     int i;
00126 
00127     for (i = 0; AVRtpPayloadTypes[i].pt >= 0; i++)
00128         if (!strcmp(buf, AVRtpPayloadTypes[i].enc_name) && (codec_type == AVRtpPayloadTypes[i].codec_type)){
00129             return AVRtpPayloadTypes[i].codec_id;
00130         }
00131 
00132     return CODEC_ID_NONE;
00133 }

const char* ff_rtp_enc_name ( int  payload_type  ) 

Definition at line 111 of file rtp.c.

References AVRtpPayloadTypes, enc_name, and pt.

Referenced by rtp_parse_close(), rtp_parse_open(), and sdp_parse_line().

00112 {
00113     int i;
00114 
00115     for (i = 0; AVRtpPayloadTypes[i].pt >= 0; i++)
00116         if (AVRtpPayloadTypes[i].pt == payload_type) {
00117             return AVRtpPayloadTypes[i].enc_name;
00118         }
00119 
00120     return "";
00121 }

int rtp_get_codec_info ( AVCodecContext codec,
int  payload_type 
)

Definition at line 77 of file rtp.c.

References audio_channels, AVRtpPayloadTypes, AVCodecContext::channels, clock_rate, codec_id, AVCodecContext::codec_id, CODEC_ID_NONE, AVCodecContext::codec_type, pt, and AVCodecContext::sample_rate.

Referenced by sdp_parse_line().

00078 {
00079     int i = 0;
00080 
00081     for (i = 0; AVRtpPayloadTypes[i].pt >= 0; i++)
00082         if (AVRtpPayloadTypes[i].pt == payload_type) {
00083             if (AVRtpPayloadTypes[i].codec_id != CODEC_ID_NONE) {
00084                 codec->codec_type = AVRtpPayloadTypes[i].codec_type;
00085                 codec->codec_id = AVRtpPayloadTypes[i].codec_id;
00086                 if (AVRtpPayloadTypes[i].audio_channels > 0)
00087                     codec->channels = AVRtpPayloadTypes[i].audio_channels;
00088                 if (AVRtpPayloadTypes[i].clock_rate > 0)
00089                     codec->sample_rate = AVRtpPayloadTypes[i].clock_rate;
00090                 return 0;
00091             }
00092         }
00093     return -1;
00094 }

int rtp_get_payload_type ( AVCodecContext codec  ) 

return < 0 if unknown payload type

Definition at line 96 of file rtp.c.

References AVRtpPayloadTypes, AVCodecContext::channels, codec_id, AVCodecContext::codec_id, and CODEC_ID_PCM_S16BE.

Referenced by rtp_write_header().

00097 {
00098     int i, payload_type;
00099 
00100     /* compute the payload type */
00101     for (payload_type = -1, i = 0; AVRtpPayloadTypes[i].pt >= 0; ++i)
00102         if (AVRtpPayloadTypes[i].codec_id == codec->codec_id) {
00103             if (codec->codec_id == CODEC_ID_PCM_S16BE)
00104                 if (codec->channels != AVRtpPayloadTypes[i].audio_channels)
00105                     continue;
00106             payload_type = AVRtpPayloadTypes[i].pt;
00107         }
00108     return payload_type;
00109 }


Variable Documentation

int audio_channels

Definition at line 45 of file rtp.c.

struct { ... } AVRtpPayloadTypes[] [static]

Referenced by ff_rtp_codec_id(), ff_rtp_enc_name(), rtp_get_codec_info(), and rtp_get_payload_type().

int clock_rate

Definition at line 44 of file rtp.c.

Referenced by rtp_get_codec_info().

enum CodecID codec_id

Definition at line 43 of file rtp.c.

Referenced by av_guess_codec(), ff_rtp_codec_id(), ff_vbv_update(), matroska_read_header(), mpegps_read_packet(), new_pes_av_stream(), new_video_stream(), rtp_get_codec_info(), and rtp_get_payload_type().

enum CodecType codec_type

Definition at line 42 of file rtp.c.

Referenced by avi_read_header(), new_pes_av_stream(), opt_bitrate(), and sdp_parse_line().

const char enc_name[6]

Definition at line 41 of file rtp.c.

Referenced by ff_rtp_codec_id(), and ff_rtp_enc_name().

int pt

Definition at line 40 of file rtp.c.

Referenced by ff_rtp_enc_name(), rtp_get_codec_info(), vp5_parse_coeff(), vp5_parse_coeff_models(), vp6_parse_coeff(), vp6_parse_coeff_huffman(), and vp6_parse_coeff_models().


Generated on Thu Nov 20 10:45:52 2008 for libextractor by  doxygen 1.5.1