#include "mm_file_utils.h"
#include "mm_file_format_ffmpeg.h"
+static int g_max_analyze_duration = 0;
+static int g_probesize = 0;
+
#ifdef __MMFILE_TEST_MODE__
static void _dump_av_packet(AVPacket *pkt)
{
* Please refer to below for detail.
* https://ffmpeg.org/ffmpeg-formats.html#Format-Options
*/
+ if (g_max_analyze_duration == 0)
+ g_max_analyze_duration = mmfile_get_int_from_ini(MMFILE_INI_MAXANLDURATION, MMFILE_DEFAULT_MAXANLDURATION);
+ if (g_probesize == 0)
+ g_probesize = mmfile_get_int_from_ini(MMFILE_INI_PROBESIZE, MMFILE_DEFAULT_PROBESIZE);
+
if (formatContext->formatType == MM_FILE_FORMAT_M2TS)
- pFormatCtx->max_analyze_duration = 100000; // MPEGTS file timeout set
+ pFormatCtx->max_analyze_duration = g_max_analyze_duration; // MPEGTS file timeout set
else
- pFormatCtx->probesize = 900000;
+ pFormatCtx->probesize = g_probesize; // the size of the data(packet) to probe stream information
+
+ debug_msg(RELEASE, "max_analyze_duration: %"PRId64", probesize: %"PRId64"", pFormatCtx->max_analyze_duration, pFormatCtx->probesize);
if (formatContext->cdis != 1) {
if (avformat_find_stream_info(pFormatCtx, NULL) < 0) {
;junk_counter_limit
; limit loop count for junk-data in mpeg4
+;max_analyze_duration
+; MPEGTS file timeout set
+;probesize
+; the size of the data to probe
[mm-file-config]
junk_counter_limit=1000
+max_analyze_duration=100000
+probesize=1000
Name: libmm-fileinfo
Summary: Media Fileinfo
-Version: 1.0.5
+Version: 1.0.6
Release: 0
Group: System/Libraries
License: Apache-2.0
mm_file_util_string.c \
mm_file_util_locale.c \
mm_file_util_validity.c \
- mm_file_util_tag.c
+ mm_file_util_tag.c \
+ mm_file_util_ini.c
libmmfile_utils_la_CFLAGS = -I$(srcdir)/include \
-I$(srcdir)/../include \
#define MMFILE_UTIL_FAIL -1
#define MMFILE_UTIL_SUCCESS 0
-#define MM_FILE_INI_PATH "/etc/multimedia/mm_file_config.ini"
-
#define mmfile_free(ptr) do { g_free((ptr)); (ptr) = NULL; } while (0)
long long mmfile_get_size(MMFileIOHandle *h);
int mmfile_close(MMFileIOHandle *h);
+/*////////////////////////////////////////////////////////////////////// */
+/* INI API // */
+/*////////////////////////////////////////////////////////////////////// */
+#define MMFILE_INI_PATH "/etc/multimedia/mm_file_config.ini"
+#define MMFILE_INI_JUNKCNTLIMIT "mm-file-config:junk_counter_limit"
+#define MMFILE_INI_MAXANLDURATION "mm-file-config:max_analyze_duration"
+#define MMFILE_INI_PROBESIZE "mm-file-config:probesize"
+#define MMFILE_DEFAULT_JUNKCNTLIMIT 1000
+#define MMFILE_DEFAULT_MAXANLDURATION 100000
+#define MMFILE_DEFAULT_PROBESIZE 1000
+
+int mmfile_get_int_from_ini(const char *key, int notfound);
/*////////////////////////////////////////////////////////////////////// */
/* MIME API // */
/*////////////////////////////////////////////////////////////////////// */
/* TAG API // */
/*////////////////////////////////////////////////////////////////////// */
-
inline static int __AvMemstr(unsigned char *mem, unsigned char *str, int str_len, int search_range)
{
int offset = 0;
--- /dev/null
+/*
+ * libmm-fileinfo
+ *
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jiyong Min <jiyong.min@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <iniparser.h>
+
+#include "mm_file_debug.h"
+#include "mm_file_utils.h"
+
+int mmfile_get_int_from_ini(const char *key, int notfound)
+{
+ dictionary *dict = NULL;
+ int data = 0;
+
+ dict = iniparser_load(MMFILE_INI_PATH);
+ if (!dict) {
+ debug_error(DEBUG, "%s load failed", MMFILE_INI_PATH);
+ return notfound;
+ }
+
+ data = iniparser_getint(dict, key, notfound);
+ debug_msg(DEBUG, "%s: %d", key, data);
+
+ iniparser_freedict(dict);
+
+ return data;
+}
#include <ctype.h>
#include <vconf.h>
#include <glib.h>
-#include <iniparser.h>
#include <stdint.h>
#include "mm_file.h"
{"TDRC", 660099, AV_ID3TAG_RECDATE}, /*Recdate for 2.4*/
};
-static int GetJunkCounterLimit(void);
+static int g_junk_counter_limit = 0;
static int GetStringFromTextTagBox(MMFileFormatContext *formatContext, MMFileIOHandle *fp, MMFILE_MP4_BASIC_BOX_HEADER *basic_header, eMMFILE_3GP_TEXT_TAG eTag)
{
return MMFILE_UTIL_SUCCESS;
}
-static int g_junk_counter_limit = 0;
-static int GetJunkCounterLimit(void)
-{
- dictionary *dict = NULL;
- int data = 0;
-
- dict = iniparser_load(MM_FILE_INI_PATH);
- if (!dict) {
- debug_error(DEBUG, "%s load failed", MM_FILE_INI_PATH);
- return -1;
- }
-
- data = iniparser_getint(dict, "mm-file-config:junk_counter_limit", 0);
- debug_msg(DEBUG, "mm-file-config:junk_counter_limit= %u", data);
-
- iniparser_freedict(dict);
-
- return data;
-}
-
int ParseSpatialVideoMetadataFromXMLString(const char *xmlStr, MMFileFormatContext *formatContext)
{
const char is_spherical_str[] = "<GSpherical:Spherical>";
basic_header.start_offset = mmfile_tell(fp);
if (g_junk_counter_limit == 0)
- g_junk_counter_limit = GetJunkCounterLimit();
+ g_junk_counter_limit = mmfile_get_int_from_ini(MMFILE_INI_JUNKCNTLIMIT, MMFILE_DEFAULT_JUNKCNTLIMIT);
while ((ret != MMFILE_UTIL_FAIL) && ((readed = mmfile_read(fp, (unsigned char *)&basic_header, MMFILE_MP4_BASIC_BOX_HEADER_LEN)) == MMFILE_MP4_BASIC_BOX_HEADER_LEN)) {
basic_header.size = mmfile_io_be_uint32(basic_header.size);