~ubuntu-branches/ubuntu/quantal/linphone/quantal

« back to all changes in this revision

Viewing changes to oRTP/src/payloadtype.h

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2004-06-30 13:58:16 UTC
  • Revision ID: james.westby@ubuntu.com-20040630135816-wwx75gdlodkqbabb
Tags: upstream-0.12.2
ImportĀ upstreamĀ versionĀ 0.12.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  The oRTP library is an RTP (Realtime Transport Protocol - rfc1889) stack.
 
3
  Copyright (C) 2001  Simon MORLAT simon.morlat@linphone.org
 
4
 
 
5
  This library is free software; you can redistribute it and/or
 
6
  modify it under the terms of the GNU Lesser General Public
 
7
  License as published by the Free Software Foundation; either
 
8
  version 2.1 of the License, or (at your option) any later version.
 
9
 
 
10
  This library is distributed in the hope that it will be useful,
 
11
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
  Lesser General Public License for more details.
 
14
 
 
15
  You should have received a copy of the GNU Lesser General Public
 
16
  License along with this library; if not, write to the Free Software
 
17
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
*/
 
19
 
 
20
#ifndef PAYLOADTYPE_H
 
21
#define PAYLOADTYPE_H
 
22
#include "rtpport.h"
 
23
 
 
24
typedef enum{
 
25
        PAYLOAD_TYPE_ALLOCATED = 1
 
26
}PayloadTypeFlags;
 
27
 
 
28
struct _PayloadType
 
29
{
 
30
        gint type;
 
31
        #define PAYLOAD_AUDIO_CONTINUOUS 0
 
32
        #define PAYLOAD_AUDIO_PACKETIZED 1
 
33
        #define PAYLOAD_VIDEO 2
 
34
        #define PAYLOAD_OTHER 3  /* ?? */
 
35
        gint clock_rate;
 
36
        double bytes_per_sample;                /* in case of continuous audio data */
 
37
        char *zero_pattern;
 
38
        gint pattern_length;
 
39
        /* other usefull information */
 
40
        gint normal_bitrate;    /*in bit/s */
 
41
        char *mime_type;
 
42
        PayloadTypeFlags flags;
 
43
        void *user_data;
 
44
};
 
45
 
 
46
#ifndef PayloadType_defined
 
47
#define PayloadType_defined
 
48
typedef struct _PayloadType PayloadType;
 
49
#endif
 
50
 
 
51
PayloadType *payload_type_new();
 
52
PayloadType *payload_type_clone(PayloadType *payload);
 
53
void payload_type_destroy(PayloadType *pt);
 
54
#define payload_type_set_flag(pt,flag) (pt)->flags|=(flag)
 
55
#define payload_type_unset_flag(pt,flag) (pt)->flags&=(~flag)
 
56
 
 
57
struct _RtpProfile
 
58
{
 
59
        char *name;
 
60
        PayloadType *payload[127];
 
61
};
 
62
 
 
63
 
 
64
typedef struct _RtpProfile RtpProfile;
 
65
 
 
66
 
 
67
extern RtpProfile av_profile;
 
68
 
 
69
#define payload_type_set_user_data(pt,p)        (pt)->user_data=(p)
 
70
#define payload_type_get_user_data(pt)          ((pt)->user_data)
 
71
 
 
72
 
 
73
 
 
74
#define rtp_profile_get_name(profile)   (profile)->name
 
75
#define rtp_profile_set_name(profile,nm)        (profile)->name=(nm)
 
76
#define rtp_profile_set_payload(profile,index,pt)  (profile)->payload[(index)]=(pt)
 
77
#define rtp_profile_clear_payload(profile,index)        (profile)->payload[(index)]=NULL
 
78
#define rtp_profile_clear_all(profile)  memset((void*)(profile),0,sizeof(RtpProfile))
 
79
#define rtp_profile_get_payload(profile,index)  ((profile)->payload[(index)])
 
80
PayloadType * rtp_profile_get_payload_from_mime(RtpProfile *profile,const char *mime);
 
81
PayloadType * rtp_profile_get_payload_from_rtpmap(RtpProfile *profile, const char *rtpmap);
 
82
gint rtp_profile_get_payload_number_from_mime(RtpProfile *profile,const char *mime);
 
83
gint rtp_profile_get_payload_number_from_rtpmap(RtpProfile *profile, const char *rtpmap);
 
84
gint rtp_profile_find_payload_number(RtpProfile *prof,const gchar *mime,int rate);
 
85
PayloadType * rtp_profile_find_payload(RtpProfile *prof,const gchar *mime,int rate);
 
86
gint rtp_profile_move_payload(RtpProfile *prof,int oldpos,int newpos);
 
87
 
 
88
RtpProfile * rtp_profile_new(char *name);
 
89
/*clone a profile and its payloads */
 
90
RtpProfile * rtp_profile_clone_full(RtpProfile *prof);
 
91
void rtp_profile_destroy(RtpProfile *prof);
 
92
 
 
93
/* some payload types */
 
94
/* audio */
 
95
extern PayloadType pcmu8000;
 
96
extern PayloadType pcma8000;
 
97
extern PayloadType pcm8000;
 
98
extern PayloadType lpc1016;
 
99
extern PayloadType gsm;
 
100
extern PayloadType lpc1015;
 
101
extern PayloadType speex_nb;
 
102
extern PayloadType speex_wb;
 
103
extern PayloadType truespeech;
 
104
 
 
105
/* video */
 
106
extern PayloadType mpv;
 
107
extern PayloadType h261;
 
108
 
 
109
 
 
110
 
 
111
 
 
112
#endif