summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2014-05-06 16:20:36 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2014-09-18 13:38:00 -0400
commitac98be9a8a48f6f21babd2d5b41df0f5b85a3e42 (patch)
tree5588066df6f12cf03593eb99c1372a3af39c6e6a
parent4e4d73f86c19d2615992445b89b2622fb45ac7e9 (diff)
downloadfarstream-ac98be9a8a48f6f21babd2d5b41df0f5b85a3e42.tar.gz
Add Application Media type
-rw-r--r--farstream/fs-codec.c7
-rw-r--r--farstream/fs-codec.h4
-rw-r--r--farstream/fs-rtp.c8
-rw-r--r--gst/fsrawconference/fs-raw-session.c2
-rw-r--r--gst/fsrtpconference/fs-rtp-codec-cache.c10
-rw-r--r--gst/fsrtpconference/fs-rtp-discover-codecs.c11
-rw-r--r--gst/fsrtpconference/fs-rtp-session.c2
-rw-r--r--tests/rtp/codec-discovery.c18
8 files changed, 60 insertions, 2 deletions
diff --git a/farstream/fs-codec.c b/farstream/fs-codec.c
index e97b515b..dc2c399a 100644
--- a/farstream/fs-codec.c
+++ b/farstream/fs-codec.c
@@ -367,6 +367,11 @@ fs_codec_list_from_keyfile (const gchar *filename, GError **error)
{
media_type = FS_MEDIA_TYPE_VIDEO;
}
+ else if ((next_tok - groups[i]) == 11 /* strlen ("application") */ &&
+ !g_ascii_strncasecmp ("application", groups[i], 11))
+ {
+ media_type = FS_MEDIA_TYPE_APPLICATION;
+ }
else
{
GST_WARNING ("Invalid media type in codec name name %s", groups[i]);
@@ -504,6 +509,8 @@ fs_media_type_to_string (FsMediaType media_type)
return "audio";
} else if (media_type == FS_MEDIA_TYPE_VIDEO) {
return "video";
+ } else if (media_type == FS_MEDIA_TYPE_APPLICATION) {
+ return "application";
} else {
return NULL;
}
diff --git a/farstream/fs-codec.h b/farstream/fs-codec.h
index 0cf448e6..24a361d4 100644
--- a/farstream/fs-codec.h
+++ b/farstream/fs-codec.h
@@ -46,6 +46,7 @@ typedef struct _FsFeedbackParameter FsFeedbackParameter;
* FsMediaType:
* @FS_MEDIA_TYPE_AUDIO: A media type that encodes audio.
* @FS_MEDIA_TYPE_VIDEO: A media type that encodes video.
+ * @FS_MEDIA_TYPE_APPLICATION: A media type for application data.
* @FS_MEDIA_TYPE_LAST: Largest valid #FsMediaType
*
* Enum used to signify the media type of a codec or stream.
@@ -53,7 +54,8 @@ typedef struct _FsFeedbackParameter FsFeedbackParameter;
typedef enum {
FS_MEDIA_TYPE_AUDIO,
FS_MEDIA_TYPE_VIDEO,
- FS_MEDIA_TYPE_LAST = FS_MEDIA_TYPE_VIDEO
+ FS_MEDIA_TYPE_APPLICATION,
+ FS_MEDIA_TYPE_LAST = FS_MEDIA_TYPE_APPLICATION
} FsMediaType;
/**
diff --git a/farstream/fs-rtp.c b/farstream/fs-rtp.c
index c7311bcd..45622423 100644
--- a/farstream/fs-rtp.c
+++ b/farstream/fs-rtp.c
@@ -174,6 +174,7 @@ fs_rtp_header_extension_list_destroy (GList *extensions)
#define RTP_HDREXT_PREFIX "rtp-hdrext:"
#define RTP_HDREXT_AUDIO_PREFIX "audio:"
#define RTP_HDREXT_VIDEO_PREFIX "video:"
+#define RTP_HDREXT_APPLICATION_PREFIX "application:"
/**
* fs_rtp_header_extension_list_from_keyfile:
@@ -264,6 +265,13 @@ fs_rtp_header_extension_list_from_keyfile (const gchar *filename,
if (media_type != FS_MEDIA_TYPE_VIDEO)
continue;
}
+ else if (!g_ascii_strncasecmp (RTP_HDREXT_APPLICATION_PREFIX,
+ groups[i] + strlen (RTP_HDREXT_PREFIX),
+ strlen (RTP_HDREXT_APPLICATION_PREFIX)))
+ {
+ if (media_type != FS_MEDIA_TYPE_APPLICATION)
+ continue;
+ }
else
{
continue;
diff --git a/gst/fsrawconference/fs-raw-session.c b/gst/fsrawconference/fs-raw-session.c
index 63df4b03..898a2147 100644
--- a/gst/fsrawconference/fs-raw-session.c
+++ b/gst/fsrawconference/fs-raw-session.c
@@ -772,6 +772,8 @@ _create_transform_bin (FsRawSession *self, GError **error)
else if (mtype == FS_MEDIA_TYPE_VIDEO)
return gst_parse_bin_from_description_full ("videoconvert ! videoscale",
TRUE, NULL, GST_PARSE_FLAG_NONE, error);
+ else if (mtype == FS_MEDIA_TYPE_APPLICATION)
+ return gst_element_factory_make ("identify", NULL);
g_set_error (error, FS_ERROR, FS_ERROR_NOT_IMPLEMENTED,
"No transform bin for this media type");
diff --git a/gst/fsrtpconference/fs-rtp-codec-cache.c b/gst/fsrtpconference/fs-rtp-codec-cache.c
index 30faf5a0..62aa2c0f 100644
--- a/gst/fsrtpconference/fs-rtp-codec-cache.c
+++ b/gst/fsrtpconference/fs-rtp-codec-cache.c
@@ -111,6 +111,12 @@ get_codecs_cache_path (FsMediaType media_type) {
cache_path = g_build_filename (g_get_user_cache_dir (), "farstream",
"codecs.video." HOST_CPU ".cache", NULL);
}
+ } else if (media_type == FS_MEDIA_TYPE_APPLICATION) {
+ cache_path = g_strdup (g_getenv ("FS_APPLICATION_CODECS_CACHE"));
+ if (cache_path == NULL) {
+ cache_path = g_build_filename (g_get_user_cache_dir (), "farstream",
+ "codecs.application." HOST_CPU ".cache", NULL);
+ }
} else {
GST_ERROR ("Unknown media type %d for cache loading", media_type);
return NULL;
@@ -293,6 +299,8 @@ load_codecs_cache (FsMediaType media_type)
magic_media = 'A';
} else if (media_type == FS_MEDIA_TYPE_VIDEO) {
magic_media = 'V';
+ } else if (media_type == FS_MEDIA_TYPE_APPLICATION) {
+ magic_media = 'P';
} else {
GST_ERROR ("Invalid media type %d", media_type);
return NULL;
@@ -543,6 +551,8 @@ save_codecs_cache (FsMediaType media_type, GList *blueprints)
magic[2] = 'A';
} else if (media_type == FS_MEDIA_TYPE_VIDEO) {
magic[2] = 'V';
+ } else if (media_type == FS_MEDIA_TYPE_APPLICATION) {
+ magic[2] = 'P';
}
/* version of the binary format */
diff --git a/gst/fsrtpconference/fs-rtp-discover-codecs.c b/gst/fsrtpconference/fs-rtp-discover-codecs.c
index 88d5f2d9..ee755335 100644
--- a/gst/fsrtpconference/fs-rtp-discover-codecs.c
+++ b/gst/fsrtpconference/fs-rtp-discover-codecs.c
@@ -262,6 +262,11 @@ fs_rtp_blueprints_get (FsMediaType media_type, GError **error)
caps = gst_caps_new_simple ("application/x-rtp",
"media", G_TYPE_STRING, "video", NULL);
}
+ else if (media_type == FS_MEDIA_TYPE_APPLICATION)
+ {
+ caps = gst_caps_new_simple ("application/x-rtp",
+ "media", G_TYPE_STRING, "application", NULL);
+ }
else
{
g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
@@ -605,7 +610,7 @@ parse_codec_cap_list (GList *list, FsMediaType media_type)
GST_DEBUG ("skipping codec %s/%s, no encoding name specified"
" (pt: %d clock_rate:%u",
- media_type == FS_MEDIA_TYPE_AUDIO ? "audio" : "video",
+ fs_media_type_to_string (media_type),
encoding_name ? encoding_name : "unknown", codec->id,
codec->clock_rate);
@@ -1409,6 +1414,10 @@ extract_field_data (GQuark field_id,
{
codec->media_type = FS_MEDIA_TYPE_VIDEO;
}
+ else if (strcmp (tmp, "application") == 0)
+ {
+ codec->media_type = FS_MEDIA_TYPE_APPLICATION;
+ }
}
else if (0 == strcmp (field_name, "payload"))
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index e092108c..6b529352 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1107,6 +1107,8 @@ fs_rtp_session_constructed (GObject *object)
self->priv->input_caps = gst_caps_new_empty_simple ("audio/x-raw");
else if (self->priv->media_type == FS_MEDIA_TYPE_VIDEO)
self->priv->input_caps = gst_caps_new_empty_simple ("video/x-raw");
+ else if (self->priv->media_type == FS_MEDIA_TYPE_APPLICATION)
+ self->priv->input_caps = gst_caps_new_any ();
else
g_assert_not_reached ();
diff --git a/tests/rtp/codec-discovery.c b/tests/rtp/codec-discovery.c
index 2ff6a5da..d90c1d69 100644
--- a/tests/rtp/codec-discovery.c
+++ b/tests/rtp/codec-discovery.c
@@ -139,5 +139,23 @@ int main (int argc, char **argv)
g_print ("VIDEO FINISHED!!\n");
+
+ g_print ("APPLICATION STARTING!!\n");
+
+ elements = fs_rtp_blueprints_get (FS_MEDIA_TYPE_APPLICATION, &error);
+
+ if (error)
+ g_printerr ("Error: %s\n", error->message);
+ else
+ g_list_foreach (elements, (GFunc) debug_blueprint, NULL);
+
+ g_clear_error (&error);
+
+ fs_rtp_blueprints_unref (FS_MEDIA_TYPE_APPLICATION);
+
+ g_print ("APPLICATION FINISHED!!\n");
+
+
+
return 0;
}