static size_t __pkt_calculate_video_buffer_size(media_packet_s *pkt)
{
int stride = 0;
- int width = 0;
- int height = 0;
+ unsigned int width = 0;
+ unsigned int height = 0;
size_t buffersize = 0;
if (MEDIA_FORMAT_IS_VIDEO(pkt->format)) {
- width = pkt->format->detail.video.width;
- height = pkt->format->detail.video.height;
+ width = (unsigned int)pkt->format->detail.video.width;
+ height = (unsigned int)pkt->format->detail.video.height;
}
/* TODO : need to check type mapping again with mm_transform */
case MEDIA_FORMAT_I420:
case MEDIA_FORMAT_YV12:
stride = _ROUND_UP_16(width);
- buffersize = (stride + (_ROUND_UP_16(width) / 2)) * height;
+ buffersize = (size_t)((stride + (_ROUND_UP_16(width) / 2)) * height);
break;
case MEDIA_FORMAT_YUYV:
case MEDIA_FORMAT_UYVY:
case MEDIA_FORMAT_RGB565:
case MEDIA_FORMAT_422P:
stride = _ROUND_UP_16(width * 2);
- buffersize = stride * height;
+ buffersize = (size_t)(stride * height);
break;
case MEDIA_FORMAT_RGB888:
stride = _ROUND_UP_16(width * 3);
- buffersize = stride * height;
+ buffersize = (size_t)(stride * height);
break;
case MEDIA_FORMAT_ARGB:
case MEDIA_FORMAT_RGBA:
case MEDIA_FORMAT_BGRA:
stride = width * 4;
- buffersize = stride * height;
+ buffersize = (size_t)(stride * height);
break;
case MEDIA_FORMAT_NV12:
case MEDIA_FORMAT_NV12T:
case MEDIA_FORMAT_XVID:
case MEDIA_FORMAT_AV1:
stride = _ROUND_UP_16(width);
- buffersize = (stride + (_ROUND_UP_16(width) / 2)) * height;
+ buffersize = (size_t)((stride + (_ROUND_UP_16(width) / 2)) * height);
break;
default:
LOGE("Not supported format"); //LCOV_EXCL_LINE
gboolean input(GIOChannel *channel)
{
+ GIOStatus status;
gchar buf[MAX_STRING_LEN];
gsize read;
GError *error = NULL;
- g_io_channel_read_chars(channel, buf, MAX_STRING_LEN, &read, &error);
+ status = g_io_channel_read_chars(channel, buf, sizeof(buf), &read, &error);
+ if (status != G_IO_STATUS_NORMAL) {
+ g_printerr("failed to g_io_channel_read_chars(), status[%d][%s]",
+ status, error ? error->message : "(null)");
+ if (error)
+ g_error_free(error);
+ return TRUE;
+ }
+
buf[read] = '\0';
g_strstrip(buf);
interpret(buf);