/** * Write value to the database file, possibly caching it and deferring write. * * Any registered value cleanup callback will be invoked right after the value * is written to disk (for immediated writes) or removed from the cache (for * deferred writes). * * @param dw the DBM wrapper * @param key the key (constant-width, determined at open time) * @param value the start of the value in memory * @param length length of the value */ void dbmw_write(dbmw_t *dw, gconstpointer key, gpointer value, size_t length) { struct cached *entry; dbmw_check(dw); g_assert(key); g_assert(length <= dw->value_size); g_assert(length || value == NULL); g_assert(length == 0 || value); dw->w_access++; entry = map_lookup(dw->values, key); if (entry) { if (entry->dirty) dw->w_hits++; else if (entry->absent) dw->count_needs_sync = TRUE; /* Key exists now */ fill_entry(dw, entry, value, length); hash_list_moveto_tail(dw->keys, key); } else if (dw->max_cached > 1) { entry = allocate_entry(dw, key, NULL); fill_entry(dw, entry, value, length); dw->count_needs_sync = TRUE; /* Does not know whether key exists */ } else { write_immediately(dw, key, value, length); } }
/** * Write value to the database file, possibly caching it and deferring write. * * Any registered value cleanup callback will be invoked right after the value * is written to disk (for immediated writes) or removed from the cache (for * deferred writes). * * @param dw the DBM wrapper * @param key the key (constant-width, determined at open time) * @param value the start of the value in memory * @param length length of the value */ void dbmw_write(dbmw_t *dw, const void *key, void *value, size_t length) { struct cached *entry; dbmw_check(dw); g_assert(key); g_assert(length <= dw->value_size); g_assert(length || value == NULL); g_assert(length == 0 || value); dw->w_access++; entry = map_lookup(dw->values, key); if (entry) { if (dbg_ds_debugging(dw->dbg, 2, DBG_DSF_CACHING | DBG_DSF_UPDATE)) { dbg_ds_log(dw->dbg, dw, "%s: %s key=%s%s", G_STRFUNC, entry->dirty ? "dirty" : "clean", dbg_ds_keystr(dw->dbg, key, (size_t) -1), entry->absent ? " (was absent)" : ""); } if (entry->dirty) dw->w_hits++; if (entry->absent) dw->cached++; /* Key exists now, in unflushed status */ fill_entry(dw, entry, value, length); hash_list_moveto_tail(dw->keys, key); } else if (dw->max_cached > 1) { if (dbg_ds_debugging(dw->dbg, 2, DBG_DSF_CACHING | DBG_DSF_UPDATE)) { dbg_ds_log(dw->dbg, dw, "%s: deferring key=%s", G_STRFUNC, dbg_ds_keystr(dw->dbg, key, (size_t) -1)); } entry = allocate_entry(dw, key, NULL); fill_entry(dw, entry, value, length); dw->count_needs_sync = TRUE; /* Does not know whether key exists */ } else { if (dbg_ds_debugging(dw->dbg, 2, DBG_DSF_CACHING | DBG_DSF_UPDATE)) { dbg_ds_log(dw->dbg, dw, "%s: writing key=%s", G_STRFUNC, dbg_ds_keystr(dw->dbg, key, (size_t) -1)); } write_immediately(dw, key, value, length); } }
int fuse_reply_create(fuse_req_t req, const struct fuse_entry_param *e, const struct fuse_file_info *f) { struct { struct fuse_entry_out e; struct fuse_open_out o; } arg; memset(&arg, 0, sizeof(arg)); fill_entry(&arg.e, e); #ifdef POSIXACLS if (req->f->conn.proto_minor < 12) { fill_open((struct fuse_open_out*) ((char*)&arg + FUSE_COMPAT_ENTRY_OUT_SIZE), f); return send_reply_ok(req, &arg, FUSE_COMPAT_ENTRY_OUT_SIZE + sizeof(struct fuse_open_out)); } else { fill_open(&arg.o, f); return send_reply_ok(req, &arg, sizeof(arg)); } #else fill_open(&arg.o, f); return send_reply_ok(req, &arg, sizeof(arg)); #endif }
int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e) { struct fuse_entry_out arg; /* before ABI 7.4 e->ino == 0 was invalid, only ENOENT meant negative entry */ if (!e->ino && req->f->conn.proto_minor < 4) return fuse_reply_err(req, ENOENT); memset(&arg, 0, sizeof(arg)); fill_entry(&arg, e); return send_reply_ok(req, &arg, sizeof(arg)); }
int fuse_reply_create(fuse_req_t req, const struct fuse_entry_param *e, const struct fuse_file_info *f) { struct { struct fuse_entry_out e; struct fuse_open_out o; } arg; memset(&arg, 0, sizeof(arg)); fill_entry(&arg.e, e); fill_open(&arg.o, f); return send_reply_ok(req, &arg, sizeof(arg)); }
int fuse_reply_create(fuse_req_t req, const struct fuse_entry_param *e, const struct fuse_file_info *f) { char buf[sizeof(struct fuse_entry_out) + sizeof(struct fuse_open_out)]; size_t entrysize = req->f->conn.proto_minor < 9 ? FUSE_COMPAT_ENTRY_OUT_SIZE : sizeof(struct fuse_entry_out); struct fuse_entry_out *earg = (struct fuse_entry_out *) buf; struct fuse_open_out *oarg = (struct fuse_open_out *) (buf + entrysize); memset(buf, 0, sizeof(buf)); fill_entry(earg, e); fill_open(oarg, f); return send_reply_ok(req, buf, entrysize + sizeof(struct fuse_open_out)); }
/** * Delete key from database. */ void dbmw_delete(dbmw_t *dw, gconstpointer key) { struct cached *entry; dbmw_check(dw); g_assert(key); dw->w_access++; entry = map_lookup(dw->values, key); if (entry) { if (entry->dirty) dw->w_hits++; if (!entry->absent) { dw->count_needs_sync = TRUE; /* Deferred delete */ fill_entry(dw, entry, NULL, 0); entry->absent = TRUE; } hash_list_moveto_tail(dw->keys, key); } else { dw->ioerr = FALSE; dbmap_remove(dw->dm, key); if (dbmap_has_ioerr(dw->dm)) { dw->ioerr = TRUE; dw->error = errno; g_warning("DBMW \"%s\" I/O error whilst deleting key: %s", dw->name, dbmap_strerror(dw->dm)); } /* * If the maximum value length of the DB is 0, then it is used as a * "search table" only, meaning there will be no read to get values, * only existence checks. * * Therefore, it makes sense to cache that the key is no longer valid. * Otherwise, possibly pushing a value out of the cache to record * a deletion is not worth it. */ if (0 == dw->value_size) { WALLOC0(entry); entry->absent = TRUE; (void) allocate_entry(dw, key, entry); } } }
int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e) { struct fuse_entry_out arg; /* before ABI 7.4 e->ino == 0 was invalid, only ENOENT meant negative entry */ if (!e->ino && req->f->conn.proto_minor < 4) return fuse_reply_err(req, ENOENT); memset(&arg, 0, sizeof(arg)); fill_entry(&arg, e); #ifdef POSIXACLS return send_reply_ok(req, &arg, (req->f->conn.proto_minor >= 12 ? sizeof(arg) : FUSE_COMPAT_ENTRY_OUT_SIZE)); #else return send_reply_ok(req, &arg, sizeof(arg)); #endif }
struct dvb_file *read_dvb_file(const char *fname) { char *buf = NULL, *p, *key, *value; size_t size = 0; int len = 0; int line = 0, rc; struct dvb_file *dvb_file; FILE *fd; struct dvb_entry *entry = NULL; char err_msg[80]; dvb_file = calloc(sizeof(*dvb_file), 1); if (!dvb_file) { perror("Allocating memory for dvb_file"); return NULL; } fd = fopen(fname, "r"); if (!fd) { perror(fname); return NULL; } do { len = getline(&buf, &size, fd); if (len <= 0) break; line++; p = buf; while (*p == ' ' || *p == '\t') p++; if (*p == '\n' || *p == '#' || *p == '\a' || *p == '\0') continue; if (*p == '[') { /* NEW Entry */ if (!entry) { dvb_file->first_entry = calloc(sizeof(*entry), 1); entry = dvb_file->first_entry; } else { entry->next = calloc(sizeof(*entry), 1); entry = entry->next; } entry->sat_number = -1; p++; p = strtok(p, "]"); if (!p) { sprintf(err_msg, "Missing channel group"); goto error; } if (!strcasecmp(p, CHANNEL)) p += strlen(CHANNEL); while (*p == ' ' || *p == '\t') p++; if (*p) { entry->channel = calloc(strlen(p) + 1, 1); strcpy(entry->channel, p); } } else { if (!entry) { sprintf(err_msg, "key/value without a channel group"); goto error; } key = strtok(p, "="); if (!key) { sprintf(err_msg, "missing key"); goto error; } p = &key[strlen(key) - 1]; while ((p > key) && (*(p - 1) == ' ' || *(p - 1) == '\t')) p--; *p = 0; value = strtok(NULL, "\n"); if (!value) { sprintf(err_msg, "missing value"); goto error; } while (*value == ' ' || *value == '\t') value++; rc = fill_entry(entry, key, value); if (rc == -2) { sprintf(err_msg, "value %s is invalid for %s", value, key); goto error; } else if (rc == -2) { sprintf(err_msg, "key %s is unknown", key); goto error; } } } while (1); fclose(fd); return dvb_file; error: fprintf (stderr, "ERROR %s while parsing line %d of %s\n", err_msg, line, fname); dvb_file_free(dvb_file); fclose(fd); return NULL; };
void jumpTableEntry::initialize_as_unused(int index) { fill_entry(halt_instruction, (char*) index, unused_entry); }
int main(int argc, char* argv[]){ uint32_t temp; int a,i,nb,npart,mf,first,pemplacement=0; char* name; disk_id* id; error e; block *block0; // block* block_navigation = malloc(sizeof(block)); //block *block_file_table; TTTFS_File_Table_Entry* entry_root = malloc(sizeof(TTTFS_File_Table_Entry)); if (argc < 5){ fprintf(stderr, "Error : wrong number of arguments.\n"); return -1; } name = malloc(sizeof(char)); strcpy(name,"disk.tfs"); nb = argc; // Si le nombre d'argument est pair, i.e le nom du disque est indiqué if (argc % 2 == 0) { strcpy(name,argv[argc-1]); nb--; } //recuperation du numero de la partition if (strcmp(argv[1],"-p") != 0){ fprintf(stderr, "Error : wrong option mode \"-p\" .\n"); return -1; } npart=atoi(argv[2]); //recuperation du nombre de file demandé if (strcmp(argv[3],"-mf") != 0){ fprintf(stderr, "Error : wrong option mode \"-mf\".\n"); return -1; } mf=atoi(argv[4]); //démarage du disque id = malloc(sizeof(disk_id)); e = start_disk(name,id); if (e.val != 0){ fprintf(stderr, "Error while reading disk.\n"); return -1; } //recuperation du block 0 block0 = malloc(sizeof(block)); read_block(id,block0,0); //verification de l'existance de la partition memcpy(&temp,(block0->octets)+(sizeof(uint32_t)),sizeof(uint32_t)); if ((a=uitoi(temp))< npart) { fprintf(stderr, "Non-existing partition number .\n"); return -1; } //recuperation du decalage de la partition for (i=0; i<npart; i++) { memcpy(&temp,(block0->octets)+((2+i)*sizeof(uint32_t)),sizeof(uint32_t)); pemplacement+=uitoi(temp); } pemplacement++; //printf("decalage pour part: %i \n",pemplacement); //mise à jour de l'entête de la partition memcpy(&temp,(block0->octets) + ((npart+2)*sizeof(uint32_t)),sizeof(uint32_t)); a=uitoi(temp); //printf("a:%i\n",a); first = 2+(mf/FILE_TABLE_BLOCK_SIZE); if (a-first<0) {// file count trop grand fprintf(stderr, "Error file_count too big .\n"); return -1; } else if(a-first<mf){//file count trop grand mais tiens dans la memoire fprintf(stderr, "file_count of %i too big for this partition .\n",mf); mf=a-first; printf("changing file_count to %i\n",mf); } //printf("cas n : \n\t mf/ftb:%i \n\t mf:%i \n\t first:%i \n\t a:%i\n",mf/FILE_TABLE_BLOCK_SIZE+1,mf,first,a); read_block(id,block0,pemplacement); //first = 2+(mf/FILE_TABLE_BLOCK_SIZE); a-=first; //printf("a : %i\n",a); temp = itoui(a);//nombre de blocks libres memcpy((block0->octets) + (3*sizeof(uint32_t)),&temp,sizeof(uint32_t)); temp = itoui(first); // premier block libre memcpy((block0->octets) + (4*sizeof(uint32_t)),&temp,sizeof(uint32_t)); // le nombre de fichiers supportables if (a<mf) {// verification du nombre de fichier max temp = itoui(a); } else{ temp = itoui(mf); //printf("temp: %i\n",temp); } memcpy((block0->octets) + (5*sizeof(uint32_t)),&temp,sizeof(uint32_t)); // le nombre de fichiers actuellement libres if (a<mf) {// verification du nombre de fichier max temp = itoui(a); } else{ temp = itoui(mf); } memcpy((block0->octets) + (6*sizeof(uint32_t)),&temp,sizeof(uint32_t)); temp = itoui(0); // le numero du premier fichier libre du volume memcpy((block0->octets) + (7*sizeof(uint32_t)),&temp,sizeof(uint32_t)); // Next free file int j; block *partition_sub_block = malloc(sizeof(block)); for (j = first; j < a; j++){ if (j == a-1){ a = itoui(j); } else{ a = itoui(j+1); } read_block(id,partition_sub_block,j); memcpy((partition_sub_block->octets) + (TTTFS_VOLUME_BLOCK_SIZE-sizeof(uint32_t)),&a,sizeof(uint32_t)); write_block(id,partition_sub_block,j); } write_block(id,block0,pemplacement); for (i = 0; i < (mf/FILE_TABLE_BLOCK_SIZE); i++){ if (i == (mf/FILE_TABLE_BLOCK_SIZE)-1){ a = itoui(i); } else{ a = itoui(i+1); } // Pour chaque bloc... read_block(id,partition_sub_block,pemplacement+1+i); for (j = 0; j < FILE_TABLE_BLOCK_SIZE; j++){ memcpy((partition_sub_block->octets) + ((j+1)*sizeof(uint32_t))-sizeof(uint32_t),&a,sizeof(uint32_t)); } write_block(id,partition_sub_block,pemplacement+1+i); } // ---------------- Construction du répertoire racine // On récuppère le numéro de bloc qui sera occupé par la racine read_block(id,block0,pemplacement); memcpy(&temp,(block0->octets)+(4*sizeof(uint32_t)),sizeof(uint32_t)); first = uitoi(temp); // Création de l'entrée //block_file_table = malloc(sizeof(block)); //read_block(id,block_file_table,pemplacement+1); entry_root->size = TFS_DIRECTORIES_SIZE*2; entry_root->type = 0; entry_root->sub_type = 1; entry_root->tfs_direct[0] = first; for (i = 1; i < 10; i++){ entry_root->tfs_direct[i] = 0; } entry_root->tfs_indirect1 = 0; entry_root->tfs_indirect2 = 0; // Remplissage if (fill_block(id,pemplacement).val != 0){ fprintf(stderr, "Error while filling block.\n"); return -1; } if (fill_entry(id,pemplacement,entry_root).val != 0){ fprintf(stderr, "Error while writing on File Table.\n"); return -1; } //write_block(id,block_file_table,pemplacement+1); char* buf_d = malloc(sizeof(uint32_t)+28); read_block(id,block0,first); temp = itoui(0); memcpy(buf_d,&temp,sizeof(uint32_t)); strncpy(&buf_d[sizeof(uint32_t)],".\0",28); memcpy((block0->octets),buf_d,sizeof(uint32_t)+28); strncpy(&buf_d[sizeof(uint32_t)],"..\0",28); memcpy((block0->octets)+(sizeof(uint32_t)+28),buf_d,sizeof(uint32_t)+28); write_block(id,block0,first); sync_disk(id); printf("Partition %i formated !\n",npart); return 0; }
/** * \brief Create the pipeline, add information to MIB at the same time * \param pipeline the pipepline of the stream * \param bus the bus associated to the pipeline * \param bust_watch_id the watch associated to the bus * \param input the las element of the pipeline, (avenc_mp4 or capsfilter) as we built our own source * \param ip the ip to which send the stream on * \port the port to use * \return GstElement* the last element added to the pipeline */ GstElement* create_pipeline_serviceUser( gpointer stream_datas, GstCaps *caps, struct channelTable_entry *channel_entry, gchar *cmdline, redirect_data *redirect){ stream_data *data = stream_datas; /* create the empty videoFormatTable_entry structure to intiate the MIB */ struct videoFormatTable_entry *video_stream_info; video_stream_info = SNMP_MALLOC_TYPEDEF(struct videoFormatTable_entry); if( !video_stream_info){ g_critical("Failed to create temporary empty entry for the table"); return NULL; } g_debug("Create Service User's pipeline"); GstElement *pipeline = data->pipeline; GstBus *bus = data->bus; guint bus_watch_id = data->bus_watch_id; GstElement *first, *last; first = addUDP_SU( pipeline, bus, bus_watch_id, caps, channel_entry); data->udp_elem = first; /* check if everything went ok */ if ( first == NULL ) return NULL; /* one element in pipeline: first is last, and last is first */ last = first; /* Add RTP depayloader element */ last = addRTP_SU( pipeline, bus, bus_watch_id, first, video_stream_info, data, caps); /* * Gather a maximum of information from caps into the MIB */ fill_entry ( gst_caps_get_structure ( caps , 0 ), video_stream_info, data); last = addSink_SU( pipeline, bus, bus_watch_id, last, channel_entry, cmdline, redirect , caps , video_stream_info); fill_entry ( gst_caps_get_structure ( caps , 0 ), video_stream_info, data); /* * Fill the channel Table with parameters from the video_format_table , copy them */ channelTable_fill_entry(channel_entry, video_stream_info); /* * As we are a Service User, we are registering the resolution of the VIDEO contained in SDP * This will help us later, when the user will change the ROI or Resolution parameters of the channel * to prevent from Gstreamer's errors */ g_debug("save SDP height and SDP width in channelTable_entry for ROI management"); channel_entry->sdp_height = video_stream_info->videoFormatMaxVertRes; channel_entry->sdp_width = video_stream_info->videoFormatMaxHorzRes; return last; }
/** * \brief This function add the RTP element to the pipeline for service provider * \param pipeline the pipeline associated to this SP * \param bus the bus the channel * \param bus_watch_id an id watch on the bus * \param input last element added in pipeline to which we should link elements added * \param video_info a "fake" entry to VFT into which we will save all element we can retrieve from the video caps of the stream (via fill_entry() ) * \param stream_data the data associated to this SP's pipeline * \param caps the caps of the input stream if this is a redirection, NULL otherwise * \param channel_entry_index the channel's index of this SP: to build the multicast address * \return the last element added in pipeline (rtp payloader if everything goes ok) */ static GstElement* addRTP( GstElement *pipeline, GstBus *bus, guint bus_watch_id, GstElement* input, struct videoFormatTable_entry *video_info, gpointer stream_datas, GstCaps *caps){ /*Create element that will be add to the pipeline */ GstElement *rtp = NULL; GstElement *parser; GstStructure *video_caps; g_debug("addRTP: add RTP payloader to Service Provider's pipeline"); if (caps == NULL){ /* Media stream Type detection */ video_caps = type_detection(GST_BIN(pipeline), input, NULL); if ( video_caps == NULL ) return NULL; /* Fill the MIB a first Time */ fill_entry(video_caps, video_info, stream_datas); }else{ GstElement *appsrc = gst_bin_get_by_name( GST_BIN ( pipeline ) , APPSRC_NAME ) ; g_object_set ( appsrc , "caps" , caps , NULL) ; video_caps = gst_caps_get_structure( caps, 0 ); /* This is a redirection, fill the MIB once for all */ fill_entry(video_caps, video_info, stream_datas); } /* * Handle the ROI */ handle_roi ( pipeline , video_info , NULL ) ; /* in case RAW video type has been detected */ if ( gst_structure_has_name( video_caps, "video/x-raw") ){ g_debug("%s video detected: add %s to SP pipeline", RAW_NAME , RTPRAWPAY_NAME); /* For Raw video */ rtp = gst_element_factory_make_log ("rtpvrawpay", RTPRAWPAY_NAME); if ( !rtp ) return NULL; } /* in case MPEG4 video type has been detected */ else if (gst_structure_has_name( video_caps, "video/mpeg")){ /* * For MPEG-a videos we need to add a parser before the RTP payloader. However, if caps are NULL i.e. if this pipeline is a Service Provider's pipeline * used for a redirection, we cannot add the mpeg4 parser here because the parser need to be in the same pipeline as the MPEG-4 encoder, otherwise the typefind * cannot be performed. So if caps are NULL then it means that the parser has already been added in the SU's pipeline of the Service Users's part of teh redirection. * We do not have to add it again */ if ( caps == NULL ){ parser = gst_element_factory_make_log ("mpeg4videoparse", MPEG4PARSER_NAME ); if ( !parser ) return NULL; g_debug("%s video detected: add %s to pipeline", MPEG4_NAME , MPEG4PARSER_NAME); gst_bin_add(GST_BIN(pipeline),parser); if ( !gst_element_link_log(input, parser)) return NULL; input = parser; } g_debug("%s video detected: add %s to SP pipeline", MPEG4_NAME , RTPMP4PAY_NAME ); rtp = gst_element_factory_make_log ("rtpmp4vpay", RTPMP4PAY_NAME ); if ( !rtp ) return NULL; } /* in case J2K video type has been detected */ else if ( g_strv_contains ( J2K_STR_NAMES, gst_structure_get_name(video_caps))){ /* * For J2K video our RTP payloader can only accept image/x-jpc input video media type. However, not all encoders have this caos on their src pads. * So we first link the output of the encoder to a capsfilter with image/x-jpc media type. If the encoder and the capfsilter cannot negociate caps, then the encoder * cannot be link to the RTP payloader, so we stop there. As an example: avenc_jpeg2000 only has image/x-j2c as a media type. But openjpegenc has image/x-j2c, image/-xjpc * and image-j2p */ GstElement *capsfilter = gst_element_factory_make_log("capsfilter", CAPSFITER_J2K_NAME ) ; GstCaps *caps_jpeg2000 = get_rtpj2kpay_allowed_caps(); /* Put the source in the pipeline */ g_object_set (capsfilter, "caps",caps_jpeg2000 , NULL); g_debug("%s video detected: add %s to SP pipeline", J2K_NAME , CAPSFITER_J2K_NAME ); gst_bin_add(GST_BIN(pipeline),capsfilter); if ( !gst_element_link_log(input,capsfilter )){ g_critical("JPEG2000 format can only be x-jpc"); return NULL; } input = capsfilter; g_debug("%s video detected: add %s to SP pipeline", J2K_NAME , RTPJ2KPAY_NAME ); /* For J2K video */ rtp = gst_element_factory_make_log ("rtpj2kpay", RTPJ2KPAY_NAME ); if ( !rtp ) return NULL; } /* in case the video type detected is unknown */ else { g_critical("unknow type of video stream"); return NULL; } /* add rtp to pipeline */ gst_bin_add(GST_BIN (pipeline), rtp); if (caps == NULL ){ /* Filters out non VIVOE videos, and link input to RTP if video has a valid format*/ video_caps = type_detection(GST_BIN(pipeline), input,NULL); if (!filter_VIVOE(video_caps,input, rtp)) return NULL; /* Now that we have added the RTP payloader to the pipeline, we can get the new caps of the video stream*/ /* Media stream Type detection */ video_caps = type_detection(GST_BIN(pipeline), rtp, NULL); if ( video_caps == NULL) return NULL; /*Fill the MIB a second time after creating payload*/ fill_entry(video_caps, video_info, stream_datas); }else{ /* link input to rtp payloader */ if ( !gst_element_link_log(input, rtp)) return NULL; input = rtp ; video_caps = type_detection(GST_BIN(pipeline), input ,NULL); if ( !video_caps ) return NULL; /*Fill the MIB a second time after creating payload, this is needed to get rtp_data needed to build SDP files */ fill_entry(video_caps, video_info, stream_datas); } /* Finally return*/ return rtp; }
/** * \brief This function add the RTP element to the pipeline * \param pipeline the associated pipeline of the channel * \param bus the bus the channel * \param bus_watch_id an id watch on the bus * \param input the gstelement to link in input * \param video_info a videoFormatTable_entry to store detected caps * \param stream_data the stream_data associated to the pipeline * \param caps the input video caps * \return GstElement the last element added in pipeline */ static GstElement* addRTP_SU( GstElement *pipeline, GstBus *bus, guint bus_watch_id, GstElement* input, struct videoFormatTable_entry *video_info, gpointer stream_datas, GstCaps *caps){ /*Create element that will be add to the pipeline */ GstElement *rtp = NULL; GstElement *last = NULL; GstStructure *video_caps = gst_caps_get_structure(caps, 0); char *encoding = (char*) gst_structure_get_string(video_caps, "encoding-name"); g_debug("addRTP_SU: add RTP payloader to Service Users's pipeline"); /* Fill the MIB a first Time */ fill_entry(video_caps, video_info, stream_datas); if ( gst_structure_has_field( video_caps, "encoding-name")){ /* For Raw video */ if ( strcmp( RAW_NAME,encoding) == 0 ){ rtp = gst_element_factory_make_log ("rtpvrawdepay" , RTPRAWDEPAY_NAME ); /* Check if everything went ok */ g_debug("%s video dectect, add %s to SU pipeline", RAW_NAME , RTPRAWDEPAY_NAME ); if( rtp == NULL) return NULL; }else if ( strcmp( MPEG4_NAME , encoding) == 0 ){ /* For MPEG-4 video */ rtp = gst_element_factory_make_log ("rtpmp4vdepay" , RTPMP4DEPAY_NAME ); g_debug("%s video dectect, add %s to SU pipeline", MPEG4_NAME , RTPMP4DEPAY_NAME ); /* Check if everything went ok */ if( rtp == NULL) return NULL; } /* For J2K video */ else if ( strcmp( J2K_NAME , encoding) == 0 ){ rtp = gst_element_factory_make_log ("rtpj2kdepay" , RTPJ2KDEPAY_NAME ); g_debug("%s video dectect, add %s to SU pipeline", J2K_NAME , RTPJ2KDEPAY_NAME ); /* Check if everything went ok */ if( rtp == NULL) return NULL; } else { g_critical("unknow type of video stream"); return NULL; } }else{ g_critical("encoding format not found"); return NULL; } gst_bin_add(GST_BIN (pipeline), rtp); if ( ! gst_element_link_log ( input, rtp )) return NULL; last = rtp; /* Finally return*/ return last; }
void jumpTableEntry::initialize_as_link(char* link) { fill_entry(halt_instruction, link, link_entry); }
void jumpTableEntry::initialize_nmethod_stub(char* dest) { fill_entry(jump_instruction, dest - (int) state_addr(), nmethod_entry); }
/** * Delete key from database. */ void dbmw_delete(dbmw_t *dw, const void *key) { struct cached *entry; dbmw_check(dw); g_assert(key); dw->w_access++; entry = map_lookup(dw->values, key); if (entry) { if (dbg_ds_debugging(dw->dbg, 2, DBG_DSF_CACHING | DBG_DSF_DELETE)) { dbg_ds_log(dw->dbg, dw, "%s: %s key=%s%s", G_STRFUNC, entry->dirty ? "dirty" : "clean", dbg_ds_keystr(dw->dbg, key, (size_t) -1), entry->absent ? " (was absent)" : ""); } if (entry->dirty) dw->w_hits++; if (!entry->absent) { /* * Entry was present but is now deleted. * * If it was clean, then it was flushed to the database and we now * know that there is one less entry in the database than there is * physically present in the map. * * If it was dirty, then we do not know whether it exists in the * database or not, and therefore we cannot adjust the amount * of cached entries down. */ if (entry->dirty) dw->count_needs_sync = TRUE; /* Deferred delete */ else dw->cached--; /* One less entry in database */ fill_entry(dw, entry, NULL, 0); entry->absent = TRUE; } hash_list_moveto_tail(dw->keys, key); } else { if (dbg_ds_debugging(dw->dbg, 2, DBG_DSF_DELETE)) { dbg_ds_log(dw->dbg, dw, "%s: removing key=%s", G_STRFUNC, dbg_ds_keystr(dw->dbg, key, (size_t) -1)); } dw->ioerr = FALSE; dbmap_remove(dw->dm, key); if (dbmap_has_ioerr(dw->dm)) { dw->ioerr = TRUE; dw->error = errno; s_warning("DBMW \"%s\" I/O error whilst deleting key: %s", dw->name, dbmap_strerror(dw->dm)); } /* * If the maximum value length of the DB is 0, then it is used as a * "search table" only, meaning there will be no read to get values, * only existence checks. * * Therefore, it makes sense to cache that the key is no longer valid. * Otherwise, possibly pushing a value out of the cache to record * a deletion is not worth it. */ if (0 == dw->value_size) { WALLOC0(entry); entry->absent = TRUE; (void) allocate_entry(dw, key, entry); if (dbg_ds_debugging(dw->dbg, 2, DBG_DSF_CACHING)) { dbg_ds_log(dw->dbg, dw, "%s: cached absent key=%s", G_STRFUNC, dbg_ds_keystr(dw->dbg, key, (size_t) -1)); } } } }
void jumpTableEntry::initialize_block_closure_stub() { fill_entry(jump_instruction, StubRoutines::compile_block_entry() - (int) state_addr(), block_closure_entry); }