File: utils.h

package info (click to toggle)
telepathy-farstream 0.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 2,756 kB
  • ctags: 1,058
  • sloc: sh: 11,072; ansic: 9,131; python: 2,875; makefile: 223
file content (62 lines) | stat: -rw-r--r-- 1,427 bytes parent folder | download | duplicates (2)
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
#ifndef __UTILS_H__
#define __UTILS_H__

/*
 * tp_media_type_to_fs:
 * @type: A Telepathy Media Stream Type
 *
 * Converts a Telepathy Media Stream Type to the Farstream equivalent
 *
 * Return: A Farstream Stream Type
 */

static inline FsMediaType
tp_media_type_to_fs (TpMediaStreamType type)
{
  switch (type)
    {
    case TP_MEDIA_STREAM_TYPE_AUDIO:
      return FS_MEDIA_TYPE_AUDIO;
    case TP_MEDIA_STREAM_TYPE_VIDEO:
      return FS_MEDIA_TYPE_VIDEO;
    default:
      g_return_val_if_reached(0);
    }
}

static inline TpMediaStreamDirection
fsdirection_to_tpdirection (FsStreamDirection dir)
{
  switch (dir) {
  case FS_DIRECTION_NONE:
    return TP_MEDIA_STREAM_DIRECTION_NONE;
  case FS_DIRECTION_SEND:
    return TP_MEDIA_STREAM_DIRECTION_SEND;
  case FS_DIRECTION_RECV:
    return TP_MEDIA_STREAM_DIRECTION_RECEIVE;
  case FS_DIRECTION_BOTH:
    return TP_MEDIA_STREAM_DIRECTION_BIDIRECTIONAL;
  default:
    g_assert_not_reached ();
  }
}

static inline FsStreamDirection
tpdirection_to_fsdirection (TpMediaStreamDirection dir)
{
  switch (dir) {
  case TP_MEDIA_STREAM_DIRECTION_NONE:
    return FS_DIRECTION_NONE;
  case TP_MEDIA_STREAM_DIRECTION_SEND:
    return FS_DIRECTION_SEND;
  case TP_MEDIA_STREAM_DIRECTION_RECEIVE:
    return FS_DIRECTION_RECV;
  case TP_MEDIA_STREAM_DIRECTION_BIDIRECTIONAL:
    return FS_DIRECTION_BOTH;
  default:
    g_assert_not_reached ();
  }
}


#endif /* __UTILS_H__ */