Example #1
0
static int set_compression_type(char *optarg)
{
   int success;
   struct compression_operations* opt;

   success = 1;
   opt = &cinfo.opt;

   if (!strcmp(optarg, DUMMY_NAME))
   {
      dummy_init(opt);
   }
   else if (!strcmp(optarg, SCZ_NAME))
   {
      scz_init(opt);
   }
   else if (!strcmp(optarg, LZO_NAME))
   {
      minilzo_init(opt);
   }
   else
   {
      success = 0;
      fprintf(stderr, "Compression type %s not available\n", optarg);
   }

   return success;
}
Example #2
0
static int dummy_probe(struct device *dev)
{
	dummy_init(dev);
	return 0;
}
Example #3
0
void init_multiplex( multiplex_t *mx, sequence_t *seq_head,
                     audio_frame_t *extframe, int *exttype, int *exttypcnt,
		     uint64_t video_delay, uint64_t audio_delay, int fd,
		     int (*fill_buffers)(void *p, int f),
		     ringbuffer *vrbuffer, ringbuffer *index_vrbuffer,	
		     ringbuffer *extrbuffer, ringbuffer *index_extrbuffer,
		     int otype)
{
	int i;
	uint32_t data_rate;

	mx->fill_buffers = fill_buffers;
	mx->video_delay = video_delay;
	mx->audio_delay = audio_delay;
	mx->fd_out = fd;
	mx->otype = otype;

	switch(mx->otype){

	case REPLEX_DVD:
		mx->video_delay += 180*CLOCK_MS;
		mx->audio_delay += 180*CLOCK_MS;
		mx->pack_size = 2048;
		mx->audio_buffer_size = 4*1024;
		mx->video_buffer_size = 232*1024;
		mx->mux_rate = 1260000;
		mx->navpack = 1;
		mx->frame_timestamps = TIME_IFRAME;
		mx->VBR = 1;
		mx->reset_clocks = 0;
		mx->write_end_codes = 0;
		mx->set_broken_link = 0;
		mx->is_ts = 0;
		break;


	case REPLEX_MPEG2:
		mx->video_delay += 180*CLOCK_MS;
		mx->audio_delay += 180*CLOCK_MS;
		mx->pack_size = 2048;
		mx->audio_buffer_size = 4*1024;
		mx->video_buffer_size = 224*1024;
		mx->mux_rate = 0;
		mx->navpack = 0;
		mx->frame_timestamps = TIME_ALWAYS;
		mx->VBR = 1;
		mx->reset_clocks = 1;
		mx->write_end_codes = 1;
		mx->set_broken_link = 1;
		mx->is_ts = 0;
		break;

	case REPLEX_HDTV:
		mx->video_delay += 180*CLOCK_MS;
		mx->audio_delay += 180*CLOCK_MS;
		mx->pack_size = 2048;
		mx->audio_buffer_size = 4*1024;
		mx->video_buffer_size = 4*224*1024;
		mx->mux_rate = 0;
		mx->navpack = 0;
		mx->frame_timestamps = TIME_ALWAYS;
		mx->VBR = 1;
		mx->reset_clocks = 1;
		mx->write_end_codes = 1;
		mx->set_broken_link = 1;
		mx->is_ts = 0;
		break;

	case REPLEX_TS_SD:
		mx->video_delay += 180*CLOCK_MS;
		mx->audio_delay += 180*CLOCK_MS;
		mx->pack_size = 188;
		mx->audio_buffer_size = 4*1024;
		mx->video_buffer_size = 232*1024;
		mx->mux_rate = 1260000;
		mx->navpack = 0;
		mx->frame_timestamps = TIME_ALWAYS;
		mx->VBR = 1;
		mx->reset_clocks = 0;
		mx->write_end_codes = 0;
		mx->set_broken_link = 0;
		mx->is_ts = 1;
		break;

	case REPLEX_TS_HD:
		mx->video_delay += 180*CLOCK_MS;
		mx->audio_delay += 180*CLOCK_MS;
		mx->pack_size = 188;
		mx->audio_buffer_size = 4*1024;
		mx->video_buffer_size = 4*224*1024;
		mx->mux_rate = 0;
		mx->navpack = 0;
		mx->frame_timestamps = TIME_ALWAYS;
		mx->VBR = 1;
		mx->reset_clocks = 0;
		mx->write_end_codes = 0;
		mx->set_broken_link = 0;
		mx->is_ts = 1;
		break;
	}

	for (mx->extcnt = 0, data_rate = 0, i = 0;
			 i < N_AUDIO && exttype[i]; i++){
		if (exttype[i] >= MAX_TYPES) {
			fprintf(stderr, "Found illegal stream type %d\n",
				exttype[i]);
			exit(1);
		}
		mx->ext[i].type = exttype[i];
		mx->ext[i].pts_off = 0;
		mx->ext[i].frmperpkt = 1;
		mx->ext[i].strmnum = exttypcnt[i];
		strncpy(mx->ext[i].language, extframe[i].language, 4);
		dummy_init(&mx->ext[i].dbuf, mx->audio_buffer_size);
		data_rate += extframe[i].bit_rate;
		mx->extcnt++;
	}

	mx->vrbuffer = vrbuffer;
	mx->index_vrbuffer = index_vrbuffer;
	mx->extrbuffer = extrbuffer;
	mx->index_extrbuffer = index_extrbuffer;

	dummy_init(&mx->vdbuf, mx->video_buffer_size);

	//NOTE: vpkt_hdr/extpkt_hdr are worst-case for PS streams, but
	//best-guess for TS streams
	if(mx->is_ts) {
		//Use best guess for TS streams
		mx->data_size = get_ts_video_overhead(mx->pack_size, seq_head);
		mx->extsize = get_ts_ext_overhead(mx->pack_size, extframe,
				mx->ext, mx->extcnt);
		
	} else {
		//Use worst case for PS streams
		mx->data_size = mx->pack_size - PES_H_MIN - PS_HEADER_L1 - 10;
		mx->extsize = mx->data_size + 5; //one less DTS
	}
	mx->vsize = mx->data_size;
	
	data_rate += seq_head->bit_rate *400;

	mx->muxr = ((uint64_t)data_rate / 8 * mx->pack_size) / mx->data_size; 
                                     // muxrate of payload in Byte/s

	if (mx->mux_rate) {
		if ( mx->mux_rate < mx->muxr)
                        fprintf(stderr, "data rate may be to high for required mux rate\n");
                mx->muxr = mx->mux_rate;
        }
	fprintf(stderr, "Mux rate: %.2f Mbit/s\n", mx->muxr*8.0/1000000.);
	
	mx->SCRinc = 27000000ULL/((uint64_t)mx->muxr / 
				     (uint64_t) mx->pack_size);
	
}