Require an --experimental-bitstream flag at runtime for encoding profile 1.

Change-Id: I73865bbbf6ea74434f15b73783ae97b4d273be80
diff --git a/vpxenc.c b/vpxenc.c
index 02856d9..d3734fe 100644
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -231,6 +231,10 @@
 static const arg_def_t disable_warning_prompt =
     ARG_DEF("y", "disable-warning-prompt", 0,
             "Display warnings, but do not prompt user to continue.");
+static const arg_def_t experimental_bitstream =
+    ARG_DEF(NULL, "experimental-bitstream", 0,
+            "Allow experimental bitstream features.");
+
 
 static const arg_def_t *main_args[] = {
   &debugmode,
@@ -713,6 +717,8 @@
       global->disable_warnings = 1;
     else if (arg_match(&arg, &disable_warning_prompt, argi))
       global->disable_warning_prompt = 1;
+    else if (arg_match(&arg, &experimental_bitstream, argi))
+      global->experimental_bitstream = 1;
     else
       argj++;
   }
@@ -1002,13 +1008,20 @@
   } while (0)
 
 
-static void validate_stream_config(struct stream_state *stream) {
-  struct stream_state *streami;
+static void validate_stream_config(const struct stream_state *stream,
+                                   const struct VpxEncoderConfig *global) {
+  const struct stream_state *streami;
 
   if (!stream->config.cfg.g_w || !stream->config.cfg.g_h)
     fatal("Stream %d: Specify stream dimensions with --width (-w) "
           " and --height (-h)", stream->index);
 
+  if (stream->config.cfg.g_profile != 0 && !global->experimental_bitstream) {
+    fatal("Stream %d: profile %d is experimental and requires the --%s flag",
+          stream->index, stream->config.cfg.g_profile,
+          experimental_bitstream.long_name);
+  }
+
   for (streami = stream; streami; streami = streami->next) {
     /* All streams require output files */
     if (!streami->config.out_fn)
@@ -1571,7 +1584,7 @@
       fatal("Specify stream dimensions with --width (-w) "
             " and --height (-h)");
     FOREACH_STREAM(set_stream_dimensions(stream, input.width, input.height));
-    FOREACH_STREAM(validate_stream_config(stream));
+    FOREACH_STREAM(validate_stream_config(stream, &global));
 
     /* Ensure that --passes and --pass are consistent. If --pass is set and
      * --passes=2, ensure --fpf was set.