Mercurial > audlegacy-plugins
comparison src/ffmpeg/libavcodec/utils.c @ 820:a53d893eb303 trunk
[svn] - remove more video codecs
| author | nenolod |
|---|---|
| date | Mon, 12 Mar 2007 14:02:32 -0700 |
| parents | 07107d476f32 |
| children | dec0488e1344 |
comparison
equal
deleted
inserted
replaced
| 819:1481c3667dc9 | 820:a53d893eb303 |
|---|---|
| 60 0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB, | 60 0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB, |
| 61 0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7, | 61 0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7, |
| 62 0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF, | 62 0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF, |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 int av_get_bits_per_sample(enum CodecID codec_id){ | |
| 66 switch(codec_id){ | |
| 67 case CODEC_ID_ADPCM_SBPRO_2: | |
| 68 return 2; | |
| 69 case CODEC_ID_ADPCM_SBPRO_3: | |
| 70 return 3; | |
| 71 case CODEC_ID_ADPCM_SBPRO_4: | |
| 72 case CODEC_ID_ADPCM_CT: | |
| 73 return 4; | |
| 74 case CODEC_ID_PCM_ALAW: | |
| 75 case CODEC_ID_PCM_MULAW: | |
| 76 case CODEC_ID_PCM_S8: | |
| 77 case CODEC_ID_PCM_U8: | |
| 78 return 8; | |
| 79 case CODEC_ID_PCM_S16BE: | |
| 80 case CODEC_ID_PCM_S16LE: | |
| 81 case CODEC_ID_PCM_U16BE: | |
| 82 case CODEC_ID_PCM_U16LE: | |
| 83 return 16; | |
| 84 case CODEC_ID_PCM_S24DAUD: | |
| 85 case CODEC_ID_PCM_S24BE: | |
| 86 case CODEC_ID_PCM_S24LE: | |
| 87 case CODEC_ID_PCM_U24BE: | |
| 88 case CODEC_ID_PCM_U24LE: | |
| 89 return 24; | |
| 90 case CODEC_ID_PCM_S32BE: | |
| 91 case CODEC_ID_PCM_S32LE: | |
| 92 case CODEC_ID_PCM_U32BE: | |
| 93 case CODEC_ID_PCM_U32LE: | |
| 94 return 32; | |
| 95 default: | |
| 96 return 0; | |
| 97 } | |
| 98 } | |
| 99 | |
| 100 /** | |
| 101 * decode a frame. | |
| 102 * @param buf bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE larger then the actual read bytes | |
| 103 * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end | |
| 104 * @param buf_size the size of the buffer in bytes | |
| 105 * @param got_picture_ptr zero if no frame could be decompressed, Otherwise, it is non zero | |
| 106 * @return -1 if error, otherwise return the number of | |
| 107 * bytes used. | |
| 108 */ | |
| 109 int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, | |
| 110 int *got_picture_ptr, | |
| 111 uint8_t *buf, int buf_size) | |
| 112 { | |
| 113 int ret; | |
| 114 | |
| 115 *got_picture_ptr= 0; | |
| 116 if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height)) | |
| 117 return -1; | |
| 118 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){ | |
| 119 ret = avctx->codec->decode(avctx, picture, got_picture_ptr, | |
| 120 buf, buf_size); | |
| 121 | |
| 122 emms_c(); //needed to avoid an emms_c() call before every return; | |
| 123 | |
| 124 if (*got_picture_ptr) | |
| 125 avctx->frame_number++; | |
| 126 }else | |
| 127 ret= 0; | |
| 128 | |
| 129 return ret; | |
| 130 } | |
| 131 | |
| 132 /* decode an audio frame. return -1 if error, otherwise return the | |
| 133 *number of bytes used. If no frame could be decompressed, | |
| 134 *frame_size_ptr is zero. Otherwise, it is the decompressed frame | |
| 135 *size in BYTES. */ | |
| 136 int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, | |
| 137 int *frame_size_ptr, | |
| 138 uint8_t *buf, int buf_size) | |
| 139 { | |
| 140 int ret; | |
| 141 | |
| 142 *frame_size_ptr= 0; | |
| 143 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){ | |
| 144 ret = avctx->codec->decode(avctx, samples, frame_size_ptr, | |
| 145 buf, buf_size); | |
| 146 avctx->frame_number++; | |
| 147 }else | |
| 148 ret= 0; | |
| 149 return ret; | |
| 150 } | |
| 151 | |
| 152 /* decode a subtitle message. return -1 if error, otherwise return the | |
| 153 *number of bytes used. If no subtitle could be decompressed, | |
| 154 *got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */ | |
| 155 int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, | |
| 156 int *got_sub_ptr, | |
| 157 const uint8_t *buf, int buf_size) | |
| 158 { | |
| 159 int ret; | |
| 160 | |
| 161 *got_sub_ptr = 0; | |
| 162 ret = avctx->codec->decode(avctx, sub, got_sub_ptr, | |
| 163 (uint8_t *)buf, buf_size); | |
| 164 if (*got_sub_ptr) | |
| 165 avctx->frame_number++; | |
| 166 return ret; | |
| 167 } | |
| 65 | 168 |
| 66 #define INTERNAL_BUFFER_SIZE 32 | 169 #define INTERNAL_BUFFER_SIZE 32 |
| 67 | 170 |
| 68 #undef ALIGN | 171 #undef ALIGN |
| 69 #define ALIGN(x, a) (((x)+(a)-1)&~((a)-1)) | 172 #define ALIGN(x, a) (((x)+(a)-1)&~((a)-1)) |
| 218 const short *samples) | 321 const short *samples) |
| 219 { | 322 { |
| 220 int ret; | 323 int ret; |
| 221 | 324 |
| 222 ret = avctx->codec->encode(avctx, buf, buf_size, (void *)samples); | 325 ret = avctx->codec->encode(avctx, buf, buf_size, (void *)samples); |
| 223 avctx->frame_number++; | |
| 224 return ret; | |
| 225 } | |
| 226 | |
| 227 /* decode an audio frame. return -1 if error, otherwise return the | |
| 228 *number of bytes used. If no frame could be decompressed, | |
| 229 *frame_size_ptr is zero. Otherwise, it is the decompressed frame | |
| 230 *size in BYTES. */ | |
| 231 int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, | |
| 232 int *frame_size_ptr, | |
| 233 uint8_t *buf, int buf_size) | |
| 234 { | |
| 235 int ret; | |
| 236 ret = avctx->codec->decode(avctx, samples, frame_size_ptr, | |
| 237 buf, buf_size); | |
| 238 avctx->frame_number++; | 326 avctx->frame_number++; |
| 239 return ret; | 327 return ret; |
| 240 } | 328 } |
| 241 | 329 |
| 242 int avcodec_close(AVCodecContext *avctx) | 330 int avcodec_close(AVCodecContext *avctx) |
