comparison libaf/af_format.c @ 29049:8c706ce21c6f

Remove af_msg special-casing API in libaf. Replace it by standard mp_msg message system.
author bircoph
date Sat, 28 Mar 2009 19:57:56 +0000
parents 69346a3311e9
children 0f1b5b68af32
comparison
equal deleted inserted replaced
29048:584ff003cce9 29049:8c706ce21c6f
60 60
61 // Sanity check for bytes per sample 61 // Sanity check for bytes per sample
62 static int check_bps(int bps) 62 static int check_bps(int bps)
63 { 63 {
64 if(bps != 4 && bps != 3 && bps != 2 && bps != 1){ 64 if(bps != 4 && bps != 3 && bps != 2 && bps != 1){
65 af_msg(AF_MSG_ERROR,"[format] The number of bytes per sample" 65 mp_msg(MSGT_AFILTER, MSGL_ERR, "[format] The number of bytes per sample"
66 " must be 1, 2, 3 or 4. Current value is %i \n",bps); 66 " must be 1, 2, 3 or 4. Current value is %i \n",bps);
67 return AF_ERROR; 67 return AF_ERROR;
68 } 68 }
69 return AF_OK; 69 return AF_OK;
70 } 70 }
75 char buf[256]; 75 char buf[256];
76 switch(format & AF_FORMAT_SPECIAL_MASK){ 76 switch(format & AF_FORMAT_SPECIAL_MASK){
77 case(AF_FORMAT_IMA_ADPCM): 77 case(AF_FORMAT_IMA_ADPCM):
78 case(AF_FORMAT_MPEG2): 78 case(AF_FORMAT_MPEG2):
79 case(AF_FORMAT_AC3): 79 case(AF_FORMAT_AC3):
80 af_msg(AF_MSG_ERROR,"[format] Sample format %s not yet supported \n", 80 mp_msg(MSGT_AFILTER, MSGL_ERR, "[format] Sample format %s not yet supported \n",
81 af_fmt2str(format,buf,256)); 81 af_fmt2str(format,buf,256));
82 return AF_ERROR; 82 return AF_ERROR;
83 } 83 }
84 return AF_OK; 84 return AF_OK;
85 } 85 }
103 (AF_OK != check_format(data->format)) || 103 (AF_OK != check_format(data->format)) ||
104 (AF_OK != check_bps(af->data->bps)) || 104 (AF_OK != check_bps(af->data->bps)) ||
105 (AF_OK != check_format(af->data->format))) 105 (AF_OK != check_format(af->data->format)))
106 return AF_ERROR; 106 return AF_ERROR;
107 107
108 af_msg(AF_MSG_VERBOSE,"[format] Changing sample format from %s to %s\n", 108 mp_msg(MSGT_AFILTER, MSGL_V, "[format] Changing sample format from %s to %s\n",
109 af_fmt2str(data->format,buf1,256), 109 af_fmt2str(data->format,buf1,256),
110 af_fmt2str(af->data->format,buf2,256)); 110 af_fmt2str(af->data->format,buf2,256));
111 111
112 af->data->rate = data->rate; 112 af->data->rate = data->rate;
113 af->data->nch = data->nch; 113 af->data->nch = data->nch;
117 117
118 // look whether only endianness differences are there 118 // look whether only endianness differences are there
119 if ((af->data->format & ~AF_FORMAT_END_MASK) == 119 if ((af->data->format & ~AF_FORMAT_END_MASK) ==
120 (data->format & ~AF_FORMAT_END_MASK)) 120 (data->format & ~AF_FORMAT_END_MASK))
121 { 121 {
122 af_msg(AF_MSG_VERBOSE,"[format] Accelerated endianness conversion only\n"); 122 mp_msg(MSGT_AFILTER, MSGL_V, "[format] Accelerated endianness conversion only\n");
123 af->play = play_swapendian; 123 af->play = play_swapendian;
124 } 124 }
125 if ((data->format == AF_FORMAT_FLOAT_NE) && 125 if ((data->format == AF_FORMAT_FLOAT_NE) &&
126 (af->data->format == AF_FORMAT_S16_NE)) 126 (af->data->format == AF_FORMAT_S16_NE))
127 { 127 {
128 af_msg(AF_MSG_VERBOSE,"[format] Accelerated %s to %s conversion\n", 128 mp_msg(MSGT_AFILTER, MSGL_V, "[format] Accelerated %s to %s conversion\n",
129 af_fmt2str(data->format,buf1,256), 129 af_fmt2str(data->format,buf1,256),
130 af_fmt2str(af->data->format,buf2,256)); 130 af_fmt2str(af->data->format,buf2,256));
131 af->play = play_float_s16; 131 af->play = play_float_s16;
132 } 132 }
133 if ((data->format == AF_FORMAT_S16_NE) && 133 if ((data->format == AF_FORMAT_S16_NE) &&
134 (af->data->format == AF_FORMAT_FLOAT_NE)) 134 (af->data->format == AF_FORMAT_FLOAT_NE))
135 { 135 {
136 af_msg(AF_MSG_VERBOSE,"[format] Accelerated %s to %s conversion\n", 136 mp_msg(MSGT_AFILTER, MSGL_V, "[format] Accelerated %s to %s conversion\n",
137 af_fmt2str(data->format,buf1,256), 137 af_fmt2str(data->format,buf1,256),
138 af_fmt2str(af->data->format,buf2,256)); 138 af_fmt2str(af->data->format,buf2,256));
139 af->play = play_s16_float; 139 af->play = play_s16_float;
140 } 140 }
141 return AF_OK; 141 return AF_OK;
142 } 142 }
143 case AF_CONTROL_COMMAND_LINE:{ 143 case AF_CONTROL_COMMAND_LINE:{
144 int format = af_str2fmt_short(arg); 144 int format = af_str2fmt_short(arg);
145 if (format == -1) { 145 if (format == -1) {
146 af_msg(AF_MSG_ERROR, "[format] %s is not a valid format\n", (char *)arg); 146 mp_msg(MSGT_AFILTER, MSGL_ERR, "[format] %s is not a valid format\n", (char *)arg);
147 return AF_ERROR; 147 return AF_ERROR;
148 } 148 }
149 if(AF_OK != af->control(af,AF_CONTROL_FORMAT_FMT | AF_CONTROL_SET,&format)) 149 if(AF_OK != af->control(af,AF_CONTROL_FORMAT_FMT | AF_CONTROL_SET,&format))
150 return AF_ERROR; 150 return AF_ERROR;
151 return AF_OK; 151 return AF_OK;