From 1fc543b6ccedbbc72c89e2ac05169030792e8247 Mon Sep 17 00:00:00 2001 From: "minje.ahn" Date: Wed, 10 Aug 2022 13:50:13 +0900 Subject: [PATCH] Change to copy only the specified frame length Change-Id: Ie75fe4eed6bb96f30ab6be549370526b68de7372 Signed-off-by: minje.ahn --- formats/ffmpeg/mm_file_format_ffmpeg.c | 2 +- formats/ffmpeg/mm_file_format_imelody.c | 6 +++--- formats/ffmpeg/mm_file_format_midi.c | 6 +++--- utils/mm_file_util_string.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/formats/ffmpeg/mm_file_format_ffmpeg.c b/formats/ffmpeg/mm_file_format_ffmpeg.c index 1795971..3e2cff6 100644 --- a/formats/ffmpeg/mm_file_format_ffmpeg.c +++ b/formats/ffmpeg/mm_file_format_ffmpeg.c @@ -1107,12 +1107,12 @@ static int _get_first_good_video_frame(AVFormatContext *pFormatCtx, AVCodecConte if (!(pkt->flags & AV_PKT_FLAG_KEY) && !key_detected) goto NEXT; - debug_msg(RELEASE, "video frame: %d, %d, %d", retry, i, v); #ifdef __MMFILE_TEST_MODE__ _dump_av_packet(pkt); #endif i++; key_detected = false; + debug_msg(RELEASE, "video frame: %d, %d, %d", retry, i, v); ret = avcodec_send_packet(pCodecCtx, pkt); if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) { diff --git a/formats/ffmpeg/mm_file_format_imelody.c b/formats/ffmpeg/mm_file_format_imelody.c index 5d854e9..3e69fa4 100755 --- a/formats/ffmpeg/mm_file_format_imelody.c +++ b/formats/ffmpeg/mm_file_format_imelody.c @@ -411,7 +411,7 @@ int mmfile_format_read_tag_imy(MMFileFormatContext *formatContext) * UTF8 convert */ if (taginfo.title) { - formatContext->title = mmfile_convert_to_utf8(taginfo.title, -1, locale); + formatContext->title = mmfile_convert_to_utf8(taginfo.title, strlen(taginfo.title), locale); if (formatContext->title == NULL) { debug_warning(DEBUG, "failed to UTF8 convert.\n"); @@ -421,7 +421,7 @@ int mmfile_format_read_tag_imy(MMFileFormatContext *formatContext) } if (taginfo.composer) { - formatContext->composer = mmfile_convert_to_utf8(taginfo.composer, -1, locale); + formatContext->composer = mmfile_convert_to_utf8(taginfo.composer, strlen(taginfo.composer), locale); if (formatContext->composer == NULL) { debug_warning(DEBUG, "failed to UTF8 convert.\n"); formatContext->composer = g_strdup(taginfo.composer); @@ -430,7 +430,7 @@ int mmfile_format_read_tag_imy(MMFileFormatContext *formatContext) } if (taginfo.copyright) { - formatContext->copyright = mmfile_convert_to_utf8(taginfo.copyright, -1, locale); + formatContext->copyright = mmfile_convert_to_utf8(taginfo.copyright, strlen(taginfo.copyright), locale); if (formatContext->copyright == NULL) { debug_warning(DEBUG, "failed to UTF8 convert.\n"); formatContext->copyright = g_strdup(taginfo.copyright); diff --git a/formats/ffmpeg/mm_file_format_midi.c b/formats/ffmpeg/mm_file_format_midi.c index e9a170a..917116d 100755 --- a/formats/ffmpeg/mm_file_format_midi.c +++ b/formats/ffmpeg/mm_file_format_midi.c @@ -919,7 +919,7 @@ int mmfile_format_read_tag_mid(MMFileFormatContext *formatContext) * UTF8 converting. */ if (info->title) { - formatContext->title = mmfile_convert_to_utf8((const char *)info->title, -1, locale); + formatContext->title = mmfile_convert_to_utf8(info->title, strlen(info->title), locale); if (formatContext->title == NULL) { debug_warning(DEBUG, "failed to UTF8 convert.\n"); formatContext->title = g_strdup(info->title); @@ -927,7 +927,7 @@ int mmfile_format_read_tag_mid(MMFileFormatContext *formatContext) } if (info->copyright) { - formatContext->copyright = mmfile_convert_to_utf8((const char *)info->copyright, -1, locale); + formatContext->copyright = mmfile_convert_to_utf8(info->copyright, strlen(info->copyright), locale); if (formatContext->copyright == NULL) { debug_warning(DEBUG, "failed to UTF8 convert.\n"); formatContext->copyright = g_strdup(info->copyright); @@ -935,7 +935,7 @@ int mmfile_format_read_tag_mid(MMFileFormatContext *formatContext) } if (info->comment) { - formatContext->comment = mmfile_convert_to_utf8((const char *)info->comment, -1, locale); + formatContext->comment = mmfile_convert_to_utf8(info->comment, strlen(info->comment), locale); if (formatContext->comment == NULL) { debug_warning(DEBUG, "failed to UTF8 convert.\n"); formatContext->comment = g_strdup(info->comment); diff --git a/utils/mm_file_util_string.c b/utils/mm_file_util_string.c index b3a1da6..ea8043c 100755 --- a/utils/mm_file_util_string.c +++ b/utils/mm_file_util_string.c @@ -88,7 +88,7 @@ char *mmfile_convert_to_utf8(const char *str, ssize_t len, const char *from_code /*if both to_codeset and from_codeset are same, return duplicated string.*/ if (g_strcmp0(MMFILE_CODESET_UTF8, from_codeset) == 0) - return g_strdup(str); + return g_strndup(str, len); result = g_convert(str, len, MMFILE_CODESET_UTF8, from_codeset, NULL, NULL, &err); -- 2.7.4