Name: mm-hal-interface
Summary: Multimedia HAL Interface
-Version: 0.0.16
+Version: 0.0.17
Release: 0
Group: Multimedia/Development
License: Apache-2.0
%manifest mm-hal-interface-codec.manifest
%license LICENSE.APLv2
%defattr(-,root,root,-)
-%{_libdir}/libcodec*.so.*
%files devel
%defattr(-,root,root,-)
%license LICENSE.APLv2
%defattr(-,root,root,-)
%{_bindir}/codec_*
+%{_libdir}/libcodec*.so.*
%{_datadir}/testcase/res/codec/*
#include <string.h>
#include <string>
+#include <parser.hh>
+
#define DEVICE_FILE_OBJECT "device-files"
#define DEVICE_TYPE_PROP_PLAYBACK_DEVICES "playback-devices"
#define DEVICE_TYPE_PROP_CAPTURE_DEVICES "capture-devices"
using namespace std;
-class CDeviceMapParser
-{
-public:
- CDeviceMapParser();
- CDeviceMapParser(const char* map_file);
- virtual ~CDeviceMapParser();
-
- void dump_devices();
-
- void get_playback(string& card, string& device_num, int& rate, int& channels);
- void get_capture(string& card, string& device_num, int& rate, int& channels);
-
-private:
- void open_json(const char* json_file);
- void close_json();
- void parse_device_string_object(json_object *device_string_o, string& device_string);
- void parse_device_role_object(json_object *device_role_o, string& device_params);
- void parse_device_file_object(json_object *device_file_o, pair<string, string>& device);
- void parse_device_file_array_object(json_object *device_file_array_o, pair<string, string>& device);
-
- void parse_playback();
- void parse_capture();
- void get_device(string& s, string& card, string& device_num);
- void get_params(string& s, int& rate, int& channels);
- void get_single_param(string& s, int& rate, int& channels);
-
- // FixMe, pair doens't define what is paired clearly....
- pair<string, string> m_playback; // device_string, device_params
- pair<string, string> m_capture; // device_string, device_params
-
- json_object *m_json_obj;
- json_object *m_json_device_files_obj;
-};
-
CDeviceMapParser::CDeviceMapParser()
{
open_json("/etc/pulse/device-map.json");
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <iostream>
#include <string>
#include <json.h>
-#include <assert.h>
-#include <string.h>
using namespace std;
# with gtest
bin_PROGRAMS = codec_haltests
-TEST_FILES_DIRECTORY = /usr/share/testcase/res
+TEST_FILES_DIRECTORY = /usr/share/testcase/res/codec
codec_haltests_SOURCES = \
codec_haltests.cpp
#define CODEC_INI_GET_STRING(x_dict, x_item, x_ini, x_default) \
do {\
- gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
+ char* str = iniparser_getstring(x_dict, x_ini, x_default); \
\
if (str && \
(strlen(str) > 0) && \
struct _codec_list_t {
codec_list_e ename;
- gchar cname[CODEC_INI_MAX_STRLEN];
- gchar plugins[2][CODEC_INI_MAX_STRLEN];
+ char cname[CODEC_INI_MAX_STRLEN];
+ char plugins[2][CODEC_INI_MAX_STRLEN];
};
static codec_list_t codec_list[] = {
char *usr_ptr = NULL;
const char *delimiters = " ,";
size_t len;
- gchar port_name[CNAME_SIZE];
- gchar temp[CNAME_SIZE];
- gchar cname[CNAME_SIZE];
+ char port_name[CNAME_SIZE];
+ char temp[CNAME_SIZE];
+ char cname[CNAME_SIZE];
const char *type[2];
type[0] = ":hw_decoder";
type[1] = ":hw_encoder";
- CODEC_INI_GET_STRING(dict, port_name, "port_in_use:media_codec_port", DEFAULT_PORT);
+ CODEC_INI_GET_STRING(dict, port_name, (char *)"port_in_use:media_codec_port", (char *)DEFAULT_PORT);
- if (strcmp(port_name, "GST_PORT") == 0) {
+ if (strcmp(port_name, DEFAULT_PORT) == 0) {
for (i = 0; i < 2; i++) {
for (j = 0; j < codec_num; j++) {
index = 0;
snprintf(cname, CNAME_SIZE, "%s", codec_list[j].cname);
len = strlen(cname);
snprintf(cname + len, CNAME_SIZE - len, "%s", type[i]);
- CODEC_INI_GET_STRING(dict, temp, cname, "");
+ CODEC_INI_GET_STRING(dict, temp, cname, (char *)"");
token = strtok_r(temp, delimiters, &usr_ptr);
while (token) {