Commit 6c9ce82f authored by Måns Rullgård's avatar Måns Rullgård

remove libtheora wrapper

Originally committed as revision 5873 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 98a2582f
......@@ -411,7 +411,6 @@ libgsm="no"
mp3lame="no"
libogg="no"
vorbis="no"
theora="no"
faad="no"
faadbin="no"
faac="no"
......@@ -909,14 +908,6 @@ EOF
exit 1;
fi
if test "$theora" = "yes" ; then
if test "$libogg" = "no"; then
echo "libogg must be enabled to enable Theora."
fail="yes"
theora="no"
fi
fi
if test "$vorbis" = "yes" ; then
if test "$libogg" = "no"; then
echo "libogg must be enabled to enable Vorbis."
......@@ -1256,7 +1247,6 @@ enabled libgsm && require libgsm gsm.h gsm_create -lgsm
enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame
enabled vorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg
enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg
enabled theora && require libtheora theora/theora.h theora_info_init -ltheora
enabled xvid && require XviD xvid.h xvid_global -lxvidcore
enabled x264 && require x264 x264.h x264_encoder_open -lx264
enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
......@@ -1881,11 +1871,6 @@ if test "$vorbis" = "yes" ; then
echo "CONFIG_LIBVORBIS=yes" >> config.mak
fi
if test "$theora" = "yes" ; then
echo "#define CONFIG_LIBTHEORA 1" >> $TMPH
echo "CONFIG_LIBTHEORA=yes" >> config.mak
fi
if test "$faad" = "yes" ; then
echo "#define CONFIG_FAAD 1" >> $TMPH
echo "CONFIG_FAAD=yes" >> config.mak
......
......@@ -210,7 +210,6 @@ OBJS-$(CONFIG_XVID) += xvidff.o xvid_rc.o
OBJS-$(CONFIG_X264) += x264.o
OBJS-$(CONFIG_MP3LAME) += mp3lameaudio.o
OBJS-$(CONFIG_LIBVORBIS) += oggvorbis.o
OBJS-$(CONFIG_LIBTHEORA) += oggtheora.o
OBJS-$(CONFIG_LIBGSM) += libgsm.o
# currently using liba52 for ac3 decoding
......
......@@ -59,11 +59,6 @@ void avcodec_register_all(void)
register_avcodec(&oggvorbis_decoder);
#endif //CONFIG_OGGVORBIS_DECODER
#endif
#ifdef CONFIG_LIBTHEORA
#ifdef CONFIG_OGGTHEORA_DECODER
register_avcodec(&oggtheora_decoder);
#endif //CONFIG_OGGTHEORA_DECODER
#endif
#ifdef CONFIG_FAAC
#ifdef CONFIG_FAAC_ENCODER
register_avcodec(&faac_encoder);
......@@ -375,7 +370,7 @@ void avcodec_register_all(void)
#ifdef CONFIG_VP3_DECODER
register_avcodec(&vp3_decoder);
#endif //CONFIG_VP3_DECODER
#if (defined CONFIG_THEORA_DECODER && !defined CONFIG_LIBTHEORA)
#ifdef CONFIG_THEORA_DECODER
register_avcodec(&theora_decoder);
#endif //CONFIG_THEORA_DECODER
#ifdef CONFIG_ASV1_DECODER
......
......@@ -201,8 +201,6 @@ enum CodecID {
CODEC_ID_TTA,
CODEC_ID_SMACKAUDIO,
CODEC_ID_OGGTHEORA= 0x16000,
/* subtitle codecs */
CODEC_ID_DVD_SUBTITLE= 0x17000,
CODEC_ID_DVB_SUBTITLE,
......@@ -2186,7 +2184,6 @@ extern AVCodec mace6_decoder;
extern AVCodec huffyuv_decoder;
extern AVCodec ffvhuff_decoder;
extern AVCodec oggvorbis_decoder;
extern AVCodec oggtheora_decoder;
extern AVCodec cyuv_decoder;
extern AVCodec h264_decoder;
extern AVCodec indeo3_decoder;
......
/**
Copyright (C) 2005 Måns Rullgård
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
**/
#include <stdlib.h>
#include <theora/theora.h>
#include "avcodec.h"
typedef struct TheoraContext {
theora_info info;
theora_state state;
theora_comment comment;
ogg_packet op;
} TheoraContext;
static int
Theora_decode_frame(AVCodecContext *ctx, void *outdata, int *outdata_size,
uint8_t *buf, int buf_size)
{
TheoraContext *thc = ctx->priv_data;
AVFrame *frame = outdata;
yuv_buffer yuv;
thc->op.packet = buf;
thc->op.bytes = buf_size;
if(theora_decode_packetin(&thc->state, &thc->op))
return -1;
theora_decode_YUVout(&thc->state, &yuv);
frame->data[0] = yuv.y;
frame->data[1] = yuv.u;
frame->data[2] = yuv.v;
frame->linesize[0] = yuv.y_stride;
frame->linesize[1] = yuv.uv_stride;
frame->linesize[2] = yuv.uv_stride;
*outdata_size = sizeof(*frame);
return buf_size;
}
static int
Theora_decode_end(AVCodecContext *ctx)
{
TheoraContext *thc = ctx->priv_data;
theora_info_clear(&thc->info);
theora_comment_clear(&thc->comment);
return 0;
}
static int
Theora_decode_init(AVCodecContext *ctx)
{
TheoraContext *thc = ctx->priv_data;
int size, hs, i;
ogg_packet op;
uint8_t *cdp;
if(ctx->extradata_size < 6)
return -1;
theora_info_init(&thc->info);
memset(&op, 0, sizeof(op));
cdp = ctx->extradata;
size = ctx->extradata_size;
for(i = 0; i < 3; i++){
hs = *cdp++ << 8;
hs += *cdp++;
size -= 2;
if(hs > size){
av_log(ctx, AV_LOG_ERROR, "extradata too small: %i > %i\n",
hs, size);
return -1;
}
op.packet = cdp;
op.bytes = hs;
op.b_o_s = !i;
if(theora_decode_header(&thc->info, &thc->comment, &op))
return -1;
op.packetno++;
cdp += hs;
size -= hs;
}
theora_decode_init(&thc->state, &thc->info);
ctx->width = thc->info.width;
ctx->height = thc->info.height;
ctx->time_base.num = thc->info.fps_denominator;
ctx->time_base.den = thc->info.fps_numerator;
ctx->pix_fmt = PIX_FMT_YUV420P; /* FIXME: others are possible */
return 0;
}
AVCodec oggtheora_decoder = {
"theora",
CODEC_TYPE_VIDEO,
CODEC_ID_THEORA,
sizeof(TheoraContext),
Theora_decode_init,
NULL,
Theora_decode_end,
Theora_decode_frame,
0,
NULL
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment