type
stringclasses
5 values
content
stringlengths
9
163k
functions
gint gtk_menu_get_monitor (GtkMenu *menu) { GtkMenuPrivate *priv; g_return_val_if_fail (GTK_IS_MENU (menu), -1); priv = gtk_menu_get_private (menu); return priv->monitor_num; }
functions
void gtk_menu_grab_notify (GtkWidget *widget, gboolean was_grabbed) { GtkWidget *toplevel; GtkWindowGroup *group; GtkWidget *grab; toplevel = gtk_widget_get_toplevel (widget); group = gtk_window_get_group (GTK_WINDOW (toplevel)); grab = _gtk_window_group_get_current_grab (group); if (!was_gra...
functions
void gtk_menu_set_reserve_toggle_size (GtkMenu *menu, gboolean reserve_toggle_size) { GtkMenuPrivate *priv = gtk_menu_get_private (menu); gboolean no_toggle_size; no_toggle_size = !reserve_toggle_size; if (priv->no_toggle_size != no_toggle_size) { priv->no_toggl...
functions
gboolean gtk_menu_get_reserve_toggle_size (GtkMenu *menu) { GtkMenuPrivate *priv = gtk_menu_get_private (menu); return !priv->no_toggle_size; }
includes
#include <framework/mlt.h>
includes
#include <stdlib.h>
includes
#include <string.h>
includes
#include <pthread.h>
includes
#include <stdio.h>
includes
#include <sys/types.h>
includes
#include <fcntl.h>
includes
#include <errno.h>
includes
#include <unistd.h>
includes
#include <winsock2.h>
includes
#include <arpa/inet.h>
includes
#include <strings.h>
includes
#include <sys/types.h>
includes
#include <sys/socket.h>
includes
#include <netdb.h>
includes
#include <net/if.h>
includes
#include <sys/time.h>
includes
#include <time.h>
defines
#define CBRTS_BSD_SOCKETS 1
defines
#define TSP_BYTES (188)
defines
#define MAX_PID (8192)
defines
#define SCR_HZ (27000000ULL)
defines
#define NULL_PID (0x1fff)
defines
#define PAT_PID (0)
defines
#define SDT_PID (0x11)
defines
#define PCR_SMOOTHING (12)
defines
#define PCR_PERIOD_MS (20)
defines
#define RTP_BYTES (12)
defines
#define UDP_MTU (RTP_BYTES + TSP_BYTES * 7)
defines
#define REMUX_BUFFER_MIN (10)
defines
#define REMUX_BUFFER_MAX (50)
defines
#define UDP_BUFFER_MINIMUM (100)
defines
#define UDP_BUFFER_DEFAULT (1000)
defines
#define RTP_VERSION (2)
defines
#define RTP_PAYLOAD (33)
defines
#define RTP_HZ (90000)
defines
#define PIDOF( packet ) ( ntohs( *( ( uint16_t* )( packet + 1 ) ) ) & 0x1fff )
defines
#define HASPCR( packet ) ( (packet[3] & 0x20) && (packet[4] != 0) && (packet[5] & 0x10) )
defines
#define CCOF( packet ) ( packet[3] & 0x0f )
defines
#define ADAPTOF( packet ) ( ( packet[3] >> 4 ) & 0x03 )
structs
struct consumer_cbrts_s { struct mlt_consumer_s parent; mlt_consumer avformat; pthread_t thread; int joined; int running; mlt_position last_position; mlt_event event_registered; int fd; uint8_t *leftover_data[TSP_BYTES]; int leftover_size; mlt_deque tsp_packets; uint64_t previous_pcr; uint64_t previous_pac...
functions
mlt_consumer consumer_cbrts_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { consumer_cbrts self = calloc( sizeof( struct consumer_cbrts_s ), 1 ); if ( self && mlt_consumer_init( &self->parent, self, profile ) == 0 ) { // Get the parent consumer object mlt_consumer parent = &self->...
functions
void load_sections( consumer_cbrts self, mlt_properties properties ) { int n = mlt_properties_count( properties ); // Store the sections with automatic cleanup // and make it easy to iterate over the data sections. mlt_properties si_properties = mlt_properties_get_data( properties, "si.properties", NULL ); if ( !...
functions
void write_section( consumer_cbrts self, ts_section *section ) { uint8_t *packet; const uint8_t *data_ptr = section->data; uint8_t *p; int size = section->size; int first, len; while ( size > 0 ) { first = ( section->data == data_ptr ); p = packet = malloc( TSP_BYTES ); *p++ = 0x47; *p = ( section->pid ...
functions
void write_sections( consumer_cbrts self ) { mlt_properties properties = mlt_properties_get_data( MLT_CONSUMER_PROPERTIES( &self->parent ), "si.properties", NULL ); if ( properties ) { int n = mlt_properties_count( properties ); while ( n-- ) { ts_section *section = mlt_properties_get_data_at( properties, ...
functions
uint64_t get_pcr( uint8_t *packet ) { uint64_t pcr = 0; pcr += (uint64_t) packet[6] << 25; pcr += packet[7] << 17; pcr += packet[8] << 9; pcr += packet[9] << 1; pcr += packet[10] >> 7; pcr *= 300; // convert 90KHz to 27MHz pcr += (packet[10] & 0x01) << 8; pcr += packet[11]; return pcr; }
functions
void set_pcr( uint8_t *packet, uint64_t pcr ) { uint64_t pcr_base = pcr / 300; uint64_t pcr_ext = pcr % 300; packet[6] = pcr_base >> 25; packet[7] = pcr_base >> 17; packet[8] = pcr_base >> 9; packet[9] = pcr_base >> 1; packet[10] = (( pcr_base & 1 ) << 7) | 0x7E | (( pcr_ext & 0x100 ) >> 8); packet[11] = pc...
functions
uint64_t update_pcr( consumer_cbrts self, uint64_t muxrate, unsigned packets ) { return self->previous_pcr + packets * TSP_BYTES * 8 * SCR_HZ / muxrate; }
functions
uint32_t get_rtp_timestamp( consumer_cbrts self ) { return self->rtp_counter++ * self->udp_packet_size * 8 * RTP_HZ / self->muxrate; }
functions
double measure_bitrate( consumer_cbrts self, uint64_t pcr, int drop ) { double muxrate = 0; if ( self->is_stuffing_set || self->previous_pcr ) { muxrate = ( self->packet_count - self->previous_packet_count - drop ) * TSP_BYTES * 8; if ( pcr >= self->previous_pcr ) muxrate /= (double) ( pcr - self->previous_p...
functions
int writen( consumer_cbrts self, const void *buf, size_t count ) { int result = 0; int written = 0; while ( written < count ) { if ( ( result = write( self->fd, buf + written, count - written ) ) < 0 ) { mlt_log_error( MLT_CONSUMER_SERVICE(&self->parent), "Failed to write: %s\n", strerror( errno ) ); brea...
functions
int sendn( consumer_cbrts self, const void *buf, size_t count ) { int result = 0; #ifdef CBRTS_BSD_SOCKETS int written = 0; while ( written < count ) { result = sendto(self->fd, buf + written, count - written, 0, self->addr->ai_addr, self->addr->ai_addrlen); if ( result < 0 ) { mlt_log_error( MLT_CONSU...
functions
int write_udp( consumer_cbrts self, const void *buf, size_t count ) { int result = 0; #ifdef CBRTS_BSD_SOCKETS if ( !self->timer.tv_sec ) clock_gettime( CLOCK_MONOTONIC, &self->timer ); self->femto_counter += self->femto_per_packet; self->timer.tv_nsec += self->femto_counter / 1000000; self->femto_counter = se...
functions
int create_socket( consumer_cbrts self ) { int result = -1; #ifdef CBRTS_BSD_SOCKETS struct addrinfo hints = {0}
functions
else if ( addr->ai_addr->sa_family == AF_INET6 ) { result = setsockopt( self->fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &ttl, sizeof(ttl) ); }
functions
else if ( addr->ai_addr->sa_family == AF_INET6 ) { result = setsockopt( self->fd, IPPROTO_IPV6, IPV6_MULTICAST_IF, &iface, sizeof(iface) ); }
functions
int enqueue_udp( consumer_cbrts self, const void *buf, size_t count ) { // Append TSP to the UDP packet. memcpy( &self->udp_packet[self->udp_bytes], buf, count ); self->udp_bytes = ( self->udp_bytes + count ) % self->udp_packet_size; // Send the UDP packet. if ( !self->udp_bytes ) { size_t offset = self->rtp_s...
functions
int insert_pcr( consumer_cbrts self, uint16_t pid, uint8_t cc, uint64_t pcr ) { uint8_t packet[ TSP_BYTES ]; uint8_t *p = packet; *p++ = 0x47; *p++ = pid >> 8; *p++ = pid; *p++ = 0x20 | cc; // Adaptation only // Continuity Count field does not increment (see 13818-1 section 2.4.3.3) *p...
functions
int output_cbr( consumer_cbrts self, uint64_t input_rate, uint64_t output_rate, uint64_t *pcr ) { int n = mlt_deque_count( self->tsp_packets ); unsigned output_packets = 0; unsigned packets_since_pcr = 0; int result = 0; int dropped = 0; int warned = 0; uint16_t pcr_pid = 0; uint8_t cc = 0xff; float ms_since_p...
functions
wrapping if ( last_input_counter > input_counter ) { last_input_counter -= self->output_counter; self->output_counter = 0; input_counter = last_input_counter + TSP_BYTES * 8 * input_rate; }
functions
void get_pmt_pid( consumer_cbrts self, uint8_t *packet ) { // Skip 5 bytes of TSP header + 8 bytes of section header + 2 bytes of service ID uint16_t *p = ( uint16_t* )( packet + 5 + 8 + 2 ); self->pmt_pid = ntohs( p[0] ) & 0x1fff; mlt_log_debug(NULL, "PMT PID 0x%04x\n", self->pmt_pid ); return; }
functions
int remux_packet( consumer_cbrts self, uint8_t *packet ) { mlt_service service = MLT_CONSUMER_SERVICE( &self->parent ); uint16_t pid = PIDOF( packet ); int result = 0; write_sections( self ); // Sanity checks if ( packet[0] != 0x47 ) { mlt_log_panic( service, "NOT SYNC BYTE 0x%02x\n", packet[0] ); exit(1);...
functions
void start_output_thread( consumer_cbrts self ) { int rtprio = mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( &self->parent ), "udp.rtprio" ); self->thread_running = 1; if ( rtprio > 0 ) { // Use realtime priority class struct sched_param priority; pthread_attr_t thread_attributes; pthread_attr_init( &thr...
functions
void stop_output_thread( consumer_cbrts self ) { self->thread_running = 0; // Broadcast to the condition in case it's waiting. pthread_mutex_lock( &self->udp_deque_mutex ); pthread_cond_broadcast( &self->udp_deque_cond ); pthread_mutex_unlock( &self->udp_deque_mutex ); // Join the thread. pthread_join( self->o...
functions
int filter_packet( consumer_cbrts self, uint8_t *packet ) { uint16_t pid = PIDOF( packet ); // We are going to keep the existing PMT; replace all other signaling sections. int result = ( pid == NULL_PID ) || ( pid == PAT_PID && self->is_si_pat ) || ( pid == self->pmt_pid && self->is_si_pmt ) ...
functions
void filter_remux_or_write_packet( consumer_cbrts self, uint8_t *packet ) { int remux = !mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( &self->parent ), "noremux" ); // Filter out packets if ( remux ) { if ( !filter_packet( self, packet ) ) remux_packet( self, packet ); else free( packet ); }
functions
void on_data_received( mlt_properties properties, mlt_consumer consumer, uint8_t *buf, int size ) { if ( size > 0 ) { consumer_cbrts self = (consumer_cbrts) consumer->child; // Sanity check if ( self->leftover_size == 0 && buf[0] != 0x47 ) { mlt_log_verbose(MLT_CONSUMER_SERVICE( consumer ), "NOT SYNC BYTE...
functions
int consumer_start( mlt_consumer parent ) { consumer_cbrts self = parent->child; if ( !self->running ) { mlt_properties properties = MLT_CONSUMER_PROPERTIES( parent ); mlt_properties avformat = MLT_CONSUMER_PROPERTIES(self->avformat); // Cleanup after a possible abort consumer_stop( parent ); // Pass pr...
functions
int consumer_stop( mlt_consumer parent ) { // Get the actual object consumer_cbrts self = parent->child; if ( !self->joined ) { mlt_properties properties = MLT_CONSUMER_PROPERTIES( parent ); int app_locked = mlt_properties_get_int( properties, "app_locked" ); void ( *lock )( void ) = mlt_properties_get_data(...
functions
int consumer_is_stopped( mlt_consumer parent ) { consumer_cbrts self = parent->child; return !self->running; }
functions
to while( self->running ) { // Get a frame from the attached producer frame = mlt_consumer_rt_frame( consumer ); // Ensure that we have a frame if ( self->running && frame ) { if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "rendered" ) != 1 ) { mlt_frame_close( frame ); mlt_log_w...
functions
latency if ( speed == 1.0 ) { if ( last_position != -1 && last_position + 1 != mlt_frame_get_position( frame ) ) mlt_consumer_purge( self->avformat ); last_position = mlt_frame_get_position( frame ); }
functions
void consumer_close( mlt_consumer parent ) { // Get the actual object consumer_cbrts self = parent->child; // Stop the consumer mlt_consumer_stop( parent ); // Close the child consumers mlt_consumer_close( self->avformat ); // Now clean up the rest mlt_deque_close( self->tsp_packets ); mlt_deque_close( self...
includes
#include <complex.h>
includes
#include <math.h>
includes
#include <unistd.h>
includes
#include <stdlib.h>
includes
#include <assert.h>
includes
#include <sys/time.h>
includes
#include <starpu.h>
includes
#include <starpu_config.h>
includes
#include <fftw3.h>
defines
#define SIGN (-1)
functions
else if (argc == 3) { n = atoi(argv[1]); m = atoi(argv[2]); /* 2D */ size = n * m; }
functions
else if (argc == 3) { fftw_plan = _FFTW(plan_dft_2d)(n, m, in, out_fftw, SIGN, FFTW_ESTIMATE); }
main
int main(int argc, char *argv[]) { int i; struct timeval begin, end; int size; size_t bytes; int n = 0, m = 0; _FFTW(plan) fftw_plan; double timing; char *num; int num_threads = 1; _FFTW(init_threads)(); num = getenv("NUM_THREADS"); if (num) num_threads = atoi(num); _FFTW(plan_with_nthreads)(num_thread...
defines
#define TB_TRACE_MODULE_NAME "oc_number"
defines
#define TB_TRACE_MODULE_DEBUG (0)
functions
tb_object_ref_t tb_oc_number_copy(tb_object_ref_t object) { // check tb_oc_number_t* number = (tb_oc_number_t*)object; tb_assert_and_check_return_val(number, tb_null); // copy switch (number->type) { case TB_OC_NUMBER_TYPE_UINT64: return tb_oc_number_init_from_uint64(number->v.u64);...
functions
tb_void_t tb_oc_number_exit(tb_object_ref_t object) { if (object) tb_free(object); }
functions
tb_void_t tb_oc_number_clear(tb_object_ref_t object) { // check tb_oc_number_t* number = (tb_oc_number_t*)object; tb_assert_and_check_return(number); // clear switch (number->type) { case TB_OC_NUMBER_TYPE_UINT64: number->v.u64 = 0; break; case TB_OC_NUMBER_TYPE_SINT64: ...
functions
tb_object_ref_t tb_oc_number_init_from_uint8(tb_uint8_t value) { // make tb_oc_number_t* number = tb_oc_number_init_base(); tb_assert_and_check_return_val(number, tb_null); // init value number->type = TB_OC_NUMBER_TYPE_UINT8; number->v.u8 = value; // ok return (tb_object_ref_t)number;...
functions
tb_object_ref_t tb_oc_number_init_from_sint8(tb_sint8_t value) { // make tb_oc_number_t* number = tb_oc_number_init_base(); tb_assert_and_check_return_val(number, tb_null); // init value number->type = TB_OC_NUMBER_TYPE_SINT8; number->v.s8 = value; // ok return (tb_object_ref_t)number;...
functions
tb_object_ref_t tb_oc_number_init_from_uint16(tb_uint16_t value) { // make tb_oc_number_t* number = tb_oc_number_init_base(); tb_assert_and_check_return_val(number, tb_null); // init value number->type = TB_OC_NUMBER_TYPE_UINT16; number->v.u16 = value; // ok return (tb_object_ref_t)num...
functions
tb_object_ref_t tb_oc_number_init_from_sint16(tb_sint16_t value) { // make tb_oc_number_t* number = tb_oc_number_init_base(); tb_assert_and_check_return_val(number, tb_null); // init value number->type = TB_OC_NUMBER_TYPE_SINT16; number->v.s16 = value; // ok return (tb_object_ref_t)num...
functions
tb_object_ref_t tb_oc_number_init_from_uint32(tb_uint32_t value) { // make tb_oc_number_t* number = tb_oc_number_init_base(); tb_assert_and_check_return_val(number, tb_null); // init value number->type = TB_OC_NUMBER_TYPE_UINT32; number->v.u32 = value; // ok return (tb_object_ref_t)num...