summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util/chd.c6
-rw-r--r--src/lib/util/chd.h2
-rw-r--r--src/lib/util/vbiparse.c10
3 files changed, 13 insertions, 5 deletions
diff --git a/src/lib/util/chd.c b/src/lib/util/chd.c
index d9083fc73e1..e8fda05e2ad 100644
--- a/src/lib/util/chd.c
+++ b/src/lib/util/chd.c
@@ -2827,7 +2827,7 @@ static chd_error av_codec_config(chd_file *chd, int param, void *config)
static chd_error av_codec_postinit(chd_file *chd)
{
- int fps, fpsfrac, width, height, interlaced, channels, rate, metabytes;
+ int fps, fpsfrac, width, height, interlaced, channels, rate;
UINT32 fps_times_1million, max_samples_per_frame, bytes_per_frame;
av_codec_data *data = chd->codecdata;
char metadata[256];
@@ -2843,13 +2843,13 @@ static chd_error av_codec_postinit(chd_file *chd)
return err;
/* extract the info */
- if (sscanf(metadata, AV_METADATA_FORMAT, &fps, &fpsfrac, &width, &height, &interlaced, &channels, &rate, &metabytes) != 8)
+ if (sscanf(metadata, AV_METADATA_FORMAT, &fps, &fpsfrac, &width, &height, &interlaced, &channels, &rate) != 7)
return CHDERR_INVALID_METADATA;
/* compute the bytes per frame */
fps_times_1million = fps * 1000000 + fpsfrac;
max_samples_per_frame = ((UINT64)rate * 1000000 + fps_times_1million - 1) / fps_times_1million;
- bytes_per_frame = 12 + metabytes + channels * max_samples_per_frame * 2 + width * height * 2;
+ bytes_per_frame = 12 + channels * max_samples_per_frame * 2 + width * height * 2;
if (bytes_per_frame > chd->header.hunkbytes)
return CHDERR_INVALID_METADATA;
diff --git a/src/lib/util/chd.h b/src/lib/util/chd.h
index f6aef5d8da3..0e3af6f94f5 100644
--- a/src/lib/util/chd.h
+++ b/src/lib/util/chd.h
@@ -126,7 +126,7 @@
/* standard A/V metadata */
#define AV_METADATA_TAG 0x41564156 /* 'AVAV' */
-#define AV_METADATA_FORMAT "FPS:%d.%06d WIDTH:%d HEIGHT:%d INTERLACED:%d CHANNELS:%d SAMPLERATE:%d META:%d"
+#define AV_METADATA_FORMAT "FPS:%d.%06d WIDTH:%d HEIGHT:%d INTERLACED:%d CHANNELS:%d SAMPLERATE:%d"
/* CHD open values */
#define CHD_OPEN_READ 1
diff --git a/src/lib/util/vbiparse.c b/src/lib/util/vbiparse.c
index b11941cb71f..0c3b7847e85 100644
--- a/src/lib/util/vbiparse.c
+++ b/src/lib/util/vbiparse.c
@@ -101,7 +101,15 @@ int vbi_parse_manchester_code(const UINT16 *source, int sourcewidth, int sources
if (srcabs[curbit + 1 + 0] != srcabs[curbit + 1 + 1] || srcabs[curbit - 1 + 0] != srcabs[curbit - 1 + 1])
{
/* only continue if we're still in the running */
- if (++error < besterr)
+ if ((error += 1) < besterr)
+ continue;
+ }
+
+ /* off-by-two? */
+ if (srcabs[curbit + 2 + 0] != srcabs[curbit + 2 + 1] || srcabs[curbit - 2 + 0] != srcabs[curbit - 2 + 1])
+ {
+ /* only continue if we're still in the running */
+ if ((error += 2) < besterr)
continue;
}