annotate libaf/af_mp.c @ 9021:070b91093606

* Remove unneeded includes & macros * Get layers by name rather that fixed ID. Only works for DirectFB >= 0.9.16 so fall back to ID based stuff for older releases. * New option "noinput" (useful in X) * Add some NULL pointer checks to uninit() * Improve error messages and use mp_msg() * Direct rendering fix (at least IPB was broken) * Use 0xff for alpha component in all colors * Blit from temp surface to screen was only done in draw_osd() which doesn't always get called. Do the blit in flip_page() in this case. * Add GUI support to control() * Change the driver name to include G450/G550 ;) patch by Ville Syrj¸«£l¸«£ <syrjala@sci.fi>
author arpi
date Sun, 19 Jan 2003 15:41:26 +0000
parents a6615e7bc710
children 7f8eb5f6814a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8167
e8832e66babd New features:
anders
parents:
diff changeset
1 #include "af.h"
e8832e66babd New features:
anders
parents:
diff changeset
2
e8832e66babd New features:
anders
parents:
diff changeset
3 /* Decodes the format from mplayer format to libaf format */
e8832e66babd New features:
anders
parents:
diff changeset
4 int af_format_decode(int ifmt)
e8832e66babd New features:
anders
parents:
diff changeset
5 {
e8832e66babd New features:
anders
parents:
diff changeset
6 int ofmt = ~0;
e8832e66babd New features:
anders
parents:
diff changeset
7 // Check input ifmt
e8832e66babd New features:
anders
parents:
diff changeset
8 switch(ifmt){
e8832e66babd New features:
anders
parents:
diff changeset
9 case(AFMT_U8):
e8832e66babd New features:
anders
parents:
diff changeset
10 ofmt = AF_FORMAT_LE|AF_FORMAT_US; break;
e8832e66babd New features:
anders
parents:
diff changeset
11 case(AFMT_S8):
e8832e66babd New features:
anders
parents:
diff changeset
12 ofmt = AF_FORMAT_LE|AF_FORMAT_SI; break;
e8832e66babd New features:
anders
parents:
diff changeset
13 case(AFMT_S16_LE):
e8832e66babd New features:
anders
parents:
diff changeset
14 ofmt = AF_FORMAT_LE|AF_FORMAT_SI; break;
e8832e66babd New features:
anders
parents:
diff changeset
15 case(AFMT_S16_BE):
e8832e66babd New features:
anders
parents:
diff changeset
16 ofmt = AF_FORMAT_BE|AF_FORMAT_SI; break;
e8832e66babd New features:
anders
parents:
diff changeset
17 case(AFMT_U16_LE):
e8832e66babd New features:
anders
parents:
diff changeset
18 ofmt = AF_FORMAT_LE|AF_FORMAT_US; break;
e8832e66babd New features:
anders
parents:
diff changeset
19 case(AFMT_U16_BE):
e8832e66babd New features:
anders
parents:
diff changeset
20 ofmt = AF_FORMAT_BE|AF_FORMAT_US; break;
e8832e66babd New features:
anders
parents:
diff changeset
21 case(AFMT_S32_LE):
e8832e66babd New features:
anders
parents:
diff changeset
22 ofmt = AF_FORMAT_LE|AF_FORMAT_SI; break;
e8832e66babd New features:
anders
parents:
diff changeset
23 case(AFMT_S32_BE):
e8832e66babd New features:
anders
parents:
diff changeset
24 ofmt = AF_FORMAT_BE|AF_FORMAT_SI; break;
e8832e66babd New features:
anders
parents:
diff changeset
25 case(AFMT_IMA_ADPCM):
e8832e66babd New features:
anders
parents:
diff changeset
26 ofmt = AF_FORMAT_IMA_ADPCM; break;
e8832e66babd New features:
anders
parents:
diff changeset
27 case(AFMT_MU_LAW):
e8832e66babd New features:
anders
parents:
diff changeset
28 ofmt = AF_FORMAT_MU_LAW; break;
e8832e66babd New features:
anders
parents:
diff changeset
29 case(AFMT_A_LAW):
e8832e66babd New features:
anders
parents:
diff changeset
30 ofmt = AF_FORMAT_A_LAW; break;
e8832e66babd New features:
anders
parents:
diff changeset
31 case(AFMT_MPEG):
e8832e66babd New features:
anders
parents:
diff changeset
32 ofmt = AF_FORMAT_MPEG2; break;
e8832e66babd New features:
anders
parents:
diff changeset
33 case(AFMT_AC3):
e8832e66babd New features:
anders
parents:
diff changeset
34 ofmt = AF_FORMAT_AC3; break;
8233
1205e37a3ab2 Adding support for AFMT_FLOAT
anders
parents: 8167
diff changeset
35 case(AFMT_FLOAT):
8952
2369087bb777 Fix for endianess conversion if input to libaf is float
anders
parents: 8233
diff changeset
36 ofmt = AF_FORMAT_F | AF_FORMAT_NE; break;
8167
e8832e66babd New features:
anders
parents:
diff changeset
37 default:
e8832e66babd New features:
anders
parents:
diff changeset
38 //This can not happen ....
e8832e66babd New features:
anders
parents:
diff changeset
39 af_msg(AF_MSG_FATAL,"Unrecognized input audio format %i\n",ifmt);
e8832e66babd New features:
anders
parents:
diff changeset
40 break;
e8832e66babd New features:
anders
parents:
diff changeset
41 }
e8832e66babd New features:
anders
parents:
diff changeset
42 return ofmt;
e8832e66babd New features:
anders
parents:
diff changeset
43 }
8993
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
44
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
45 /* Encodes the format from libaf format to mplayer (OSS) format */
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
46 int af_format_encode(void* fmtp)
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
47 {
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
48 af_data_t* fmt=(af_data_t*) fmtp;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
49 switch(fmt->format&AF_FORMAT_SPECIAL_MASK){
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
50 case 0: // PCM:
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
51 if((fmt->format&AF_FORMAT_POINT_MASK)==AF_FORMAT_I){
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
52 if((fmt->format&AF_FORMAT_SIGN_MASK)==AF_FORMAT_SI){
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
53 // signed int PCM:
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
54 switch(fmt->bps){
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
55 case 1: return AFMT_S8;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
56 case 2: return (fmt->format&AF_FORMAT_LE) ? AFMT_S16_LE : AFMT_S16_BE;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
57 case 4: return (fmt->format&AF_FORMAT_LE) ? AFMT_S32_LE : AFMT_S32_BE;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
58 }
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
59 } else {
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
60 // unsigned int PCM:
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
61 switch(fmt->bps){
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
62 case 1: return AFMT_U8;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
63 case 2: return (fmt->format&AF_FORMAT_LE) ? AFMT_U16_LE : AFMT_U16_BE;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
64 // case 4: return (fmt->format&AF_FORMAT_LE) ? AFMT_U32_LE : AFMT_U32_BE;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
65 }
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
66 }
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
67 } else {
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
68 // float PCM:
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
69 return AFMT_FLOAT; // FIXME?
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
70 }
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
71 break;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
72 case AF_FORMAT_MU_LAW: return AFMT_MU_LAW;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
73 case AF_FORMAT_A_LAW: return AFMT_A_LAW;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
74 case AF_FORMAT_MPEG2: return AFMT_MPEG;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
75 case AF_FORMAT_AC3: return AFMT_AC3;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
76 case AF_FORMAT_IMA_ADPCM: return AFMT_IMA_ADPCM;
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
77 }
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
78 return AFMT_S16_LE; // shouldn't happen
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
79 }
a6615e7bc710 added af_format_encode() to convert sample format from libaf to mplayer (OSS)
arpi
parents: 8952
diff changeset
80