/* --- */ void fileio_txt_init(void) { register_format(load_csv, save_csv, myformat, "Comma Separated Value (*.csv)"); register_format(load_txt, save_txt, myformat, "Text (*.txt)"); }
static void register_formats(struct hva_dev *hva) { unsigned int i; for (i = 0; i < hva->nb_of_encoders; i++) { register_format(hva->encoders[i]->pixelformat, hva->pixelformats, &hva->nb_of_pixelformats); register_format(hva->encoders[i]->streamformat, hva->streamformats, &hva->nb_of_streamformats); } }
static void register_converter(char *fmt, char *lext, char *lcmd, char *sext, char *scmd) { int (*saver)(char *, buffer *); int (*loader)(char *, buffer *); conv = MwRealloc(conv, (nconv+1)*sizeof conv[0]); conv[nconv].name = MwStrdup(fmt); if (lext) { loader = load_ext; conv[nconv].lext = MwStrdup(lext); conv[nconv].lcmd = MwStrdup(lcmd); } else { loader = NULL; conv[nconv].lext = NULL; conv[nconv].lcmd = NULL; } if (sext) { saver = save_ext; conv[nconv].sext = MwStrdup(sext); conv[nconv].scmd = MwStrdup(scmd); } else { saver = NULL; conv[nconv].sext = NULL; conv[nconv].scmd = NULL; } nconv++; register_format(loader, saver, myformat_ext, fmt); }
/** * gtk_text_buffer_register_serialize_format: * @buffer: a #GtkTextBuffer * @mime_type: the format's mime-type * @function: the serialize function to register * @user_data: %function's user_data * @user_data_destroy: a function to call when @user_data is no longer needed * * This function registers a rich text serialization @function along with * its @mime_type with the passed @buffer. * * Return value: (transfer none): the #GdkAtom that corresponds to the * newly registered format's mime-type. * * Since: 2.10 **/ GdkAtom gtk_text_buffer_register_serialize_format (GtkTextBuffer *buffer, const gchar *mime_type, GtkTextBufferSerializeFunc function, gpointer user_data, GDestroyNotify user_data_destroy) { GList *formats; GdkAtom atom; g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), GDK_NONE); g_return_val_if_fail (mime_type != NULL && *mime_type != '\0', GDK_NONE); g_return_val_if_fail (function != NULL, GDK_NONE); formats = g_object_steal_qdata (G_OBJECT (buffer), serialize_quark ()); formats = register_format (formats, mime_type, (gpointer) function, user_data, user_data_destroy, &atom); g_object_set_qdata_full (G_OBJECT (buffer), serialize_quark (), formats, (GDestroyNotify) free_format_list); g_object_notify (G_OBJECT (buffer), "copy-target-list"); return atom; }
static PyObject * api_registrar_register_format (PyObject *self, PyObject *args) { int status; char *name = NULL; if (!PyArg_ParseTuple (args, "|s", &name)) return NULL; status = register_format (name); return _ro (PyInt_FromLong (status)); }
/* --- */ void fileio_init() { /* Register PW format first */ siag_fmt = format_count; fileio_pw_init(); fileio_txt_init(); fileio_sxw_init(); fileio_rtf_init(); fileio_html_init(); fileio_ps_init(); fileio_extconv_init(); /* Put this catch-all last */ register_format(load_all, save_all, myformat, "All files (*)"); }
/*! * \brief Set MTK boot image output format * * \return Nothing if the format is successfully set. Otherwise, the error code. */ oc::result<void> Writer::set_format_mtk() { return register_format(std::make_unique<mtk::MtkFormatWriter>(*this)); }
void rt_constructor(void) { register_format(&rt); }
void Convert::retrieve_output_colorspace (const ::VSMap &in, ::VSMap &out, ::VSCore &core, const ::VSFormat &fmt_src) { const ::VSFormat * fmt_dst_ptr = &fmt_src; // Full colorspace int csp_dst = get_arg_int (in, out, "csp", ::pfNone); if (csp_dst != ::pfNone) { fmt_dst_ptr = _vsapi.getFormatPreset (csp_dst, &core); if (fmt_dst_ptr == 0) { throw_inval_arg ("unknown output colorspace."); } } int col_fam = fmt_dst_ptr->colorFamily; int spl_type = fmt_dst_ptr->sampleType; int bits = fmt_dst_ptr->bitsPerSample; int ssh = fmt_dst_ptr->subSamplingW; int ssv = fmt_dst_ptr->subSamplingH; // Color family _col_fam = get_arg_int (in, out, "col_fam", col_fam); // Chroma subsampling std::string css (get_arg_str (in, out, "css", "")); if (! css.empty ()) { const int ret_val = vsutl::conv_str_to_chroma_subspl (ssh, ssv, css); if (ret_val != 0) { throw_inval_arg ("unsupported css value."); } } // Destination bit depth and sample type bool bits_def_flag = false; bool flt_def_flag = false; int flt = (spl_type != ::stInteger) ? 1 : 0; bits = get_arg_int (in, out, "bits", bits, 0, &bits_def_flag); flt = get_arg_int (in, out, "flt" , flt, 0, &flt_def_flag ); spl_type = (flt != 0) ? ::stFloat : ::stInteger; if (flt_def_flag && ! bits_def_flag) { if (spl_type == ::stFloat) { bits = 32; } else { if (bits > 16) { throw_inval_arg ( "Cannot deduce the output bitdepth. Please specify it." ); } } } else if (bits_def_flag && ! flt_def_flag) { if (bits >= 32) { spl_type = ::stFloat; } else { spl_type = ::stInteger; } } // Combines the modified parameters and validates the format try { fmt_dst_ptr = register_format ( _col_fam, spl_type, bits, ssh, ssv, core ); } catch (std::exception &) { throw; } catch (...) { fmt_dst_ptr = 0; } if (fmt_dst_ptr == 0) { throw_rt_err ( "couldn\'t get a pixel format identifier for the output clip." ); } _vi_out.format = fmt_dst_ptr; }
const ::VSFormat * Matrix::find_dst_col_fam (fmtcl::ColorSpaceH265 tmp_csp, const ::VSFormat *fmt_dst_ptr, const ::VSFormat &fmt_src, ::VSCore &core) { int alt_cf = -1; switch (tmp_csp) { case fmtcl::ColorSpaceH265_RGB: case fmtcl::ColorSpaceH265_BT709: case fmtcl::ColorSpaceH265_FCC: case fmtcl::ColorSpaceH265_BT470BG: case fmtcl::ColorSpaceH265_SMPTE170M: case fmtcl::ColorSpaceH265_SMPTE240M: case fmtcl::ColorSpaceH265_BT2020NCL: case fmtcl::ColorSpaceH265_BT2020CL: alt_cf = ::cmYUV; break; case fmtcl::ColorSpaceH265_YCGCO: alt_cf = ::cmYCoCg; break; default: // Nothing break; } if (alt_cf >= 0) { int col_fam = fmt_dst_ptr->colorFamily; int spl_type = fmt_dst_ptr->sampleType; int bits = fmt_dst_ptr->bitsPerSample; int ssh = fmt_dst_ptr->subSamplingW; int ssv = fmt_dst_ptr->subSamplingH; if (fmt_src.colorFamily == ::cmRGB) { col_fam = alt_cf; } else if (fmt_src.colorFamily == alt_cf) { col_fam = ::cmRGB; } try { fmt_dst_ptr = register_format ( col_fam, spl_type, bits, ssh, ssv, core ); } catch (std::exception &) { throw; } catch (...) { fmt_dst_ptr = 0; } } return (fmt_dst_ptr); }
const ::VSFormat * Matrix::get_output_colorspace (const ::VSMap &in, ::VSMap &out, ::VSCore &core, const ::VSFormat &fmt_src, int &plane_out, bool &force_col_fam_flag) const { assert (&in != 0); assert (&out != 0); assert (&core != 0); assert (&fmt_src != 0); assert (&plane_out != 0); force_col_fam_flag = false; const ::VSFormat * fmt_dst_ptr = &fmt_src; // Full colorspace int csp_dst = get_arg_int (in, out, "csp", ::pfNone); if (csp_dst != ::pfNone) { fmt_dst_ptr = _vsapi.getFormatPreset (csp_dst, &core); if (fmt_dst_ptr == 0) { throw_inval_arg ("unknown output colorspace."); } else { force_col_fam_flag = true; } } int col_fam = fmt_dst_ptr->colorFamily; int spl_type = fmt_dst_ptr->sampleType; int bits = fmt_dst_ptr->bitsPerSample; int ssh = fmt_dst_ptr->subSamplingW; int ssv = fmt_dst_ptr->subSamplingH; // Color family if (is_arg_defined (in, "col_fam")) { force_col_fam_flag = true; col_fam = get_arg_int (in, out, "col_fam", col_fam); } if (plane_out >= 0) { col_fam = ::cmGray; } else if (col_fam == ::cmGray) { plane_out = 0; } // Destination bit depth bits = get_arg_int (in, out, "bits", bits); // Combines the modified parameters and validates the format try { fmt_dst_ptr = register_format ( col_fam, spl_type, bits, ssh, ssv, core ); } catch (std::exception &) { throw; } catch (...) { fmt_dst_ptr = 0; } if (fmt_dst_ptr == 0) { throw_rt_err ( "couldn\'t get a pixel format identifier for the output clip." ); } return (fmt_dst_ptr); }
const ::VSFormat & Transfer::get_output_colorspace (const ::VSMap &in, ::VSMap &out, ::VSCore &core, const ::VSFormat &fmt_src) const { assert (&in != 0); assert (&out != 0); assert (&core != 0); assert (&fmt_src != 0); const ::VSFormat * fmt_dst_ptr = &fmt_src; const int undef = -666666666; const int dst_flt = get_arg_int (in, out, "flt" , undef); const int dst_bits = get_arg_int (in, out, "bits", undef); int col_fam = fmt_dst_ptr->colorFamily; int spl_type = fmt_dst_ptr->sampleType; int bits = fmt_dst_ptr->bitsPerSample; int ssh = fmt_dst_ptr->subSamplingW; int ssv = fmt_dst_ptr->subSamplingH; // Data type if (dst_flt == 0) { spl_type = ::stInteger; } else if (dst_flt != undef) { spl_type = ::stFloat; if (dst_bits == undef) { bits = 32; } } // Bitdepth if (dst_bits != undef) { bits = dst_bits; if (dst_flt == undef) { if (bits < 32) { spl_type = ::stInteger; } else { spl_type = ::stFloat; } } } // Combines the modified parameters and validates the format try { fmt_dst_ptr = register_format ( col_fam, spl_type, bits, ssh, ssv, core ); } catch (...) { fmt_dst_ptr = 0; } if (fmt_dst_ptr == 0) { throw_rt_err ( "couldn\'t get a pixel format identifier for the output clip." ); } return (*fmt_dst_ptr); }
void dag_constructor(void) { register_format(&dag); }
/* --- */ void fileio_mgp_init(void) { register_format(NULL, NULL, myformat, "MagicPoint (*.mgp)"); }
void pcap_constructor(void) { register_format(&pcap); register_format(&pcapint); }