Change to copy only the specified frame length 75/279475/2
authorminje.ahn <minje.ahn@samsung.com>
Wed, 10 Aug 2022 04:50:13 +0000 (13:50 +0900)
committerminje.ahn <minje.ahn@samsung.com>
Wed, 10 Aug 2022 05:47:26 +0000 (14:47 +0900)
Change-Id: Ie75fe4eed6bb96f30ab6be549370526b68de7372
Signed-off-by: minje.ahn <minje.ahn@samsung.com>
formats/ffmpeg/mm_file_format_ffmpeg.c
formats/ffmpeg/mm_file_format_imelody.c
formats/ffmpeg/mm_file_format_midi.c
utils/mm_file_util_string.c

index 1795971..3e2cff6 100644 (file)
@@ -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) {
index 5d854e9..3e69fa4 100755 (executable)
@@ -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);
index e9a170a..917116d 100755 (executable)
@@ -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);
index b3a1da6..ea8043c 100755 (executable)
@@ -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);