summaryrefslogtreecommitdiffstats
path: root/tinyMEDIA/src/tmedia_session_ghost.c
blob: b6fb6cd21ecf1b3b6a5a5557737675941a8d3d58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/

/**@file tmedia_session_ghost.c
 * @brief Ghost session.
 *
 * @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
 *

 */
#include "tinymedia/tmedia_session_ghost.h"

#include "tsk_memory.h"
#include "tsk_debug.h"

/* ============ Ghost Session ================= */

static int tmedia_session_ghost_prepare(tmedia_session_t* self)
{
    return 0;
}

static int tmedia_session_ghost_start(tmedia_session_t* self)
{
    return 0;
}

static int tmedia_session_ghost_stop(tmedia_session_t* self)
{
    TSK_DEBUG_INFO("tmedia_session_ghost_stop");
    return 0;
}

static int tmedia_session_ghost_pause(tmedia_session_t* self)
{
    return 0;
}

static const tsdp_header_M_t* tmedia_session_ghost_get_lo(tmedia_session_t* self)
{
    tmedia_session_ghost_t* ghost;

    ghost = (tmedia_session_ghost_t*)self;

    if(self->M.lo) {
        return self->M.lo;
    }
    else if(!(self->M.lo = tsdp_header_M_create(ghost->media, 0, ghost->proto ? ghost->proto: "RTP/AVP"))) {
        TSK_DEBUG_ERROR("Failed to create lo");
        return tsk_null;
    }

    // add format
    if(!tsk_strnullORempty(ghost->first_format)) {
        tsk_string_t* fmt = tsk_string_create(ghost->first_format);
        if(!self->M.lo->FMTs) {
            self->M.lo->FMTs = tsk_list_create();
        }
        tsk_list_push_back_data(self->M.lo->FMTs, (void**)&fmt);
        TSK_OBJECT_SAFE_FREE(fmt);
    }

    return self->M.lo;
}

static int tmedia_session_ghost_set_ro(tmedia_session_t* self, const tsdp_header_M_t* m)
{
    return 0;
}







//=================================================================================================
//	Ghost session object definition
//
/* constructor */
static tsk_object_t* tmedia_session_ghost_ctor(tsk_object_t * self, va_list * app)
{
    tmedia_session_ghost_t *session = self;
    if(session) {
        /* init base */
        tmedia_session_init(TMEDIA_SESSION(session), tmedia_none);
        /* init self */
    }
    return self;
}
/* destructor */
static tsk_object_t* tmedia_session_ghost_dtor(tsk_object_t * self)
{
    tmedia_session_ghost_t *session = self;
    if(session) {
        /* deinit base */
        tmedia_session_deinit(TMEDIA_SESSION(session));
        /* deinit self */
        TSK_FREE(session->media);
        TSK_FREE(session->proto);
        TSK_FREE(session->first_format);
    }

    return self;
}
/* object definition */
static const tsk_object_def_t tmedia_session_ghost_def_s = {
    sizeof(tmedia_session_ghost_t),
    tmedia_session_ghost_ctor,
    tmedia_session_ghost_dtor,
    tmedia_session_cmp,
};
/* plugin definition*/
static const tmedia_session_plugin_def_t tmedia_session_ghost_plugin_def_s = {
    &tmedia_session_ghost_def_s,

    tmedia_ghost,
    "ghost",

    tsk_null, /* set() */
    tsk_null, /* get() */
    tmedia_session_ghost_prepare,
    tmedia_session_ghost_start,
    tmedia_session_ghost_stop,
    tmedia_session_ghost_pause,

    /* Audio part */
    { tsk_null },

    tmedia_session_ghost_get_lo,
    tmedia_session_ghost_set_ro
};
const tmedia_session_plugin_def_t *tmedia_session_ghost_plugin_def_t = &tmedia_session_ghost_plugin_def_s;
OpenPOWER on IntegriCloud