{
namespace mv3d
{
+// LCOV_EXCL_START
static void __destroyNotifyCb(gpointer data)
{
if (!data)
delete remained;
}
+// LCOV_EXCL_STOP
Mv3d::Mv3d()
: mDfsParameter()
height = mediaSource->getHeight();
stride = mediaSource->getWidthStride();
+ // LCOV_EXCL_START
switch (mediaSource->getColorspace()) {
case MEDIA_VISION_COLORSPACE_RGB888:
type = DFS_DATA_TYPE_UINT8C3;
default: //NOT tested
throw std::runtime_error("invalid color space");
}
+ // LCOV_EXCL_STOP
if (width != stride && type == DFS_DATA_TYPE_UINT8C1) {
//copy only Y channel
virtual ~MediaSource();
/**
- * @brief Allocates the buffer on the MediaSource
- *
- * @since_tizen 5.5
- * @param [in] bufferSize The buffer size
- * @param [in] width The image width
- * @param [in] height The image height
- * @param [in] colorspace The image colorspace
- * @return true if alloc process is ok. Otherwise return false.
- *
- * @see MediaSource::MediaSource()
- * @see MediaSource::fill()
- */
- bool alloc(unsigned int bufferSize, unsigned int width, unsigned int height, mv_colorspace_e colorspace);
-
- /**
* @brief Clears the MediaSource.
* @details Releases all internal resources and set parameters to default values.
*
mv_colorspace_e colorspace);
/**
- * @brief Fills the MediaSource based on the buffer and metadata.
- *
- * @since_tizen 5.5
- * @remarks Allocate m_pBuffer by MediaSource::alloc(). This doesn't allocate buffer.
- * @param [in] buffer The buffer of image data
- * @param [in] bufferSize The buffer size
- * @param [in] width The image width
- * @param [in] height The image height
- * @param [in] offset The offset of memory where buffer is filled.
- * @return true if filled process is ok. Otherwise return false.
- *
- * @see MediaSource::alloc()
- * @see MediaSource::MediaSource()
- * @see MediaSource::clear()
- */
- bool fill(const unsigned char *buffer, unsigned int bufferSize, unsigned int width, unsigned int height,
- size_t offset);
-
- /**
* @brief Gets data buffer of the MediaSource.
*
* @since_tizen 2.4
clear();
}
-bool MediaSource::alloc(unsigned int bufferSize, unsigned int width, unsigned int height, mv_colorspace_e colorspace)
-{
- if (bufferSize == 0)
- return false;
-
- LOGD("Call clear() first for media source %p", this);
- clear();
-
- Plane plane;
- auto &pBuffer = plane.buffer;
- auto &pImageSize = plane.imageSize;
-
- pBuffer = new (std::nothrow) unsigned char[bufferSize];
- if (pBuffer == NULL) {
- LOGE("Memory allocating for buffer in media source %p failed!", this);
- return false;
- }
-
- LOGD("Assign new size of the internal buffer of media source %p. "
- "New size is %ui.",
- this, bufferSize);
- pImageSize = bufferSize;
-
- LOGD("Assign new size (%ui x %ui) of the internal buffer image for "
- "the media source %p",
- width, height, this);
- _width = width;
- _height = height;
-
- LOGD("Assign new colorspace (%i) of the internal buffer image for "
- "the media source %p",
- colorspace, this);
- _colorspace = colorspace;
-
- _plane.push_back(plane);
-
- return true;
-}
-
void MediaSource::clear(void)
{
if (_packet) {
return true;
}
-bool MediaSource::fill(const unsigned char *buffer, unsigned int bufferSize, unsigned int width, unsigned int height,
- size_t offset)
-{
- if (bufferSize == 0 || buffer == NULL) {
- LOGE("bufferSize is %d and buffer[%p]", bufferSize, buffer);
- return false;
- }
-
- if (_plane.empty()) {
- LOGE("_plane is empty");
- return false;
- }
-
- auto &pBuffer = _plane.back().buffer;
-
- LOGD("Allocate memory [%i] for buffer in media source %p", bufferSize, this);
- LOGD("Assign new size (%ui x %ui) of the internal buffer image for "
- "the media source %p",
- width, height, this);
-
- LOGD("Copy data from external buffer (%p) to the internal buffer (%p + %zd) of "
- "media source %p",
- buffer, pBuffer, offset, this);
- std::memcpy(pBuffer + offset, buffer, bufferSize);
-
- LOGD("size is %ui x %ui [%ui] on buffer(%p).", width, height, bufferSize, this);
-
- return true;
-}
-
unsigned char *MediaSource::getBuffer(void) const
{
if (_plane.empty())
return MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT;
}
+ // LCOV_EXCL_START
switch (mimetype) {
case MEDIA_FORMAT_I420:
image_colorspace = MEDIA_VISION_COLORSPACE_I420;
mimetype);
return MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT;
}
+ // LCOV_EXCL_STOP
ret = media_packet_get_number_of_video_planes(media_packet, &plane_num);
if (plane_num <= 0 || ret != MEDIA_PACKET_ERROR_NONE) {