diff --git a/configure b/configure index b826811a26..e556be2763 100755 --- a/configure +++ b/configure @@ -91,7 +91,6 @@ show_help(){ echo " --enable-libmp3lame enable MP3 encoding via libmp3lame [default=no]" echo " --enable-libnut enable NUT (de)muxing via libnut," echo " native demuxer exists [default=no]" - echo " --enable-libogg enable Ogg muxing via libogg [default=no]" echo " --enable-libtheora enable Theora encoding via libtheora [default=no]" echo " --enable-libvorbis enable Vorbis encoding via libvorbis," echo " native implementation exists [default=no]" @@ -620,7 +619,6 @@ CONFIG_LIST=" libgsm libmp3lame libnut - libogg libtheora libvorbis libx264 @@ -799,7 +797,6 @@ dv1394_demuxer_deps="dv1394" libdc1394_demuxer_deps="libdc1394" libnut_demuxer_deps="libnut" libnut_muxer_deps="libnut" -libogg_muxer_deps="libogg" mp3_demuxer_deps="mpegaudio_parser" oss_demuxer_deps_any="soundcard_h sys_soundcard_h" oss_muxer_deps_any="soundcard_h sys_soundcard_h" @@ -1247,11 +1244,6 @@ fi disabled static && LIBNAME="" -if ! enabled libogg; then - enabled libtheora && die "libogg must be enabled to enable libtheora." - enabled libvorbis && die "libogg must be enabled to enable libvorbis." -fi - if enabled_any libfaad libfaadbin ; then if check_header faad.h; then check_cc << EOF @@ -1565,7 +1557,6 @@ enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad enabled libgsm && require libgsm gsm.h gsm_create -lgsm enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm enabled libnut && require libnut libnut.h nut_demuxer_init -lnut -enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg enabled libx264 && require x264 x264.h x264_encoder_open -lx264 @@ -1747,7 +1738,6 @@ check_deps $CONFIG_LIST $HAVE_LIST $DECODER_LIST $ENCODER_LIST $PARSER_LIST \ $BSF_LIST $DEMUXER_LIST $MUXER_LIST $PROTOCOL_LIST enabled libdc1394 && append pkg_requires "libraw1394" -enabled libogg && append pkg_requires "ogg >= 1.1" enabled libtheora && append pkg_requires "theora" enabled libvorbis && append pkg_requires "vorbisenc" @@ -1815,7 +1805,6 @@ echo "libfaad dlopened ${libfaadbin-no}" echo "libgsm enabled ${libgsm-no}" echo "libmp3lame enabled ${libmp3lame-no}" echo "libnut enabled ${libnut-no}" -echo "libogg enabled ${libogg-no}" echo "libtheora enabled ${libtheora-no}" echo "libvorbis enabled ${libvorbis-no}" echo "x264 enabled ${libx264-no}" diff --git a/libavformat/Makefile b/libavformat/Makefile index 3d29abeb9c..378364f0c5 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -161,7 +161,6 @@ OBJS-$(CONFIG_YUV4MPEGPIPE_DEMUXER) += yuv4mpeg.o OBJS-$(CONFIG_LIBDC1394_DEMUXER) += libdc1394.o OBJS-$(CONFIG_LIBNUT_DEMUXER) += libnut.o riff.o OBJS-$(CONFIG_LIBNUT_MUXER) += libnut.o riff.o -OBJS-$(CONFIG_LIBOGG_MUXER) += libogg.o OBJS-$(CONFIG_VHOOK) += framehook.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index b92201ab7f..52529974d1 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -172,7 +172,6 @@ void av_register_all(void) /* external libraries */ REGISTER_DEMUXER (LIBDC1394, libdc1394); REGISTER_MUXDEMUX (LIBNUT, libnut); - REGISTER_MUXER (LIBOGG, libogg); /* protocols */ REGISTER_PROTOCOL (FILE, file); diff --git a/libavformat/libogg.c b/libavformat/libogg.c deleted file mode 100644 index 9ed4f1d5f0..0000000000 --- a/libavformat/libogg.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Ogg bitstream support - * Mark Hills - * - * Uses libogg, but requires libvorbisenc to construct correct headers - * when containing Vorbis stream -- currently the only format supported - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include - -#include "avformat.h" - - -#define DECODER_BUFFER_SIZE 4096 - - -typedef struct OggContext { - /* output */ - ogg_stream_state os ; - int header_handled ; - ogg_packet op; - - /* input */ - ogg_sync_state oy ; -} OggContext ; - - -#ifdef CONFIG_MUXERS -static int ogg_write_header(AVFormatContext *avfcontext) -{ - OggContext *context = avfcontext->priv_data; - ogg_packet *op= &context->op; - int n; - - ogg_stream_init(&context->os, 31415); - - for(n = 0 ; n < avfcontext->nb_streams ; n++) { - AVCodecContext *codec = avfcontext->streams[n]->codec; - uint8_t *headers = codec->extradata; - int headers_len = codec->extradata_size; - uint8_t *header_start[3]; - int header_len[3]; - int i, j; - - av_set_pts_info(avfcontext->streams[n], 60, 1, AV_TIME_BASE); - - for(j=1,i=0;i<2;++i, ++j) { - header_len[i]=0; - while(jbytes = header_len[i]; - - op->packet= header_start[i]; - op->b_o_s= op->packetno==0; - - ogg_stream_packetin(&context->os, op); - - op->packetno++; //FIXME multiple streams - } - - context->header_handled = 0 ; - } - - return 0 ; -} - -static int ogg_write_packet(AVFormatContext *avfcontext, AVPacket *pkt) -{ - OggContext *context = avfcontext->priv_data ; - AVCodecContext *avctx= avfcontext->streams[pkt->stream_index]->codec; - ogg_packet *op= &context->op; - ogg_page og ; - int64_t pts; - - pts= av_rescale(pkt->pts, avctx->sample_rate, AV_TIME_BASE); - -// av_log(avfcontext, AV_LOG_DEBUG, "M%d\n", size); - - /* flush header packets so audio starts on a new page */ - - if(!context->header_handled) { - while(ogg_stream_flush(&context->os, &og)) { - put_buffer(&avfcontext->pb, og.header, og.header_len) ; - put_buffer(&avfcontext->pb, og.body, og.body_len) ; - put_flush_packet(&avfcontext->pb); - } - context->header_handled = 1 ; - } - - op->packet = (uint8_t*) pkt->data; - op->bytes = pkt->size; - op->b_o_s = op->packetno == 0; - op->granulepos= pts; - - /* correct the fields in the packet -- essential for streaming */ - - ogg_stream_packetin(&context->os, op); - - while(ogg_stream_pageout(&context->os, &og)) { - put_buffer(&avfcontext->pb, og.header, og.header_len); - put_buffer(&avfcontext->pb, og.body, og.body_len); - put_flush_packet(&avfcontext->pb); - } - op->packetno++; - - return 0; -} - - -static int ogg_write_trailer(AVFormatContext *avfcontext) { - OggContext *context = avfcontext->priv_data ; - ogg_page og ; - - while(ogg_stream_flush(&context->os, &og)) { - put_buffer(&avfcontext->pb, og.header, og.header_len) ; - put_buffer(&avfcontext->pb, og.body, og.body_len) ; - put_flush_packet(&avfcontext->pb); - } - - ogg_stream_clear(&context->os) ; - return 0 ; -} - - -AVOutputFormat libogg_muxer = { - "libogg", - "Ogg format", - "application/ogg", - "ogg", - sizeof(OggContext), - CODEC_ID_VORBIS, - 0, - ogg_write_header, - ogg_write_packet, - ogg_write_trailer, -} ; -#endif //CONFIG_MUXERS - -#if 0 -static int next_packet(AVFormatContext *avfcontext, ogg_packet *op) { - OggContext *context = avfcontext->priv_data ; - ogg_page og ; - char *buf ; - - while(ogg_stream_packetout(&context->os, op) != 1) { - - /* while no pages are available, read in more data to the sync */ - while(ogg_sync_pageout(&context->oy, &og) != 1) { - buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ; - if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0) - return 1 ; - ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ; - } - - /* got a page. Feed it into the stream and get the packet */ - if(ogg_stream_pagein(&context->os, &og) != 0) - return 1 ; - } - - return 0 ; -} - - -static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap) -{ - OggContext *context = avfcontext->priv_data; - ogg_packet op ; - char *buf ; - ogg_page og ; - AVStream *ast ; - AVCodecContext *codec; - uint8_t *p; - int i; - - ogg_sync_init(&context->oy) ; - buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ; - - if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0) - return AVERROR(EIO) ; - - ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ; - ogg_sync_pageout(&context->oy, &og) ; - ogg_stream_init(&context->os, ogg_page_serialno(&og)) ; - ogg_stream_pagein(&context->os, &og) ; - - /* currently only one vorbis stream supported */ - - ast = av_new_stream(avfcontext, 0) ; - if(!ast) - return AVERROR(ENOMEM) ; - av_set_pts_info(ast, 60, 1, AV_TIME_BASE); - - codec= &ast->codec; - codec->codec_type = CODEC_TYPE_AUDIO; - codec->codec_id = CODEC_ID_VORBIS; - for(i=0; i<3; i++){ - if(next_packet(avfcontext, &op)){ - return -1; - } - if(op.bytes >= (1<<16) || op.bytes < 0) - return -1; - codec->extradata_size+= 2 + op.bytes; - codec->extradata= av_realloc(codec->extradata, codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - memset(codec->extradata + codec->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - p= codec->extradata + codec->extradata_size - 2 - op.bytes; - *(p++)= op.bytes>>8; - *(p++)= op.bytes&0xFF; - memcpy(p, op.packet, op.bytes); - } - - return 0 ; -} - - -static int ogg_read_packet(AVFormatContext *avfcontext, AVPacket *pkt) { - ogg_packet op ; - - if(next_packet(avfcontext, &op)) - return AVERROR(EIO) ; - if(av_new_packet(pkt, op.bytes) < 0) - return AVERROR(EIO) ; - pkt->stream_index = 0 ; - memcpy(pkt->data, op.packet, op.bytes); - if(avfcontext->streams[0]->codec.sample_rate && op.granulepos!=-1) - pkt->pts= av_rescale(op.granulepos, AV_TIME_BASE, avfcontext->streams[0]->codec.sample_rate); -// printf("%"PRId64" %d %d\n", pkt->pts, (int)op.granulepos, avfcontext->streams[0]->codec.sample_rate); - - return op.bytes; -} - - -static int ogg_read_close(AVFormatContext *avfcontext) { - OggContext *context = avfcontext->priv_data ; - - ogg_stream_clear(&context->os) ; - ogg_sync_clear(&context->oy) ; - - return 0 ; -} - - -static AVInputFormat ogg_iformat = { - "ogg", - "Ogg Vorbis", - sizeof(OggContext), - NULL, - ogg_read_header, - ogg_read_packet, - ogg_read_close, - .extensions = "ogg", -} ; -#endif