summaryrefslogtreecommitdiff
path: root/vpxenc.c
diff options
context:
space:
mode:
authorVignesh Venkatasubramanian <vigneshv@google.com>2014-03-14 08:10:35 -0700
committerVignesh Venkatasubramanian <vigneshv@google.com>2014-03-14 14:44:47 -0700
commit0ffa3836f3ce24596c2101d50c3ac51f79963f92 (patch)
tree32dc663c7e2f4906a2786d65fe763ed1a7878332 /vpxenc.c
parent1f08824d6db735e4cacb0419785a789395e42b2b (diff)
downloadlibvpx-0ffa3836f3ce24596c2101d50c3ac51f79963f92.tar
libvpx-0ffa3836f3ce24596c2101d50c3ac51f79963f92.tar.gz
libvpx-0ffa3836f3ce24596c2101d50c3ac51f79963f92.tar.bz2
libvpx-0ffa3836f3ce24596c2101d50c3ac51f79963f92.zip
Adding a configure flag to control WebM container support
Adding a --(enable|disable)-webm-io flag to control WebM container input and output support. For now, enabling WebM IO by default only when there is a C++ compiler. Doing so because eventually we will move WebM IO to libwebm and it is built using C++. Change-Id: I210ac36c23528e382ed41d3c4322291720481492
Diffstat (limited to 'vpxenc.c')
-rw-r--r--vpxenc.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/vpxenc.c b/vpxenc.c
index c61d83e41..1cd5e9232 100644
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -123,6 +123,7 @@ int fourcc_is_ivf(const char detect[4]) {
return 0;
}
+#if CONFIG_WEBM_IO
/* Murmur hash derived from public domain reference implementation at
* http:// sites.google.com/site/murmurhash/
*/
@@ -169,7 +170,7 @@ static unsigned int murmur(const void *key, int len, unsigned int seed) {
return h;
}
-
+#endif // CONFIG_WEBM_IO
static const arg_def_t debugmode = ARG_DEF("D", "debug", 0,
"Debug mode (makes output deterministic)");
@@ -218,7 +219,7 @@ static const arg_def_t recontest = ARG_DEF_ENUM(NULL, "test-decode", 1,
static const arg_def_t framerate = ARG_DEF(NULL, "fps", 1,
"Stream frame rate (rate/scale)");
static const arg_def_t use_ivf = ARG_DEF(NULL, "ivf", 0,
- "Output IVF (default is WebM)");
+ "Output IVF (default is WebM if WebM IO is enabled)");
static const arg_def_t out_part = ARG_DEF("P", "output-partitions", 0,
"Makes encoder output partitions. Requires IVF output!");
static const arg_def_t q_hist_n = ARG_DEF(NULL, "q-hist", 1,
@@ -834,7 +835,9 @@ static struct stream_state *new_stream(struct VpxEncoderConfig *global,
/* Initialize remaining stream parameters */
stream->config.stereo_fmt = STEREO_FORMAT_MONO;
stream->config.write_webm = 1;
+#if CONFIG_WEBM_IO
stream->ebml.last_pts_ms = -1;
+#endif
/* Allows removal of the application version from the EBML tags */
stream->ebml.debug = global->debug;
@@ -1143,13 +1146,17 @@ static void open_output_file(struct stream_state *stream,
if (stream->config.write_webm && fseek(stream->file, 0, SEEK_CUR))
fatal("WebM output to pipes not supported.");
+#if CONFIG_WEBM_IO
if (stream->config.write_webm) {
stream->ebml.stream = stream->file;
write_webm_file_header(&stream->ebml, cfg,
&global->framerate,
stream->config.stereo_fmt,
global->codec->fourcc);
- } else {
+ }
+#endif
+
+ if (!stream->config.write_webm) {
ivf_write_file_header(stream->file, cfg, global->codec->fourcc, 0);
}
}
@@ -1162,11 +1169,15 @@ static void close_output_file(struct stream_state *stream,
if (cfg->g_pass == VPX_RC_FIRST_PASS)
return;
+#if CONFIG_WEBM_IO
if (stream->config.write_webm) {
write_webm_file_footer(&stream->ebml, stream->hash);
free(stream->ebml.cue_list);
stream->ebml.cue_list = NULL;
- } else {
+ }
+#endif
+
+ if (!stream->config.write_webm) {
if (!fseek(stream->file, 0, SEEK_SET))
ivf_write_file_header(stream->file, &stream->config.cfg,
fourcc,
@@ -1316,6 +1327,7 @@ static void get_cx_data(struct stream_state *stream,
fprintf(stderr, " %6luF", (unsigned long)pkt->data.frame.sz);
update_rate_histogram(stream->rate_hist, cfg, pkt);
+#if CONFIG_WEBM_IO
if (stream->config.write_webm) {
/* Update the hash */
if (!stream->ebml.debug)
@@ -1324,7 +1336,9 @@ static void get_cx_data(struct stream_state *stream,
stream->hash);
write_webm_block(&stream->ebml, cfg, pkt);
- } else {
+ }
+#endif
+ if (!stream->config.write_webm) {
if (pkt->data.frame.partition_id <= 0) {
ivf_header_pos = ftello(stream->file);
fsize = pkt->data.frame.sz;
@@ -1594,6 +1608,14 @@ int main(int argc, const char **argv_) {
" and --passes=2\n", stream->index, global.pass);
});
+#if !CONFIG_WEBM_IO
+ FOREACH_STREAM({
+ stream->config.write_webm = 0;
+ warn("vpxenc was compiled without WebM container support."
+ "Producing IVF output");
+ });
+#endif
+
/* Use the frame rate from the file only if none was specified
* on the command-line.
*/