~ubuntu-branches/ubuntu/vivid/sflphone/vivid

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject/pjmedia/src/pjmedia/bidirectional.c

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2013-06-30 11:40:56 UTC
  • mfrom: (4.1.18 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130630114056-0np50jkyqo6vnmii
Tags: 1.2.3-2
* changeset_r92d62cfc54732bbbcfff2b1d36c096b120b981a5.diff 
  - fixes automatic endian detection 
* Update Vcs: fixes vcs-field-not-canonical

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: bidirectional.c 3553 2011-05-05 06:14:19Z nanang $ */
2
 
/* 
3
 
 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
 
 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5
 
 *
6
 
 * This program is free software; you can redistribute it and/or modify
7
 
 * it under the terms of the GNU General Public License as published by
8
 
 * the Free Software Foundation; either version 2 of the License, or
9
 
 * (at your option) any later version.
10
 
 *
11
 
 * This program is distributed in the hope that it will be useful,
12
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 * GNU General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU General Public License
17
 
 * along with this program; if not, write to the Free Software
18
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
19
 
 */
20
 
#include <pjmedia/bidirectional.h>
21
 
#include <pj/pool.h>
22
 
 
23
 
 
24
 
#define THIS_FILE   "bidirectional.c"
25
 
#define SIGNATURE   PJMEDIA_PORT_SIGNATURE('B', 'D', 'I', 'R')
26
 
 
27
 
struct bidir_port
28
 
{
29
 
    pjmedia_port     base;
30
 
    pjmedia_port    *get_port;
31
 
    pjmedia_port    *put_port;
32
 
};
33
 
 
34
 
 
35
 
static pj_status_t put_frame(pjmedia_port *this_port, 
36
 
                             const pjmedia_frame *frame)
37
 
{
38
 
    struct bidir_port *p = (struct bidir_port*)this_port;
39
 
    return pjmedia_port_put_frame(p->put_port, frame);
40
 
}
41
 
 
42
 
 
43
 
static pj_status_t get_frame(pjmedia_port *this_port, 
44
 
                             pjmedia_frame *frame)
45
 
{
46
 
    struct bidir_port *p = (struct bidir_port*)this_port;
47
 
    return pjmedia_port_get_frame(p->get_port, frame);
48
 
}
49
 
 
50
 
 
51
 
PJ_DEF(pj_status_t) pjmedia_bidirectional_port_create( pj_pool_t *pool,
52
 
                                                       pjmedia_port *get_port,
53
 
                                                       pjmedia_port *put_port,
54
 
                                                       pjmedia_port **p_port )
55
 
{
56
 
    struct bidir_port *port;
57
 
 
58
 
    port = PJ_POOL_ZALLOC_T(pool, struct bidir_port);
59
 
 
60
 
    pjmedia_port_info_init(&port->base.info, &get_port->info.name, SIGNATURE,
61
 
                           get_port->info.clock_rate,
62
 
                           get_port->info.channel_count,
63
 
                           get_port->info.bits_per_sample,
64
 
                           get_port->info.samples_per_frame);
65
 
 
66
 
    port->get_port = get_port;
67
 
    port->put_port = put_port;
68
 
 
69
 
    port->base.get_frame = &get_frame;
70
 
    port->base.put_frame = &put_frame;
71
 
 
72
 
    *p_port = &port->base;
73
 
 
74
 
    return PJ_SUCCESS;
75
 
}
76