if (msg->audio_codecs) {
guint i = 0;
g_string_append_printf(lines, GST_STRING_WFD_AUDIO_CODECS);
+ g_string_append_printf(lines, GST_STRING_WFD_COLON);
if (msg->audio_codecs->list) {
- g_string_append_printf(lines, GST_STRING_WFD_COLON);
for (; i < msg->audio_codecs->count; i++) {
g_string_append_printf(lines, " %s", msg->audio_codecs->list[i].audio_format);
g_string_append_printf(lines, " %08x", msg->audio_codecs->list[i].modes);
if ((i + 1) < msg->audio_codecs->count)
g_string_append_printf(lines, GST_STRING_WFD_COMMA);
}
+ } else {
+ g_string_append_printf(lines, GST_STRING_WFD_SPACE);
+ g_string_append_printf(lines, GST_STRING_WFD_NONE);
}
g_string_append_printf(lines, GST_STRING_WFD_CRLF);
}
/*g_print("gst_wfd_parse_line input: %s\n", buffer); */
read_string_type_and_value(type, value, sizeof(type), sizeof(value), ':', p);
/*g_print("gst_wfd_parse_line type:%s value:%s\n", type, value); */
+
if (!g_strcmp0(type, GST_STRING_WFD_AUDIO_CODECS)) {
msg->audio_codecs = g_new0(GstWFDAudioCodeclist, 1);
if (strlen(v)) {
- guint i = 0;
- msg->audio_codecs->count = strlen(v) / 16;
- msg->audio_codecs->list = g_new0(GstWFDAudioCodec, msg->audio_codecs->count);
- for (; i < msg->audio_codecs->count; i++) {
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_STRING(msg->audio_codecs->list[i].audio_format);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->audio_codecs->list[i].modes);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->audio_codecs->list[i].latency);
- GST_WFD_SKIP_COMMA(v);
+ if (!strcmp(v, GST_STRING_WFD_NONE)) {
+ msg->audio_codecs->list = NULL;
+ msg->audio_codecs->count = 0;
+ } else {
+ guint i = 0;
+ msg->audio_codecs->count = strlen(v) / 16;
+ msg->audio_codecs->list = g_new0(GstWFDAudioCodec, msg->audio_codecs->count);
+ for (; i < msg->audio_codecs->count; i++) {
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_STRING(msg->audio_codecs->list[i].audio_format);
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->audio_codecs->list[i].modes);
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->audio_codecs->list[i].latency);
+ GST_WFD_SKIP_COMMA(v);
+ }
}
}
} else if (!g_strcmp0(type, GST_STRING_WFD_VIDEO_FORMATS)) {
msg->video_formats = g_new0(GstWFDVideoCodeclist, 1);
if (strlen(v)) {
- msg->video_formats->count = 1;
- msg->video_formats->list = g_new0(GstWFDVideoCodec, 1);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->video_formats->list->native);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->video_formats->list->preferred_display_mode_supported);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.profile);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.level);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.CEA_Support);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.VESA_Support);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.HH_Support);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.latency);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.min_slice_size);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.slice_enc_params);
- GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support);
- GST_WFD_SKIP_SPACE(v);
- if (msg->video_formats->list->preferred_display_mode_supported == GST_WFD_PREFERRED_DISPLAY_MODE_SUPPORTED) {
- GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.max_hres);
+ if (!strcmp(v, GST_STRING_WFD_NONE)) {
+ msg->video_formats->count = 0 ;
+ msg->video_formats->list = NULL;
+ } else {
+ msg->video_formats->count = 1;
+ msg->video_formats->list = g_new0(GstWFDVideoCodec, 1);
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->video_formats->list->native);
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->video_formats->list->preferred_display_mode_supported);
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.profile);
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.level);
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.CEA_Support);
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.VESA_Support);
GST_WFD_SKIP_SPACE(v);
- GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.max_vres);
+ GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.HH_Support);
GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.latency);
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.min_slice_size);
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.slice_enc_params);
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support);
+ GST_WFD_SKIP_SPACE(v);
+ if (msg->video_formats->list->preferred_display_mode_supported == GST_WFD_PREFERRED_DISPLAY_MODE_SUPPORTED) {
+ GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.max_hres);
+ GST_WFD_SKIP_SPACE(v);
+ GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.max_vres);
+ GST_WFD_SKIP_SPACE(v);
+ }
}
}
} else if (!g_strcmp0(type, GST_STRING_WFD_3D_VIDEO_FORMATS)) {
if (!msg->audio_codecs)
msg->audio_codecs = g_new0(GstWFDAudioCodeclist, 1);
-
- msg->audio_codecs->list = g_new0(GstWFDAudioCodec, 1);
- msg->audio_codecs->count = 1;
- if (aCodec == GST_WFD_AUDIO_LPCM) {
- msg->audio_codecs->list->audio_format = g_strdup(GST_STRING_WFD_LPCM);
- msg->audio_codecs->list->modes = aFreq;
- msg->audio_codecs->list->latency = aLatency;
- } else if (aCodec == GST_WFD_AUDIO_AAC) {
- msg->audio_codecs->list->audio_format = g_strdup(GST_STRING_WFD_AAC);
- msg->audio_codecs->list->modes = aChanels;
- msg->audio_codecs->list->latency = aLatency;
- } else if (aCodec == GST_WFD_AUDIO_AC3) {
- msg->audio_codecs->list->audio_format = g_strdup(GST_STRING_WFD_AC3);
- msg->audio_codecs->list->modes = aChanels;
- msg->audio_codecs->list->latency = aLatency;
+ if (aCodec != GST_WFD_AUDIO_UNKNOWN) {
+ msg->audio_codecs->list = g_new0(GstWFDAudioCodec, 1);
+ msg->audio_codecs->count = 1;
+ if (aCodec == GST_WFD_AUDIO_LPCM) {
+ msg->audio_codecs->list->audio_format = g_strdup(GST_STRING_WFD_LPCM);
+ msg->audio_codecs->list->modes = aFreq;
+ msg->audio_codecs->list->latency = aLatency;
+ } else if (aCodec == GST_WFD_AUDIO_AAC) {
+ msg->audio_codecs->list->audio_format = g_strdup(GST_STRING_WFD_AAC);
+ msg->audio_codecs->list->modes = aChanels;
+ msg->audio_codecs->list->latency = aLatency;
+ } else if (aCodec == GST_WFD_AUDIO_AC3) {
+ msg->audio_codecs->list->audio_format = g_strdup(GST_STRING_WFD_AC3);
+ msg->audio_codecs->list->modes = aChanels;
+ msg->audio_codecs->list->latency = aLatency;
+ }
+ } else {
+ msg->audio_codecs->list = NULL;
+ msg->audio_codecs->count = 0;
}
return GST_WFD_OK;
}
guint i = 0;
g_return_val_if_fail(msg != NULL, GST_WFD_EINVAL);
g_return_val_if_fail(msg->audio_codecs != NULL, GST_WFD_EINVAL);
-
for (; i < msg->audio_codecs->count; i++) {
if (!g_strcmp0(msg->audio_codecs->list[i].audio_format, GST_STRING_WFD_LPCM)) {
*aCodec |= GST_WFD_AUDIO_LPCM;
guint *aBitwidth, guint32 *aLatency)
{
g_return_val_if_fail(msg != NULL, GST_WFD_EINVAL);
-
if (!g_strcmp0(msg->audio_codecs->list->audio_format, GST_STRING_WFD_LPCM)) {
*aCodec = GST_WFD_AUDIO_LPCM;
*aFreq = msg->audio_codecs->list->modes;