ac3 parser element = ac3parse
-ac3 decoder element =
+ac3 decoder element =
lpcm converter element =
video evas sink element = evaspixmapsink
-[audio param]
+[wfd audio codecs]
; 0x1: LPCM, 0x2: AAC, 0x4: AC3
;default aac and LPCM
audio codec=0x3
audio channels=0x1
-
[video param]
; 0: H264CBP 1: H264CHP
video codec=0x1
video framerate control support=11
-[hdcp param]
+
+[wfd hdcp content protection]
+enable hdcp = no
+
;0x0:none, 0x1:HDCP_2.0, 0x2:HDCP_2.1
hdcp content protection=0x0
* of each string item.
*/
-enum WFDSinkINIProbeFlags
-{
- WFD_SINK_INI_PROBE_DEFAULT = 0,
- WFD_SINK_INI_PROBE_TIMESTAMP = (1 << 0),
- WFD_SINK_INI_PROBE_BUFFERSIZE = (1 << 1),
- WFD_SINK_INI_PROBE_CAPS = (1 << 2),
- WFD_SINK_INI_PROBE_BUFFER_DURATION = (1 << 3),
-};
-
#define MM_WFD_SINK_INI_DEFAULT_PATH SYSCONFDIR"/multimedia/mmfw_wfd_sink.ini"
#define WFD_SINK_INI_MAX_STRLEN 256
#define WFD_SINK_INI_MAX_ELEMENT 10
+typedef struct {
+ guint audio_codec;
+ guint audio_latency;
+ guint audio_channel;
+ guint audio_sampling_frequency;
+} WFDAudioCodecs;
+
+typedef struct {
+ gboolean enable_hdcp;
+ gint hdcp_content_protection;
+ gint hdcp_port_no;
+} WFDHDCPContentProtection;
+
typedef struct __mm_wfd_sink_ini {
/* general */
gchar gst_param[5][WFD_SINK_INI_MAX_STRLEN];
gchar name_of_video_evas_sink[WFD_SINK_INI_MAX_STRLEN];
/* audio parameter for reponse of M3 request */
- guint audio_codec;
- guint audio_latency;
- guint audio_channel;
- guint audio_sampling_frequency;
+ WFDAudioCodecs wfd_audio_codecs;
/* video parameter for reponse of M3 request */
guint video_codec;
gint video_framerate_control_support;
/* hdcp parameter for reponse of M3 request */
- gint hdcp_content_protection;
- gint hdcp_port_no;
+ WFDHDCPContentProtection wfd_content_protection;
} mm_wfd_sink_ini_t;
#define DEFAULT_NAME_OF_VIDEO_SINK ""
#define DEFAULT_NAME_OF_EVAS_VIDEO_SINK ""
-/* Audio */
-#define DEFAULT_AUDIO_CODEC WFD_AUDIO_LPCM | WFD_AUDIO_AAC
-#define DEFAULT_AUDIO_LATENCY 0x0
-#define DEFAULT_AUDIO_CHANNELS WFD_CHANNEL_2
-#define DEFAULT_AUDIO_SAMP_FREQUENCY WFD_FREQ_44100 | WFD_FREQ_48000
-
/* Video */
#define DEFAULT_VIDEO_CODEC WFD_VIDEO_H264
#define DEFAULT_VIDEO_NATIVE_RESOLUTION 0x20
#define DEFAULT_VIDEO_SLICE_ENC_PARAM 200
#define DEFAULT_VIDEO_FRAMERATE_CONTROL 11
-/* HDCP */
-#define DEFAULT_HDCP_CONTENT_PROTECTION 0x0
-#define DEFAULT_HDCP_PORT_NO 0
-
-
#define MM_WFD_SINK_DEFAULT_INI \
" \
[general]\n\
\n\
\n\
\n\
-[audio param]\n\
+[wfd audio codecs]\n\
; 0x1: LPCM, 0x2: aac, 0x4: ac3\n\
;default aac and LPCM\n\
audio codec=0x3\n\
\n\
\n\
\n\
-[hdcp param]\n\
+[wfd hdcp content protection]\n\
;0x0:none, 0x1:HDCP_2.0, 0x2:HDCP_2.1\n\
hdcp content protection=0x0\n\
\n\
#include <mm_error.h>
#include "mm_wfd_sink_dlog.h"
+#include "mm_wfd_sink_enum.h"
#include "mm_wfd_sink_ini.h"
/*Default sink ini values*/
#define DEFAULT_NAME_OF_VIDEO_H264_PARSER ""
#define DEFAULT_NAME_OF_VIDEO_H264_DECODER ""
+/* Audio */
+#define DEFAULT_WFD_AUDIO_CODECS_CODEC WFD_AUDIO_LPCM | WFD_AUDIO_AAC
+#define DEFAULT_WFD_AUDIO_CODECS_LATENCY 0x0
+#define DEFAULT_WFD_AUDIO_CODECS_CHANNELS WFD_CHANNEL_2
+#define DEFAULT_WFD_AUDIO_CODECS_SAMP_FREQUENCY WFD_FREQ_44100 | WFD_FREQ_48000
+
+/* HDCP */
+#define DEFAULT_ENABLE_HDCP FALSE
+#define DEFAULT_WFD_HDCP_CONTENT_PROTECTION 0x0
+#define DEFAULT_WFD_HDCP_PORT_NO 0
+
+
static gboolean loaded = FALSE;
/* global variables here */
/* create new file */
fp = fopen(MM_WFD_SINK_INI_DEFAULT_PATH, "wt");
- if (!fp) {
+ if (!fp)
return FALSE;
- }
/* writing default ini file */
if (strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp)) {
MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_video_evas_sink, "pipeline:video evas sink element", DEFAULT_NAME_OF_EVAS_VIDEO_SINK);
/* audio parameter*/
- ini->audio_codec = iniparser_getint(dict, "audio param:audio codec", DEFAULT_AUDIO_CODEC);
- ini->audio_latency = iniparser_getint(dict, "audio param:audio latency", DEFAULT_AUDIO_LATENCY);
- ini->audio_channel = iniparser_getint(dict, "audio param:audio channels", DEFAULT_AUDIO_CHANNELS);
- ini->audio_sampling_frequency = iniparser_getint(dict, "audio param:audio sampling frequency", DEFAULT_AUDIO_SAMP_FREQUENCY);
+ ini->wfd_audio_codecs.audio_codec = iniparser_getint(dict, "wfd audio codecs:audio codec", DEFAULT_WFD_AUDIO_CODECS_CODEC);
+ ini->wfd_audio_codecs.audio_latency = iniparser_getint(dict, "wfd audio codecs:audio latency", DEFAULT_WFD_AUDIO_CODECS_LATENCY);
+ ini->wfd_audio_codecs.audio_channel = iniparser_getint(dict, "wfd audio codecs:audio channels", DEFAULT_WFD_AUDIO_CODECS_CHANNELS);
+ ini->wfd_audio_codecs.audio_sampling_frequency = iniparser_getint(dict, "wfd audio codecs:audio sampling frequency", DEFAULT_WFD_AUDIO_CODECS_SAMP_FREQUENCY);
/* video parameter*/
ini->video_codec = iniparser_getint(dict, "video param:video codec", DEFAULT_VIDEO_CODEC);
ini->video_framerate_control_support = iniparser_getint(dict, "video param:video framerate control support", DEFAULT_VIDEO_FRAMERATE_CONTROL);
/* hdcp parameter*/
- ini->hdcp_content_protection = iniparser_getint(dict, "hdcp param:hdcp content protection", DEFAULT_HDCP_CONTENT_PROTECTION);
- ini->hdcp_port_no = iniparser_getint(dict, "hdcp param:hdcp port no", DEFAULT_HDCP_PORT_NO);
+ ini->wfd_content_protection.enable_hdcp = iniparser_getboolean(dict, "wfd hdcp content protection:enable hdcp", DEFAULT_ENABLE_HDCP);
+ ini->wfd_content_protection.hdcp_content_protection = iniparser_getint(dict, "wfd hdcp content protection:hdcp content protection", DEFAULT_WFD_HDCP_CONTENT_PROTECTION);
+ ini->wfd_content_protection.hdcp_port_no = iniparser_getint(dict, "wfd hdcp content protection:hdcp port no", DEFAULT_WFD_HDCP_PORT_NO);
} else { /* if dict is not available just fill the structure with default value */
wfd_sink_error("failed to load ini. using hardcoded default");
strncpy(ini->name_of_video_evas_sink, DEFAULT_NAME_OF_EVAS_VIDEO_SINK, WFD_SINK_INI_MAX_STRLEN - 1);
/* audio parameter*/
- ini->audio_codec = DEFAULT_AUDIO_CODEC;
- ini->audio_latency = DEFAULT_AUDIO_LATENCY;
- ini->audio_channel = DEFAULT_AUDIO_CHANNELS;
- ini->audio_sampling_frequency = DEFAULT_AUDIO_SAMP_FREQUENCY;
+ ini->wfd_audio_codecs.audio_codec = DEFAULT_WFD_AUDIO_CODECS_CODEC;
+ ini->wfd_audio_codecs.audio_latency = DEFAULT_WFD_AUDIO_CODECS_LATENCY;
+ ini->wfd_audio_codecs.audio_channel = DEFAULT_WFD_AUDIO_CODECS_CHANNELS;
+ ini->wfd_audio_codecs.audio_sampling_frequency = DEFAULT_WFD_AUDIO_CODECS_SAMP_FREQUENCY;
/* video parameter*/
ini->video_codec = DEFAULT_VIDEO_CODEC;
ini->video_framerate_control_support = DEFAULT_VIDEO_FRAMERATE_CONTROL;
/* hdcp parameter*/
- ini->hdcp_content_protection = DEFAULT_HDCP_CONTENT_PROTECTION;
- ini->hdcp_port_no = DEFAULT_HDCP_PORT_NO;
+ ini->wfd_content_protection.enable_hdcp = DEFAULT_ENABLE_HDCP;
+ ini->wfd_content_protection.hdcp_content_protection = DEFAULT_WFD_HDCP_CONTENT_PROTECTION;
+ ini->wfd_content_protection.hdcp_port_no = DEFAULT_WFD_HDCP_PORT_NO;
}
/* free dict as we got our own structure */
wfd_sink_debug("name_of_video_evas_sink : %s", ini->name_of_video_evas_sink);
/* audio parameter*/
- wfd_sink_debug("audio_codec : %x\n", ini->audio_codec);
- wfd_sink_debug("audio_latency : %d\n", ini->audio_latency);
- wfd_sink_debug("audio_channel : %x\n", ini->audio_channel);
- wfd_sink_debug("audio_sampling_frequency : %x\n", ini->audio_sampling_frequency);
+ wfd_sink_debug("wfd_audio_codecs.audio_codec : %x", ini->wfd_audio_codecs.audio_codec);
+ wfd_sink_debug("wfd_audio_codecs.audio_latency : %d", ini->wfd_audio_codecs.audio_latency);
+ wfd_sink_debug("wfd_audio_codecs.audio_channel : %x", ini->wfd_audio_codecs.audio_channel);
+ wfd_sink_debug("wfd_audio_codecs.audio_sampling_frequency : %x", ini->wfd_audio_codecs.audio_sampling_frequency);
/* video parameter*/
wfd_sink_debug("video_codec : %x\n", ini->video_codec);
wfd_sink_debug("video_framerate_control_support : %d\n", ini->video_framerate_control_support);
/* hdcp parameter*/
- wfd_sink_debug("hdcp_content_protection : %x\n", ini->hdcp_content_protection);
- wfd_sink_debug("hdcp_port_no : %d\n", ini->hdcp_port_no);
+ wfd_sink_debug("wfd_content_protection.enable_hdcp : %d", ini->wfd_content_protection.enable_hdcp);
+ wfd_sink_debug("wfd_content_protection.hdcp_content_protection : %x", ini->wfd_content_protection.hdcp_content_protection);
+ wfd_sink_debug("wfd_content_protection.hdcp_port_no : %d", ini->wfd_content_protection.hdcp_port_no);
wfd_sink_debug("---------------------------------------------------");
static int __mm_wfd_sink_prepare_source(mm_wfd_sink_t *wfd_sink, GstElement *wfdsrc)
{
- GstStructure *audio_param = NULL;
+ GstStructure *wfd_audio_codecs = NULL;
GstStructure *video_param = NULL;
- GstStructure *hdcp_param = NULL;
+ GstStructure *wfd_content_protection = NULL;
gint hdcp_version = 0;
gint hdcp_port = 0;
guint CEA_resolution = 0;
if (g_object_class_find_property(klass, "latency"))
g_object_set(G_OBJECT(wfdsrc), "latency", wfd_sink->ini.jitter_buffer_latency, NULL);
- audio_param = gst_structure_new("audio_param",
- "audio_codec", G_TYPE_UINT, wfd_sink->ini.audio_codec,
- "audio_latency", G_TYPE_UINT, wfd_sink->ini.audio_latency,
- "audio_channels", G_TYPE_UINT, wfd_sink->ini.audio_channel,
- "audio_sampling_frequency", G_TYPE_UINT, wfd_sink->ini.audio_sampling_frequency,
- NULL);
+ /* set audio parameter for Wi-Fi Display session negotiation */
+ wfd_audio_codecs = gst_structure_new("wfd_audio_codecs",
+ "audio_codec", G_TYPE_UINT, wfd_sink->ini.wfd_audio_codecs.audio_codec,
+ "audio_latency", G_TYPE_UINT, wfd_sink->ini.wfd_audio_codecs.audio_latency,
+ "audio_channels", G_TYPE_UINT, wfd_sink->ini.wfd_audio_codecs.audio_channel,
+ "audio_sampling_frequency", G_TYPE_UINT, wfd_sink->ini.wfd_audio_codecs.audio_sampling_frequency,
+ NULL);
+
+ if (wfd_audio_codecs) {
+ if (g_object_class_find_property(klass, "audio-param"))
+ g_object_set(G_OBJECT(wfdsrc), "audio-param", wfd_audio_codecs, NULL);
+ if (g_object_class_find_property(klass, "wfd-audio-codecs"))
+ g_object_set(G_OBJECT(wfdsrc), "wfd-audio-codecs", wfd_audio_codecs, NULL);
+ }
CEA_resolution = wfd_sink->ini.video_cea_support;
VESA_resolution = wfd_sink->ini.video_vesa_support;
"video_framerate_control_support", G_TYPE_INT, wfd_sink->ini.video_framerate_control_support,
NULL);
- mm_attrs_get_int_by_name(wfd_sink->attrs, "hdcp_version", &hdcp_version);
- mm_attrs_get_int_by_name(wfd_sink->attrs, "hdcp_port", &hdcp_port);
- wfd_sink_debug("set hdcp version %d with %d port", hdcp_version, hdcp_port);
+ /* set hdcp parameter for Wi-Fi Display session negotiation */
+ if (wfd_sink->ini.wfd_content_protection.enable_hdcp) {
+ mm_attrs_get_int_by_name(wfd_sink->attrs, "hdcp_version", &hdcp_version);
+ mm_attrs_get_int_by_name(wfd_sink->attrs, "hdcp_port", &hdcp_port);
+ wfd_sink_debug("set hdcp version %d with %d port", hdcp_version, hdcp_port);
- hdcp_param = gst_structure_new("hdcp_param",
+ wfd_content_protection = gst_structure_new("wfd_content_protection",
"hdcp_version", G_TYPE_INT, hdcp_version,
"hdcp_port_no", G_TYPE_INT, hdcp_port,
NULL);
- g_object_set(G_OBJECT(wfdsrc), "audio-param", audio_param, NULL);
+ if (wfd_content_protection) {
+ if (g_object_class_find_property(klass, "hdcp-param"))
+ g_object_set(G_OBJECT(wfdsrc), "hdcp-param", wfd_content_protection, NULL);
+ if (g_object_class_find_property(klass, "wfd-content-protection"))
+ g_object_set(G_OBJECT(wfdsrc), "wfd-content-protection", wfd_content_protection, NULL);
+ }
+ }
+
g_object_set(G_OBJECT(wfdsrc), "video-param", video_param, NULL);
- g_object_set(G_OBJECT(wfdsrc), "hdcp-param", hdcp_param, NULL);
g_signal_connect(wfdsrc, "update-media-info", G_CALLBACK(__mm_wfd_sink_update_stream_info), wfd_sink);
case MM_WFD_SINK_AUDIO_CODEC_NONE:
default:
wfd_sink_debug("audio decodebin could NOT be linked now, just create");
- audio_codec = wfd_sink->ini.audio_codec;
+ audio_codec = wfd_sink->ini.wfd_audio_codecs.audio_codec;
link = FALSE;
break;
}
MMWFDSINK_PAD_PROBE(wfd_sink, NULL, a_decodebin[WFD_SINK_A_D_HDCP].gst, "sink");
/* create codec */
- audio_codec = wfd_sink->ini.audio_codec;
+ audio_codec = wfd_sink->ini.wfd_audio_codecs.audio_codec;
if (audio_codec & WFD_AUDIO_LPCM) {
/* create LPCM converter */
MMWFDSINK_CREATE_ELEMENT(a_decodebin, WFD_SINK_A_D_LPCM_CONVERTER, wfd_sink->ini.name_of_lpcm_converter, "audio_lpcm_convert", FALSE);