annotate libmpdemux/muxer_rawaudio.c @ 33306:37e215798390

Fix output of "No bind found for key" to actually make sense for key combinations and match the binding you'd have to add to input.conf also for these. Previously the extra keys would end up appended at the end, resulting in output like > No bind found for key 'MOUSE_BTN0'.-MOUSE_BTN2 and even worse for some translations.
author reimar
date Sat, 07 May 2011 11:11:07 +0000
parents d643e4643313
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29238
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
1 /*
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
2 * This file is part of MPlayer.
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
3 *
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
5 * it under the terms of the GNU General Public License as published by
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
7 * (at your option) any later version.
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
8 *
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
12 * GNU General Public License for more details.
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
13 *
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
14 * You should have received a copy of the GNU General Public License along
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
17 */
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
18
15754
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
19 #include <stdio.h>
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
20 #include <stdlib.h>
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
21 #include <string.h>
15774
ed3fec6506c4 Fix off_t on OSX, thanks to Steven M. Schultz
ranma
parents: 15754
diff changeset
22 #include <sys/types.h>
15754
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
23
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
24 #include "help_mp.h"
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
25 #include "mp_msg.h"
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
26
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
27 #include "aviheader.h"
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
28 #include "ms_hdr.h"
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
29
22605
4d81dbdf46b9 Add explicit location for headers from the stream/ directory.
diego
parents: 21660
diff changeset
30 #include "stream/stream.h"
15754
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
31 #include "muxer.h"
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
32
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
33 static muxer_stream_t* rawaudiofile_new_stream(muxer_t *muxer,int type){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
34 muxer_stream_t* s;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
35 if (!muxer) return NULL;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
36 if(type==MUXER_TYPE_AUDIO && muxer->avih.dwStreams>=1){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
37 mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_TooManyStreams" "MSGTR_RawMuxerOnlyOneStream);
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
38 return NULL;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
39 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
40 s=malloc(sizeof(muxer_stream_t));
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
41 memset(s,0,sizeof(muxer_stream_t));
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
42 if(!s) return NULL; // no mem!?
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
43 muxer->streams[muxer->avih.dwStreams]=s;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
44 s->type=type;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
45 s->id=muxer->avih.dwStreams;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
46 s->timer=0.0;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
47 s->size=0;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
48 s->muxer=muxer;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
49 switch(type){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
50 case MUXER_TYPE_AUDIO:
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
51 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
52 s->h.fccType=streamtypeAUDIO;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
53 muxer->avih.dwStreams++;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
54 break;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
55 case MUXER_TYPE_VIDEO:
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
56 mp_msg(MSGT_MUXER,MSGL_WARN,MSGTR_IgnoringVideoStream);
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
57 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
58 s->h.fccType=streamtypeAUDIO;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
59 break;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
60 default:
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
61 mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_UnknownStreamType,type);
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
62 return NULL;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
63 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
64 return s;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
65 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
66
17487
fa17424b4c7b change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents: 17023
diff changeset
67 static void rawaudiofile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags, double dts, double pts){
15754
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
68 muxer_t *muxer=s->muxer;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
69
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
70 // write out the chunk:
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
71 if (s->type==MUXER_TYPE_AUDIO)
21660
ca9da45d13e9 muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents: 17487
diff changeset
72 stream_write_buffer(muxer->stream, s->buffer, len);
15754
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
73 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
74
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
75 static void rawaudiofile_write_header(muxer_t *muxer){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
76 return;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
77 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
78
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
79 static void rawaudiofile_write_index(muxer_t *muxer){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
80 return;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
81 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
82
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
83 int muxer_init_muxer_rawaudio(muxer_t *muxer){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
84 muxer->cont_new_stream = &rawaudiofile_new_stream;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
85 muxer->cont_write_chunk = &rawaudiofile_write_chunk;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
86 muxer->cont_write_header = &rawaudiofile_write_header;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
87 muxer->cont_write_index = &rawaudiofile_write_index;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
88 return 1;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
89 }