static int volatile entangled_thread_counter=0;
static int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op);
static void *codec_mutex;
+static void *avformat_mutex;
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
{
#if HAVE_MMX
if(s->codec_id == CODEC_ID_SVQ1 || s->codec_id == CODEC_ID_VP5 ||
s->codec_id == CODEC_ID_VP6 || s->codec_id == CODEC_ID_VP6F ||
- s->codec_id == CODEC_ID_VP6A) {
+ s->codec_id == CODEC_ID_VP6A || s->codec_id == CODEC_ID_DIRAC) {
linesize_align[0] =
linesize_align[1] =
linesize_align[2] = 16;
}
if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {
- av_log(avctx, AV_LOG_WARNING, "The maximum value for lowres supported by the decoder is %d\n",
+ av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n",
avctx->codec->max_lowres);
- avctx->lowres = avctx->codec->max_lowres;
+ ret = AVERROR(EINVAL);
+ goto free_and_end;
}
if (avctx->codec->encode) {
int i;
return 0;
}
+static enum CodecID remap_deprecated_codec_id(enum CodecID id)
+{
+ switch(id){
+ case CODEC_ID_G723_1_DEPRECATED : return CODEC_ID_G723_1;
+ case CODEC_ID_G729_DEPRECATED : return CODEC_ID_G729;
+ case CODEC_ID_UTVIDEO_DEPRECATED: return CODEC_ID_UTVIDEO;
+ default : return id;
+ }
+}
+
AVCodec *avcodec_find_encoder(enum CodecID id)
{
AVCodec *p, *experimental=NULL;
p = first_avcodec;
+ id= remap_deprecated_codec_id(id);
while (p) {
if (p->encode != NULL && p->id == id) {
if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) {
{
AVCodec *p, *experimental=NULL;
p = first_avcodec;
+ id= remap_deprecated_codec_id(id);
while (p) {
if (p->decode != NULL && p->id == id) {
if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) {
if (ff_lockmgr_cb) {
if (ff_lockmgr_cb(&codec_mutex, AV_LOCK_DESTROY))
return -1;
+ if (ff_lockmgr_cb(&avformat_mutex, AV_LOCK_DESTROY))
+ return -1;
}
ff_lockmgr_cb = cb;
if (ff_lockmgr_cb) {
if (ff_lockmgr_cb(&codec_mutex, AV_LOCK_CREATE))
return -1;
+ if (ff_lockmgr_cb(&avformat_mutex, AV_LOCK_CREATE))
+ return -1;
+ }
+ return 0;
+}
+
+int avpriv_lock_avformat(void)
+{
+ if (ff_lockmgr_cb) {
+ if ((*ff_lockmgr_cb)(&avformat_mutex, AV_LOCK_OBTAIN))
+ return -1;
+ }
+ return 0;
+}
+
+int avpriv_unlock_avformat(void)
+{
+ if (ff_lockmgr_cb) {
+ if ((*ff_lockmgr_cb)(&avformat_mutex, AV_LOCK_RELEASE))
+ return -1;
}
return 0;
}
enum AVMediaType avcodec_get_type(enum CodecID codec_id)
{
+ AVCodec *c= avcodec_find_decoder(codec_id);
+ if(!c)
+ c= avcodec_find_encoder(codec_id);
+ if(c)
+ return c->type;
+
if (codec_id <= CODEC_ID_NONE)
return AVMEDIA_TYPE_UNKNOWN;
else if (codec_id < CODEC_ID_FIRST_AUDIO)