1 /* 2 * Copyright 2009-2010 Stephan Aßmus <superstippi@gmx.de> 3 * All rights reserved. Distributed under the terms of the MIT license. 4 */ 5 6 7 #include "EncoderTable.h" 8 9 10 const EncoderDescription gEncoderTable[] = { 11 { 12 { 13 "MPEG-4 video", 14 "mpeg4", 15 0, 16 CODEC_ID_MPEG4, 17 { 0 } 18 }, 19 B_ANY_FORMAT_FAMILY, // TODO: Hm, actually not really /any/ family... 20 B_MEDIA_RAW_VIDEO, 21 B_MEDIA_ENCODED_VIDEO, 22 23 23 }, 24 { 25 { 26 "MPEG-1 video", 27 "mpeg1video", 28 0, 29 CODEC_ID_MPEG1VIDEO, 30 { 0 } 31 }, 32 B_MPEG_FORMAT_FAMILY, 33 B_MEDIA_RAW_VIDEO, 34 B_MEDIA_ENCODED_VIDEO, 35 10 36 }, 37 { 38 { 39 "MPEG-2 video", 40 "mpeg2video", 41 0, 42 CODEC_ID_MPEG2VIDEO, 43 { 0 } 44 }, 45 B_MPEG_FORMAT_FAMILY, 46 B_MEDIA_RAW_VIDEO, 47 B_MEDIA_ENCODED_VIDEO, 48 15 49 }, 50 { 51 { 52 "Theora video", 53 "theora", 54 0, 55 CODEC_ID_THEORA, 56 { 0 } 57 }, 58 B_ANY_FORMAT_FAMILY, 59 B_MEDIA_RAW_VIDEO, 60 B_MEDIA_ENCODED_VIDEO, 61 18 62 }, 63 { 64 { 65 "DV (Digital Video)", 66 "dvvideo", 67 0, 68 CODEC_ID_DVVIDEO, 69 { 0 } 70 }, 71 B_MISC_FORMAT_FAMILY, 72 B_MEDIA_RAW_VIDEO, 73 B_MEDIA_ENCODED_VIDEO, 74 5 75 }, 76 { 77 { 78 "MJPEG (Motion JPEG)", 79 "mjpeg", 80 0, 81 CODEC_ID_MJPEG, 82 { 0 } 83 }, 84 B_ANY_FORMAT_FAMILY, 85 B_MEDIA_RAW_VIDEO, 86 B_MEDIA_ENCODED_VIDEO, 87 5 88 }, 89 { 90 { 91 "Raw audio", 92 "pcm", 93 0, 94 0, 95 { 0 } 96 }, 97 B_ANY_FORMAT_FAMILY, 98 B_MEDIA_RAW_AUDIO, 99 B_MEDIA_ENCODED_AUDIO, 100 1 101 }, 102 { 103 { 104 "Dolby Digital (AC-3)", 105 "ac3", 106 0, 107 CODEC_ID_AC3, 108 { 0 } 109 }, 110 B_ANY_FORMAT_FAMILY, 111 B_MEDIA_RAW_AUDIO, 112 B_MEDIA_ENCODED_AUDIO, 113 10 114 }, 115 { 116 { 117 "Vorbis audio", 118 "vorbis", 119 0, 120 CODEC_ID_VORBIS, 121 { 0 } 122 }, 123 B_ANY_FORMAT_FAMILY, 124 B_MEDIA_RAW_AUDIO, 125 B_MEDIA_ENCODED_AUDIO, 126 10 127 } 128 }; 129 130 const size_t gEncoderCount = sizeof(gEncoderTable) / sizeof(EncoderDescription); 131 132 133 /*static*/ CodecID 134 raw_audio_codec_id_for(const media_format& format) 135 { 136 if (format.type != B_MEDIA_RAW_AUDIO) 137 return CODEC_ID_NONE; 138 139 if (format.u.raw_audio.byte_order == B_MEDIA_LITTLE_ENDIAN) { 140 switch (format.u.raw_audio.format) { 141 case media_raw_audio_format::B_AUDIO_FLOAT: 142 return CODEC_ID_PCM_F32LE; 143 case media_raw_audio_format::B_AUDIO_DOUBLE: 144 return CODEC_ID_PCM_F64LE; 145 case media_raw_audio_format::B_AUDIO_INT: 146 return CODEC_ID_PCM_S32LE; 147 case media_raw_audio_format::B_AUDIO_SHORT: 148 return CODEC_ID_PCM_S16LE; 149 case media_raw_audio_format::B_AUDIO_UCHAR: 150 return CODEC_ID_PCM_U8; 151 default: 152 return CODEC_ID_NONE; 153 } 154 } else { 155 switch (format.u.raw_audio.format) { 156 case media_raw_audio_format::B_AUDIO_FLOAT: 157 return CODEC_ID_PCM_F32BE; 158 case media_raw_audio_format::B_AUDIO_DOUBLE: 159 return CODEC_ID_PCM_F64BE; 160 case media_raw_audio_format::B_AUDIO_INT: 161 return CODEC_ID_PCM_S32BE; 162 case media_raw_audio_format::B_AUDIO_SHORT: 163 return CODEC_ID_PCM_S16BE; 164 case media_raw_audio_format::B_AUDIO_UCHAR: 165 return CODEC_ID_PCM_U8; 166 default: 167 return CODEC_ID_NONE; 168 } 169 } 170 } 171 172 173 174