aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Converse <aconverse@google.com>2014-01-06 17:22:21 -0800
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2014-01-06 17:22:21 -0800
commit7900c80e5aa44099ed4f1f8d3f9565a89695cc14 (patch)
tree3b5a08ca6ad2767bce606c1db211c4c1ba10613b
parent166d8142ac5a68a5e5a8646029c8beb796b3b99c (diff)
parent64b89f1b4b1c0ee17524672962288a69b45d769c (diff)
downloadlibvpx-7900c80e5aa44099ed4f1f8d3f9565a89695cc14.tar
libvpx-7900c80e5aa44099ed4f1f8d3f9565a89695cc14.tar.gz
libvpx-7900c80e5aa44099ed4f1f8d3f9565a89695cc14.tar.bz2
libvpx-7900c80e5aa44099ed4f1f8d3f9565a89695cc14.zip
Merge "Fix encoding Raw yv12 and i420 from a pipe."
-rw-r--r--ivfdec.c5
-rw-r--r--vpxenc.c13
2 files changed, 9 insertions, 9 deletions
diff --git a/ivfdec.c b/ivfdec.c
index 4a0816ff0..a37a44c07 100644
--- a/ivfdec.c
+++ b/ivfdec.c
@@ -17,11 +17,6 @@ int file_is_ivf(struct VpxInputContext *input_ctx) {
char raw_hdr[32];
int is_ivf = 0;
- // TODO(tomfinegan): This can eventually go away, but for now it's required
- // because the means by which file types are detected differ in vpxdec and
- // vpxenc.
- rewind(input_ctx->file);
-
if (fread(raw_hdr, 1, 32, input_ctx->file) == 32) {
if (raw_hdr[0] == 'D' && raw_hdr[1] == 'K' &&
raw_hdr[2] == 'I' && raw_hdr[3] == 'F') {
diff --git a/vpxenc.c b/vpxenc.c
index d0ed9b538..4c933ce6f 100644
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -26,7 +26,6 @@
#include "third_party/libyuv/include/libyuv/scale.h"
#include "./args.h"
-#include "./ivfdec.h"
#include "./ivfenc.h"
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
@@ -126,13 +125,19 @@ int read_frame(struct VpxInputContext *input_ctx, vpx_image_t *img) {
return !shortread;
}
-int file_is_y4m(FILE *infile, y4m_input *y4m, const char detect[4]) {
+int file_is_y4m(const char detect[4]) {
if (memcmp(detect, "YUV4", 4) == 0) {
return 1;
}
return 0;
}
+int fourcc_is_ivf(const char detect[4]) {
+ if (memcmp(detect, "DKIF", 4) == 0) {
+ return 1;
+ }
+ return 0;
+}
/* Murmur hash derived from public domain reference implementation at
* http:// sites.google.com/site/murmurhash/
@@ -1044,7 +1049,7 @@ void open_input_file(struct VpxInputContext *input) {
input->detect.position = 0;
if (input->detect.buf_read == 4
- && file_is_y4m(input->file, &input->y4m, input->detect.buf)) {
+ && file_is_y4m(input->detect.buf)) {
if (y4m_input_open(&input->y4m, input->file, input->detect.buf, 4,
input->only_i420) >= 0) {
input->file_type = FILE_TYPE_Y4M;
@@ -1055,7 +1060,7 @@ void open_input_file(struct VpxInputContext *input) {
input->use_i420 = 0;
} else
fatal("Unsupported Y4M stream.");
- } else if (input->detect.buf_read == 4 && file_is_ivf(input)) {
+ } else if (input->detect.buf_read == 4 && fourcc_is_ivf(input->detect.buf)) {
fatal("IVF is not supported as input.");
} else {
input->file_type = FILE_TYPE_RAW;