1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
From: Marc Leeman <marc.leeman@gmail.com>
Date: Thu, 1 Sep 2016 13:45:24 +0200
Subject: ogminfo: timestamp correction
---
ogminfo.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/ogminfo.c b/ogminfo.c
index a17b8cf..ca5f734 100644
--- a/ogminfo.c
+++ b/ogminfo.c
@@ -51,7 +51,7 @@ ogg_int64_t pagebytesread = 0;
void add_stream(stream_t *ndmx) {
stream_t *cur = first;
-
+
if (first == NULL) {
first = ndmx;
first->next = NULL;
@@ -66,13 +66,13 @@ void add_stream(stream_t *ndmx) {
stream_t *find_stream(int fserial) {
stream_t *cur = first;
-
+
while (cur != NULL) {
if (cur->serial == fserial)
break;
cur = cur->next;
}
-
+
return cur;
}
@@ -92,7 +92,7 @@ void usage(char *fname) {
" -V, --version Show version information.\n", fname);
}
-#ifndef XIPHCORRECTINTERLEAVING
+#ifndef XIPHCORRECTINTERLEAVING
#define OUTOFSYNC ((((stream->stype == 't' ? end_pts : start_pts) \
- last_pts) < 0.0 ) ? "OUT_OF_SYNC " : "sync_ok ")
#else
@@ -131,7 +131,7 @@ void dump_streamheader(stream_header *sth, char stype, int sno, int snum) {
int all_header_packets_dumped() {
stream_t *stream = first;
-
+
while (stream != NULL) {
if ((stream->stype == 'V') && (stream->header_packets < 3))
return 0;
@@ -139,7 +139,7 @@ int all_header_packets_dumped() {
return 0;
stream = stream->next;
}
-
+
return 1;
}
@@ -172,7 +172,7 @@ void handle_packet(stream_t *stream, ogg_packet *pack, ogg_page *page) {
vorbis_comment_init(&vc);
if (vorbis_unpack_comment(&vc, pack->packet, pack->bytes) != 0)
fprintf(stdout, "(%s) %c%d: comment packet, length %ld. This packet "
- "does NOT contain a valid Vorbis comment packet!\n",
+ "does NOT contain a valid Vorbis comment packet!\n",
__FILE__, stream->stype, stream->sno, pack->bytes);
else {
fprintf(stdout, "(%s) %c%d: comment packet, length %ld,", __FILE__,
@@ -194,9 +194,9 @@ void handle_packet(stream_t *stream, ogg_packet *pack, ogg_page *page) {
__FILE__, stream->sno, pack->bytes, ogg_page_granulepos(page),
pack->packetno);
if (check_timing && (stream->sample_rate != -1)) {
- end_pts = (double)ogg_page_granulepos(page) *
+ end_pts = (double)ogg_page_granulepos(page) *
(double)1000.0 / (double)stream->sample_rate;
- start_pts = (double)stream->last_granulepos *
+ start_pts = (double)stream->last_granulepos *
(double)1000.0 / (double)stream->sample_rate;
fprintf(stdout, " start: % 13.2fms end: % 13.2fms %s",
start_pts, end_pts, OUTOFSYNC);
@@ -224,9 +224,9 @@ void handle_packet(stream_t *stream, ogg_packet *pack, ogg_page *page) {
"10lld ", __FILE__, stream->stype, stream->sno, n,
ogg_page_granulepos(page), pack->packetno);
if (check_timing && (stream->sample_rate != -1)) {
- end_pts = (double)ogg_page_granulepos(page) *
+ end_pts = (double)ogg_page_granulepos(page) *
(double)1000.0 / (double)stream->sample_rate;
- start_pts = (double)stream->last_granulepos *
+ start_pts = (double)stream->last_granulepos *
(double)1000.0 / (double)stream->sample_rate;
fprintf(stdout, " start: % 13.2fms end: % 13.2fms %s",
start_pts, end_pts, OUTOFSYNC);
@@ -344,8 +344,8 @@ void process_ogm(int fdin)
copy_headers(&sth, (old_stream_header *)&pack.packet[1], pack.bytes);
if (!strncmp(sth.streamtype, "video", 5)) {
unsigned long codec;
- codec = (sth.subtype[0] << 24) +
- (sth.subtype[1] << 16) + (sth.subtype[2] << 8) + sth.subtype[3];
+ codec = (sth.subtype[0] << 24) +
+ (sth.subtype[1] << 16) + (sth.subtype[2] << 8) + sth.subtype[3];
fprintf(stdout, "(%s) (v%d/serial %d) fps: %.3f width height: %dx%d "
"codec: %p (%c%c%c%c)\n", __FILE__, nvstreams + 1,
serialnumber, (double)10000000 /
@@ -450,7 +450,7 @@ void process_ogm(int fdin)
numstreams++;
}
}
-
+
if ((verbose == 0) && !summary)
exit(0);
@@ -500,7 +500,7 @@ void process_ogm(int fdin)
}
pagebytesread += pageseek;
}
-
+
if (summary) {
stream = first;
while (stream != NULL) {
@@ -513,7 +513,7 @@ void process_ogm(int fdin)
stream->serial, stream->size,
(stream->size * 8.0 / 1000.0) / now,
(stream->size / 1024.0) / now,
- stream->num_packets, now * 1000.0);
+ stream->num_packets, now);
stream = stream->next;
}
}
@@ -521,7 +521,7 @@ void process_ogm(int fdin)
int main(int argc, char *argv[]) {
int i, fdin = -1;
-
+
nice(2);
for (i = 1; i < argc; i++)
@@ -552,11 +552,11 @@ int main(int argc, char *argv[]) {
usage(argv[0]);
exit(1);
}
-
+
if (verbose >= 2)
summary = 1;
- process_ogm(fdin);
-
+ process_ogm(fdin);
+
close(fdin);
return 0;
}
|