Mercurial > mplayer.hg
annotate libmpcodecs/ae.c @ 26625:5b89b42f6d50
Only compile and use libmpeg2 AltiVec code when AltiVec is available. The
AltiVec code needs -maltivec to compile, but then AltiVec instructions
appear in other places of the code causing MPlayer to sigill.
Somehow upstream libmpeg2 manages not to sigill under what appear to be
the same circumstances. Enlightenment welcome.
author | diego |
---|---|
date | Sat, 03 May 2008 15:23:22 +0000 |
parents | 4eed49de214f |
children | e7c989f7a7c9 |
rev | line source |
---|---|
15234 | 1 #include <stdio.h> |
2 #include <string.h> | |
3 #include <stdlib.h> | |
4 #include <inttypes.h> | |
15238 | 5 #include <unistd.h> |
15240 | 6 #include <sys/types.h> |
15234 | 7 #include <math.h> |
23640 | 8 #include "config.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
9 #include "libmpdemux/aviheader.h" |
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
10 #include "libmpdemux/ms_hdr.h" |
22600
3c2b4a866c6a
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
11 #include "stream/stream.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
12 #include "libmpdemux/muxer.h" |
15234 | 13 #include "ae.h" |
14 | |
16616
d9b74d27974d
forgotten include; patch by Jan Knutar (jknutar ad nic puntum fi)
nicodvb
parents:
15359
diff
changeset
|
15 #include "ae_pcm.h" |
d9b74d27974d
forgotten include; patch by Jan Knutar (jknutar ad nic puntum fi)
nicodvb
parents:
15359
diff
changeset
|
16 |
15234 | 17 #ifdef HAVE_TOOLAME |
18 #include "ae_toolame.h" | |
19 #endif | |
20 | |
21 #ifdef HAVE_MP3LAME | |
22 #include "ae_lame.h" | |
23 #endif | |
24 | |
25 #ifdef USE_LIBAVCODEC | |
26 #include "ae_lavc.h" | |
27 #endif | |
28 | |
15259 | 29 #ifdef HAVE_FAAC |
30 #include "ae_faac.h" | |
31 #endif | |
32 | |
15359 | 33 #ifdef HAVE_TWOLAME |
34 #include "ae_twolame.h" | |
35 #endif | |
36 | |
15234 | 37 audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params_t *params) |
38 { | |
39 int ris; | |
15242 | 40 audio_encoder_t *encoder; |
15234 | 41 if(! params) |
42 return NULL; | |
43 | |
15242 | 44 encoder = (audio_encoder_t *) calloc(1, sizeof(audio_encoder_t)); |
15234 | 45 memcpy(&encoder->params, params, sizeof(audio_encoding_params_t)); |
46 encoder->stream = stream; | |
47 | |
48 switch(stream->codec) | |
49 { | |
50 case ACODEC_PCM: | |
51 ris = mpae_init_pcm(encoder); | |
52 break; | |
53 #ifdef HAVE_TOOLAME | |
54 case ACODEC_TOOLAME: | |
55 ris = mpae_init_toolame(encoder); | |
56 break; | |
57 #endif | |
58 #ifdef USE_LIBAVCODEC | |
59 case ACODEC_LAVC: | |
60 ris = mpae_init_lavc(encoder); | |
61 break; | |
62 #endif | |
63 #ifdef HAVE_MP3LAME | |
64 case ACODEC_VBRMP3: | |
65 ris = mpae_init_lame(encoder); | |
66 break; | |
67 #endif | |
15259 | 68 #ifdef HAVE_FAAC |
69 case ACODEC_FAAC: | |
70 ris = mpae_init_faac(encoder); | |
71 break; | |
72 #endif | |
15359 | 73 #ifdef HAVE_TWOLAME |
74 case ACODEC_TWOLAME: | |
75 ris = mpae_init_twolame(encoder); | |
76 break; | |
77 #endif | |
17781
d9474f04cce5
add default case to encoder switch-case (maybe an error message would be good as well).
reimar
parents:
17122
diff
changeset
|
78 default: |
d9474f04cce5
add default case to encoder switch-case (maybe an error message would be good as well).
reimar
parents:
17122
diff
changeset
|
79 ris = 0; |
d9474f04cce5
add default case to encoder switch-case (maybe an error message would be good as well).
reimar
parents:
17122
diff
changeset
|
80 break; |
15234 | 81 } |
82 | |
83 if(! ris) | |
84 { | |
85 free(encoder); | |
86 return NULL; | |
87 } | |
88 encoder->bind(encoder, stream); | |
17122 | 89 encoder->decode_buffer = malloc(encoder->decode_buffer_size); |
15234 | 90 if(! encoder->decode_buffer) |
91 { | |
92 free(encoder); | |
93 return NULL; | |
94 } | |
95 | |
96 encoder->codec = stream->codec; | |
97 return encoder; | |
98 } | |
99 | |
100 |