| OLD | NEW |
| 1 /* | 1 /* |
| 2 * audio conversion | 2 * audio conversion |
| 3 * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | 3 * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 { "5.0", 5, CH_LAYOUT_5POINT0_BACK }, | 114 { "5.0", 5, CH_LAYOUT_5POINT0_BACK }, |
| 115 { "5.1", 6, CH_LAYOUT_5POINT1 }, | 115 { "5.1", 6, CH_LAYOUT_5POINT1 }, |
| 116 { "5.1", 6, CH_LAYOUT_5POINT1_BACK }, | 116 { "5.1", 6, CH_LAYOUT_5POINT1_BACK }, |
| 117 { "5.1+downmix", 8, CH_LAYOUT_5POINT1|CH_LAYOUT_STEREO_DOWNMIX, }, | 117 { "5.1+downmix", 8, CH_LAYOUT_5POINT1|CH_LAYOUT_STEREO_DOWNMIX, }, |
| 118 { "7.1", 8, CH_LAYOUT_7POINT1 }, | 118 { "7.1", 8, CH_LAYOUT_7POINT1 }, |
| 119 { "7.1(wide)", 8, CH_LAYOUT_7POINT1_WIDE }, | 119 { "7.1(wide)", 8, CH_LAYOUT_7POINT1_WIDE }, |
| 120 { "7.1+downmix", 10, CH_LAYOUT_7POINT1|CH_LAYOUT_STEREO_DOWNMIX, }, | 120 { "7.1+downmix", 10, CH_LAYOUT_7POINT1|CH_LAYOUT_STEREO_DOWNMIX, }, |
| 121 { 0 } | 121 { 0 } |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 int64_t avcodec_get_channel_layout(const char *name) |
| 125 { |
| 126 int i = 0; |
| 127 do { |
| 128 if (!strcmp(channel_layout_map[i].name, name)) |
| 129 return channel_layout_map[i].layout; |
| 130 i++; |
| 131 } while (channel_layout_map[i].name); |
| 132 |
| 133 return 0; |
| 134 } |
| 135 |
| 124 void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels,
int64_t channel_layout) | 136 void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels,
int64_t channel_layout) |
| 125 { | 137 { |
| 126 int i; | 138 int i; |
| 127 | 139 |
| 128 for (i=0; channel_layout_map[i].name; i++) | 140 for (i=0; channel_layout_map[i].name; i++) |
| 129 if (nb_channels == channel_layout_map[i].nb_channels && | 141 if (nb_channels == channel_layout_map[i].nb_channels && |
| 130 channel_layout == channel_layout_map[i].layout) { | 142 channel_layout == channel_layout_map[i].layout) { |
| 131 av_strlcpy(buf, channel_layout_map[i].name, buf_size); | 143 av_strlcpy(buf, channel_layout_map[i].name, buf_size); |
| 132 return; | 144 return; |
| 133 } | 145 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_FLT, *(const float*)pi) | 246 else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_FLT, *(const float*)pi) |
| 235 else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_DBL, av_clip_uint8( lrint
(*(const double*)pi * (1<<7)) + 0x80)) | 247 else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_DBL, av_clip_uint8( lrint
(*(const double*)pi * (1<<7)) + 0x80)) |
| 236 else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_DBL, av_clip_int16( lrint
(*(const double*)pi * (1<<15)))) | 248 else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_DBL, av_clip_int16( lrint
(*(const double*)pi * (1<<15)))) |
| 237 else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_DBL, av_clipl_int32(llrint
(*(const double*)pi * (1U<<31)))) | 249 else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_DBL, av_clipl_int32(llrint
(*(const double*)pi * (1U<<31)))) |
| 238 else CONV(SAMPLE_FMT_FLT, float , SAMPLE_FMT_DBL, *(const double*)pi) | 250 else CONV(SAMPLE_FMT_FLT, float , SAMPLE_FMT_DBL, *(const double*)pi) |
| 239 else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_DBL, *(const double*)pi) | 251 else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_DBL, *(const double*)pi) |
| 240 else return -1; | 252 else return -1; |
| 241 } | 253 } |
| 242 return 0; | 254 return 0; |
| 243 } | 255 } |
| OLD | NEW |