1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
/*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* MPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <unistd.h>
#include "config.h"
//#include "stream/stream.h"
//#include "demuxer.h"
//#include "stheader.h"
#include "aviheader.h"
#include "ms_hdr.h"
#include "stream/stream.h"
#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;
}
static void write_rawvideo_chunk(stream_t *stream,int len,void* data){
if(len>0){
if(data){
// DATA
stream_write_buffer(stream,data,len);
}
}
}
static void rawvideofile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags, double dts, double pts){
muxer_t *muxer=s->muxer;
// write out the chunk:
if (s->type == MUXER_TYPE_VIDEO)
write_rawvideo_chunk(muxer->stream,len,s->buffer); /* unsigned char */
// 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;
}
int muxer_init_muxer_rawvideo(muxer_t *muxer){
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;
return 1;
}
|