2004-03-09 14:46:34 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
2005-11-18 14:39:25 +00:00
|
|
|
#include "version.h"
|
2004-03-09 14:46:34 +00:00
|
|
|
|
|
|
|
//#include "stream.h"
|
|
|
|
//#include "demuxer.h"
|
|
|
|
//#include "stheader.h"
|
2004-08-28 20:31:41 +00:00
|
|
|
#include "aviheader.h"
|
|
|
|
#include "ms_hdr.h"
|
2004-03-09 14:46:34 +00:00
|
|
|
|
2006-12-18 21:03:59 +00:00
|
|
|
#include "stream.h"
|
2004-03-09 14:46:34 +00:00
|
|
|
#include "muxer.h"
|
|
|
|
|
|
|
|
static muxer_stream_t* rawvideofile_new_stream(muxer_t *muxer,int type){
|
|
|
|
muxer_stream_t* s;
|
|
|
|
if (!muxer) return NULL;
|
|
|
|
s=malloc(sizeof(muxer_stream_t));
|
|
|
|
memset(s,0,sizeof(muxer_stream_t));
|
|
|
|
if(!s) return NULL; // no mem!?
|
|
|
|
muxer->streams[muxer->avih.dwStreams]=s;
|
|
|
|
s->type=type;
|
|
|
|
s->id=muxer->avih.dwStreams;
|
|
|
|
s->timer=0.0;
|
|
|
|
s->size=0;
|
|
|
|
s->muxer=muxer;
|
|
|
|
switch(type){
|
|
|
|
case MUXER_TYPE_VIDEO:
|
|
|
|
s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
|
|
|
|
s->h.fccType=streamtypeVIDEO;
|
|
|
|
if(!muxer->def_v) muxer->def_v=s;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
muxer->avih.dwStreams++;
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2006-12-18 21:03:59 +00:00
|
|
|
static void write_rawvideo_chunk(stream_t *stream,int len,void* data){
|
2004-03-09 14:46:34 +00:00
|
|
|
if(len>0){
|
|
|
|
if(data){
|
|
|
|
// DATA
|
2006-12-18 21:03:59 +00:00
|
|
|
stream_write_buffer(stream,data,len);
|
2004-03-09 14:46:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-26 19:32:07 +00:00
|
|
|
static void rawvideofile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags, double dts, double pts){
|
2004-03-09 14:46:34 +00:00
|
|
|
muxer_t *muxer=s->muxer;
|
|
|
|
|
|
|
|
// write out the chunk:
|
2005-10-19 05:44:27 +00:00
|
|
|
if (s->type == MUXER_TYPE_VIDEO)
|
2006-12-18 21:03:59 +00:00
|
|
|
write_rawvideo_chunk(muxer->stream,len,s->buffer); /* unsigned char */
|
2004-03-09 14:46:34 +00:00
|
|
|
|
|
|
|
// if((unsigned int)len>s->h.dwSuggestedBufferSize) s->h.dwSuggestedBufferSize=len;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rawvideofile_write_header(muxer_t *muxer){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rawvideofile_write_index(muxer_t *muxer){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-02-21 21:45:49 +00:00
|
|
|
int muxer_init_muxer_rawvideo(muxer_t *muxer){
|
2004-03-09 14:46:34 +00:00
|
|
|
muxer->cont_new_stream = &rawvideofile_new_stream;
|
|
|
|
muxer->cont_write_chunk = &rawvideofile_write_chunk;
|
|
|
|
muxer->cont_write_header = &rawvideofile_write_header;
|
|
|
|
muxer->cont_write_index = &rawvideofile_write_index;
|
2005-02-21 21:45:49 +00:00
|
|
|
return 1;
|
2004-03-09 14:46:34 +00:00
|
|
|
}
|