[flvmeta] 9 new revisions pushed by marc.noi...@gmail.com on 2012-04-12 09:14 GMT

7 views
Skip to first unread message

flv...@googlecode.com

unread,
Apr 12, 2012, 5:14:31 AM4/12/12
to flvme...@googlegroups.com
9 new revisions:

Revision: 194eab485ded
Author: Marc Noirot <marc....@gmail.com>
Date: Thu Apr 5 09:26:12 2012
Log: Completed checking feature....
http://code.google.com/p/flvmeta/source/detail?r=194eab485ded

Revision: c6662fc7c3da
Author: Marc Noirot <marc....@gmail.com>
Date: Tue Apr 3 01:25:02 2012
Log: Fixed building on Mac OSX with CMake.
http://code.google.com/p/flvmeta/source/detail?r=c6662fc7c3da

Revision: fe78f5362864
Author: Marc Noirot <marc....@gmail.com>
Date: Tue Apr 3 02:23:47 2012
Log: Updated copyright notices to 2012.
http://code.google.com/p/flvmeta/source/detail?r=fe78f5362864

Revision: f0d071c0ef93
Author: Marc Noirot <marc....@gmail.com>
Date: Tue Apr 3 02:24:45 2012
Log: Merge branch 'master' of github.com:noirotm/flvmeta
http://code.google.com/p/flvmeta/source/detail?r=f0d071c0ef93

Revision: 937d361cd16d
Author: Marc Noirot <marc....@gmail.com>
Date: Thu Apr 5 09:32:57 2012
Log: Merged feature_check branche back into master
http://code.google.com/p/flvmeta/source/detail?r=937d361cd16d

Revision: a1b0f862bd94
Author: Marc Noirot <marc....@gmail.com>
Date: Wed Apr 11 07:21:38 2012
Log: Added autotools support for the installation of the man page.
http://code.google.com/p/flvmeta/source/detail?r=a1b0f862bd94

Revision: 9294eb769fbd
Author: Marc Noirot <marc....@gmail.com>
Date: Wed Apr 11 07:23:25 2012
Log: Fixed invalid keyframe position check.
http://code.google.com/p/flvmeta/source/detail?r=9294eb769fbd

Revision: 7bc831dec4f4
Author: Marc Noirot <marc....@gmail.com>
Date: Wed Apr 11 09:40:02 2012
Log: Updated manual.
http://code.google.com/p/flvmeta/source/detail?r=7bc831dec4f4

Revision: 32d4b866c208
Author: Marc Noirot <marc....@gmail.com>
Date: Thu Apr 12 02:07:34 2012
Log: Fixed desynchronisation detection on 64-bit platforms.
http://code.google.com/p/flvmeta/source/detail?r=32d4b866c208

==============================================================================
Revision: 194eab485ded
Author: Marc Noirot <marc....@gmail.com>
Date: Thu Apr 5 09:26:12 2012
Log: Completed checking feature.
Fixed a bug causing a crash caused by insufficient pointer initialization.
Updated TODO.

http://code.google.com/p/flvmeta/source/detail?r=194eab485ded

Modified:
/TODO
/src/check.c
/src/check.h

=======================================
--- /TODO Mon Sep 20 07:59:24 2010
+++ /TODO Thu Apr 5 09:26:12 2012
@@ -20,3 +20,5 @@
Batch mode to handle multiple input files in one invocation.

Scripting environment for custom manipulation of FLV files and metadata.
+
+Fix Mac OSX invalid desync report in --check.
=======================================
--- /src/check.c Tue Oct 4 11:14:05 2011
+++ /src/check.c Thu Apr 5 09:26:12 2012
@@ -22,6 +22,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "check.h"
+#include "dump.h"
#include "info.h"

#include <math.h>
@@ -502,6 +503,8 @@
amf_data * name;
amf_data * data;

+ name = NULL;
+ data = NULL;
result = flv_read_metadata(flv_in, &name, &data);

if (result == FLV_ERROR_EOF) {
@@ -692,6 +695,8 @@
data = amf_associative_array_get_data(n);
type = amf_data_get_type(data);

+ /* TODO: check UTF-8 strings, in key, and value if string type
*/
+
/* hasMetadata (bool): true */
if (!strcmp((char*)name, "hasMetadata")) {
if (type == AMF_TYPE_BOOLEAN) {
@@ -1358,6 +1363,36 @@
if (info.video_width == 0 && info.video_height == 0) {
print_warning(WARNING_VIDEO_SIZE_ERROR,
file_stats.st_size, "unable to determine video resolution");
}
+
+ /* global info */
+
+ if (info.have_video) {
+ /* video codec */
+ sprintf(message, "video codec is %s",
dump_string_get_video_codec(prev_video_tag));
+ print_info(INFO_VIDEO_CODEC, 0, message);
+
+ }
+
+ if (info.have_audio) {
+ /* audio info */
+ sprintf(message, "audio format is %s (%s, %s-bit, %s kHz)",
+ dump_string_get_sound_format(prev_audio_tag),
+ dump_string_get_sound_type(prev_audio_tag),
+ dump_string_get_sound_size(prev_audio_tag),
+ dump_string_get_sound_rate(prev_audio_tag)
+ );
+ print_info(INFO_AUDIO_FORMAT, 0, message);
+ }
+
+ /* does the file use extended timestamps ? */
+ if (last_timestamp > 0x00FFFFFF) {
+ print_info(INFO_TIMESTAMP_USE_EXTENDED, 0, "extended timestamps
used in the file");
+ }
+
+ /* is the file larger than 4GB ? */
+ if (file_stats.st_size > 0xFFFFFFFFULL) {
+ print_info(INFO_GENERAL_LARGE_FILE, 0, "file is larger than 4 GB");
+ }

end:
report_end(opts, errors, warnings);
=======================================
--- /src/check.h Tue Oct 4 11:14:05 2011
+++ /src/check.h Thu Apr 5 09:26:12 2012
@@ -128,6 +128,10 @@
#define ERROR_VIDEO_WIDTH_MISSING LEVEL_ERROR
TOPIC_VIDEO_DATA "077"
#define ERROR_VIDEO_HEIGHT_MISSING LEVEL_ERROR
TOPIC_VIDEO_DATA "078"
#define WARNING_VIDEO_SIZE_ERROR LEVEL_WARNING
TOPIC_VIDEO_DATA "079"
+#define INFO_VIDEO_CODEC LEVEL_INFO
TOPIC_VIDEO_CODECS "080"
+#define INFO_AUDIO_FORMAT LEVEL_INFO
TOPIC_AUDIO_CODECS "081"
+#define INFO_TIMESTAMP_USE_EXTENDED LEVEL_INFO
TOPIC_TIMESTAMPS "082"
+#define INFO_GENERAL_LARGE_FILE LEVEL_INFO
TOPIC_GENERAL_FORMAT "083"

#ifdef __cplusplus
extern "C" {
@@ -141,4 +145,3 @@
#endif /* __cplusplus */

#endif /* __CHECK_H__ */
-

==============================================================================
Revision: c6662fc7c3da
Author: Marc Noirot <marc....@gmail.com>
Date: Tue Apr 3 01:25:02 2012
Log: Fixed building on Mac OSX with CMake.

http://code.google.com/p/flvmeta/source/detail?r=c6662fc7c3da

Modified:
/CMakeLists.txt
/src/types.h

=======================================
--- /CMakeLists.txt Thu Nov 17 01:46:52 2011
+++ /CMakeLists.txt Tue Apr 3 01:25:02 2012
@@ -71,7 +71,8 @@
check_function_exists("fseeko" HAVE_FSEEKO)
if(HAVE_FSEEKO)
execute_process(COMMAND getconf LFS_CFLAGS
- OUTPUT_VARIABLE LFS_CFLAGS)
+ OUTPUT_VARIABLE LFS_CFLAGS
+ ERROR_QUIET)
if(LFS_CFLAGS)
add_definitions(${LFS_CFLAGS})
endif(LFS_CFLAGS)
=======================================
--- /src/types.h Mon Jun 27 07:07:36 2011
+++ /src/types.h Tue Apr 3 01:25:02 2012
@@ -115,12 +115,14 @@
# define lfs_ftell ftello
# define lfs_fseek fseeko

+# define FILE_OFFSET_T_64_BITS 1
typedef off_t file_offset_t;

#else /* !HAVE_SEEKO */

# ifdef WIN32

+# define FILE_OFFSET_T_64_BITS 1
typedef long long int file_offset_t;

/* Win32 large file support */
@@ -139,7 +141,7 @@
#endif /* HAVE_FSEEKO */

/* file offset printf specifier */
-#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
+#ifdef FILE_OFFSET_T_64_BITS
# define FILE_OFFSET_PRINTF_FORMAT "ll"
#else
# define FILE_OFFSET_PRINTF_FORMAT "l"

==============================================================================
Revision: fe78f5362864
Author: Marc Noirot <marc....@gmail.com>
Date: Tue Apr 3 02:23:47 2012
Log: Updated copyright notices to 2012.

http://code.google.com/p/flvmeta/source/detail?r=fe78f5362864

Modified:
/src/amf.c
/src/amf.h
/src/avc.c
/src/avc.h
/src/check.c
/src/check.h
/src/compat/win32_tmpfile.c
/src/compat/win32_tmpfile.h
/src/dump.c
/src/dump.h
/src/dump_json.c
/src/dump_json.h
/src/dump_raw.c
/src/dump_raw.h
/src/dump_xml.c
/src/dump_xml.h
/src/dump_yaml.c
/src/dump_yaml.h
/src/flv.c
/src/flv.h
/src/flvmeta.c
/src/flvmeta.h
/src/info.c
/src/info.h
/src/types.c
/src/types.h
/src/update.c
/src/update.h
/src/util.c
/src/util.h

=======================================
--- /src/amf.c Mon Jun 27 07:07:36 2011
+++ /src/amf.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/amf.h Mon Jun 27 07:07:36 2011
+++ /src/amf.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/avc.c Mon Jun 27 07:07:36 2011
+++ /src/avc.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/avc.h Mon Jun 27 07:07:36 2011
+++ /src/avc.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/check.c Wed Aug 10 08:30:51 2011
+++ /src/check.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/check.h Mon Jun 27 07:07:36 2011
+++ /src/check.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/compat/win32_tmpfile.c Mon Jun 27 07:07:36 2011
+++ /src/compat/win32_tmpfile.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/compat/win32_tmpfile.h Mon Jun 27 07:07:36 2011
+++ /src/compat/win32_tmpfile.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/dump.c Mon Jun 27 07:07:36 2011
+++ /src/dump.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/dump.h Mon Jun 27 07:07:36 2011
+++ /src/dump.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/dump_json.c Mon Jun 27 07:07:36 2011
+++ /src/dump_json.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/dump_json.h Mon Jun 27 07:07:36 2011
+++ /src/dump_json.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/dump_raw.c Mon Jun 27 07:07:36 2011
+++ /src/dump_raw.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/dump_raw.h Mon Jun 27 07:07:36 2011
+++ /src/dump_raw.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/dump_xml.c Mon Jun 27 07:07:36 2011
+++ /src/dump_xml.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/dump_xml.h Mon Jun 27 07:07:36 2011
+++ /src/dump_xml.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/dump_yaml.c Mon Jun 27 07:07:36 2011
+++ /src/dump_yaml.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/dump_yaml.h Mon Jun 27 07:07:36 2011
+++ /src/dump_yaml.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/flv.c Mon Jun 27 07:07:36 2011
+++ /src/flv.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/flv.h Mon Jun 27 07:07:36 2011
+++ /src/flv.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/flvmeta.c Mon Jun 27 07:07:36 2011
+++ /src/flvmeta.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/flvmeta.h Mon Jun 27 07:07:36 2011
+++ /src/flvmeta.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

@@ -32,7 +32,7 @@
#include "flv.h"

/* copyright string */
-#define COPYRIGHT_STR "Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT
gmail.com>"
+#define COPYRIGHT_STR "Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT
gmail.com>"

/* error statuses */
#define OK FLV_OK
=======================================
--- /src/info.c Mon Jun 27 07:07:36 2011
+++ /src/info.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/info.h Mon Jun 27 07:07:36 2011
+++ /src/info.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/types.c Mon Jun 27 07:07:36 2011
+++ /src/types.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/types.h Tue Apr 3 01:25:02 2012
+++ /src/types.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/update.c Mon Jun 27 07:07:36 2011
+++ /src/update.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/update.h Mon Jun 27 07:07:36 2011
+++ /src/update.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/util.c Mon Jun 27 07:07:36 2011
+++ /src/util.c Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.

=======================================
--- /src/util.h Mon Jun 27 07:07:36 2011
+++ /src/util.h Tue Apr 3 02:23:47 2012
@@ -3,7 +3,7 @@

FLV Metadata updater

- Copyright (C) 2007-2011 Marc Noirot <marc.noirot AT gmail.com>
+ Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>

This file is part of FLVMeta.


==============================================================================
Revision: f0d071c0ef93
Author: Marc Noirot <marc....@gmail.com>
Date: Tue Apr 3 02:24:45 2012
Log: Merge branch 'master' of github.com:noirotm/flvmeta

http://code.google.com/p/flvmeta/source/detail?r=f0d071c0ef93

==============================================================================
Revision: 937d361cd16d
Author: Marc Noirot <marc....@gmail.com>
Date: Thu Apr 5 09:32:57 2012
Log: Merged feature_check branche back into master

http://code.google.com/p/flvmeta/source/detail?r=937d361cd16d

Modified:
/src/check.c
/src/check.h
/src/flv.c
/src/flv.h
/src/info.c
/src/info.h

=======================================
--- /src/check.c Tue Apr 3 02:23:47 2012
+++ /src/check.c Thu Apr 5 09:32:57 2012
@@ -22,6 +22,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "check.h"
+#include "dump.h"
#include "info.h"

#include <math.h>
@@ -32,7 +33,7 @@
#include <sys/types.h>
#include <sys/stat.h>

-#define MAX_ACCEPTABLE_TAG_BODY_LENGTH 100000
+#define MAX_ACCEPTABLE_TAG_BODY_LENGTH 1000000

/* start the report */
static void report_start(const flvmeta_opts * opts) {
@@ -162,7 +163,7 @@
int have_desync;
int have_on_metadata;
file_offset_t on_metadata_offset;
- amf_data * on_metadata;
+ amf_data * on_metadata, * on_metadata_name;
int have_on_last_second;
uint32 on_last_second_timestamp;

@@ -184,7 +185,7 @@
video_frames_number = keyframes_number = 0;
have_on_metadata = 0;
on_metadata_offset = 0;
- on_metadata = NULL;
+ on_metadata = on_metadata_name = NULL;
have_on_last_second = 0;
on_last_second_timestamp = 0;

@@ -208,57 +209,57 @@
/* check signature */
result = flv_read_header(flv_in, &header);
if (result == FLV_ERROR_EOF) {
- print_fatal("F11001", 0, "unexpected end of file in header");
+ print_fatal(FATAL_HEADER_EOF, 0, "unexpected end of file in
header");
goto end;
}
else if (result == FLV_ERROR_NO_FLV) {
- print_fatal("F11002", 0, "FLV signature not found in header");
+ print_fatal(FATAL_HEADER_NO_SIGNATURE, 0, "FLV signature not found
in header");
goto end;
}

/* version */
if (header.version != FLV_VERSION) {
sprintf(message, "header version should be 1, %d found instead",
header.version);
- print_error("E11003", 3, message);
+ print_error(ERROR_HEADER_BAD_VERSION, 3, message);
}

/* video and audio flags */
if (!flv_header_has_audio(header) && !flv_header_has_video(header)) {
- print_error("E11004", 4, "header signals the file does not contain
video tags or audio tags");
+ print_error(ERROR_HEADER_NO_STREAMS, 4, "header signals the file
does not contain video tags or audio tags");
}
else if (!flv_header_has_audio(header)) {
- print_info("I11005", 4, "header signals the file does not contain
audio tags");
+ print_info(INFO_HEADER_NO_AUDIO, 4, "header signals the file does
not contain audio tags");
}
else if (!flv_header_has_video(header)) {
- print_warning("W11006", 4, "header signals the file does not
contain video tags");
+ print_warning(WARNING_HEADER_NO_VIDEO, 4, "header signals the file
does not contain video tags");
}

/* reserved flags */
if (header.flags & 0xFA) {
- print_error("E11007", 4, "header reserved flags are not zero");
+ print_error(ERROR_HEADER_BAD_RESERVED_FLAGS, 4, "header reserved
flags are not zero");
}

/* offset */
if (flv_header_get_offset(header) != 9) {
sprintf(message, "header offset should be 9, %d found instead",
flv_header_get_offset(header));
- print_error("E11008", 5, message);
+ print_error(ERROR_HEADER_BAD_OFFSET, 5, message);
}

/** check first previous tag size **/

result = flv_read_prev_tag_size(flv_in, &prev_tag_size);
if (result == FLV_ERROR_EOF) {
- print_fatal("F12009", 9, "unexpected end of file in previous tag
size");
+ print_fatal(FATAL_PREV_TAG_SIZE_EOF, 9, "unexpected end of file in
previous tag size");
goto end;
}
else if (prev_tag_size != 0) {
sprintf(message, "first previous tag size should be 0, %d found
instead", prev_tag_size);
- print_error("E12010", 9, message);
+ print_error(ERROR_PREV_TAG_SIZE_BAD_FIRST, 9, message);
}

/* we reached the end of file: no tags in file */
if (flv_get_offset(flv_in) == file_stats.st_size) {
- print_fatal("F10011", 13, "file does not contain tags");
+ print_fatal(FATAL_GENERAL_NO_TAG, 13, "file does not contain
tags");
goto end;
}

@@ -271,7 +272,7 @@

result = flv_read_tag(flv_in, &tag);
if (result != FLV_OK) {
- print_fatal("F20012", flv_get_offset(flv_in), "unexpected end
of file in tag");
+ print_fatal(FATAL_TAG_EOF, flv_get_offset(flv_in), "unexpected
end of file in tag");
goto end;
}

@@ -288,19 +289,19 @@
&& tag.type != FLV_TAG_TYPE_META
) {
sprintf(message, "unknown tag type %hhd", tag.type);
- print_error("E30013", offset, message);
+ print_error(ERROR_TAG_TYPE_UNKNOWN, offset, message);
}

/* check consistency with global header */
if (!have_video && tag.type == FLV_TAG_TYPE_VIDEO) {
if (!flv_header_has_video(header)) {
- print_warning("W11014", offset, "video tag found despite
header signaling the file contains no video");
+ print_warning(WARNING_HEADER_UNEXPECTED_VIDEO,
offset, "video tag found despite header signaling the file contains no
video");
}
have_video = 1;
}
if (!have_audio && tag.type == FLV_TAG_TYPE_AUDIO) {
if (!flv_header_has_audio(header)) {
- print_warning("W11015", offset, "audio tag found despite
header signaling the file contains no audio");
+ print_warning(WARNING_HEADER_UNEXPECTED_AUDIO,
offset, "audio tag found despite header signaling the file contains no
audio");
}
have_audio = 1;
}
@@ -308,15 +309,15 @@
/* check body length */
if (body_length > (file_stats.st_size - flv_get_offset(flv_in))) {
sprintf(message, "tag body length (%d bytes) exceeds file
size", body_length);
- print_fatal("F20016", offset + 1, message);
+ print_fatal(FATAL_TAG_BODY_LENGTH_OVERFLOW, offset + 1,
message);
goto end;
}
else if (body_length > MAX_ACCEPTABLE_TAG_BODY_LENGTH) {
sprintf(message, "tag body length (%d bytes) is abnormally
large", body_length);
- print_warning("W20017", offset + 1, message);
+ print_warning(WARNING_TAG_BODY_LENGTH_LARGE, offset + 1,
message);
}
else if (body_length == 0) {
- print_warning("W20018", offset + 1, "tag body length is zero");
+ print_warning(WARNING_TAG_BODY_LENGTH_ZERO, offset + 1, "tag
body length is zero");
}

/** check timestamp **/
@@ -325,14 +326,14 @@
/* check whether first timestamp is zero */
if (tag_number == 1 && timestamp != 0) {
sprintf(message, "first timestamp should be zero, %d found
instead", timestamp);
- print_error("E40019", offset + 4, message);
+ print_error(ERROR_TIMESTAMP_FIRST_NON_ZERO, offset + 4,
message);
}

/* check whether timestamps decrease in a given stream */
if (tag.type == FLV_TAG_TYPE_AUDIO) {
if (last_audio_timestamp > timestamp) {
sprintf(message, "audio tag timestamps are decreasing
from %d to %d", last_audio_timestamp, timestamp);
- print_error("E40020", offset + 4, message);
+ print_error(ERROR_TIMESTAMP_AUDIO_DECREASE, offset + 4,
message);
}
last_audio_timestamp = timestamp;
decr_timestamp_signaled = 1;
@@ -340,7 +341,7 @@
if (tag.type == FLV_TAG_TYPE_VIDEO) {
if (last_video_timestamp > timestamp) {
sprintf(message, "video tag timestamps are decreasing
from %d to %d", last_video_timestamp, timestamp);
- print_error("E40021", offset + 4, message);
+ print_error(ERROR_TIMESTAMP_VIDEO_DECREASE, offset + 4,
message);
}
last_video_timestamp = timestamp;
decr_timestamp_signaled = 1;
@@ -348,13 +349,13 @@

/* check for overflow error */
if (last_timestamp > timestamp && last_timestamp - timestamp >
0xF00000) {
- print_error("E40022", offset + 4, "extended bits not used
after timestamp overflow");
+ print_error(ERROR_TIMESTAMP_OVERFLOW, offset + 4, "extended
bits not used after timestamp overflow");
}

/* check whether timestamps decrease globally */
else if (!decr_timestamp_signaled && last_timestamp > timestamp &&
last_timestamp - timestamp >= 1000) {
sprintf(message, "timestamps are decreasing from %d to %d",
last_timestamp, timestamp);
- print_error("E40023", offset + 4, message);
+ print_error(ERROR_TIMESTAMP_DECREASE, offset + 4, message);
}

last_timestamp = timestamp;
@@ -363,14 +364,14 @@
if (have_video && have_audio && !have_desync &&
labs(last_video_timestamp - last_audio_timestamp) >= 1000) {
sprintf(message, "audio and video streams are desynchronized
by %ld ms",
labs(last_video_timestamp - last_audio_timestamp));
- print_warning("W40024", offset + 4, message);
+ print_warning(WARNING_TIMESTAMP_DESYNC, offset + 4, message);
have_desync = 1; /* do not repeat */
}

/** stream id must be zero **/
if (stream_id != 0) {
sprintf(message, "tag stream id must be zero, %d found
instead", stream_id);
- print_error("E20025", offset + 8, message);
+ print_error(ERROR_TAG_STREAM_ID_NON_ZERO, offset + 8, message);
}

/* check tag body contents only if not empty */
@@ -383,20 +384,20 @@

result = flv_read_audio_tag(flv_in, &at);
if (result == FLV_ERROR_EOF) {
- print_fatal("F20012", offset + 11, "unexpected end of
file in tag");
+ print_fatal(FATAL_TAG_EOF, offset + 11, "unexpected
end of file in tag");
goto end;
}

/* check whether the format varies between tags */
if (have_prev_audio_tag && prev_audio_tag != at) {
- print_warning("W51026", offset + 11, "audio format
changed since last tag");
+ print_warning(WARNING_AUDIO_FORMAT_CHANGED, offset +
11, "audio format changed since last tag");
}

/* check format */
audio_format = flv_audio_tag_sound_format(at);
if (audio_format == 12 || audio_format == 13) {
sprintf(message, "unknown audio format %d",
audio_format);
- print_warning("W51027", offset + 11, message);
+ print_warning(WARNING_AUDIO_CODEC_UNKNOWN, offset +
11, message);
}
else if (audio_format == FLV_AUDIO_TAG_SOUND_FORMAT_G711_A
|| audio_format == FLV_AUDIO_TAG_SOUND_FORMAT_G711_MU
@@ -405,14 +406,14 @@
|| audio_format ==
FLV_AUDIO_TAG_SOUND_FORMAT_DEVICE_SPECIFIC
) {
sprintf(message, "audio format %d is reserved for
internal use", audio_format);
- print_warning("W51028", offset + 11, message);
+ print_warning(WARNING_AUDIO_CODEC_RESERVED, offset +
11, message);
}

/* check consistency, see flash video spec */
if (flv_audio_tag_sound_rate(at) !=
FLV_AUDIO_TAG_SOUND_RATE_44
&& audio_format == FLV_AUDIO_TAG_SOUND_FORMAT_AAC
) {
- print_warning("W51029", offset + 11, "audio data in
AAC format should have a 44KHz rate, field will be ignored");
+ print_warning(WARNING_AUDIO_CODEC_AAC_BAD, offset +
11, "audio data in AAC format should have a 44KHz rate, field will be
ignored");
}

if (flv_audio_tag_sound_type(at) ==
FLV_AUDIO_TAG_SOUND_TYPE_STEREO
@@ -420,17 +421,17 @@
|| audio_format ==
FLV_AUDIO_TAG_SOUND_FORMAT_NELLYMOSER_16_MONO
|| audio_format ==
FLV_AUDIO_TAG_SOUND_FORMAT_NELLYMOSER_8_MONO)
) {
- print_warning("W51030", offset + 11, "audio data in
Nellymoser format cannot be stereo, field will be ignored");
+ print_warning(WARNING_AUDIO_CODEC_NELLYMOSER_BAD,
offset + 11, "audio data in Nellymoser format cannot be stereo, field will
be ignored");
}

else if (flv_audio_tag_sound_type(at) ==
FLV_AUDIO_TAG_SOUND_TYPE_MONO
&& audio_format == FLV_AUDIO_TAG_SOUND_FORMAT_AAC
) {
- print_warning("W51031", offset + 11, "audio data in
AAC format should be stereo, field will be ignored");
+ print_warning(WARNING_AUDIO_CODEC_AAC_MONO, offset +
11, "audio data in AAC format should be stereo, field will be ignored");
}

else if (audio_format ==
FLV_AUDIO_TAG_SOUND_FORMAT_LINEAR_PCM) {
- print_warning("W51032", offset + 11, "audio data in
Linear PCM, platform endian format should not be used because of
non-portability");
+ print_warning(WARNING_AUDIO_CODEC_LINEAR_PCM, offset +
11, "audio data in Linear PCM, platform endian format should not be used
because of non-portability");
}

prev_audio_tag = at;
@@ -445,13 +446,13 @@

result = flv_read_video_tag(flv_in, &vt);
if (result == FLV_ERROR_EOF) {
- print_fatal("F20012", offset + 11, "unexpected end of
file in tag");
+ print_fatal(FATAL_TAG_EOF, offset + 11, "unexpected
end of file in tag");
goto end;
}

/* check whether the format varies between tags */
if (have_prev_video_tag &&
flv_video_tag_codec_id(prev_video_tag) != flv_video_tag_codec_id(vt)) {
- print_warning("W60033", offset + 11, "video format
changed since last tag");
+ print_warning(WARNING_VIDEO_FORMAT_CHANGED, offset +
11, "video format changed since last tag");
}

/* check video frame type */
@@ -463,7 +464,7 @@
&& video_frame_type !=
FLV_VIDEO_TAG_FRAME_TYPE_COMMAND_FRAME
) {
sprintf(message, "unknown video frame type %d",
video_frame_type);
- print_error("E60034", offset + 11, message);
+ print_error(ERROR_VIDEO_FRAME_TYPE_UNKNOWN, offset +
11, message);
}

if (video_frame_type == FLV_VIDEO_TAG_FRAME_TYPE_KEYFRAME)
{
@@ -472,7 +473,7 @@

/* check whether first frame is a keyframe */
if (!have_prev_video_tag && video_frame_type !=
FLV_VIDEO_TAG_FRAME_TYPE_KEYFRAME) {
- print_warning("W60035", offset + 11, "first video
frame is not a keyframe, playback will suffer");
+ print_warning(WARNING_VIDEO_NO_FIRST_KEYFRAME, offset
+ 11, "first video frame is not a keyframe, playback will suffer");
}

/* check video codec */
@@ -486,12 +487,12 @@
&& video_codec != FLV_VIDEO_TAG_CODEC_AVC
) {
sprintf(message, "unknown video codec id %d",
video_codec);
- print_error("E61034", offset + 11, message);
+ print_error(ERROR_VIDEO_CODEC_UNKNOWN, offset + 11,
message);
}

/* according to spec, JPEG codec is not currently used */
if (video_codec == FLV_VIDEO_TAG_CODEC_JPEG) {
- print_warning("W61035", offset + 11, "JPEG codec not
currently used");
+ print_warning(WARNING_VIDEO_CODEC_JPEG, offset +
11, "JPEG codec not currently used");
}

prev_video_tag = vt;
@@ -502,42 +503,44 @@
amf_data * name;
amf_data * data;

+ name = NULL;
+ data = NULL;
result = flv_read_metadata(flv_in, &name, &data);

if (result == FLV_ERROR_EOF) {
- print_fatal("F20012", offset + 11, "unexpected end of
file in tag");
+ print_fatal(FATAL_TAG_EOF, offset + 11, "unexpected
end of file in tag");
amf_data_free(name);
amf_data_free(data);
goto end;
}
else if (result == FLV_ERROR_EMPTY_TAG) {
- print_warning("W70038", offset + 11, "empty metadata
tag");
+ print_warning(WARNING_METADATA_EMPTY, offset +
11, "empty metadata tag");
}
else if (result == FLV_ERROR_INVALID_METADATA_NAME) {
- print_error("E70039", offset + 11, "invalid metadata
name");
+ print_error(ERROR_METADATA_NAME_INVALID, offset +
11, "invalid metadata name");
}
else if (result == FLV_ERROR_INVALID_METADATA) {
- print_error("E70039", offset + 11, "invalid metadata");
+ print_error(ERROR_METADATA_DATA_INVALID, offset +
11, "invalid metadata");
}
else if (amf_data_get_type(name) != AMF_TYPE_STRING) {
/* name type checking */
sprintf(message, "invalid metadata name type: %d,
should be a string (2)", amf_data_get_type(name));
- print_error("E70038", offset, message);
+ print_error(ERROR_METADATA_NAME_INVALID_TYPE, offset,
message);
}
else {
/* empty name checking */
if (amf_string_get_size(name) == 0) {
- print_warning("W70038", offset, "empty metadata
name");
+ print_warning(WARNING_METADATA_NAME_EMPTY,
offset, "empty metadata name");
}

/* check whether all body size has been read */
if (flv_in->current_tag_body_length > 0) {
sprintf(message, "%d bytes not read in tag body
after metadata end", body_length - flv_in->current_tag_body_length);
- print_warning("W70040", flv_get_offset(flv_in),
message);
- }
- else if (flv_in->current_tag_body_length < 0) {
- sprintf(message, "%d bytes missing from tag body
after metadata end", flv_in->current_tag_body_length - body_length);
- print_warning("W70041", flv_get_offset(flv_in),
message);
+ print_warning(WARNING_METADATA_DATA_REMAINING,
flv_get_offset(flv_in), message);
+ }
+ else if (flv_in->current_tag_body_overflow > 0) {
+ sprintf(message, "%d bytes missing from tag body
after metadata end", flv_in->current_tag_body_overflow);
+ print_warning(WARNING_METADATA_DATA_MISSING,
flv_get_offset(flv_in), message);
}

/* onLastSecond checking */
@@ -547,7 +550,7 @@
on_last_second_timestamp = timestamp;
}
else {
- print_warning("W70038", offset, "duplicate
onLastSecond event");
+
print_warning(WARNING_METADATA_LAST_SECOND_DUP, offset, "duplicate
onLastSecond event");
}
}

@@ -557,23 +560,24 @@
have_on_metadata = 1;
on_metadata_offset = offset;
on_metadata = amf_data_clone(data);
+ on_metadata_name = amf_data_clone(name);

/* check onMetadata type */
if (amf_data_get_type(on_metadata) !=
AMF_TYPE_ASSOCIATIVE_ARRAY) {
sprintf(message, "invalid onMetaData data
type: %d, should be an associative array (8)",
amf_data_get_type(on_metadata));
- print_error("E70038", offset, message);
+
print_error(ERROR_METADATA_DATA_INVALID_TYPE, offset, message);
}

/* onMetaData must be the first tag at 0
timestamp */
if (tag_number != 1) {
- print_warning("W70038",
offset, "onMetadata event found after the first tag");
+ print_warning(WARNING_METADATA_BAD_TAG,
offset, "onMetadata event found after the first tag");
}
if (timestamp != 0) {
- print_warning("W70038",
offset, "onMetadata event found after timestamp zero");
+
print_warning(WARNING_METADATA_BAD_TIMESTAMP, offset, "onMetadata event
found after timestamp zero");
}
}
else {
- print_warning("W70038", offset, "duplicate
onMetaData event");
+ print_warning(WARNING_METADATA_DUPLICATE,
offset, "duplicate onMetaData event");
}
}

@@ -582,7 +586,7 @@
&&
strcmp((char*)amf_string_get_bytes(name), "onCuePoint")
&&
strcmp((char*)amf_string_get_bytes(name), "onLastSecond")) {
sprintf(message, "unknown metadata event
name: '%s'", (char*)amf_string_get_bytes(name));
- print_info("I70039", flv_get_offset(flv_in),
message);
+ print_info(INFO_METADATA_NAME_UNKNOWN,
flv_get_offset(flv_in), message);
}
}

@@ -594,14 +598,13 @@
/* check body length against previous tag size */
result = flv_read_prev_tag_size(flv_in, &prev_tag_size);
if (result != FLV_OK) {
- print_fatal("F12036", flv_get_offset(flv_in), "unexpected end
of file after tag");
+ print_fatal(FATAL_PREV_TAG_SIZE_EOF,
flv_get_offset(flv_in), "unexpected end of file in previous tag size");
goto end;
}

if (prev_tag_size != FLV_TAG_SIZE + body_length) {
sprintf(message, "previous tag size should be %d, %d found
instead", FLV_TAG_SIZE + body_length, prev_tag_size);
- print_error("E12037", flv_get_offset(flv_in), message);
- goto end;
+ print_error(ERROR_PREV_TAG_SIZE_BAD, flv_get_offset(flv_in),
message);
}
}

@@ -609,46 +612,46 @@

/* check consistency with global header */
if (!have_video && flv_header_has_video(header)) {
- print_warning("W11038", 4, "no video tag found despite header
signaling the file contains video");
+ print_warning(WARNING_HEADER_VIDEO_NOT_FOUND, 4, "no video tag
found despite header signaling the file contains video");
}
if (!have_audio && flv_header_has_audio(header)) {
- print_warning("W11039", 4, "no audio tag found despite header
signaling the file contains audio");
+ print_warning(WARNING_HEADER_AUDIO_NOT_FOUND, 4, "no audio tag
found despite header signaling the file contains audio");
}

/* check last timestamps */
if (have_video && have_audio && labs(last_audio_timestamp -
last_video_timestamp) >= 1000) {
if (last_audio_timestamp > last_video_timestamp) {
sprintf(message, "video stops %d ms before audio",
last_audio_timestamp - last_video_timestamp);
- print_warning("W40040", file_stats.st_size, message);
+ print_warning(WARNING_TIMESTAMP_VIDEO_ENDS_FIRST,
file_stats.st_size, message);
}
else {
sprintf(message, "audio stops %d ms before video",
last_video_timestamp - last_audio_timestamp);
- print_warning("W40041", file_stats.st_size, message);
+ print_warning(WARNING_TIMESTAMP_AUDIO_ENDS_FIRST,
file_stats.st_size, message);
}
}

/* check video keyframes */
if (have_video && keyframes_number == 0) {
- print_warning("W60042", file_stats.st_size, "no keyframe detected,
file is probably broken or incomplete");
+ print_warning(WARNING_VIDEO_NO_KEYFRAME, file_stats.st_size, "no
keyframe detected, file is probably broken or incomplete");
}
if (have_video && keyframes_number == video_frames_number) {
- print_warning("W60043", file_stats.st_size, "only keyframes
detected, probably inefficient compression scheme used");
+ print_warning(WARNING_VIDEO_ONLY_KEYFRAMES,
file_stats.st_size, "only keyframes detected, probably inefficient
compression scheme used");
}

/* only keyframes + onLastSecond bug */
if (have_video && have_on_last_second && keyframes_number ==
video_frames_number) {
- print_warning("W60044", file_stats.st_size, "only keyframes
detected and onLastSecond event present, file is probably not playable");
+ print_warning(WARNING_VIDEO_ONLY_KF_LAST_SEC,
file_stats.st_size, "only keyframes detected and onLastSecond event
present, file is probably not playable");
}

/* check onLastSecond timestamp */
if (have_on_last_second && (last_timestamp - on_last_second_timestamp)
>= 2000) {
sprintf(message, "onLastSecond event located %d ms before the last
tag", last_timestamp - on_last_second_timestamp);
- print_warning("W70050", file_stats.st_size, message);
+ print_warning(WARNING_METADATA_LAST_SECOND_BAD,
file_stats.st_size, message);
}

/* check onMetaData presence */
if (!have_on_metadata) {
- print_warning("W70044", file_stats.st_size, "onMetaData event not
found, file might not be playable");
+ print_warning(WARNING_METADATA_NOT_PRESENT,
file_stats.st_size, "onMetaData event not found, file might not be
playable");
}
else {
amf_node * n;
@@ -657,41 +660,55 @@
have_width = 0;
have_height = 0;

- /* compute metadata */
+ /* compute metadata, with a sensible set of unobstrusive options */
opts_loc.verbose = 0;
opts_loc.reset_timestamps = 0;
opts_loc.preserve_metadata = 0;
opts_loc.all_keyframes = 0;
opts_loc.error_handling = FLVMETA_IGNORE_ERRORS;
+ opts_loc.insert_onlastsecond = 0;

flv_reset(flv_in);
if (get_flv_info(flv_in, &info, &opts_loc) != OK) {
- print_fatal("F10042", 0, "unable to compute metadata");
+ print_fatal(FATAL_INFO_COMPUTATION_ERROR, 0, "unable to
compute file information");
goto end;
}
+
+ /* delete useless info data */
+ amf_data_free(info.original_on_metadata);

/* more metadata checks */
for (n = amf_associative_array_first(on_metadata); n != NULL; n =
amf_associative_array_next(n)) {
byte * name;
amf_data * data;
byte type;
+ number64 duration;
+
+ if (info.have_audio) {
+ duration = (info.last_timestamp - info.first_timestamp +
info.audio_frame_duration) / 1000.0;
+ }
+ else {
+ duration = (info.last_timestamp - info.first_timestamp +
info.video_frame_duration) / 1000.0;
+ }

name = amf_string_get_bytes(amf_associative_array_get_name(n));
data = amf_associative_array_get_data(n);
type = amf_data_get_type(data);

+ /* TODO: check UTF-8 strings, in key, and value if string type
*/
+
/* hasMetadata (bool): true */
if (!strcmp((char*)name, "hasMetadata")) {
if (type == AMF_TYPE_BOOLEAN) {
if (amf_boolean_get_value(data) == 0) {
- print_warning("W70045",
on_metadata_offset, "hasMetadata should be set to true");
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, "hasMetadata should be set to true");
}
}
else {
- sprintf(message, "Invalid type for hasMetadata:
expected %s, got %s",
+ sprintf(message, "invalid type for hasMetadata:
expected %s, got %s",
get_amf_type_string(AMF_TYPE_BOOLEAN),
get_amf_type_string(type));
- print_warning("W70046", on_metadata_offset, message);
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
}
}

@@ -700,14 +717,14 @@
if (type == AMF_TYPE_BOOLEAN) {
if (amf_boolean_get_value(data) != info.have_video) {
sprintf(message, "hasVideo should be set to %s",
info.have_video ? "true" : "false");
- print_warning("W70045", on_metadata_offset,
message);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
}
}
else {
- sprintf(message, "Invalid type for hasVideo:
expected %s, got %s",
+ sprintf(message, "invalid type for hasVideo:
expected %s, got %s",
get_amf_type_string(AMF_TYPE_BOOLEAN),
get_amf_type_string(type));
- print_warning("W70046", on_metadata_offset, message);
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
}
}

@@ -716,82 +733,672 @@
if (type == AMF_TYPE_BOOLEAN) {
if (amf_boolean_get_value(data) != info.have_audio) {
sprintf(message, "hasAudio should be set to %s",
info.have_audio ? "true" : "false");
- print_warning("W70045", on_metadata_offset,
message);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
}
}
else {
- sprintf(message, "Invalid type for hasAudio:
expected %s, got %s",
+ sprintf(message, "invalid type for hasAudio:
expected %s, got %s",
get_amf_type_string(AMF_TYPE_BOOLEAN),
get_amf_type_string(type));
- print_warning("W70046", on_metadata_offset, message);
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
}
}

/* duration (number) */
if (!strcmp((char*)name, "duration")) {
if (type == AMF_TYPE_NUMBER) {
- number64 duration, file_duration;
- if (info.have_audio) {
- duration = (info.last_timestamp -
info.first_timestamp + info.audio_frame_duration) / 1000.0;
- }
- else {
- duration = (info.last_timestamp -
info.first_timestamp + info.video_frame_duration) / 1000.0;
- }
+ number64 file_duration;
file_duration = amf_number_get_value(data);

- if (fabs(file_duration - duration) > 1.0) {
+ if (fabs(file_duration - duration) >= 1.0) {
sprintf(message, "duration should be %.12g,
got %.12g", duration, file_duration);
- print_warning("W70045", on_metadata_offset,
message);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
}
}
else {
- sprintf(message, "Invalid type for duration:
expected %s, got %s",
+ sprintf(message, "invalid type for duration:
expected %s, got %s",
get_amf_type_string(AMF_TYPE_NUMBER),
get_amf_type_string(type));
- print_warning("W70046", on_metadata_offset, message);
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
}
}

/* lasttimestamp: (number) */
+ if (!strcmp((char*)name, "lasttimestamp")) {
+ if (type == AMF_TYPE_NUMBER) {
+ number64 lasttimestamp, file_lasttimestamp;
+ lasttimestamp = info.last_timestamp / 1000.0;
+ file_lasttimestamp = amf_number_get_value(data);
+
+ if (fabs(file_lasttimestamp - lasttimestamp) >= 1.0) {
+ sprintf(message, "lasttimestamp should be %.12g,
got %.12g", lasttimestamp, file_lasttimestamp);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ sprintf(message, "invalid type for lasttimestamp:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* lastkeyframetimestamp: (number) */
+ if (!strcmp((char*)name, "lastkeyframetimestamp")) {
+ if (type == AMF_TYPE_NUMBER) {
+ number64 lastkeyframetimestamp,
file_lastkeyframetimestamp;
+ lastkeyframetimestamp = info.last_keyframe_timestamp /
1000.0;
+ file_lastkeyframetimestamp =
amf_number_get_value(data);
+
+ if (fabs(file_lastkeyframetimestamp -
lastkeyframetimestamp) >= 1.0) {
+ sprintf(message, "lastkeyframetimestamp should
be %.12g, got %.12g",
+ lastkeyframetimestamp,
+ file_lastkeyframetimestamp);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ sprintf(message, "invalid type for
lastkeyframetimestamp: expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* width: (number) */
+ if (!strcmp((char*)name, "width")) {
+ if (type == AMF_TYPE_NUMBER) {
+ if (info.have_video) {
+ number64 width, file_width;
+ width = info.video_width;
+ file_width = amf_number_get_value(data);
+
+ if (fabs(file_width - width) >= 1.0) {
+ sprintf(message, "width should be %.12g,
got %.12g", width, file_width);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ have_width = 1;
+ }
+ else {
+ print_warning(WARNING_AMF_DATA_VIDEO_NEEDED,
on_metadata_offset, "width metadata present without video data");
+ }
+ }
+ else {
+ sprintf(message, "invalid type for width: expected %s,
got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* height: (number) */
+ if (!strcmp((char*)name, "height")) {
+ if (type == AMF_TYPE_NUMBER) {
+ if (info.have_video) {
+ number64 height, file_height;
+ height = info.video_height;
+ file_height = amf_number_get_value(data);
+
+ if (fabs(file_height - height) >= 1.0) {
+ sprintf(message, "height should be %.12g,
got %.12g", height, file_height);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ have_height = 1;
+ }
+ else {
+ print_warning(WARNING_AMF_DATA_VIDEO_NEEDED,
on_metadata_offset, "height metadata present without video data");
+ }
+ }
+ else {
+ sprintf(message, "invalid type for height:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* videodatarate: (number)*/
+ if (!strcmp((char*)name, "videodatarate")) {
+ if (type == AMF_TYPE_NUMBER) {
+ if (info.have_video) {
+ number64 videodatarate, file_videodatarate;
+ videodatarate = ((info.real_video_data_size /
1024.0) * 8.0) / duration;
+ file_videodatarate = amf_number_get_value(data);
+
+ if (fabs(file_videodatarate - videodatarate) >=
1.0) {
+ sprintf(message, "videodatarate should
be %.12g, got %.12g", videodatarate, file_videodatarate);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ print_warning(WARNING_AMF_DATA_VIDEO_NEEDED,
on_metadata_offset, "videodatarate metadata present without video data");
+ }
+ }
+ else {
+ sprintf(message, "invalid type for videodatarate:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* framerate: (number) */
+ if (!strcmp((char*)name, "framerate")) {
+ if (type == AMF_TYPE_NUMBER) {
+ if (info.have_video) {
+ number64 framerate, file_framerate;
+ framerate = info.video_frames_number / duration;
+ file_framerate = amf_number_get_value(data);
+
+ if (fabs(file_framerate - framerate) >= 1.0) {
+ sprintf(message, "framerate should be %.12g,
got %.12g", framerate, file_framerate);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ print_warning(WARNING_AMF_DATA_VIDEO_NEEDED,
on_metadata_offset, "framerate metadata present without video data");
+ }
+ }
+ else {
+ sprintf(message, "invalid type for framerate:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* audiodatarate: (number) */
+ if (!strcmp((char*)name, "audiodatarate")) {
+ if (type == AMF_TYPE_NUMBER) {
+ if (info.have_audio) {
+ number64 audiodatarate, file_audiodatarate;
+ audiodatarate = ((info.real_audio_data_size /
1024.0) * 8.0) / duration;
+ file_audiodatarate = amf_number_get_value(data);
+
+ if (fabs(file_audiodatarate - audiodatarate) >=
1.0) {
+ sprintf(message, "audiodatarate should
be %.12g, got %.12g", audiodatarate, file_audiodatarate);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ print_warning(WARNING_AMF_DATA_AUDIO_NEEDED,
on_metadata_offset, "audiodatarate metadata present without audio data");
+ }
+ }
+ else {
+ sprintf(message, "invalid type for audiodatarate:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* audiosamplerate: (number) */
+ if (!strcmp((char*)name, "audiosamplerate")) {
+ if (type == AMF_TYPE_NUMBER) {
+ if (info.have_audio) {
+ number64 audiosamplerate, file_audiosamplerate;
+ audiosamplerate = 0.0;
+ switch (info.audio_rate) {
+ case FLV_AUDIO_TAG_SOUND_RATE_5_5:
audiosamplerate = 5500.0; break;
+ case FLV_AUDIO_TAG_SOUND_RATE_11:
audiosamplerate = 11000.0; break;
+ case FLV_AUDIO_TAG_SOUND_RATE_22:
audiosamplerate = 22050.0; break;
+ case FLV_AUDIO_TAG_SOUND_RATE_44:
audiosamplerate = 44100.0; break;
+ }
+ file_audiosamplerate = amf_number_get_value(data);
+
+ /* 100 tolerance, since 44000 is sometimes used
instead of 44100 */
+ if (fabs(file_audiosamplerate - audiosamplerate) >
100.0) {
+ sprintf(message, "audiosamplerate should
be %.12g, got %.12g", audiosamplerate, file_audiosamplerate);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ print_warning(WARNING_AMF_DATA_AUDIO_NEEDED,
on_metadata_offset, "audiosamplerate metadata present without audio data");
+ }
+ }
+ else {
+ sprintf(message, "invalid type for audiosamplerate:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* audiosamplesize: (number) */
+ if (!strcmp((char*)name, "audiosamplesize")) {
+ if (type == AMF_TYPE_NUMBER) {
+ if (info.have_audio) {
+ number64 audiosamplesize, file_audiosamplesize;
+ audiosamplesize = 0.0;
+ switch (info.audio_size) {
+ case FLV_AUDIO_TAG_SOUND_SIZE_8:
audiosamplesize = 8.0; break;
+ case FLV_AUDIO_TAG_SOUND_SIZE_16:
audiosamplesize = 16.0; break;
+ }
+ file_audiosamplesize = amf_number_get_value(data);
+
+ if (fabs(file_audiosamplesize - audiosamplesize)
>= 1.0) {
+ sprintf(message, "audiosamplesize should
be %.12g, got %.12g", audiosamplesize, file_audiosamplesize);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ print_warning(WARNING_AMF_DATA_AUDIO_NEEDED,
on_metadata_offset, "audiosamplesize metadata present without audio data");
+ }
+ }
+ else {
+ sprintf(message, "invalid type for audiosamplesize:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* stereo: (boolean) */
+ if (!strcmp((char*)name, "stereo")) {
+ if (type == AMF_TYPE_BOOLEAN) {
+ if (info.have_audio) {
+ uint8 stereo, file_stereo;
+ stereo = (info.audio_stereo ==
FLV_AUDIO_TAG_SOUND_TYPE_STEREO);
+ file_stereo = amf_boolean_get_value(data);
+
+ if (file_stereo != stereo) {
+ sprintf(message, "stereo should be %s",
stereo ? "true" : "false");
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ print_warning(WARNING_AMF_DATA_AUDIO_NEEDED,
on_metadata_offset, "stereo metadata present without audio data");
+ }
+ }
+ else {
+ sprintf(message, "invalid type for stereo:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_BOOLEAN),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* filesize: (number) */
+ if (!strcmp((char*)name, "filesize")) {
+ if (type == AMF_TYPE_NUMBER) {
+ number64 filesize, file_filesize;
+
+ filesize = (number64)(file_stats.st_size);
+ file_filesize = amf_number_get_value(data);
+
+ if (fabs(file_filesize - filesize) >= 1.0) {
+ sprintf(message, "filesize should be %.12g,
got %.12g", filesize, file_filesize);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ sprintf(message, "invalid type for filesize:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* videosize: (number) */
+ if (!strcmp((char*)name, "videosize")) {
+ if (type == AMF_TYPE_NUMBER) {
+ if (info.have_video) {
+ number64 videosize, file_videosize;
+ videosize = (number64)(info.video_data_size);
+ file_videosize = amf_number_get_value(data);
+
+ if (fabs(file_videosize - videosize) >= 1.0) {
+ sprintf(message, "videosize should be %.12g,
got %.12g", videosize, file_videosize);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ print_warning(WARNING_AMF_DATA_VIDEO_NEEDED,
on_metadata_offset, "videosize metadata present without video data");
+ }
+ }
+ else {
+ sprintf(message, "invalid type for videosize:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* audiosize: (number) */
+ if (!strcmp((char*)name, "audiosize")) {
+ if (type == AMF_TYPE_NUMBER) {
+ if (info.have_audio) {
+ number64 audiosize, file_audiosize;
+ audiosize = (number64)(info.audio_data_size);
+ file_audiosize = amf_number_get_value(data);
+
+ if (fabs(file_audiosize - audiosize) >= 1.0) {
+ sprintf(message, "audiosize should be %.12g,
got %.12g", audiosize, file_audiosize);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ print_warning(WARNING_AMF_DATA_AUDIO_NEEDED,
on_metadata_offset, "audiosize metadata present without audio data");
+ }
+ }
+ else {
+ sprintf(message, "invalid type for audiosize:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* datasize: (number) */
+ if (!strcmp((char*)name, "datasize")) {
+ if (type == AMF_TYPE_NUMBER) {
+ number64 datasize, file_datasize;
+ uint32 on_metadata_size;
+
+ on_metadata_size = FLV_TAG_SIZE +
+ (uint32)(amf_data_size(on_metadata_name) +
amf_data_size(on_metadata));
+ datasize = (number64)(info.meta_data_size +
on_metadata_size);
+ file_datasize = amf_number_get_value(data);
+
+ if (fabs(file_datasize - datasize) >= 1.0) {
+ sprintf(message, "datasize should be %.12g,
got %.12g", datasize, file_datasize);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ sprintf(message, "invalid type for datasize:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
+ print_warning(WARNING_AMF_DATA_INVALID_TYPE,
on_metadata_offset, message);
+ }
+ }
+
/* audiocodecid: (number) */
+ if (!strcmp((char*)name, "audiocodecid")) {
+ if (type == AMF_TYPE_NUMBER) {
+ if (info.have_audio) {
+ number64 audiocodecid, file_audiocodecid;
+ audiocodecid = (number64)info.audio_codec;
+ file_audiocodecid = amf_number_get_value(data);
+
+ if (fabs(file_audiocodecid - audiocodecid) >= 1.0)
{
+ sprintf(message, "audiocodecid should
be %.12g, got %.12g", audiocodecid, file_audiocodecid);
+ print_warning(WARNING_AMF_DATA_INVALID_VALUE,
on_metadata_offset, message);
+ }
+ }
+ else {
+ print_warning(WARNING_AMF_DATA_AUDIO_NEEDED,
on_metadata_offset, "audiocodecid metadata present without audio data");
+ }
+ }
+ else {
+ sprintf(message, "invalid type for audiocodecid:
expected %s, got %s",
+ get_amf_type_string(AMF_TYPE_NUMBER),
+ get_amf_type_string(type));
***The diff for this file has been truncated for email.***
=======================================
--- /src/check.h Tue Apr 3 02:23:47 2012
+++ /src/check.h Thu Apr 5 09:32:57 2012
@@ -26,6 +26,113 @@

#include "flvmeta.h"

+/* message level codes */
+#define LEVEL_FATAL "F"
+#define LEVEL_ERROR "E"
+#define LEVEL_WARNING "W"
+#define LEVEL_INFO "I"
+
+/* message topic codes */
+#define TOPIC_GENERAL_FORMAT "10"
+#define TOPIC_HEADER "11"
+#define TOPIC_PREV_TAG_SIZE "12"
+#define TOPIC_TAG_FORMAT "20"
+#define TOPIC_TAG_TYPES "30"
+#define TOPIC_TIMESTAMPS "40"
+#define TOPIC_AUDIO_DATA "50"
+#define TOPIC_AUDIO_CODECS "51"
+#define TOPIC_VIDEO_DATA "60"
+#define TOPIC_VIDEO_CODECS "61"
+#define TOPIC_METADATA "70"
+#define TOPIC_AMF_DATA "80"
+#define TOPIC_KEYFRAMES "81"
+#define TOPIC_CUE_POINTS "82"
+
+/* info, warning, error codes, sorted by unique identifier */
+#define FATAL_HEADER_EOF LEVEL_FATAL
TOPIC_HEADER "001"
+#define FATAL_HEADER_NO_SIGNATURE LEVEL_FATAL
TOPIC_HEADER "002"
+#define ERROR_HEADER_BAD_VERSION LEVEL_ERROR
TOPIC_HEADER "003"
+#define ERROR_HEADER_NO_STREAMS LEVEL_ERROR
TOPIC_HEADER "004"
+#define INFO_HEADER_NO_AUDIO LEVEL_INFO
TOPIC_HEADER "005"
+#define WARNING_HEADER_NO_VIDEO LEVEL_WARNING
TOPIC_HEADER "006"
+#define ERROR_HEADER_BAD_RESERVED_FLAGS LEVEL_ERROR
TOPIC_HEADER "007"
+#define ERROR_HEADER_BAD_OFFSET LEVEL_ERROR
TOPIC_HEADER "008"
+#define FATAL_PREV_TAG_SIZE_EOF LEVEL_FATAL
TOPIC_PREV_TAG_SIZE "009"
+#define ERROR_PREV_TAG_SIZE_BAD_FIRST LEVEL_ERROR
TOPIC_PREV_TAG_SIZE "010"
+#define FATAL_GENERAL_NO_TAG LEVEL_FATAL
TOPIC_GENERAL_FORMAT "011"
+#define FATAL_TAG_EOF LEVEL_FATAL
TOPIC_TAG_FORMAT "012"
+#define ERROR_TAG_TYPE_UNKNOWN LEVEL_ERROR
TOPIC_TAG_TYPES "013"
+#define WARNING_HEADER_UNEXPECTED_VIDEO LEVEL_WARNING
TOPIC_HEADER "014"
+#define WARNING_HEADER_UNEXPECTED_AUDIO LEVEL_WARNING
TOPIC_HEADER "015"
+#define FATAL_TAG_BODY_LENGTH_OVERFLOW LEVEL_FATAL
TOPIC_TAG_FORMAT "016"
+#define WARNING_TAG_BODY_LENGTH_LARGE LEVEL_WARNING
TOPIC_TAG_FORMAT "017"
+#define WARNING_TAG_BODY_LENGTH_ZERO LEVEL_WARNING
TOPIC_TAG_FORMAT "018"
+#define ERROR_TIMESTAMP_FIRST_NON_ZERO LEVEL_ERROR
TOPIC_TIMESTAMPS "019"
+#define ERROR_TIMESTAMP_AUDIO_DECREASE LEVEL_ERROR
TOPIC_TIMESTAMPS "020"
+#define ERROR_TIMESTAMP_VIDEO_DECREASE LEVEL_ERROR
TOPIC_TIMESTAMPS "021"
+#define ERROR_TIMESTAMP_OVERFLOW LEVEL_ERROR
TOPIC_TIMESTAMPS "022"
+#define ERROR_TIMESTAMP_DECREASE LEVEL_ERROR
TOPIC_TIMESTAMPS "023"
+#define WARNING_TIMESTAMP_DESYNC LEVEL_WARNING
TOPIC_TIMESTAMPS "024"
+#define ERROR_TAG_STREAM_ID_NON_ZERO LEVEL_ERROR
TOPIC_TAG_FORMAT "025"
+#define WARNING_AUDIO_FORMAT_CHANGED LEVEL_WARNING
TOPIC_AUDIO_DATA "026"
+#define WARNING_AUDIO_CODEC_UNKNOWN LEVEL_WARNING
TOPIC_AUDIO_CODECS "027"
+#define WARNING_AUDIO_CODEC_RESERVED LEVEL_WARNING
TOPIC_AUDIO_CODECS "028"
+#define WARNING_AUDIO_CODEC_AAC_BAD LEVEL_WARNING
TOPIC_AUDIO_CODECS "029"
+#define WARNING_AUDIO_CODEC_NELLYMOSER_BAD LEVEL_WARNING
TOPIC_AUDIO_CODECS "030"
+#define WARNING_AUDIO_CODEC_AAC_MONO LEVEL_WARNING
TOPIC_AUDIO_CODECS "031"
+#define WARNING_AUDIO_CODEC_LINEAR_PCM LEVEL_WARNING
TOPIC_AUDIO_CODECS "032"
+#define WARNING_VIDEO_FORMAT_CHANGED LEVEL_WARNING
TOPIC_VIDEO_DATA "033"
+#define ERROR_VIDEO_FRAME_TYPE_UNKNOWN LEVEL_ERROR
TOPIC_VIDEO_DATA "034"
+#define WARNING_VIDEO_NO_FIRST_KEYFRAME LEVEL_WARNING
TOPIC_VIDEO_DATA "035"
+#define ERROR_VIDEO_CODEC_UNKNOWN LEVEL_ERROR
TOPIC_VIDEO_CODECS "036"
+#define WARNING_VIDEO_CODEC_JPEG LEVEL_WARNING
TOPIC_VIDEO_CODECS "037"
+#define WARNING_METADATA_EMPTY LEVEL_WARNING
TOPIC_METADATA "038"
+#define ERROR_METADATA_NAME_INVALID LEVEL_ERROR
TOPIC_METADATA "039"
+#define ERROR_METADATA_DATA_INVALID LEVEL_ERROR
TOPIC_METADATA "040"
+#define ERROR_METADATA_NAME_INVALID_TYPE LEVEL_ERROR
TOPIC_METADATA "041"
+#define WARNING_METADATA_NAME_EMPTY LEVEL_WARNING
TOPIC_METADATA "042"
+#define WARNING_METADATA_DATA_REMAINING LEVEL_WARNING
TOPIC_METADATA "043"
+#define WARNING_METADATA_DATA_MISSING LEVEL_WARNING
TOPIC_METADATA "044"
+#define WARNING_METADATA_LAST_SECOND_DUP LEVEL_WARNING
TOPIC_METADATA "045"
+#define ERROR_METADATA_DATA_INVALID_TYPE LEVEL_ERROR
TOPIC_METADATA "046"
+#define WARNING_METADATA_BAD_TAG LEVEL_WARNING
TOPIC_METADATA "047"
+#define WARNING_METADATA_BAD_TIMESTAMP LEVEL_WARNING
TOPIC_METADATA "048"
+#define WARNING_METADATA_DUPLICATE LEVEL_WARNING
TOPIC_METADATA "049"
+#define INFO_METADATA_NAME_UNKNOWN LEVEL_INFO
TOPIC_METADATA "050"
+#define ERROR_PREV_TAG_SIZE_BAD LEVEL_ERROR
TOPIC_PREV_TAG_SIZE "051"
+#define WARNING_HEADER_VIDEO_NOT_FOUND LEVEL_WARNING
TOPIC_HEADER "052"
+#define WARNING_HEADER_AUDIO_NOT_FOUND LEVEL_WARNING
TOPIC_HEADER "053"
+#define WARNING_TIMESTAMP_VIDEO_ENDS_FIRST LEVEL_WARNING
TOPIC_TIMESTAMPS "054"
+#define WARNING_TIMESTAMP_AUDIO_ENDS_FIRST LEVEL_WARNING
TOPIC_TIMESTAMPS "055"
+#define WARNING_VIDEO_NO_KEYFRAME LEVEL_WARNING
TOPIC_VIDEO_DATA "056"
+#define WARNING_VIDEO_ONLY_KEYFRAMES LEVEL_WARNING
TOPIC_VIDEO_DATA "057"
+#define WARNING_VIDEO_ONLY_KF_LAST_SEC LEVEL_WARNING
TOPIC_VIDEO_DATA "058"
+#define WARNING_METADATA_LAST_SECOND_BAD LEVEL_WARNING
TOPIC_METADATA "059"
+#define WARNING_METADATA_NOT_PRESENT LEVEL_WARNING
TOPIC_METADATA "060"
+#define FATAL_INFO_COMPUTATION_ERROR LEVEL_FATAL
TOPIC_GENERAL_FORMAT "061"
+#define WARNING_AMF_DATA_INVALID_VALUE LEVEL_WARNING
TOPIC_AMF_DATA "062"
+#define WARNING_AMF_DATA_INVALID_TYPE LEVEL_WARNING
TOPIC_AMF_DATA "063"
+#define WARNING_AMF_DATA_VIDEO_NEEDED LEVEL_WARNING
TOPIC_AMF_DATA "064"
+#define WARNING_AMF_DATA_AUDIO_NEEDED LEVEL_WARNING
TOPIC_AMF_DATA "065"
+#define WARNING_AMF_DATA_AUDIO_VIDEO_NEEDED LEVEL_WARNING
TOPIC_AMF_DATA "066"
+#define WARNING_KEYFRAMES_TIMES_MISSING LEVEL_WARNING
TOPIC_KEYFRAMES "067"
+#define WARNING_KEYFRAMES_FILEPOS_MISSING LEVEL_WARNING
TOPIC_KEYFRAMES "068"
+#define WARNING_KEYFRAMES_TIMES_TYPE_BAD LEVEL_WARNING
TOPIC_KEYFRAMES "069"
+#define WARNING_KEYFRAMES_FILEPOS_TYPE_BAD LEVEL_WARNING
TOPIC_KEYFRAMES "070"
+#define WARNING_KEYFRAMES_ARRAY_LENGTH_BAD LEVEL_WARNING
TOPIC_KEYFRAMES "071"
+#define WARNING_KEYFRAMES_TIME_TYPE_BAD LEVEL_WARNING
TOPIC_KEYFRAMES "072"
+#define WARNING_KEYFRAMES_POS_TYPE_BAD LEVEL_WARNING
TOPIC_KEYFRAMES "073"
+#define WARNING_KEYFRAMES_TIME_BAD LEVEL_WARNING
TOPIC_KEYFRAMES "074"
+#define WARNING_KEYFRAMES_POS_BAD LEVEL_WARNING
TOPIC_KEYFRAMES "075"
+#define WARNING_KEYFRAMES_TIME_DUPLICATE LEVEL_WARNING
TOPIC_KEYFRAMES "076"
+#define ERROR_VIDEO_WIDTH_MISSING LEVEL_ERROR
TOPIC_VIDEO_DATA "077"
+#define ERROR_VIDEO_HEIGHT_MISSING LEVEL_ERROR
TOPIC_VIDEO_DATA "078"
+#define WARNING_VIDEO_SIZE_ERROR LEVEL_WARNING
TOPIC_VIDEO_DATA "079"
+#define INFO_VIDEO_CODEC LEVEL_INFO
TOPIC_VIDEO_CODECS "080"
+#define INFO_AUDIO_FORMAT LEVEL_INFO
TOPIC_AUDIO_CODECS "081"
+#define INFO_TIMESTAMP_USE_EXTENDED LEVEL_INFO
TOPIC_TIMESTAMPS "082"
+#define INFO_GENERAL_LARGE_FILE LEVEL_INFO
TOPIC_GENERAL_FORMAT "083"
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
=======================================
--- /src/flv.c Tue Apr 3 02:23:47 2012
+++ /src/flv.c Thu Apr 5 09:32:57 2012
@@ -42,6 +42,7 @@
return NULL;
}
stream->current_tag_body_length = 0;
+ stream->current_tag_body_overflow = 0;
stream->current_tag_offset = 0;
stream->state = FLV_STREAM_STATE_START;
return stream;
@@ -139,6 +140,7 @@
else {
memcpy(&stream->current_tag, tag, sizeof(flv_tag));
stream->current_tag_body_length =
uint24_be_to_uint32(tag->body_length);
+ stream->current_tag_body_overflow = 0;
stream->state = FLV_STREAM_STATE_TAG_BODY;
return FLV_OK;
}
@@ -164,10 +166,19 @@
return FLV_ERROR_EOF;
}

- stream->current_tag_body_length -= sizeof(flv_audio_tag);
-
- if (stream->current_tag_body_length <= 0) {
+ if (stream->current_tag_body_length >= sizeof(flv_audio_tag)) {
+ stream->current_tag_body_length -= sizeof(flv_audio_tag);
+ }
+ else {
+ stream->current_tag_body_overflow = sizeof(flv_audio_tag) -
stream->current_tag_body_length;
+ stream->current_tag_body_length = 0;
+ }
+
+ if (stream->current_tag_body_length == 0) {
stream->state = FLV_STREAM_STATE_PREV_TAG_SIZE;
+ if (stream->current_tag_body_overflow > 0) {
+ lfs_fseek(stream->flvin,
-(file_offset_t)stream->current_tag_body_overflow, SEEK_CUR);
+ }
}

return FLV_OK;
@@ -189,10 +200,19 @@
return FLV_ERROR_EOF;
}

- stream->current_tag_body_length -= sizeof(flv_video_tag);
-
- if (stream->current_tag_body_length <= 0) {
+ if (stream->current_tag_body_length >= sizeof(flv_video_tag)) {
+ stream->current_tag_body_length -= sizeof(flv_video_tag);
+ }
+ else {
+ stream->current_tag_body_overflow = sizeof(flv_video_tag) -
stream->current_tag_body_length;
+ stream->current_tag_body_length = 0;
+ }
+
+ if (stream->current_tag_body_length == 0) {
stream->state = FLV_STREAM_STATE_PREV_TAG_SIZE;
+ if (stream->current_tag_body_overflow > 0) {
+ lfs_fseek(stream->flvin,
-(file_offset_t)stream->current_tag_body_overflow, SEEK_CUR);
+ }
}

return FLV_OK;
@@ -201,6 +221,7 @@
int flv_read_metadata(flv_stream * stream, amf_data ** name, amf_data **
data) {
amf_data * d;
byte error_code;
+ size_t data_size;

if (stream == NULL
|| stream->flvin == NULL
@@ -224,7 +245,22 @@
return FLV_ERROR_INVALID_METADATA_NAME;
}

- stream->current_tag_body_length -= amf_data_size(d);
+ /* if only name can be read, metadata are invalid */
+ data_size = amf_data_size(d);
+ if (stream->current_tag_body_length > data_size) {
+ stream->current_tag_body_length -= data_size;
+ }
+ else {
+ stream->current_tag_body_length = 0;
+ stream->current_tag_body_overflow = data_size -
stream->current_tag_body_length;
+
+ stream->state = FLV_STREAM_STATE_PREV_TAG_SIZE;
+ if (stream->current_tag_body_overflow > 0) {
+ lfs_fseek(stream->flvin,
-(file_offset_t)stream->current_tag_body_overflow, SEEK_CUR);
+ }
+
+ return FLV_ERROR_INVALID_METADATA;
+ }

/* read metadata contents */
d = amf_data_file_read(stream->flvin);
@@ -237,10 +273,20 @@
return FLV_ERROR_INVALID_METADATA;
}

- stream->current_tag_body_length -= amf_data_size(d);
-
- if (stream->current_tag_body_length <= 0) {
+ data_size = amf_data_size(d);
+ if (stream->current_tag_body_length >= data_size) {
+ stream->current_tag_body_length -= data_size;
+ }
+ else {
+ stream->current_tag_body_overflow = data_size -
stream->current_tag_body_length;
+ stream->current_tag_body_length = 0;
+ }
+
+ if (stream->current_tag_body_length == 0) {
stream->state = FLV_STREAM_STATE_PREV_TAG_SIZE;
+ if (stream->current_tag_body_overflow > 0) {
+ lfs_fseek(stream->flvin,
-(file_offset_t)stream->current_tag_body_overflow, SEEK_CUR);
+ }
}

return FLV_OK;
=======================================
--- /src/flv.h Tue Apr 3 02:23:47 2012
+++ /src/flv.h Thu Apr 5 09:32:57 2012
@@ -158,6 +158,7 @@
flv_tag current_tag;
file_offset_t current_tag_offset;
uint32 current_tag_body_length;
+ uint32 current_tag_body_overflow;
} flv_stream;

/* FLV stream functions */
=======================================
--- /src/info.c Tue Apr 3 02:23:47 2012
+++ /src/info.c Thu Apr 5 09:32:57 2012
@@ -214,7 +214,6 @@
info->video_data_size = 0;
info->audio_data_size = 0;
info->meta_data_size = 0;
- info->meta_data_only_size = 0;
info->real_video_data_size = 0;
info->real_audio_data_size = 0;
info->video_first_timestamp = 0;
@@ -364,7 +363,7 @@
}
}

- /* just ignore metadata that don't have a proper name */
+ /* check metadata name */
if (body_length > 0 && amf_data_get_type(tag_name) ==
AMF_TYPE_STRING) {
char * name = (char *)amf_string_get_bytes(tag_name);
size_t len = (size_t)amf_string_get_size(tag_name);
@@ -394,7 +393,6 @@
if (!strncmp(name, "onLastSecond", len)) {
info->have_on_last_second = 1;
}
- info->meta_data_only_size += body_length;
info->meta_data_size += (body_length + FLV_TAG_SIZE);
info->total_prev_tags_size += sizeof(uint32_be);
if (data != NULL) {
@@ -402,8 +400,8 @@
}
}
}
+ /* just ignore metadata that don't have a proper name */
else {
- info->meta_data_only_size += body_length;
info->meta_data_size += (body_length + FLV_TAG_SIZE);
info->total_prev_tags_size += sizeof(uint32_be);
amf_data_free(data);
@@ -693,16 +691,17 @@
node_f = amf_array_next(node_f);
}

- /* compute data size, ie. size of metadata excluding tags and
prev_tag_size */
- data_size = info->meta_data_only_size + new_on_metadata_size;
+ /* compute data size, ie. size of metadata excluding prev_tag_size */
+ data_size = info->meta_data_size + FLV_TAG_SIZE +
+ (uint32)(amf_data_size(meta->on_metadata_name) +
amf_data_size(meta->on_metadata));
if (!info->have_on_last_second && opts->insert_onlastsecond) {
- data_size += (uint32)on_last_second_size;
+ data_size += (uint32)on_last_second_size + FLV_TAG_SIZE;
}
amf_number_set_value(amf_total_data_size, (number64)data_size);

/* compute total file size */
- total_filesize = FLV_HEADER_SIZE + info->total_prev_tags_size +
info->video_data_size
- + info->audio_data_size + info->meta_data_size +
new_on_metadata_size;
+ total_filesize = FLV_HEADER_SIZE + info->total_prev_tags_size +
info->video_data_size +
+ info->audio_data_size + info->meta_data_size +
new_on_metadata_size;

if (!info->have_on_last_second && opts->insert_onlastsecond) {
/* if we have to add onLastSecond, we must count the header and
new prevTagSize we add */
@@ -711,100 +710,3 @@

amf_number_set_value(amf_total_filesize, (number64)total_filesize);
}
-
-/*
- compute the metadata without reserving space for actual insertion
-*/
-void compute_current_metadata(flv_info * info, flv_metadata * meta) {
- file_offset_t data_size;
- number64 duration, video_data_rate, framerate;
- amf_data * amf_total_data_size;
-
- meta->on_last_second_name = amf_str("onLastSecond");
- meta->on_last_second = amf_associative_array_new();
-
- meta->on_metadata_name = amf_str("onMetaData");
- meta->on_metadata = amf_associative_array_new();
-
- amf_associative_array_add(meta->on_metadata, "hasMetadata",
amf_boolean_new(1));
- amf_associative_array_add(meta->on_metadata, "hasVideo",
amf_boolean_new(info->have_video));
- amf_associative_array_add(meta->on_metadata, "hasAudio",
amf_boolean_new(info->have_audio));
-
- if (info->have_audio) {
- duration = (info->last_timestamp - info->first_timestamp +
info->audio_frame_duration) / 1000.0;
- }
- else {
- duration = (info->last_timestamp - info->first_timestamp +
info->video_frame_duration) / 1000.0;
- }
- amf_associative_array_add(meta->on_metadata, "duration",
amf_number_new(duration));
-
- amf_associative_array_add(meta->on_metadata, "lasttimestamp",
amf_number_new(info->last_timestamp / 1000.0));
- amf_associative_array_add(meta->on_metadata, "lastkeyframetimestamp",
amf_number_new(info->last_keyframe_timestamp / 1000.0));
-
- if (info->video_width > 0)
- amf_associative_array_add(meta->on_metadata, "width",
amf_number_new(info->video_width));
- if (info->video_height > 0)
- amf_associative_array_add(meta->on_metadata, "height",
amf_number_new(info->video_height));
-
- video_data_rate = ((info->real_video_data_size / 1024.0) * 8.0) /
duration;
- amf_associative_array_add(meta->on_metadata, "videodatarate",
amf_number_new(video_data_rate));
-
- framerate = info->video_frames_number / duration;
- amf_associative_array_add(meta->on_metadata, "framerate",
amf_number_new(framerate));
-
- if (info->have_audio) {
- number64 audio_khz, audio_sample_rate;
- number64 audio_data_rate = ((info->real_audio_data_size / 1024.0)
* 8.0) / duration;
- amf_associative_array_add(meta->on_metadata, "audiodatarate",
amf_number_new(audio_data_rate));
-
- audio_khz = 0.0;
- switch (info->audio_rate) {
- case FLV_AUDIO_TAG_SOUND_RATE_5_5: audio_khz = 5500.0; break;
- case FLV_AUDIO_TAG_SOUND_RATE_11: audio_khz = 11000.0; break;
- case FLV_AUDIO_TAG_SOUND_RATE_22: audio_khz = 22050.0; break;
- case FLV_AUDIO_TAG_SOUND_RATE_44: audio_khz = 44100.0; break;
- }
- amf_associative_array_add(meta->on_metadata, "audiosamplerate",
amf_number_new(audio_khz));
- audio_sample_rate = 0.0;
- switch (info->audio_size) {
- case FLV_AUDIO_TAG_SOUND_SIZE_8: audio_sample_rate = 8.0;
break;
- case FLV_AUDIO_TAG_SOUND_SIZE_16: audio_sample_rate = 16.0;
break;
- }
- amf_associative_array_add(meta->on_metadata, "audiosamplesize",
amf_number_new(audio_sample_rate));
- amf_associative_array_add(meta->on_metadata, "stereo",
amf_boolean_new(info->audio_stereo == FLV_AUDIO_TAG_SOUND_TYPE_STEREO));
- }
-
- if (info->have_video) {
- amf_associative_array_add(meta->on_metadata, "videosize",
amf_number_new((number64)info->video_data_size));
- }
- if (info->have_audio) {
- amf_associative_array_add(meta->on_metadata, "audiosize",
amf_number_new((number64)info->audio_data_size));
- }
-
- /* to be computed later */
- amf_total_data_size = amf_number_new(0);
- amf_associative_array_add(meta->on_metadata, "datasize",
amf_total_data_size);
-
- amf_associative_array_add(meta->on_metadata, "metadatacreator",
amf_str(PACKAGE_STRING));
-
- amf_associative_array_add(meta->on_metadata, "metadatadate",
amf_date_new((number64)time(NULL)*1000, 0));
- if (info->have_audio) {
- amf_associative_array_add(meta->on_metadata, "audiocodecid",
amf_number_new((number64)info->audio_codec));
- }
- if (info->have_video) {
- amf_associative_array_add(meta->on_metadata, "videocodecid",
amf_number_new((number64)info->video_codec));
- }
- if (info->have_audio && info->have_video) {
- number64 audio_delay = ((sint32)info->audio_first_timestamp -
(sint32)info->video_first_timestamp) / 1000.0;
- amf_associative_array_add(meta->on_metadata, "audiodelay",
amf_number_new((number64)audio_delay));
- }
- amf_associative_array_add(meta->on_metadata, "canSeekToEnd",
amf_boolean_new(info->can_seek_to_end));
-
- amf_associative_array_add(meta->on_metadata, "hasKeyframes",
amf_boolean_new(info->have_keyframes));
- amf_associative_array_add(meta->on_metadata, "keyframes",
info->keyframes);
-
- /* compute data size, ie. size of metadata excluding tags and
prev_tag_size */
- data_size = info->meta_data_only_size +
amf_data_size(info->original_on_metadata) + (uint32)(FLV_TAG_SIZE +
sizeof(uint32_be));
-
- amf_number_set_value(amf_total_data_size, (number64)data_size);
-}
=======================================
--- /src/info.h Tue Apr 3 02:23:47 2012
+++ /src/info.h Thu Apr 5 09:32:57 2012
@@ -41,7 +41,6 @@
file_offset_t video_data_size;
file_offset_t audio_data_size;
file_offset_t meta_data_size;
- file_offset_t meta_data_only_size;
file_offset_t real_video_data_size;
file_offset_t real_audio_data_size;
uint32 video_first_timestamp;

==============================================================================
Revision: a1b0f862bd94
Author: Marc Noirot <marc....@gmail.com>
Date: Wed Apr 11 07:21:38 2012
Log: Added autotools support for the installation of the man page.

http://code.google.com/p/flvmeta/source/detail?r=a1b0f862bd94

Added:
/man/Makefile.am
Modified:
/Makefile.am
/configure.ac

=======================================
--- /dev/null
+++ /man/Makefile.am Wed Apr 11 07:21:38 2012
@@ -0,0 +1,1 @@
+man1_MANS = 1/flvmeta.1
=======================================
--- /Makefile.am Tue Jun 21 01:19:08 2011
+++ /Makefile.am Wed Apr 11 07:21:38 2012
@@ -1,3 +1,3 @@
-SUBDIRS = src tests schemas
+SUBDIRS = src tests schemas man
EXTRA_DIST = autogen.sh \
CMakeLists.txt
=======================================
--- /configure.ac Tue Nov 22 11:31:26 2011
+++ /configure.ac Wed Apr 11 07:21:38 2012
@@ -67,5 +67,6 @@
src/libyaml/Makefile
tests/Makefile
schemas/Makefile
+man/Makefile
])
AC_OUTPUT

==============================================================================
Revision: 9294eb769fbd
Author: Marc Noirot <marc....@gmail.com>
Date: Wed Apr 11 07:23:25 2012
Log: Fixed invalid keyframe position check.

http://code.google.com/p/flvmeta/source/detail?r=9294eb769fbd

Modified:
/src/check.c

=======================================
--- /src/check.c Thu Apr 5 09:32:57 2012
+++ /src/check.c Wed Apr 11 07:23:25 2012
@@ -1317,9 +1317,9 @@
else {
f_position =
amf_number_get_value(amf_array_get(ff_node));

- if (fabs(time - f_time) >= 1.0) {
+ if (fabs(position - f_position) >=
1.0) {
sprintf(message, "invalid
keyframe file position: expected %.12g, got %.12g",
- time, f_time);
+ position, f_position);

print_warning(WARNING_KEYFRAMES_POS_BAD, on_metadata_offset, message);
}
}

==============================================================================
Revision: 7bc831dec4f4
Author: Marc Noirot <marc....@gmail.com>
Date: Wed Apr 11 09:40:02 2012
Log: Updated manual.

http://code.google.com/p/flvmeta/source/detail?r=7bc831dec4f4

Modified:
/man/1/flvmeta.1
/man/1/flvmeta.1.ronn

=======================================
--- /man/1/flvmeta.1 Mon Sep 12 07:28:47 2011
+++ /man/1/flvmeta.1 Wed Apr 11 09:40:02 2012
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "FLVMETA" "1" "September 2011" "" ""
+.TH "FLVMETA" "1" "April 2012" "" ""
.
.SH "NAME"
\fBflvmeta\fR \- manipulate or extract metadata in Adobe Flash Video Files
@@ -31,7 +31,7 @@
It possesses the ability to compute and inject a variety of values in the
\fIonMetaData\fR event tag, including keyframe indices used by most video
players to allow random\-access seeking, notably for HTTP pseudo\-streamed
files via a server\-side module, by having the client send the file offset
looked up for the nearest desired keyframe\. Tools such as \fBflvmeta\fR
must be used in the case the initial encoding process is unable to inject
those metadata\.
.
.P
-It can also optionnally inject the \fIonLastSecond\fR event, used to
signal the end of playback, used for example to revert the player software
to a \'stopped\' state\.
+It can also optionnally inject the \fIonLastSecond\fR event, used to
signal the end of playback, for example to revert the player software to a
\'stopped\' state\.
.
.P
\fBflvmeta\fR also has the ability to dump metadata and full file
information to standard output, in a variety of textual output formats,
including XML, YAML, and JSON\.
@@ -52,16 +52,16 @@
By default, if no command is specified, \fBflvmeta\fR will implicitely
choose the command to use according to the presence of \fIINPUT_FILE\fR and
\fIOUTPUT_FILE\fR\.
.
.P
-If only \fIINPUT_FILE\fR is present, the \fB\-D\fR|\fB\-\-dump\fR command
will be executed\.
+If only \fIINPUT_FILE\fR is present, the \fB\-\-dump\fR command will be
executed\.
.
.P
-If both \fIINPUT_FILE\fR and \fIOUTPUT_FILE\fR are present, the \fB\-U\fR|
\fB\-\-update\fR command will be executed\.
+If both \fIINPUT_FILE\fR and \fIOUTPUT_FILE\fR are present, the
\fB\-\-update\fR command will be executed\.
.
.IP "\(bu" 4
\fB\-D\fR, \fB\-\-dump\fR: Dump a textual representation of the first
\fIonMetaData\fR tag found in \fIINPUT_FILE\fR to standard output\. The
default format is XML, unless specified otherwise\.
.
.IP
-It is also possible to specify another event via the \fB\-e\fR option,
such as \fIonLastSecond\fR\.
+It is also possible to specify another event via the \fB\-\-event\fR
option, such as \fIonLastSecond\fR\.
.
.IP "\(bu" 4
\fB\-F\fR, \fB\-\-full\-dump\fR: Dump a textual representation of the
whole contents of \fIINPUT_FILE\fR to standard output\. The default format
is XML, unless specified otherwise\.
@@ -89,6 +89,9 @@
.
.IP "" 0
.
+.IP
+The \fB\-\-level\fR option allows to limit the display of messages to a
minimum level among those, for example if the user is only interested in
error messages and above\.
+.
.IP
Each message or message template presented to the user is identified by a
specific code of the following format:
.
@@ -110,15 +113,13 @@
Messages can be related to the following topics :
.
.IP "\(bu" 4
+\fI10\fR general flv file format
.
.IP "\(bu" 4
\fI11\fR file header
.
.IP "\(bu" 4
\fI12\fR previous tag size
-.
-.IP "" 0
-
.
.IP "\(bu" 4
\fI20\fR tag format
@@ -130,25 +131,22 @@
\fI40\fR timestamps
.
.IP "\(bu" 4
+\fI50\fR audio data
.
.IP "\(bu" 4
\fI51\fR audio codecs
-.
-.IP "" 0
-
.
.IP "\(bu" 4
+\fI60\fR video data
.
.IP "\(bu" 4
\fI61\fR video codecs
-.
-.IP "" 0
-
.
.IP "\(bu" 4
\fI70\fR metadata
.
.IP "\(bu" 4
+\fI80\fR AMF data
.
.IP "\(bu" 4
\fI81\fR keyframes
@@ -157,12 +155,27 @@
\fI82\fR cue points
.
.IP "" 0
-
-.
-.IP "" 0
+.
+.IP
+For example, \fIW51050\fR represents a Warning in topic 51 with the id
050, which represents a warning message related to audio codecs, in that
case to signal that an audio tag has an unknown codec\.
+.
+.IP "\(bu" 4
+\fB\-U\fR, \fB\-\-update\fR: Update the given input file by inserting a
computed \fIonMetaData\fR tag\. If an output file is specified, it will be
created or overwritten instead and the input file will not be modified\. If
the original file is to be updated, a temporary file will be created in the
default temp directory of the platform, and it will be copied over the
original file at the end of the operation\. This is due to the fact that
the output file is written while the original file is being read due to the
two\-pass method\.
.
.IP
-For example, \fIW10050\fR represents a Warning in topic 10 with the id
050\.
+The computed metadata contains among other data full keyframe
informations, in order to allow HTTP pseudo\-streaming and random\-access
seeking in the file\.
+.
+.IP
+By default, an \fIonLastSecond\fR tag will be inserted, unless the
\fB\-\-no\-last\-second\fR option is specified\.
+.
+.IP
+Normally overwritten by the update process, the existing metadata found in
the input file can be preserved by the \fB\-\-preserve\fR option\.
+.
+.IP
+It is also possible to insert custom string values with the \fB\-\-add\fR
option, which can be specified multiple times\.
+.
+.IP
+By default, the update operation is performed without output, unless the
\fB\-\-verbose\fR option is specified, or the \fB\-\-print\-metadata\fR is
used to print the newly written metadata to the standard output\.
.
.IP "" 0
.
@@ -172,6 +185,10 @@
.
.SS "FULL DUMP"
.
+.SS "CHECK"
+.
+.SS "UPDATE"
+.
.SH "FORMATS"
.
.SH "EXAMPLES"
=======================================
--- /man/1/flvmeta.1.ronn Mon Sep 12 07:28:47 2011
+++ /man/1/flvmeta.1.ronn Wed Apr 11 09:40:02 2012
@@ -25,8 +25,7 @@
unable to inject those metadata.

It can also optionnally inject the _onLastSecond_ event, used to signal
the end
-of playback, used for example to revert the player software to a 'stopped'
-state.
+of playback, for example to revert the player software to a 'stopped'
state.

`flvmeta` also has the ability to dump metadata and full file information
to
standard output, in a variety of textual output formats, including XML,
YAML,
@@ -95,6 +94,10 @@
* *fatal*: messages that inform of errors that make further file
reading
impossible therefore ending parsing completely

+ The `--level` option allows to limit the display of messages to a
minimum
+ level among those, for example if the user is only interested in error
+ messages and above.
+
Each message or message template presented to the user is identified
by a
specific code of the following format:

@@ -110,21 +113,49 @@
Messages can be related to the following topics :

* *10* general flv file format
- * *11* file header
- * *12* previous tag size
+ * *11* file header
+ * *12* previous tag size
* *20* tag format
* *30* tag types
* *40* timestamps
* *50* audio data
- * *51* audio codecs
+ * *51* audio codecs
* *60* video data
- * *61* video codecs
+ * *61* video codecs
* *70* metadata
* *80* AMF data
- * *81* keyframes
- * *82* cue points
-
- For example, <W10050> represents a Warning in topic 10 with the id 050.
+ * *81* keyframes
+ * *82* cue points
+
+ For example, <W51050> represents a Warning in topic 51 with the id 050,
+ which represents a warning message related to audio codecs, in that
case to
+ signal that an audio tag has an unknown codec.
+
+ * `-U`, `--update`:
+ Update the given input file by inserting a computed _onMetaData_ tag.
If an
+ output file is specified, it will be created or overwritten instead and
+ the input file will not be modified. If the original file is to be
updated,
+ a temporary file will be created in the default temp directory of the
+ platform, and it will be copied over the original file at the end of
+ the operation. This is due to the fact that the output file is written
+ while the original file is being read due to the two-pass method.
+
+ The computed metadata contains among other data full keyframe
informations,
+ in order to allow HTTP pseudo-streaming and random-access seeking in
the
+ file.
+
+ By default, an _onLastSecond_ tag will be inserted, unless the
+ `--no-last-second` option is specified.
+
+ Normally overwritten by the update process, the existing metadata
found in
+ the input file can be preserved by the `--preserve` option.
+
+ It is also possible to insert custom string values with the `--add`
option,
+ which can be specified multiple times.
+
+ By default, the update operation is performed without output, unless
the
+ `--verbose` option is specified, or the `--print-metadata` is used to
+ print the newly written metadata to the standard output.


## OPTIONS
@@ -133,6 +164,10 @@

### FULL DUMP

+### CHECK
+
+### UPDATE
+
## FORMATS

## EXAMPLES

==============================================================================
Revision: 32d4b866c208
Author: Marc Noirot <marc....@gmail.com>
Date: Thu Apr 12 02:07:34 2012
Log: Fixed desynchronisation detection on 64-bit platforms.

http://code.google.com/p/flvmeta/source/detail?r=32d4b866c208

Modified:
/TODO
/src/check.c

=======================================
--- /TODO Thu Apr 5 09:26:12 2012
+++ /TODO Thu Apr 12 02:07:34 2012
@@ -20,5 +20,3 @@
Batch mode to handle multiple input files in one invocation.

Scripting environment for custom manipulation of FLV files and metadata.
-
-Fix Mac OSX invalid desync report in --check.
=======================================
--- /src/check.c Wed Apr 11 07:23:25 2012
+++ /src/check.c Thu Apr 12 02:07:34 2012
@@ -361,9 +361,9 @@
last_timestamp = timestamp;

/* check for desyncs between audio and video: one second or more
is suspicious */
- if (have_video && have_audio && !have_desync &&
labs(last_video_timestamp - last_audio_timestamp) >= 1000) {
- sprintf(message, "audio and video streams are desynchronized
by %ld ms",
- labs(last_video_timestamp - last_audio_timestamp));
+ if (have_video && have_audio && !have_desync &&
abs(last_video_timestamp - last_audio_timestamp) >= 1000) {
+ sprintf(message, "audio and video streams are desynchronized
by %d ms",
+ abs(last_video_timestamp - last_audio_timestamp));
print_warning(WARNING_TIMESTAMP_DESYNC, offset + 4, message);
have_desync = 1; /* do not repeat */
}
@@ -619,7 +619,7 @@
}

/* check last timestamps */
- if (have_video && have_audio && labs(last_audio_timestamp -
last_video_timestamp) >= 1000) {
+ if (have_video && have_audio && abs(last_audio_timestamp -
last_video_timestamp) >= 1000) {
if (last_audio_timestamp > last_video_timestamp) {
sprintf(message, "video stops %d ms before audio",
last_audio_timestamp - last_video_timestamp);
print_warning(WARNING_TIMESTAMP_VIDEO_ENDS_FIRST,
file_stats.st_size, message);

Reply all
Reply to author
Forward
0 new messages