/** * UfoGroupSchedulerError: * @UFO_GROUP_SCHEDULER_ERROR_SETUP: Could not start scheduler due to error */ GQuark ufo_group_scheduler_error_quark (void) { return g_quark_from_static_string ("ufo-scheduler-error-quark"); }
GQuark json_parser_error_quark (void) { return g_quark_from_static_string ("json-parser-error"); }
static inline GQuark roar_output_quark(void) { return g_quark_from_static_string("roar_output"); }
/** * pka_context_error_quark: * * Retrieves the #PkaContext error domain #GQuark. * * Returns: A #GQuark. * Side effects: None. */ GQuark pka_context_error_quark (void) { return g_quark_from_static_string("pka-context-error-quark"); }
/* sends a command to the dropbox server returns an hash of the return values in theory, this should disconnection errors but it doesn't matter right now, any error is a sufficient condition to disconnect */ static GHashTable * send_command_to_db(GIOChannel *chan, const gchar *command_name, GHashTable *args, GError **err) { GError *tmp_error = NULL; GIOStatus iostat; gsize bytes_trans; gchar *line; g_assert(chan != NULL); g_assert(command_name != NULL); #define WRITE_OR_DIE_SANI(s,l) { \ gchar *sani_s; \ sani_s = dropbox_client_util_sanitize(s); \ iostat = g_io_channel_write_chars(chan, sani_s,l, &bytes_trans, \ &tmp_error); \ g_free(sani_s); \ if (iostat == G_IO_STATUS_ERROR || \ iostat == G_IO_STATUS_AGAIN) { \ if (tmp_error != NULL) { \ g_propagate_error(err, tmp_error); \ } \ return NULL; \ } \ } #define WRITE_OR_DIE(s,l) { \ iostat = g_io_channel_write_chars(chan, s,l, &bytes_trans, \ &tmp_error); \ if (iostat == G_IO_STATUS_ERROR || \ iostat == G_IO_STATUS_AGAIN) { \ if (tmp_error != NULL) { \ g_propagate_error(err, tmp_error); \ } \ return NULL; \ } \ } /* send command to server */ WRITE_OR_DIE_SANI(command_name, -1); WRITE_OR_DIE("\n", -1); if (args != NULL) { GList *keys, *li; /* oh god */ keys = glib_check_version(2, 14, 0) ? my_g_hash_table_get_keys(args) : g_hash_table_get_keys(args); for (li = keys; li != NULL; li = g_list_next(li)) { int i; gchar **value; WRITE_OR_DIE_SANI((gchar *) li->data, -1); value = g_hash_table_lookup(args, li->data); for (i = 0; value[i] != NULL; i++) { WRITE_OR_DIE("\t", -1); WRITE_OR_DIE_SANI(value[i], -1); } WRITE_OR_DIE("\n", -1); } g_list_free(keys); } WRITE_OR_DIE("done\n", -1); #undef WRITE_OR_DIE #undef WRITE_OR_DIE_SANI g_io_channel_flush(chan, &tmp_error); if (tmp_error != NULL) { g_propagate_error(err, tmp_error); return NULL; } /* now we have to read the data */ iostat = g_io_channel_read_line(chan, &line, NULL, NULL, &tmp_error); if (iostat == G_IO_STATUS_ERROR) { g_assert(line == NULL); g_propagate_error(err, tmp_error); return NULL; } else if (iostat == G_IO_STATUS_AGAIN) { g_assert(line == NULL); g_set_error(err, g_quark_from_static_string("dropbox command connection timed out"), 0, "dropbox command connection timed out"); return NULL; } else if (iostat == G_IO_STATUS_EOF) { g_assert(line == NULL); g_set_error(err, g_quark_from_static_string("dropbox command connection closed"), 0, "dropbox command connection closed"); return NULL; } /* if the response was okay */ if (strncmp(line, "ok\n", 3) == 0) { GHashTable *return_table = g_hash_table_new_full((GHashFunc) g_str_hash, (GEqualFunc) g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) g_strfreev); g_free(line); line = NULL; receive_args_until_done(chan, return_table, &tmp_error); if (tmp_error != NULL) { g_hash_table_destroy(return_table); g_propagate_error(err, tmp_error); return NULL; } return return_table; } /* otherwise */ else { /* read errors off until we get done */ do { g_free(line); line = NULL; /* clear string */ iostat = g_io_channel_read_line(chan, &line, NULL, NULL, &tmp_error); if (iostat == G_IO_STATUS_ERROR) { g_assert(line == NULL); g_propagate_error(err, tmp_error); return NULL; } else if (iostat == G_IO_STATUS_AGAIN) { g_assert(line == NULL); g_set_error(err, g_quark_from_static_string("dropbox command connection timed out"), 0, "dropbox command connection timed out"); return NULL; } else if (iostat == G_IO_STATUS_EOF) { g_assert(line == NULL); g_set_error(err, g_quark_from_static_string("dropbox command connection closed"), 0, "dropbox command connection closed"); return NULL; } /* we got our line */ } while (strncmp(line, "done\n", 5) != 0); g_free(line); return NULL; } }
static GQuark lua_expr_quark (void) { return g_quark_from_static_string ("lua-expression"); }
static inline GQuark lame_encoder_quark(void) { return g_quark_from_static_string("lame_encoder"); }
GQuark li_angel_call_error_quark(void) { return g_quark_from_static_string("angel-call-error-quark"); }
GQuark li_angel_connection_error_quark(void) { return g_quark_from_static_string("angel-connection-error-quark"); }
char* getGstBufferDataPointer(GstBuffer* buffer) { GstMiniObject* miniObject = reinterpret_cast<GstMiniObject*>(buffer); GstMapInfo* mapInfo = static_cast<GstMapInfo*>(gst_mini_object_get_qdata(miniObject, g_quark_from_static_string(webkitGstMapInfoQuarkString))); return reinterpret_cast<char*>(mapInfo->data); }
/** * The quark used for GError.domain. */ static inline GQuark pipe_output_quark(void) { return g_quark_from_static_string("pipe_output"); }
void unmapGstBuffer(GstBuffer* buffer) { GstMiniObject* miniObject = reinterpret_cast<GstMiniObject*>(buffer); GstMapInfo* mapInfo = static_cast<GstMapInfo*>(gst_mini_object_steal_qdata(miniObject, g_quark_from_static_string(webkitGstMapInfoQuarkString))); if (!mapInfo) return; gst_buffer_unmap(buffer, mapInfo); g_slice_free(GstMapInfo, mapInfo); }
GQuark gst_gl_context_error_quark (void) { return g_quark_from_static_string ("gst-gl-context-error-quark"); }
static void gst_xvidenc_class_init (GstXvidEncClass * klass) { GstElementClass *gstelement_class; GObjectClass *gobject_class; GParamSpec *pspec; gobject_class = G_OBJECT_CLASS (klass); gstelement_class = GST_ELEMENT_CLASS (klass); parent_class = g_type_class_peek_parent (klass); GST_DEBUG_CATEGORY_INIT (xvidenc_debug, "xvidenc", 0, "XviD encoder"); gobject_class->finalize = gst_xvidenc_finalize; gobject_class->set_property = gst_xvidenc_set_property; gobject_class->get_property = gst_xvidenc_get_property; /* prop handling */ xvidenc_prop_count = 0; xvidenc_pspec_quark = g_quark_from_static_string ("xvid-enc-param-spec-data"); pspec = g_param_spec_enum ("profile", "Profile", "XviD/MPEG-4 encoding profile", GST_TYPE_XVIDENC_PROFILE, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, profile); pspec = g_param_spec_enum ("quant-type", "Quantizer Type", "Quantizer type", GST_TYPE_XVIDENC_QUANT_TYPE, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, quant_type); pspec = g_param_spec_enum ("pass", "Encoding pass/type", "Encoding pass/type", GST_TYPE_XVIDENC_PASS, XVIDENC_CBR, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, pass); pspec = g_param_spec_int ("bitrate", "Bitrate", "[CBR|PASS2] Target video bitrate (bps)", 0, G_MAXINT, 1800000, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, bitrate); pspec = g_param_spec_int ("quantizer", "Quantizer", "[QUANT] Quantizer to apply for constant quantizer mode", 2, 31, 2, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, quant); pspec = g_param_spec_string ("statsfile", "Statistics Filename", "[PASS1|PASS2] Filename to store data for 2-pass encoding", "xvid-stats.log", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, filename); pspec = g_param_spec_int ("max-key-interval", "Max. Key Interval", "Maximum number of frames between two keyframes (< 0 is in sec)", -100, G_MAXINT, -10, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, max_key_interval); pspec = g_param_spec_boolean ("closed-gop", "Closed GOP", "Closed GOP", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, closed_gop); pspec = g_param_spec_int ("motion", "ME Quality", "Quality of Motion Estimation", 0, 6, 6, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, motion); pspec = g_param_spec_boolean ("me-chroma", "ME Chroma", "Enable use of Chroma planes for Motion Estimation", TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, me_chroma); pspec = g_param_spec_int ("me-vhq", "ME DCT/Frequency", "Extent in which to use DCT to minimize encoding length", 0, 4, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, me_vhq); pspec = g_param_spec_boolean ("me-quarterpel", "ME Quarterpel", "Use quarter pixel precision for motion vector search", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, me_quarterpel); pspec = g_param_spec_boolean ("lumimasking", "Lumimasking", "Enable lumimasking - apply more compression to dark or bright areas", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, lumimasking); pspec = g_param_spec_int ("max-bframes", "Max B-Frames", "Maximum B-frames in a row", 0, G_MAXINT, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, max_bframes); pspec = g_param_spec_int ("bquant-ratio", "B-quantizer ratio", "Ratio in B-frame quantizer computation", 0, 200, 150, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, bquant_ratio); pspec = g_param_spec_int ("bquant-offset", "B-quantizer offset", "Offset in B-frame quantizer computation", 0, 200, 100, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, bquant_offset); pspec = g_param_spec_int ("bframe-threshold", "B-Frame Threshold", "Higher threshold yields more chance that B-frame is used", -255, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, bframe_threshold); pspec = g_param_spec_boolean ("gmc", "Global Motion Compensation", "Allow generation of Sprite Frames for Pan/Zoom/Rotating images", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, gmc); pspec = g_param_spec_boolean ("trellis", "Trellis Quantization", "Enable Trellis Quantization", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, trellis); pspec = g_param_spec_boolean ("interlaced", "Interlaced Material", "Enable for interlaced video material", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, interlaced); pspec = g_param_spec_boolean ("cartoon", "Cartoon Material", "Adjust thresholds for flat looking cartoons", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, cartoon); pspec = g_param_spec_boolean ("greyscale", "Disable Chroma", "Do not write chroma data in encoded video", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, greyscale); pspec = g_param_spec_boolean ("hqacpred", "High quality AC prediction", "Enable high quality AC prediction", TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, hqacpred); pspec = g_param_spec_int ("max-iquant", "Max Quant I-Frames", "Upper bound for I-frame quantization", 0, 31, 31, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, max_iquant); pspec = g_param_spec_int ("min-iquant", "Min Quant I-Frames", "Lower bound for I-frame quantization", 0, 31, 2, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, min_iquant); pspec = g_param_spec_int ("max-pquant", "Max Quant P-Frames", "Upper bound for P-frame quantization", 0, 31, 31, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, max_pquant); pspec = g_param_spec_int ("min-pquant", "Min Quant P-Frames", "Lower bound for P-frame quantization", 0, 31, 2, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, min_pquant); pspec = g_param_spec_int ("max-bquant", "Max Quant B-Frames", "Upper bound for B-frame quantization", 0, 31, 31, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, max_bquant); pspec = g_param_spec_int ("min-bquant", "Min Quant B-Frames", "Lower bound for B-frame quantization", 0, 31, 2, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, min_bquant); pspec = g_param_spec_int ("reaction-delay-factor", "Reaction Delay Factor", "[CBR] Reaction delay factor", -1, 100, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, reaction_delay_factor); pspec = g_param_spec_int ("averaging-period", "Averaging Period", "[CBR] Number of frames for which XviD averages bitrate", -1, 100, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, averaging_period); pspec = g_param_spec_int ("buffer", "Buffer Size", "[CBR] Size of the video buffers", -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, buffer); pspec = g_param_spec_int ("keyframe-boost", "Keyframe boost", "[PASS2] Bitrate boost for keyframes", 0, 100, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, keyframe_boost); pspec = g_param_spec_int ("curve-compression-high", "Curve Compression High", "[PASS2] Shrink factor for upper part of bitrate curve", 0, 100, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, curve_compression_high); pspec = g_param_spec_int ("curve-compression-low", "Curve Compression Low", "[PASS2] Growing factor for lower part of bitrate curve", 0, 100, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, curve_compression_low); pspec = g_param_spec_int ("flow-control-strength", "Flow Control Strength", "[PASS2] Overflow control strength per frame", -1, 100, 5, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, overflow_control_strength); pspec = g_param_spec_int ("max-overflow-improvement", "Max Overflow Improvement", "[PASS2] Amount in % that flow control can increase frame size compared to ideal curve", -1, 100, 5, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, max_overflow_improvement); pspec = g_param_spec_int ("max-overflow-degradation", "Max Overflow Degradation", "[PASS2] Amount in % that flow control can decrease frame size compared to ideal curve", -1, 100, 5, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, max_overflow_degradation); pspec = g_param_spec_int ("keyframe-reduction", "Keyframe Reduction", "[PASS2] Keyframe size reduction in % of those within threshold", -1, 100, 20, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, kfreduction); pspec = g_param_spec_int ("keyframe-threshold", "Keyframe Threshold", "[PASS2] Distance between keyframes not to be subject to reduction", -1, 100, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, kfthreshold); pspec = g_param_spec_int ("container-frame-overhead", "Container Frame Overhead", "[PASS2] Average container overhead per frame", -1, 100, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gst_xvidenc_add_pspec (gobject_class, pspec, container_frame_overhead); gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_xvidenc_change_state); }
/* define the GError domain for Thrift protocols */ GQuark thrift_protocol_error_quark (void) { return g_quark_from_static_string (THRIFT_PROTOCOL_ERROR_DOMAIN); }
GQuark egg_desktop_file_error_quark (void) { return g_quark_from_static_string ("egg-desktop_file-error-quark"); }
GQuark eknc_domain_error_quark (void) { return g_quark_from_static_string ("eknc-domain-error-quark"); }
static GQuark rspamd_sqlite3_quark (void) { return g_quark_from_static_string ("rspamd-sqlite3"); }
GQuark my_intensity_box_error_quark (void) { return g_quark_from_static_string ("my-intensity-box-error-quark"); }
GQuark openvrml_xembed_error_quark() { return g_quark_from_static_string("openvrml-xembed-error-quark"); }
GQuark tracker_db_backup_error_quark (void) { return g_quark_from_static_string ("tracker-db-backup-error-quark"); }
* SECTION: gesextractable * @title: GESExtractable Interface * @short_description: An interface for objects which can be extracted from a GESAsset * * FIXME: Long description needed */ #include "ges-asset.h" #include "ges-internal.h" #include "ges-extractable.h" #include "ges-uri-clip.h" static GQuark ges_asset_key; G_DEFINE_INTERFACE_WITH_CODE (GESExtractable, ges_extractable, G_TYPE_INITIALLY_UNOWNED, ges_asset_key = g_quark_from_static_string ("ges-extractable-data")); static gchar * ges_extractable_check_id_default (GType type, const gchar * id, GError ** error) { return g_strdup (g_type_name (type)); } static GType ges_extractable_get_real_extractable_type_default (GType type, const gchar * id) { return type; } static GParameter * extractable_get_parameters_from_id (const gchar * id, guint * n_params)
static GQuark gvir_storage_pool_error_quark(void) { return g_quark_from_static_string("gvir-storage-pool"); }
static inline GQuark ffmpeg_quark(void) { return g_quark_from_static_string("ffmpeg"); }
static gboolean receive_args_until_done(GIOChannel *chan, GHashTable *return_table, GError **err) { GIOStatus iostat; GError *tmp_error = NULL; guint numargs = 0; while (1) { gchar *line; gsize term_pos; /* if we are getting too many args, connection could be malicious */ if (numargs >= 20) { g_set_error(err, g_quark_from_static_string("malicious connection"), 0, "malicious connection"); return FALSE; } /* get the string */ iostat = g_io_channel_read_line(chan, &line, NULL, &term_pos, &tmp_error); if (iostat == G_IO_STATUS_ERROR || tmp_error != NULL) { g_free(line); if (tmp_error != NULL) { g_propagate_error(err, tmp_error); } return FALSE; } else if (iostat == G_IO_STATUS_EOF) { g_free(line); g_set_error(err, g_quark_from_static_string("connection closed"), 0, "connection closed"); return FALSE; } *(line+term_pos) = '\0'; if (strcmp("done", line) == 0) { g_free(line); break; } else { gboolean parse_result; parse_result = dropbox_client_util_command_parse_arg(line, return_table); g_free(line); if (FALSE == parse_result) { g_set_error(err, g_quark_from_static_string("parse error"), 0, "parse error"); return FALSE; } } numargs += 1; } return TRUE; }
GQuark remote_phone_control_error_quark (void) { return g_quark_from_static_string ("remote_phone_control_error-quark"); }
GQuark ags_soundcard_error_quark() { return(g_quark_from_static_string("ags-soundcard-error-quark\0")); }
* By default EggSpreadTableDnd accepts drops from only the same table * * To disable dropping completely in a spread table, use egg_spread_table_set_drop_enabled(). */ dnd_table_signals[SIGNAL_DROP_POSSIBLE] = g_signal_new ("widget-drop-possible", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (EggSpreadTableDndClass, widget_drop_possible), boolean_handled_accumulator, NULL, _egg_marshal_BOOLEAN__OBJECT_POINTER, G_TYPE_BOOLEAN, 2, GTK_TYPE_WIDGET, G_TYPE_POINTER); dnd_target_atom_child = gdk_atom_intern_static_string (dnd_targets[0].target); dnd_table_child_quark = g_quark_from_static_string ("egg-spread-table-dnd-child"); dnd_table_connected_quark = g_quark_from_static_string ("egg-spread-table-dnd-connected"); g_type_class_add_private (class, sizeof (EggSpreadTableDndPrivate)); } static void egg_spread_table_dnd_init (EggSpreadTableDnd *spread_table) { EggSpreadTableDndPrivate *priv; spread_table->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (spread_table, EGG_TYPE_SPREAD_TABLE_DND, EggSpreadTableDndPrivate); /* Setup the spread table as a drag target for our target type */ gtk_drag_dest_set (GTK_WIDGET (spread_table),
static GQuark obex_io_error_quark(void) { return g_quark_from_static_string("obex-io-error-quark"); }
static GstFlowReturn gst_rtp_ac3_pay_flush (GstRtpAC3Pay * rtpac3pay) { guint avail, FT, NF, mtu; GstBuffer *outbuf; GstFlowReturn ret; /* the data available in the adapter is either smaller * than the MTU or bigger. In the case it is smaller, the complete * adapter contents can be put in one packet. In the case the * adapter has more than one MTU, we need to split the AC3 data * over multiple packets. */ avail = gst_adapter_available (rtpac3pay->adapter); ret = GST_FLOW_OK; FT = 0; /* number of frames */ NF = rtpac3pay->NF; mtu = GST_RTP_BASE_PAYLOAD_MTU (rtpac3pay); GST_LOG_OBJECT (rtpac3pay, "flushing %u bytes", avail); while (avail > 0) { guint towrite; guint8 *payload; guint payload_len; guint packet_len; GstRTPBuffer rtp = { NULL, }; GstBuffer *payload_buffer; /* this will be the total length of the packet */ packet_len = gst_rtp_buffer_calc_packet_len (2 + avail, 0, 0); /* fill one MTU or all available bytes */ towrite = MIN (packet_len, mtu); /* this is the payload length */ payload_len = gst_rtp_buffer_calc_payload_len (towrite, 0, 0); /* create buffer to hold the payload */ outbuf = gst_rtp_buffer_new_allocate (2, 0, 0); if (FT == 0) { /* check if it all fits */ if (towrite < packet_len) { guint maxlen; GST_LOG_OBJECT (rtpac3pay, "we need to fragment"); /* check if we will be able to put at least 5/8th of the total * frame in this first frame. */ if ((avail * 5) / 8 >= (payload_len - 2)) FT = 1; else FT = 2; /* check how many fragments we will need */ maxlen = gst_rtp_buffer_calc_payload_len (mtu - 2, 0, 0); NF = (avail + maxlen - 1) / maxlen; } } else if (FT != 3) { /* remaining fragment */ FT = 3; } /* * 0 1 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | MBZ | FT| NF | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * FT: 0: one or more complete frames * 1: initial 5/8 fragment * 2: initial fragment not 5/8 * 3: other fragment * NF: amount of frames if FT = 0, else number of fragments. */ gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp); GST_LOG_OBJECT (rtpac3pay, "FT %u, NF %u", FT, NF); payload = gst_rtp_buffer_get_payload (&rtp); payload[0] = (FT & 3); payload[1] = NF; payload_len -= 2; if (avail == payload_len) gst_rtp_buffer_set_marker (&rtp, TRUE); gst_rtp_buffer_unmap (&rtp); payload_buffer = gst_adapter_take_buffer_fast (rtpac3pay->adapter, payload_len); gst_rtp_copy_meta (GST_ELEMENT_CAST (rtpac3pay), outbuf, payload_buffer, g_quark_from_static_string (GST_META_TAG_AUDIO_STR)); outbuf = gst_buffer_append (outbuf, payload_buffer); avail -= payload_len; GST_BUFFER_PTS (outbuf) = rtpac3pay->first_ts; GST_BUFFER_DURATION (outbuf) = rtpac3pay->duration; ret = gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (rtpac3pay), outbuf); } return ret; }