class CImageCodec {
public:
- CImageCodec(std::string name);
+ CImageCodec(std::string name) : m_name(name) {}
~CImageCodec();
void SetMaxResolution(int w, int h) { m_width_max = w, m_height_max = h; }
private:
std::string m_name;
- int m_width_max;
- int m_height_max;
- int m_width_min;
- int m_height_min;
+ int m_width_max {};
+ int m_height_max {};
+ int m_width_min {};
+ int m_height_min {};
};
#endif// __CIMAGE_CODEC_H__
int ReadIndex(std::string filename) const;
std::string GetChipSetName(void);
- bool m_has_dedicated_category_h264_fhd_portrait;
- bool m_exclusive_bw_for_h264_fhd_n_decoding;
+ bool m_has_dedicated_category_h264_fhd_portrait {};
+ bool m_exclusive_bw_for_h264_fhd_n_decoding {};
std::string m_chipset_name;
std::map<std::string, eChipSet> m_chipset_info;
void Init(void);
void SetPolicy(const int strategy, const ReclaimPolicy reclaim, const InterlacedPlayback interlaced, const SeamlessPlayback seamless, const AV1DualDecoding dual_decoding);
- int strategy_;
+ int strategy_ {};
ReclaimPolicy reclaim_policy_;
InterlacedPlayback interlaced_playback_;
SeamlessPlayback seamless_playback_;
class CResourceInfo
{
public:
- CResourceInfo();
- ~CResourceInfo();
+ CResourceInfo() {}
+ ~CResourceInfo() {};
static CResourceInfo* GetInstance(void);
ri_rsc_category_e GetVideoCategoryID(const char *codec_name, int color_depth, int h_size, int framerate, int sampling_format);
int GetCapableAudioDecoderCategoryID(ri_audio_category_option_request_s* option);
private:
- static CResourceInfo* m_instance;
+ static CResourceInfo *m_instance;
ri_color_depth GetColorDepthID(int color_depth, int sampling_format);
ri_framerate GetFrameRateID(int framerate);
class CResourceInfoDB
{
public:
- CResourceInfoDB();
- ~CResourceInfoDB();
+ CResourceInfoDB() {}
+ ~CResourceInfoDB() {}
static CResourceInfoDB* GetInstance(void);
ri_rsc_category_e IsSupportedVideoFormat(ri_rsc_category_e decoder_id);
ri_device_common_attr_s *GetDeviceAttr(int device_id);
private:
- static CResourceInfoDB* m_instance;
+ static CResourceInfoDB *m_instance;
std::map<int, ri_resource_category_s*> m_resource_categories;
std::map<int, ri_device_common_attr_s*> m_device_attr_map_by_dev_id;
std::map<int, CVideoDecoder *> m_video_decoders;
std::map<std::string, std::vector<VideoCapability *>> video_capabilities_;
- int m_system_bw;
- int m_vdecs;
- int m_n_scalers;
+ int m_system_bw {};
+ int m_vdecs {};
+ int m_n_scalers {};
bool GetDeviceNodePathNames(int category, char** device_node);
bool GetClassOptions(const char *codec, ri_video_decoder_class_e class_value, bool *is_uhd_decoder, int *class_cat, bool *is_class_uhd, char **class_device_node);
bool IsScaler(int category);
void InitVideoDecCategories(void);
bool IsCodecSupporting2KPortrait(std::string codec_name);
- CCategoryIdBuilder* GetVideoDecCategoryBuilder(std::string codec_name);
+ CCategoryIdBuilder *GetVideoDecCategoryBuilder(std::string codec_name);
};
#endif //_RESOURCE_INFO_DB_H_
class VideoCapability {
public:
- VideoCapability(const std::string device, const int w, const int h, const int fps): device_(device), width_(w), height_(h), fps_(fps) {}
- VideoCapability(const VideoCapability& capa): device_(""), width_(0), height_(0), fps_(0) {
+ VideoCapability(const std::string device, const int w, const int h, const int fps) : device_(device), width_(w), height_(h), fps_(fps) {}
+ VideoCapability(const VideoCapability& capa) : device_(""), width_(0), height_(0), fps_(0) {
device_ = capa.GetDeviceProperty();
width_ = capa.GetWidth();
height_ = capa.GetHeight();
class CVideoCodecNDecoding
{
public:
- CVideoCodecNDecoding(std::string codec_name, int rsz, int framerate):m_name(codec_name), m_max_rsz(rsz), m_max_fps(framerate) { }
+ CVideoCodecNDecoding(std::string codec_name, int rsz, int framerate)
+ : m_name(codec_name), m_max_rsz(rsz), m_max_fps(framerate) { }
~CVideoCodecNDecoding() = default;
void SetMaxResolution(int rsz) { m_max_rsz = rsz; }
private:
std::string m_name;
- int m_max_rsz;
- int m_max_fps;
- int m_category_id;
+ int m_max_rsz {};
+ int m_max_fps {};
+ int m_category_id {};
};
#endif //__CVideoCodecNDecoding_H__
unsigned long long GetMaxBandWidthMultiEncodingSingle(void) const;
private:
- CVideoEncoder():max_w_(0), max_h_(0), max_fps_(0), max_w_multi_(0), max_h_multi_(0), max_fps_multi_(0), margin_(0) {}
+ CVideoEncoder() {}
~CVideoEncoder() = default;
- int max_w_;
- int max_h_;
- int max_fps_;
- int max_w_multi_;
- int max_h_multi_;
- int max_fps_multi_;
- int margin_;
+ int max_w_ {};
+ int max_h_ {};
+ int max_fps_ {};
+ int max_w_multi_ {};
+ int max_h_multi_ {};
+ int max_fps_multi_ {};
+ int margin_ {};
};
#endif //__CVIDEO_ENCODER_H__
\ No newline at end of file
\r
private:\r
std::string m_name;\r
- ri_rsc_category_e m_id;\r
- category_type_e m_type;\r
+ ri_rsc_category_e m_id {};\r
+ category_type_e m_type {};\r
std::string m_codec_name;\r
- ri_resolution m_rsz;\r
- int m_framerate;\r
- bool m_n_decoding;\r
+ ri_resolution m_rsz {};\r
+ int m_framerate {};\r
+ bool m_n_decoding {};\r
};\r
\r
#endif//__CCATEGORY_H_\r
class CResourceTableProviderDefault
{
public:
- CResourceTableProviderDefault(const int table_index, const int product_type, const bool support_android);
+ CResourceTableProviderDefault(const int table_index, const int product_type, const bool support_android)
+ :table_index_(table_index), product_type_(product_type), support_android_(support_android) {}
~CResourceTableProviderDefault() = default;
private:
std::string FindResourceTablePath(const std::map<int, std::string> &table_paths, const int index) const;
std::string FindResourceTablePathAOT(const std::map<int, std::string> &table_paths, const int index) const;
- int table_index_;
- int product_type_;
- bool support_android_;
+ int table_index_ {};
+ int product_type_ {};
+ bool support_android_ {};
};
#endif // __CRESOURCE_PROVIDER_TABLE_DEFAULT_H__
class CResourceTableProviderLicense\r
{\r
public:\r
- CResourceTableProviderLicense(const int table_index):table_index_(table_index) {};\r
+ CResourceTableProviderLicense(const int table_index) :table_index_(table_index) {};\r
~CResourceTableProviderLicense() = default;\r
\r
std::string GetResourceTablePath(void) const;\r
\r
private:\r
- int table_index_;\r
+ int table_index_ {};\r
};\r
\r
#endif //__CRESOURCE_TABLE_PROVIDER_LICENSE_H__\r
class CapabilityElement : public Element {
public:
- CapabilityElement(const std::string device, const int w, const int h, const int fps): device_(device), width_(w), height_(h), fps_(fps) {};
+ CapabilityElement(const std::string device, const int w, const int h, const int fps) : device_(device), width_(w), height_(h), fps_(fps) {};
~CapabilityElement() = default;
std::string GetDevice(void) const { return device_; }
int GetFPS(void) const { return fps_; }
private:
- CapabilityElement(): device_(""), width_(0), height_(0), fps_(0) {};
+ CapabilityElement() {}
std::string device_;
- int width_;
- int height_;
- int fps_;
+ int width_ {};
+ int height_ {};
+ int fps_ {};
};
\ No newline at end of file
class CategoryElement : public Element\r
{\r
public:\r
- CategoryElement(void){}\r
+ CategoryElement(void) : Element() {}\r
CategoryElement(char *category_name, char *category_type, int class_id, bool is_uhd_device);\r
~CategoryElement(void);\r
\r
// LCOV_EXCL_END\r
\r
protected:\r
- ri_rsc_category_e m_promotion_category_enum;\r
- ri_rsc_category_e m_category_enum;\r
+ ri_rsc_category_e m_promotion_category_enum { RI_CATEGORY_NONE };\r
+ ri_rsc_category_e m_category_enum { RI_CATEGORY_NONE };\r
private:\r
};\r
\r
class DecodingElement : public Element {
public:
- DecodingElement(const std::string codec): codec_(codec) {}
+ DecodingElement(const std::string codec) : codec_(codec) {}
~DecodingElement();
void SetCodec(const std::string codec) { codec_ = codec; }
void ReleaseChildElement(void) override;
private:
- DecodingElement(): codec_("empty") {}
+ DecodingElement() : codec_("empty") {}
std::string codec_;
};
\ No newline at end of file
class Element\r
{\r
public:\r
- Element(void);\r
- Element(char *element_name, char *element_type, int class_id, bool is_uhd_device);\r
- Element(char *element_name, char *element_type);\r
- Element(char *element_name);\r
+ Element(void) {}\r
+ Element(char *element_name, char *element_type, int class_id, bool is_uhd_device)\r
+ : m_element_name(element_name), m_element_type(element_type), m_class_id(class_id), m_is_uhd_decoder(is_uhd_device) { SetElementAttr(ELEMENT_CATEGORY); }\r
+ Element(char *element_name, char *element_type)\r
+ : m_element_name(element_name), m_element_type(element_type) {}\r
+ Element(char *element_name)\r
+ : m_element_name(element_name) {}\r
virtual ~Element(void){}\r
\r
virtual void SetElementAttr(ri_element_attribute_e element_attr);\r
virtual int GetMaxResolution(void) { return m_max_rez; }\r
\r
protected:\r
- ri_element_attribute_e m_element_attr; //category, device, feature\r
- char *m_element_name;\r
- char *m_element_type;\r
- unsigned int m_element_bw;\r
- ri_mem_cluster_s* m_element_mem_cluster;\r
- int m_id;\r
- int m_class_id; //for category\r
+ ri_element_attribute_e m_element_attr { ELEMENT_ROOT }; //category, device, feature\r
+ char *m_element_name {};\r
+ char *m_element_type {};\r
+ unsigned int m_element_bw {};\r
+ ri_mem_cluster_s* m_element_mem_cluster {};\r
+ int m_id {};\r
+ int m_class_id {}; //for category\r
\r
std::set<Element*> m_child_element;\r
- int m_sharable_count;\r
- int m_mixing;\r
- bool m_is_uhd_decoder;\r
- int m_device_id;\r
- int m_is_main_device;\r
- int m_max_rez;\r
- bool m_is_support_overlay;\r
- int m_max_sampling_format;\r
- char *m_element_codec_name;\r
+ int m_sharable_count {};\r
+ int m_mixing {};\r
+ bool m_is_uhd_decoder {};\r
+ int m_device_id {};\r
+ int m_is_main_device {};\r
+ int m_max_rez {};\r
+ bool m_is_support_overlay {};\r
+ int m_max_sampling_format {};\r
+ char *m_element_codec_name {};\r
\r
- char *m_device_path;\r
- char *m_omx_comp_name;\r
- char *m_audio_codec;\r
+ char *m_device_path {};\r
+ char *m_omx_comp_name {};\r
+ char *m_audio_codec {};\r
\r
private:\r
};\r
Name: resource-information
Summary: Resource Information
Version: 0.1
-Release: 1
+Release: 2
Group: Multimedia/Libraries
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
#include <assert.h>
#include <CImageCodec.h>
-CImageCodec::CImageCodec(std::string name)
-{
- m_name = name;
-}
-
// LCOV_EXCL_START
CImageCodec::~CImageCodec()
{
return instance_;
}
-CModelInfo::CModelInfo(void): m_has_dedicated_category_h264_fhd_portrait(false), m_exclusive_bw_for_h264_fhd_n_decoding(false)
+CModelInfo::CModelInfo(void) : m_has_dedicated_category_h264_fhd_portrait(false), m_exclusive_bw_for_h264_fhd_n_decoding(false)
{
InitFeatures();
}
// LCOV_EXCL_START
-CMultiview::CMultiview(void):strategy_(RI_MV_STRATEGY_NOT_SUPPORT), reclaim_policy_(ReclaimPolicy::Default), interlaced_playback_(InterlacedPlayback::All), \
+CMultiview::CMultiview(void) : strategy_(RI_MV_STRATEGY_NOT_SUPPORT), reclaim_policy_(ReclaimPolicy::Default), interlaced_playback_(InterlacedPlayback::All),
seamless_playback_(SeamlessPlayback::All), av1_dual_decoding_(AV1DualDecoding::Support)
{
Init();
CResourceInfo* CResourceInfo::m_instance = NULL;
-CResourceInfo::CResourceInfo(void)
-{
-}
-
-CResourceInfo::~CResourceInfo(void){}
-
CResourceInfo* CResourceInfo::GetInstance(void)
{
if (m_instance == NULL) {
int rsz_id = GetResolutionID(width, height, n_decoding, codec_name);
if (rsz_id == RI_RESOLUTION_UNDEFINED) {
- RI_ERR("failed to get resolution id codec(%s)/h(%d)/v(%d)\n", codec_name.c_str(), width, height);
+ RI_ERR("failed to get resolution id codec(%s)/h(%d)/v(%d)", codec_name.c_str(), width, height);
return RI_CATEGORY_VIDEO_DECODER_NOT_SUPPORTED;
}
int color_depth_id = GetColorDepthID(color_depth, sampling_format);
if (color_depth_id == (ri_color_depth) RI_ERROR) {
- RI_ERR("failed to get color depth id(%d)\n", color_depth_id);
+ RI_ERR("failed to get color depth id(%d)", color_depth_id);
return RI_CATEGORY_VIDEO_DECODER_NOT_SUPPORTED;
}
int framerate_id = GetFrameRateID(framerate);
if (framerate_id == RI_FRAMERATE_UNDEFINED) {
- RI_ERR("failed to get framerate(%d)\n",framerate_id);
+ RI_ERR("failed to get framerate(%d)",framerate_id);
return RI_CATEGORY_VIDEO_DECODER_NOT_SUPPORTED;
}
// LCOV_EXCL_END
RI_INFO("n_decoding(%d), category id : %d", n_decoding, category_id);
- return (n_decoding) ? db->IsNDecodingSupportedVideoFormat((ri_rsc_category_e) category_id):db->IsSupportedVideoFormat((ri_rsc_category_e) category_id);
+ return (n_decoding) ? db->IsNDecodingSupportedVideoFormat((ri_rsc_category_e) category_id) :db->IsSupportedVideoFormat((ri_rsc_category_e) category_id);
}
ri_rsc_category_e CResourceInfo::GetCapableVideoCategoryID(ri_video_category_option_request_s* option, bool n_decoding)
ri_rsc_category_e category_id = GetCapableVideoCategoryID(prop->codec_name, prop->width, prop->height, prop->fps, prop->sampling_format, prop->color_depth, n_decoding);
if (prop->detiled)
return ToCategoryDedicatedToDetiled(category_id);
- return (prop->progressive) ? ToCategoryDedicatedToProgressive(category_id):category_id;
+ return (prop->progressive) ? ToCategoryDedicatedToProgressive(category_id) :category_id;
}
ri_rsc_category_e CResourceInfo::ToCategoryDedicatedToProgressive(ri_rsc_category_e category_id)
} else if (color_depth == 10) { //sampling_format, RI_SAMPLING_FORMAT_OTHERS
return RI_COLOR_DEPTH_10BIT;
} else {
- RI_ERR("unknown color depth (%d)\n", color_depth);
+ RI_ERR("unknown color depth (%d)", color_depth);
return (ri_color_depth)-1;
}
}
} else if (IS_FRAMERATE_120P(framerate)) {
framerate_e = RI_FRAMERATE_120;
} else {
- RI_ERR("unexpected frame rate (%d)\n", framerate);
+ RI_ERR("unexpected frame rate (%d)", framerate);
}
return framerate_e;
static pthread_mutex_t db_instance_mutex = PTHREAD_MUTEX_INITIALIZER;
-CResourceInfoDB::CResourceInfoDB(void)
-{
- m_system_bw = 0;
-}
-
-CResourceInfoDB::~CResourceInfoDB(void){}
-
CResourceInfoDB* CResourceInfoDB::m_instance = NULL;
CResourceInfoDB* CResourceInfoDB::GetInstance(void)
if (IsVirtualDeviceIdScaler(device_id)) {
name = GetDeviceNameScaler(device_id);
RI_INFO("DEVICE ID : %d, DEVICE NAME : %s", device_id, name.c_str());
- return strdup(name.c_str());
+ return name.c_str();
}
RI_INFO("[NULL] DEVICE ID : %d CANNOT GET NAME", device_id);
#include <ri-debug.h>
#include <CVideoCodec.h>
-CVideoCodec::CVideoCodec(const std::string name, const unsigned int resolution, const int fps, const bool support_2k_portrait):\
- name_(name), max_resolution_(resolution), max_fps_(fps), support_2k_portrait_(support_2k_portrait), vr360_codec_(false)
+CVideoCodec::CVideoCodec(const std::string name, const unsigned int resolution, const int fps, const bool support_2k_portrait)
+ : name_(name), max_resolution_(resolution), max_fps_(fps), support_2k_portrait_(support_2k_portrait), vr360_codec_(false)
{
InitResolutions();
auto it = vr360_codecs_.find(name);
{7680, 4320, 4320, 7680} /** RI_RESOLUTION_8K_UHD */
};
-CVideoResolution::CVideoResolution(const unsigned int resolution):resolution_(resolution), w_(0), h_(0), wp_(0), hp_(0)
+CVideoResolution::CVideoResolution(const unsigned int resolution) :resolution_(resolution), w_(0), h_(0), wp_(0), hp_(0)
{
if (!ValidResolution(resolution))
return;
#include <CResourceTableProvider.h>
#include <CResourceTableProviderDefault.h>
-CResourceTableProviderDefault::CResourceTableProviderDefault(const int table_index, const int product_type, const bool support_android):table_index_(table_index), product_type_(product_type), support_android_(support_android)
-{
-}
-
std::string CResourceTableProviderDefault::FindResourceTablePath(const std::map<int, std::string> &table_paths, const int index) const
{
auto it = table_paths.find(index);
m_element_name = category_name;
m_element_type = category_type;
m_class_id = class_id;
- m_id = 0;
- SetElementAttr(ELEMENT_CATEGORY);
m_is_uhd_decoder = is_uhd_device;
+ SetElementAttr(ELEMENT_CATEGORY);
}
CategoryElement::~CategoryElement()
else
device->PrintInfo();
}
- RI_DBG("---------------------------------------------\n");
+ RI_DBG("---------------------------------------------");
}
// LCOV_EXCL_STOP
#include <cstddef>
#include <CElement.h>
-
-Element::Element(void):m_element_name(NULL), m_element_type(NULL), m_class_id(0)
-{}
-
-Element::Element(char *element_name, char *element_type, int class_id, bool is_uhd_device)
-:m_element_name(element_name), m_element_type(element_type), m_class_id(class_id), m_is_uhd_decoder(is_uhd_device)
-{}
-
-Element::Element(char *element_name, char *element_type):m_element_name(element_name), m_element_type(element_type), m_class_id(0)
-{}
-
-Element::Element(char *element_name):m_element_name(element_name), m_element_type(NULL), m_class_id(0)
-{}
-
void Element::SetElementAttr(ri_element_attribute_e element_attr)
{
- //RI_DBG("[DEVICE ELEMENT] element attr : %s", element_attr);
m_element_attr = element_attr;
}
{
RI_DBG("\n---------------- INFORMATION ----------------");
for (auto &it : category_elements_) {
- CategoryElement* category = dynamic_cast<CategoryElement*>(it);
- category->PrintInfo();
+ CategoryElement *category = dynamic_cast<CategoryElement*>(it);
+ if (category)
+ category->PrintInfo();
}
}
// LCOV_EXCL_STOP
category->is_uhd_device = category_element->IsUHDDecoder();
char *category_name = category_element->GetElementName();
- category->name = (category_name == NULL) ? strndup("", strlen("")): strndup(category_name, strlen(category_name));
+ category->name = (category_name == NULL) ? strndup("", strlen("")) : strndup(category_name, strlen(category_name));
char *codec_name = category_element->GetCodecName();
- category->codec = (codec_name == NULL) ? strndup("", strlen("")): strndup(codec_name, strlen(codec_name));
+ category->codec = (codec_name == NULL) ? strndup("", strlen("")) : strndup(codec_name, strlen(codec_name));
}
static void CopyToDevice(DeviceElement* dev_element, CategoryElement* category_element, ri_device_common_attr_s* device)
device->audio_codec = dev_element->GetAudioCodec();
char *dev_name = dev_element->GetElementName();
- device->name = (dev_name == NULL) ? strndup("", strlen("")): strndup(dev_name, strlen(dev_name));
+ device->name = (dev_name == NULL) ? strndup("", strlen("")) : strndup(dev_name, strlen(dev_name));
ri_mem_cluster_s* mem_info = dev_element->GetDeviceMemCluster();
//RI_INFO("id(%d)/support_overlay(%d)/max_rez(%d)/max_sampling(%d)", attr->id, attr->support_overlay, attr->max_rez, attr->max_sampling_format);
char *dev_name = dev_elem->GetElementName();
- attr->name = (dev_name == NULL) ? strndup("", strlen("")): strndup(dev_name, strlen(dev_name));
+ attr->name = (dev_name == NULL) ? strndup("", strlen("")) : strndup(dev_name, strlen(dev_name));
}
int ConstructResourceDB(void *InfoDB, std::vector<CategoryElement*>* device_info)
fileSize = m_GetXMLRawData(filename.c_str(), &xmlRawData);
if (fileSize == -1) {
- RI_ERR("fail to get XMLdata\n");
+ RI_ERR("fail to get XMLdata");
if (xmlRawData) {
free(xmlRawData);
xmlRawData = NULL;
int fileSize = 0;
if (filename == NULL) {
- printf("Invalid resource file path\n");
+ RI_ERR("Invalid resource file path");
return -1;
}
fileSize = m_GetXMLRawData(filename, &xmlRawData);
if (fileSize == -1) {
- printf("fail to get XML data (%s)\n", filename);
+ RI_ERR("fail to get XML data (%s)", filename);
//variable xmlRawData going out of scope leaks the storage it points to.
if (xmlRawData) {
xmlParser = XML_ParserCreate(NULL);
if (!xmlParser) {
- RI_ERR("parser create error\n");
+ RI_ERR("parser create error");
return PARSE_ERROR;
}
XML_SetCharacterDataHandler (xmlParser, m_ProcessCharacterData);
if (XML_Parse(xmlParser, xmlRawData, rawDataSize, 1) == XML_STATUS_ERROR) {
- RI_ERR("Failed to parse xml data (Error from expat library)\n");
+ RI_ERR("Failed to parse xml data (Error from expat library)");
return PARSE_ERROR;
}
int max_sampling_format = m_GetIntAttributeValue(atts, "max_format");
DeviceElement* pDeviceElement = new DeviceElement(device_name, pCategoryElement->GetElementType(), device_bw, mem_cluster_info, sharable_count, mixing, device_enum_type, is_main_device);
-
- if (pDeviceElement == NULL) {
- RI_ERR("cannot get device element. Dev[%s]", device_name);
-
- if (device_name) {
- free(device_name);
- device_name = NULL;
- }
-
- free(mem_cluster_info);
- mem_cluster_info = NULL;
-
- if (omx) {
- free(omx);
- omx = NULL;
- }
-
- if (audio_codec)
- free(audio_codec);
-
- return;
- }
-
pDeviceElement->SetElementID(g_ResourceID++);
pDeviceElement->SetDevicePath(device_path);
pDeviceElement->SetOmxCompName(omx);
if (w_8k > 0 || h_8k > 0 || wp_8k > 0 || hp_8k > 0)
InfoDB->Set8KSize(codec_name, w_8k, h_8k, wp_8k, hp_8k);
+
+ if (codec_name)
+ free(codec_name);
}
void m_ProcessCategoryStartElement(const char **atts)
/* Put the element into the Category Class */
CategoryElement* pCategoryElement = new CategoryElement(category_name, category_type, category_class_id, is_uhd);
-
- if (pCategoryElement == NULL) {
- RI_ERR("cannot get category element. Cat[%s]", category_name);
-
- if (category_name) {
- free(category_name);
- category_name = NULL;
- }
-
- if (category_type) {
- free(category_type);
- category_type = NULL;
- }
- return;
- }
-
pCategoryElement->SetCategoryEnum(category_id);
pCategoryElement->SetCodecName(codec_name);
*attribute_value = strndup(value, strlen(value));
- return (*attribute_value) ? PARSE_OK:PARSE_ERROR;
+ return (*attribute_value) ? PARSE_OK : PARSE_ERROR;
}
{
/*
Attributes are passed to the start handler as a pointer to a vector of char pointers.
- Each attribute seen in a start (or empty) tag occupies 2 consecutive places in this vector: the attribute name followed by the attribute value.
+ Each attribute seen in a start (or empty) tag occupies 2 consecutive places in this vector : the attribute name followed by the attribute value.
These pairs are terminated by a null pointer.
Note that an empty tag generates a call to both start and end handlers (in that order).
*/
RI_RETURN_NULL_IF_NULL(vcodec, "invalid param");
ri_video_property *prop = (ri_video_property*) calloc(1, sizeof(ri_video_property));
+
+ if (!prop)
+ return NULL;
+
prop->width = w;
prop->height = h;
prop->fps = fps;
ri_video_encoder_property_h ri_create_video_encoder_property(const int w, const int h, const int fps)
{
ri_video_encoder_property *prop = (ri_video_encoder_property*) calloc(1, sizeof(ri_video_encoder_property));
+
+ if (!prop)
+ return NULL;
+
prop->width = w;
prop->height = h;
prop->fps = fps;
}
ri_video_decoding_property* prop = (ri_video_decoding_property*) calloc(1, sizeof(ri_video_decoding_property));
- prop->codec_name = strdup(codec_name);
+
+ if (prop)
+ prop->codec_name = strdup(codec_name);
+
return prop;
}
for (auto it : capabilities) {
ri_video_capability* capa = (ri_video_capability *) calloc(1, sizeof(ri_video_capability));
+ if (!capa)
+ continue;
capa->device_prop = (it->GetDeviceProperty().compare("main") == 0) ? RI_DEVICE_PROPERTY_MAIN : RI_DEVICE_PROPERTY_SUB;
capa->width = it->GetWidth();
capa->height = it->GetHeight();