+wimlib_set_output_compression_type(WIMStruct *wim, int ctype)
+{
+ int ret = set_out_ctype(ctype, &wim->out_compression_type);
+ if (ret)
+ return ret;
+
+ /* Reset the chunk size if it's no longer valid. */
+ if (!wim_chunk_size_valid(ctype, wim->out_chunk_size))
+ wim->out_chunk_size = wim_default_chunk_size(ctype);
+ return 0;
+}
+
+/* API function documented in wimlib.h */
+WIMLIBAPI int
+wimlib_set_output_pack_compression_type(WIMStruct *wim, int ctype)
+{
+ int ret = set_out_ctype(ctype, &wim->out_pack_compression_type);
+ if (ret)
+ return ret;
+
+ /* Reset the chunk size if it's no longer valid. */
+ if (!wim_chunk_size_valid(ctype, wim->out_pack_chunk_size))
+ wim->out_pack_chunk_size = wim_default_pack_chunk_size(ctype);
+ return 0;
+}
+
+static int
+set_out_chunk_size(u32 chunk_size, int ctype, u32 *out_chunk_size_p)