2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 //#include "stream/stream.h"
27 //#include "demuxer.h"
28 //#include "stheader.h"
29 #include "aviheader.h"
32 #include "stream/stream.h"
35 static muxer_stream_t
* rawvideofile_new_stream(muxer_t
*muxer
,int type
){
37 if (!muxer
) return NULL
;
38 s
=malloc(sizeof(muxer_stream_t
));
39 memset(s
,0,sizeof(muxer_stream_t
));
40 if(!s
) return NULL
; // no mem!?
41 muxer
->streams
[muxer
->avih
.dwStreams
]=s
;
43 s
->id
=muxer
->avih
.dwStreams
;
48 case MUXER_TYPE_VIDEO
:
49 s
->ckid
=mmioFOURCC(('0'+s
->id
/10),('0'+(s
->id
%10)),'d','c');
50 s
->h
.fccType
=streamtypeVIDEO
;
51 if(!muxer
->def_v
) muxer
->def_v
=s
;
54 muxer
->avih
.dwStreams
++;
58 static void write_rawvideo_chunk(stream_t
*stream
,int len
,void* data
){
62 stream_write_buffer(stream
,data
,len
);
67 static void rawvideofile_write_chunk(muxer_stream_t
*s
,size_t len
,unsigned int flags
, double dts
, double pts
){
68 muxer_t
*muxer
=s
->muxer
;
70 // write out the chunk:
71 if (s
->type
== MUXER_TYPE_VIDEO
)
72 write_rawvideo_chunk(muxer
->stream
,len
,s
->buffer
); /* unsigned char */
74 // if((unsigned int)len>s->h.dwSuggestedBufferSize) s->h.dwSuggestedBufferSize=len;
78 static void rawvideofile_write_header(muxer_t
*muxer
){
82 static void rawvideofile_write_index(muxer_t
*muxer
){
86 int muxer_init_muxer_rawvideo(muxer_t
*muxer
){
87 muxer
->cont_new_stream
= &rawvideofile_new_stream
;
88 muxer
->cont_write_chunk
= &rawvideofile_write_chunk
;
89 muxer
->cont_write_header
= &rawvideofile_write_header
;
90 muxer
->cont_write_index
= &rawvideofile_write_index
;