Revision 8de6681e chunker_streamer.c

View differences:

chunker_streamer.c
72 72

  
73 73
void saveChunkOnFile(ExternalChunk *chunk) {
74 74
	char buf[1024], outfile[1024];
75
	FILE *fp;
75
/*	FILE *fp;
76 76
	
77 77
	strcpy(buf,"chunks//CHUNK");
78 78
	strcat(buf,"\0");
......
89 89
	fwrite(&(chunk->_refcnt),sizeof(int),1,fp);
90 90
	fwrite(chunk->data,sizeof(uint8_t),sizeof(uint8_t)*chunk->payload_len,fp);
91 91
	fclose(fp);
92

  
92
*/
93 93
	/* send the chunk to the GRAPES peer application via HTTP */
94 94
	sprintf(buf, "%slocalhost:%d%s", UL_HTTP_PREFIX, UL_DEFAULT_CHUNKBUFFER_PORT, UL_DEFAULT_CHUNKBUFFER_PATH);
95 95
	pushChunkHttp(chunk, buf);
......
123 123
	
124 124
	uint8_t *buffer,*outbuf,*outbuf_audio;
125 125
	uint8_t *outbuf_audi_audio,*tempdata;
126
	uint8_t audio_buf[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2];
126
	//uint8_t audio_buf[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2]; //TRIPLO
127
	uint16_t *audio_buf=NULL;; //TRIPLO
127 128
	unsigned int audio_buf_size = 0;
128 129
	long double newtimestamp;
129 130
	
......
150 151
	struct dirent **namelist;
151 152
	
152 153
	if(argc < 4) {
153
		printf("execute ./ingestion moviefile audiobitrate videobitrate\n");
154
		printf("execute ./chunker_streamer moviefile audiobitrate videobitrate\n");
154 155
		return -1;
155 156
	}
156 157
	sscanf(argv[2],"%d",&audio_bitrate);
......
220 221
	if(audioStream!=-1) {
221 222
		aCodecCtx=pFormatCtx->streams[audioStream]->codec;
222 223
		printf("AUDIO Codecid: %d %d\n",aCodecCtx->codec_id,aCodecCtx->sample_rate);
224
		printf("AUDIO channels %d samplerate %d\n",aCodecCtx->channels,aCodecCtx->sample_rate);
223 225
	}
224 226

  
225
	printf("AUDIO channels %d samplerate %d\n",aCodecCtx->channels,aCodecCtx->sample_rate);
227

  
226 228

  
227 229
	pCodecCtxEnc=avcodec_alloc_context();
228 230
	//pCodecCtxEnc->me_range=16;
......
329 331
	initChunk(chunkaudio,&seq_current_chunk);
330 332
	stime = -1;
331 333
	
332
	//av_init_packet(&packet);
334
	av_init_packet(&packet); //TRIPLO
333 335
	
334 336
	if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)) {
335 337
		fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError());
......
338 340

  
339 341

  
340 342
	/* initialize the HTTP chunk pusher */
341
	initChunkPusher();
343
	initChunkPusher(); //TRIPLO
344
	audio_buf = (uint16_t *)av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE); //TRIPLO
342 345

  
343 346

  
344 347
	while(av_read_frame(pFormatCtx, &packet)>=0) {
......
552 555

  
553 556

  
554 557
	/* initialize the HTTP chunk pusher */
555
	initChunkPusher();
558
	finalizeChunkPusher();
556 559

  
557 560

  
558 561
	free(chunk);
......
568 571

  
569 572
	// Free the YUV frame
570 573
	av_free(pFrame);
574

  
575
	av_free(audio_buf); //TRIPLO
571 576
  
572 577
	// Close the codec
573 578
	avcodec_close(pCodecCtx);

Also available in: Unified diff