Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37868066
en ru br
ALT Linux repositórios
S:6.0-alt2.1
D:0.5.0-alt0.14329.1
5.0: 15151-alt5.M50.1
4.1: 11656-alt1.M41.1
4.0: 10629-alt3.M40.0
3.0: 0.4.9-alt2cvs20050406

Group :: Vídeo
RPM: ffmpeg

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: ffmpeg-15151-swscale.patch
Download


 Makefile                 |    4 +-
 configure                |   15 -
 libavcodec/Makefile      |    7 +-
 libavcodec/allcodecs.c   |    2 -
 libavcodec/avcodec.h     |    3 +-
 libavcodec/dirac.c       |  770 ----------------------------------------------
 libavcodec/imgconvert.c  |    2 +
 libavcodec/imgresample.c |    2 -
 libavformat/raw.c        |   42 ---
 libavformat/riff.c       |    1 -
 libavformat/utils.c      |    1 -
 11 files changed, 8 insertions(+), 841 deletions(-)
diff --git a/Makefile b/Makefile
index 49c906d..70b60a8 100644
--- a/Makefile
+++ b/Makefile
@@ -76,11 +76,11 @@ all: lib $(PROGS) $(ALL_TARGETS-yes)
 
 lib:
 	$(MAKE)                    -C libavutil   all
-	$(MAKE-$(CONFIG_SWSCALER)) -C libswscale  all
 	$(MAKE)                    -C libavcodec  all
 	$(MAKE)                    -C libavformat all
 	$(MAKE)                    -C libavdevice all
 	$(MAKE-$(CONFIG_PP))       -C libpostproc all
+	$(MAKE-$(CONFIG_SWSCALER)) -C libswscale  all
 
 ifeq ($(CONFIG_VHOOK),yes)
 all: videohook
@@ -166,11 +166,11 @@ install-vhook: videohook
 
 install-libs:
 	$(MAKE)                    -C libavutil   install-libs
-	$(MAKE-$(CONFIG_SWSCALER)) -C libswscale  install-libs
 	$(MAKE)                    -C libavcodec  install-libs
 	$(MAKE)                    -C libavformat install-libs
 	$(MAKE)                    -C libavdevice install-libs
 	$(MAKE-$(CONFIG_PP))       -C libpostproc install-libs
+	$(MAKE-$(CONFIG_SWSCALER)) -C libswscale  install-libs
 ifeq ($(BUILD_SHARED),yes)
 	-$(LDCONFIG)
 endif
diff --git a/configure b/configure
index 73d5a99..bd2cc4a 100755
--- a/configure
+++ b/configure
@@ -99,7 +99,6 @@ show_help(){
   echo "  --enable-libtheora       enable Theora encoding via libtheora [default=no]"
   echo "  --enable-libvorbis       enable Vorbis encoding via libvorbis,"
   echo "                           native implementation exists [default=no]"
-  echo "  --enable-dirac           enable dirac codec support via libdirac_encoder [default=no]"
   echo "  --enable-libx264         enable H.264 encoding via x264 [default=no]"
   echo "  --enable-libxvid         enable Xvid encoding via xvidcore,"
   echo "                           native MPEG-4/Xvid encoder exists [default=no]"
@@ -607,13 +606,6 @@ check_foo_config(){
     return $err
 }
 
-require_pkg(){
-    pkg="$1"
-    pkg-config --exists "$pkg" || die "ERROR: $pkg.pc not found"
-    add_extralibs `pkg-config --libs "$pkg"`
-    add_cflags `pkg-config --cflags "$pkg"`
-}
-
 apply(){
     file=$1
     shift
@@ -672,7 +664,6 @@ CONFIG_LIST="
     vhook
     x11grab
     zlib
-    dirac
 "
 
 THREADS_LIST='
@@ -830,8 +821,6 @@ libgsm_ms_encoder_deps="libgsm"
 libmp3lame_encoder_deps="libmp3lame"
 libtheora_encoder_deps="libtheora"
 libvorbis_encoder_deps="libvorbis"
-dirac_decoder_deps="dirac"
-dirac_encoder_deps="dirac"
 libx264_encoder_deps="libx264"
 libxvid_encoder_deps="libxvid"
 mpeg4aac_decoder_deps="libfaad"
@@ -1667,8 +1656,6 @@ enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -
 enabled libamrnbbin && enable libamr_nb
 enabled libamrwbbin && enable libamr_wb
 
-enabled dirac      && require_pkg dirac
-
 # disable the native AC-3 decoder if liba52 is enabled
 enabled liba52 && disable ac3_decoder
 
@@ -1876,7 +1863,6 @@ check_deps $CONFIG_LIST       \
 enabled libdc1394 && append pkg_requires_private "libraw1394"
 enabled libtheora && append pkg_requires_private "theora"
 enabled libvorbis && append pkg_requires_private "vorbisenc"
-enabled dirac     && append pkg_requires_private "dirac"
 
 echo "install prefix            $PREFIX"
 echo "source path               $source_path"
@@ -1947,7 +1933,6 @@ echo "libvorbis enabled         ${libvorbis-no}"
 echo "x264 enabled              ${libx264-no}"
 echo "XviD enabled              ${libxvid-no}"
 echo "zlib enabled              ${zlib-no}"
-echo "libdirac support          ${dirac-no}"
 echo "libamr-nb dlopened        ${libamrnbbin-no}"
 echo "libamr-wb dlopened        ${libamrwbbin-no}"
 
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 451334c..984d764 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -56,8 +56,6 @@ OBJS-$(CONFIG_COOK_DECODER)            += cook.o mdct.o fft.o
 OBJS-$(CONFIG_CSCD_DECODER)            += cscd.o
 OBJS-$(CONFIG_CYUV_DECODER)            += cyuv.o
 OBJS-$(CONFIG_DCA_DECODER)             += dca.o
-OBJS-$(CONFIG_DIRAC_DECODER)           += dirac.o
-OBJS-$(CONFIG_DIRAC_ENCODER)           += dirac.o
 OBJS-$(CONFIG_DNXHD_DECODER)           += dnxhddec.o dnxhddata.o
 OBJS-$(CONFIG_DNXHD_ENCODER)           += dnxhdenc.o dnxhddata.o mpegvideo_enc.o motion_est.o ratecontrol.o
 OBJS-$(CONFIG_DSICINAUDIO_DECODER)     += dsicinav.o
@@ -306,7 +304,6 @@ OBJS-$(CONFIG_OGG_MUXER)               += xiph.o
 
 # external codec libraries
 OBJS-$(CONFIG_LIBA52)                  += liba52.o
-OBJS-$(CONFIG_DIRAC_PARSER)            += dirac.o
 OBJS-$(CONFIG_LIBAMR_NB)               += libamr.o
 OBJS-$(CONFIG_LIBAMR_WB)               += libamr.o
 OBJS-$(CONFIG_LIBFAAC)                 += libfaac.o
@@ -354,7 +351,9 @@ OBJS-$(HAVE_W32THREADS)                += w32thread.o
 
 OBJS-$(HAVE_XVMC_ACCEL)                += xvmcvideo.o
 
+ifneq ($(CONFIG_SWSCALER),yes)
 OBJS += imgresample.o
+endif
 
 # processor-specific code
 ifeq ($(HAVE_MMX),yes)
@@ -454,8 +453,6 @@ ASM_OBJS-$(ARCH_BFIN)                  += bfin/pixels_bfin.o \
 
 EXTRALIBS := -L$(BUILD_ROOT)/libavutil -lavutil$(BUILDSUF) $(EXTRALIBS)
 
-EXTRALIBS += -L$(BUILD_ROOT)/libswscale -lswscale
-
 NAME=avcodec
 LIBVERSION=$(LAVCVERSION)
 LIBMAJOR=$(LAVCMAJOR)
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 3700d2a..6e42b06 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -170,7 +170,6 @@ void avcodec_register_all(void)
     REGISTER_DECODER (XSUB, xsub);
     REGISTER_ENCDEC  (ZLIB, zlib);
     REGISTER_ENCDEC  (ZMBV, zmbv);
-    REGISTER_ENCDEC (DIRAC, dirac);
 
     /* audio codecs */
     REGISTER_DECODER (MPEG4AAC, mpeg4aac);
@@ -298,7 +297,6 @@ void avcodec_register_all(void)
     REGISTER_PARSER  (MPEGVIDEO, mpegvideo);
     REGISTER_PARSER  (PNM, pnm);
     REGISTER_PARSER  (VC1, vc1);
-    REGISTER_PARSER (DIRAC, dirac);
 
     /* bitstream filters */
     REGISTER_BSF     (DUMP_EXTRADATA, dump_extradata);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index e966693..b3325d2 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -285,7 +285,6 @@ enum CodecID {
     /* subtitle codecs */
     CODEC_ID_DVD_SUBTITLE= 0x17000,
     CODEC_ID_DVB_SUBTITLE,
-    CODEC_ID_DIRAC= 0x18000,
     CODEC_ID_TEXT,  ///< raw UTF-8 text
     CODEC_ID_XSUB,
     CODEC_ID_SSA,
@@ -2266,6 +2265,7 @@ typedef struct AVSubtitle {
     AVSubtitleRect *rects;
 } AVSubtitle;
 
+
 /* resample.c */
 
 struct ReSampleContext;
@@ -2844,6 +2844,7 @@ int av_parser_change(AVCodecParserContext *s,
                      const uint8_t *buf, int buf_size, int keyframe);
 void av_parser_close(AVCodecParserContext *s);
 
+
 typedef struct AVBitStreamFilterContext {
     void *priv_data;
     struct AVBitStreamFilter *filter;
diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
deleted file mode 100644
index 5e57f9f..0000000
--- a/libavcodec/dirac.c
+++ /dev/null
@@ -1,770 +0,0 @@
-/**
- * @file dirac.c
- * Dirac codec support via dirac_encoder.
- * @author Andrew Kennedy <dirac@rd.bbc.co.uk>
- * www.sourceforge.net/projects/dirac
- *
- * This file is part of libavcodec.
- *
- * This library 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 of the License, or (at your option) any later version.
- *
- * This library 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 this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
- 
-
-#include "avcodec.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-
-#include <libdirac_encoder/dirac_encoder.h>
-#include <libdirac_decoder/dirac_parser.h>
-
-/** ffmpeg qscale to Dirac quality conversion table */
-static const float quality_factor_conv[] = {10.0, 9.8, 9.6, 9.4, 9.2, 9.0, 8.8, 
-          8.6, 8.4, 8.2, 8.0, 7.8, 7.6, 7.3, 7.0, 6.7, 6.4, 6.0, 5.6, 5.2, 4.8, 
-          4.4, 4.0, 3.6, 3.2, 2.8, 2.4, 2.0, 1.6, 1.2, 1.0 };
-
-/** contains a single frame returned from Dirac*/
-typedef struct FfmpegDiracOutputFrame
-{
-    /** frame data */
-    unsigned char *p_data;
-    
-    /** frame size */
-    int size;
-    
-    /** frame type */
-    int type;
-    
-    /** next frame to be output in sequence */
-    struct FfmpegDiracOutputFrame *p_next_frame;
-    
- } FfmpegDiracOutputFrame;
-  
-typedef struct FfmpegDiracParams
-{
-    /* context params */
-    dirac_encoder_context_t enc_ctx;
-
-    /* frame being encoded */
-    AVFrame picture;
-
-      /* decoder */
-    dirac_decoder_t*  p_decoder;
-    
-    /* encoder */
-    dirac_encoder_t*  p_encoder;
-
-    /* input frame buffer */
-    unsigned char *p_in_frame_buf;
-    
-    /** output frame buf */
-    unsigned char* p_out_frame_buf;
-    
-    /** next frame to be output*/
-    struct FfmpegDiracOutputFrame *p_next_output_frame;
-    
-      /** last frame to be output*/
-    struct FfmpegDiracOutputFrame *p_last_output_frame;
-    
-} FfmpegDiracParams;
-
-
-typedef struct FfmpegDiracParseContext
-{
-
-    /** stream buffer variables */
-    unsigned char* p_dirac_videobuffer;
-    int dirac_videobuf_code_len;
-    unsigned char dirac_videobuf_code[5];
-    int dirac_videobuf_len;
-    int in_frame;
-    int dirac_overread_size;
-
-} FfmpegDiracParseContext ;
-
-
-/**
-* Works out Dirac-compatible pre-set option from file size
-*/
-static dirac_encoder_presets_t GetDiracPreset(AVCodecContext *avccontext)
-{
-
-    if(avccontext->width==176 && avccontext->height==120)
-        return VIDEO_FORMAT_QSIF525;
-    else if(avccontext->width==176 && avccontext->height==144)
-        return VIDEO_FORMAT_QCIF;
-    else if(avccontext->width==352 && avccontext->height==240)
-        return VIDEO_FORMAT_SIF525;
-    else if(avccontext->width==352 && avccontext->height==288)
-        return VIDEO_FORMAT_CIF;
-    else if(avccontext->width==704 && avccontext->height==480)
-        return VIDEO_FORMAT_4SIF525;
-    else if(avccontext->width==704 && avccontext->height==576)
-        return VIDEO_FORMAT_4CIF;
-    else if(avccontext->width==720 && avccontext->height==480)
-        return VIDEO_FORMAT_SD_480I60;
-    else if(avccontext->width==720 && avccontext->height==576)
-        return VIDEO_FORMAT_SD_576I50;
-    else if(avccontext->height==1280 && avccontext->height==720)
-    {
-        if (avccontext->time_base.den == 60000 && 
-            avccontext->time_base.num == 1001)
-        {
-            return VIDEO_FORMAT_HD_720P60;
-        }
-        else
-        {
-            return VIDEO_FORMAT_HD_720P50;
-        }
-    }    
-    else if(avccontext->height==1920 && avccontext->width==1080)
-    {
-        if (avccontext->time_base.den == 30000 && 
-            avccontext->time_base.num == 1001)
-        {
-            return VIDEO_FORMAT_HD_1080I60;
-        }
-        else if (avccontext->time_base.den == 25 && 
-            avccontext->time_base.num == 1)
-        {
-            return VIDEO_FORMAT_HD_1080I50;
-        }
-        else if (avccontext->time_base.den == 60 && 
-            avccontext->time_base.num == 1001)
-        {
-            return VIDEO_FORMAT_HD_1080P60;
-        }
-        else
-        {
-            return VIDEO_FORMAT_HD_1080P50;
-        }
-    }
-    return VIDEO_FORMAT_CUSTOM;
-}
-
-/**
-* Works out Dirac-compatible chroma format 
-*/
-static int GetDiracChromaFormat(AVCodecContext *avccontext)
-{
-   FfmpegDiracParams* p_dirac_params = avccontext->priv_data;
- 
-    switch(avccontext->pix_fmt)
-    {
-        case PIX_FMT_YUV420P:
-            p_dirac_params->enc_ctx.src_params.chroma =  format420;
-            break;
-
-        case PIX_FMT_YUV422P:
-            p_dirac_params->enc_ctx.src_params.chroma =  format422;
-            break;
-    
-        case PIX_FMT_YUV444P:
-            p_dirac_params->enc_ctx.src_params.chroma =  format444;
-            break;
-    
-        default:
-            av_log (avccontext, AV_LOG_ERROR, "this codec supports only Planar YUV formats (yuv420p, yuv422p, yuv444p\n");
-            return -1;
-    }
-    return format420;
-}
- 
- /**
- * returns Ffmppeg chroma format 
- */
-static int GetFfmpegChromaFormat(dirac_chroma_t dirac_chroma)
-{
-    switch(dirac_chroma)
-    {
-        case format420:
-            return PIX_FMT_YUV420P;
-        case format422:
-            return PIX_FMT_YUV422P;
-        case format444:
-            return PIX_FMT_YUV444P;
-      
-        default:
-            break;
-     }
-      
-     return PIX_FMT_YUV420P;
-}
-  
-
-static int dirac_encode_init(AVCodecContext *avccontext)
-{
-  
-   FfmpegDiracParams* p_dirac_params = avccontext->priv_data;
-   int no_local=1;  
-   int verbose=avccontext->debug;
-   dirac_encoder_presets_t preset;
-   
-   if(avccontext->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){
-        av_log(avccontext, AV_LOG_ERROR, "this codec is under development, files encoded with it may not be decodable with future versions!!!\n"
-               "use vstrict=-2 / -strict -2 to use it anyway\n");
-        return -1;
-    }
-   
-   /* get dirac preset*/
-   preset = GetDiracPreset(avccontext);
-
-    /* set data to zero */
-    memset (p_dirac_params, 0, sizeof(FfmpegDiracParams));
-     
- 
-     /* initialise the encoder context */
-    dirac_encoder_context_init (&(p_dirac_params->enc_ctx), preset);
-   
-    if (GetDiracChromaFormat(avccontext) == -1)
-        return -1;
-    p_dirac_params->enc_ctx.src_params.frame_rate.numerator=avccontext->time_base.den;
-    p_dirac_params->enc_ctx.src_params.frame_rate.denominator=avccontext->time_base.num;
-    p_dirac_params->enc_ctx.src_params.width=avccontext->width;
-    p_dirac_params->enc_ctx.src_params.height=avccontext->height;
-   
-    avccontext->frame_size = avpicture_get_size(avccontext->pix_fmt, avccontext->width, avccontext->height);
-    avccontext->coded_frame= &p_dirac_params->picture;
-     
-    if (no_local)
-    {
-        p_dirac_params->enc_ctx.decode_flag = 0;
-        p_dirac_params->enc_ctx.instr_flag = 0;
-    }
-    else
-    {
-        p_dirac_params->enc_ctx.decode_flag = 1;
-        p_dirac_params->enc_ctx.instr_flag = 1;
-    }
-    
-    if(avccontext->global_quality != 0)
-       p_dirac_params->enc_ctx.enc_params.qf=quality_factor_conv[(avccontext->global_quality/FF_QP2LAMBDA)-1];
-    else if(avccontext->bit_rate >= 1000)
-       p_dirac_params->enc_ctx.enc_params.trate=avccontext->bit_rate/1000;
-
-    if ((preset > VIDEO_FORMAT_QCIF || preset < VIDEO_FORMAT_QSIF525) && 
-        avccontext->bit_rate == 200000)
-    {
-        p_dirac_params->enc_ctx.enc_params.trate = 0;
-    }
-
-	if (avccontext->flags & CODEC_FLAG_INTERLACED_ME)
-	{
-	    // all material can be coded as interlaced or progressive
-		// irrespective of the type of source material
-		p_dirac_params->enc_ctx.enc_params.picture_coding_mode = 1;
-	}
-
-    p_dirac_params->p_encoder = dirac_encoder_init( &(p_dirac_params->enc_ctx), verbose );
-   
-   
-
-    if (!p_dirac_params->p_encoder)
-    {
-        av_log(avccontext, AV_LOG_ERROR, "Unrecoverable Error: dirac_encoder_init failed. ");
-        return EXIT_FAILURE;
-    }
-    
-   
-    /* allocate enough memory for the incoming data */
-    p_dirac_params->p_in_frame_buf = (unsigned char*) av_malloc(avccontext->frame_size);
-    
-    return 0 ;
-}
-
-
-static int dirac_encode_frame(AVCodecContext *avccontext,
-                              unsigned char *frame,
-                              int buf_size, void *data)
-{
-    int enc_size=0;
-    dirac_encoder_state_t state;
-    FfmpegDiracParams* p_dirac_params = avccontext->priv_data;
-    AVFrame* p_frame_src;
-    struct FfmpegDiracOutputFrame* p_frame_output=NULL;
-    struct FfmpegDiracOutputFrame* p_next_output_frame=NULL;
-
-
-    if(data==0)
-    {
-        /* look for any delayed frames at EOF*/
-        p_next_output_frame=p_dirac_params->p_next_output_frame;
-        if(p_next_output_frame==NULL)
-        {
-            /* get terminate data*/
-            p_dirac_params->p_encoder->enc_buf.buffer=frame;
-            p_dirac_params->p_encoder->enc_buf.size = buf_size;
-            if (dirac_encoder_end_sequence( p_dirac_params->p_encoder ) > 0)
-                return p_dirac_params->p_encoder->enc_buf.size;
-
-            return 0;
-        }
-     
-        memcpy(frame, p_next_output_frame->p_data, p_next_output_frame->size);
-        enc_size=p_next_output_frame->size;
-
-        /*remove frame*/
-        p_dirac_params->p_next_output_frame=p_next_output_frame->p_next_frame;
-        av_free(p_next_output_frame->p_data);
-        av_free(p_next_output_frame);
-        
-        return enc_size;
-    }
-    
-    p_dirac_params->picture = *(AVFrame*)data;
-    p_frame_src=(AVFrame*)data;
-    
-    /** allocate frame data to dirac input buffer */
-    /*
-    * input line size may differe from what the codec supports. Especially
-    * when transcoding from one format to another. So use avpicture_layout
-    * to copy the frame.
-    */
-    avpicture_layout ((AVPicture *)data, avccontext->pix_fmt, avccontext->width, avccontext->height,p_dirac_params->p_in_frame_buf, avccontext->frame_size);
-
-    /* load next frame*/
-    if (dirac_encoder_load( p_dirac_params->p_encoder, p_dirac_params->p_in_frame_buf, avccontext->frame_size ) < 0)
-    {
-        av_log(avccontext, AV_LOG_ERROR, "Unrecoverable Encoder Error. Quitting...\n");
-        return -1;
-    }
-     
-
-     do {
-            p_dirac_params->p_encoder->enc_buf.buffer = frame;
-            p_dirac_params->p_encoder->enc_buf.size = buf_size;
-            /* process frame */
-            state = dirac_encoder_output ( p_dirac_params->p_encoder );
-     
-            switch (state)
-            {
-                case ENC_STATE_AVAIL:
-                    assert (p_dirac_params->p_encoder->enc_buf.size > 0);
-                    /* create output frame*/
-                    p_frame_output=(struct FfmpegDiracOutputFrame*)av_malloc(sizeof(FfmpegDiracOutputFrame));
-                    memset(p_frame_output, 0, sizeof(FfmpegDiracOutputFrame));
-                
-                    /* set output data */
-                    p_frame_output->p_data=(unsigned char*)av_malloc(p_dirac_params->p_encoder->enc_buf.size);
-                    memcpy(p_frame_output->p_data,p_dirac_params->p_encoder->enc_buf.buffer,p_dirac_params->p_encoder->enc_buf.size);
-                    p_frame_output->size=p_dirac_params->p_encoder->enc_buf.size;
-                    p_frame_output->type=p_dirac_params->p_encoder->enc_fparams.ftype;
-                    if(p_dirac_params->p_next_output_frame==NULL)
-                    {
-                        p_dirac_params->p_next_output_frame=p_frame_output;
-                        p_dirac_params->p_last_output_frame=p_frame_output;
-                    }
-                    else
-                    {
-                        p_dirac_params->p_last_output_frame->p_next_frame=p_frame_output;
-                        p_dirac_params->p_last_output_frame=p_frame_output;
-                    }
-                    break;
-
-                case ENC_STATE_BUFFER:
-                    break;
-
-                case ENC_STATE_INVALID:
-                    av_log(avccontext, AV_LOG_ERROR, "Unrecoverable Encoder Error. Quitting...\n");
-                    return -1;
-                
-                default:
-                    av_log(avccontext, AV_LOG_ERROR, "Unknown Encoder state\n");
-                    return -1;
-            }
-        }
-        while(state==ENC_STATE_AVAIL);
-
-    /* copy 'next' frame in queue */
-    p_next_output_frame=p_dirac_params->p_next_output_frame;
-    if(p_next_output_frame==NULL)
-        return 0;
-
-    memcpy(frame, p_next_output_frame->p_data, p_next_output_frame->size);
-    avccontext->coded_frame->key_frame= p_next_output_frame->type == INTRA_FRAME;    
-    avccontext->coded_frame->pts= 0;    
-    enc_size=p_next_output_frame->size;
-
-    /*remove frame*/
-    p_dirac_params->p_next_output_frame=p_next_output_frame->p_next_frame;
-    av_free(p_next_output_frame->p_data);
-    av_free(p_next_output_frame);
-
-    return enc_size;
-}
-
-
-static int dirac_encode_close(AVCodecContext *avccontext)
-{
-   
-    FfmpegDiracParams* p_dirac_params = avccontext->priv_data;
-        
-     // close the encoder
-    dirac_encoder_close(p_dirac_params->p_encoder );     
-
-    av_free(p_dirac_params->p_in_frame_buf);
-    
-    return 0 ;
-}
-
-
-AVCodec dirac_encoder = {
-    "dirac",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_DIRAC,
-    sizeof(FfmpegDiracParams),
-    dirac_encode_init,
-    dirac_encode_frame,
-    dirac_encode_close,
-   .capabilities= CODEC_CAP_DELAY,
-} ;
-
-/**-------------------------DECODER------------------------------------------*/
-
-static int dirac_decode_init(AVCodecContext *avccontext)
-{
-
-    FfmpegDiracParams *p_dirac_params = (FfmpegDiracParams*)avccontext->priv_data ;
-    p_dirac_params->p_decoder =  dirac_decoder_init(avccontext->debug);
-
-    if (!p_dirac_params->p_decoder)
-        return -1;
-
-    return 0 ;
-}
-
-static int dirac_decode_frame(AVCodecContext *avccontext,
-                                void *data, int *data_size,
-                                uint8_t *buf, int buf_size)
-{
-   
-    FfmpegDiracParams *p_dirac_params=(FfmpegDiracParams*)avccontext->priv_data;
-    AVPicture *picture = (AVPicture*)data;
-    AVPicture pic;
-    int pict_size;
-    unsigned char *buffer[3];
-
-    *data_size = 0;
-
-    if(buf_size>0) 
-        /* set data to decode into buffer */
-        dirac_buffer (p_dirac_params->p_decoder, buf, buf+buf_size);
-    while (1)
-    {
-         /* parse data and process result */
-         DecoderState state = dirac_parse (p_dirac_params->p_decoder);
-         switch (state)
-         {
-            case STATE_BUFFER:
-                 return buf_size;
-
-            case STATE_SEQUENCE:
-                
-                /* tell ffmpeg about sequence details*/
-                avccontext->height=p_dirac_params->p_decoder->src_params.height;
-                avccontext->width=p_dirac_params->p_decoder->src_params.width;
-                avccontext->pix_fmt=GetFfmpegChromaFormat(p_dirac_params->p_decoder->src_params.chroma);
-                avccontext->time_base.den =p_dirac_params->p_decoder->src_params.frame_rate.numerator;
-                avccontext->time_base.num =p_dirac_params->p_decoder->src_params.frame_rate.denominator;
-                
-                /* calc output dimensions */
-                avpicture_fill(&pic, NULL, avccontext->pix_fmt, avccontext->width, avccontext->height); 
-                pict_size = avpicture_get_size(avccontext->pix_fmt, avccontext->width, avccontext->height);
-                
-                /* allocate output buffer */
-                if(p_dirac_params->p_out_frame_buf==0)
-                    p_dirac_params->p_out_frame_buf = (unsigned char *)av_malloc (pict_size);
-                buffer[0]=p_dirac_params->p_out_frame_buf;
-                buffer[1]=p_dirac_params->p_out_frame_buf+(pic.linesize[0]*avccontext->height);
-                buffer[2]=buffer[1]+(pic.linesize[1]*p_dirac_params->p_decoder->src_params.chroma_height);
-                
-                /* tell dirac about output destination */
-                dirac_set_buf(p_dirac_params->p_decoder, buffer, NULL);
-                break;
-                        
-            case STATE_SEQUENCE_END:
-                break;
-
-            case STATE_PICTURE_AVAIL:
-                /* fill pic with current buffer data from dirac*/
-                avpicture_fill(picture, p_dirac_params->p_out_frame_buf, avccontext->pix_fmt, avccontext->width, avccontext->height);
-                //*data_size=avpicture_get_size(avccontext->pix_fmt, avccontext->width, avccontext->height);
-                *data_size=1;
-                return buf_size;
-
-            case STATE_PICTURE_START:
-                 break;
-    
-            case STATE_INVALID: 
-                return -1;
-
-            default:
-                break;
-        }
-    }
-        
-    return buf_size;
-}
-
-
-static int dirac_decode_close(AVCodecContext *avccontext)
-{
-    FfmpegDiracParams *p_dirac_params=(FfmpegDiracParams*)avccontext->priv_data;    
-                
-    dirac_decoder_close (p_dirac_params->p_decoder);
-
-    av_free(p_dirac_params->p_out_frame_buf);
-    
-    return 0 ;
-}
-
-
-AVCodec dirac_decoder = {
-     "dirac",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_DIRAC,
-    sizeof(FfmpegDiracParams),
-    dirac_decode_init,
-    NULL,
-    dirac_decode_close,
-    dirac_decode_frame,
-    CODEC_CAP_DELAY
-} ;
-
-
-static int dirac_sync_video_packet (const uint8_t **buf, int buf_size,
-                                    FfmpegDiracParseContext *p_dirac_params,
-                                    int *start)
-{
-    int bytes_read = 0;
-    unsigned char* p_dirac_videobuf_code = p_dirac_params->dirac_videobuf_code;
-    p_dirac_params->dirac_videobuf_len=0;
-
-    while(p_dirac_params->dirac_videobuf_code_len<5)
-    {
-        p_dirac_videobuf_code[p_dirac_params->dirac_videobuf_code_len++]=*(*buf);
-        (*buf)++;
-        ++bytes_read;
-    }
-    while (1)
-    {
-        int c;
-        if(p_dirac_videobuf_code[0]==0x42 && p_dirac_videobuf_code[1]==0x42 && p_dirac_videobuf_code[2]==0x43 && p_dirac_videobuf_code[3]==0x44)
-            break;
-                
-        if (bytes_read >= buf_size  )
-            return -1;
-
-        ++(*start);
-        p_dirac_videobuf_code[0]=p_dirac_videobuf_code[1];
-        p_dirac_videobuf_code[1]=p_dirac_videobuf_code[2];
-        p_dirac_videobuf_code[2]=p_dirac_videobuf_code[3];
-        p_dirac_videobuf_code[3]=p_dirac_videobuf_code[4];
-        c = *(*buf);
-        (*buf)++;
-        ++bytes_read;
-        p_dirac_videobuf_code[4]=c;
-    }
-    
-    return p_dirac_videobuf_code[4];
-}
-
-static int dirac_find_frame_end(FfmpegDiracParseContext *p_dirac_params, 
-                                const uint8_t *buf, 
-                                const uint8_t *p_buf_end, int cur_idx)
-{
-    int byte;
-    int end_idx=cur_idx;
-
-     /* find end of frame */
-    int shift = 0xffffffff;
-    p_dirac_params->dirac_videobuf_code_len = 0;
-    while (p_dirac_params->in_frame)
-    {
-        if(buf==p_buf_end)
-            return -1;
-
-        byte = *buf;
-        if (byte < 0)
-            return -1;
-
-        if (shift == 0x42424344)
-        {
-            p_dirac_params->in_frame = 0;
-            p_dirac_params->dirac_videobuf_code_len = 5;
-            p_dirac_params->dirac_videobuf_code[0] = 0x42;
-            p_dirac_params->dirac_videobuf_code[1] = 0x42;
-            p_dirac_params->dirac_videobuf_code[2] = 0x43;
-            p_dirac_params->dirac_videobuf_code[3] = 0x44;
-            p_dirac_params->dirac_videobuf_code[4] = byte;
-            return end_idx;
-        }
-        shift = (shift << 8 ) | byte;
-        buf++;
-        end_idx++;
-    }
-    
-    return -1;
-
-}
-
-/*
-* Access unit header = 0x00
-* End of sequence    = 0x10
-* Auxiliary data     = 0x20
-* Padding data       = 0x30
-* Intra_Ref start    = 0x0C (using ac)
-* Intra_NonRef start = 0x08 (using ac)
-* Intra_Ref start    = 0x4C (not using ac)
-* Intra_NonRef start = 0x48 (not using ac)
-* Intra_Ref start    = 0xCC (low delay syntax)
-* Intra_NonRef start = 0xC8 (low delay syntax)
-* Inter_Ref_1Ref start = 0x0D
-* Inter_Ref_2Ref start = 0x0E
-* Inter_NonRef_1Ref start = 0x09
-* Inter_NonRef_2Ref start = 0x0A
-*/
-#define FRAME_START(c) (((c) == 0x00) || ((c) == 0x10) || (((c)&0xF8) == 0x20) || ((c) == 0x30) || (((c)&0x08) == 0x08))
-
-static int dirac_find_frame_start(FfmpegDiracParseContext *p_dirac_params, const uint8_t **buf, int buf_size)
-{
-    unsigned int shift = 0xffffffff;
-    int msg_type = 0;
-    int start=0;
-
-     /* find start of data */
-     msg_type = dirac_sync_video_packet(buf, buf_size, p_dirac_params, &start);
-
-    if (msg_type < 0)
-        return -1;
-
-        
-    /* find start of frame */
-    while (!p_dirac_params->in_frame)
-    {
-        int byte;
-        if (FRAME_START(msg_type))
-        {
-            p_dirac_params->in_frame = 1;
-            return start;
-        }
-
-        byte = *(*buf);
-        (*buf)++;
-        
-        if (byte < 0)
-        {
-            p_dirac_params->dirac_videobuf_code_len = 0;
-            return -1;
-        }
-
-        if (shift == 0x42424344)
-        {
-            if (FRAME_START(byte))
-            {
-                p_dirac_params->in_frame = 1;
-                return start;
-            }
-        }
-        shift = (shift << 8 ) | byte;
-        start++;
-    }
-    
-    return -1;
-
-}
-
-
-static int parse_dirac(AVCodecParserContext *s,
-                      AVCodecContext *avctx,
-                      const uint8_t **poutbuf, int *poutbuf_size, 
-                      const uint8_t *buf, int buf_size)
-{
-
-    int frame_start=0;
-    int frame_end;
-    const uint8_t *p_cur=buf;
-    
-    FfmpegDiracParseContext *p_dirac_params = (FfmpegDiracParseContext*)s->priv_data ;
- 
-    if(buf_size==0)
-        return 0;
-    
-    
-    if(!p_dirac_params->in_frame)
-    {
-        frame_start=dirac_find_frame_start(p_dirac_params, &p_cur, buf_size);
-        if(frame_start==-1)
-        {
-            *poutbuf = NULL;
-            *poutbuf_size = 0;
-             return buf_size;
-        }
-    }
-    
-    frame_end = dirac_find_frame_end(p_dirac_params, p_cur, buf+buf_size, p_cur-buf);
-
-    /* no frame end - store data */
-    if(frame_end < 0)
-    {
-        memcpy(p_dirac_params->p_dirac_videobuffer+p_dirac_params->dirac_videobuf_len,
-               buf+frame_start, buf_size-frame_start);
-        p_dirac_params->dirac_videobuf_len+=buf_size-frame_start;
-               
-        *poutbuf = NULL;
-        *poutbuf_size = 0;
-         return buf_size;
-    }
-
-    /* have frame end */
-    memcpy(p_dirac_params->p_dirac_videobuffer+p_dirac_params->dirac_videobuf_len,
-           buf+frame_start, frame_end-frame_start+1);   
-           p_dirac_params->dirac_videobuf_len+=frame_end-frame_start+1;
-           
-    /* construct new frame */
-    *poutbuf=av_malloc(p_dirac_params->dirac_videobuf_len);
-    memcpy(*poutbuf, p_dirac_params->p_dirac_videobuffer, p_dirac_params->dirac_videobuf_len);
-    *poutbuf_size = p_dirac_params->dirac_videobuf_len;
-    
-    
-    return frame_end+1;
-}   
-   
-    
-    
-static int dirac_parse_close(AVCodecParserContext *s)
-{
-    FfmpegDiracParseContext *pc = s->priv_data;
-    av_freep(&pc->p_dirac_videobuffer);
-    return 0;
-}
-
-static int dirac_parse_open(AVCodecParserContext *s)
-{
-    FfmpegDiracParseContext *pc = s->priv_data;
-    pc->p_dirac_videobuffer = (unsigned char *)av_malloc(0x100000);
-    return 0;
-        
-}
-
-
-AVCodecParser dirac_parser = {
-    { CODEC_ID_DIRAC },
-    sizeof(FfmpegDiracParseContext),
-    dirac_parse_open,
-    parse_dirac,
-    dirac_parse_close,
-};
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 235c214..c99ece2 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -2324,6 +2324,7 @@ int img_pad(AVPicture *dst, const AVPicture *src, int height, int width,
 }
 #endif
 
+#ifndef CONFIG_SWSCALER
 /* XXX: always use linesize. Return -1 if not supported */
 int img_convert(AVPicture *dst, int dst_pix_fmt,
                 const AVPicture *src, int src_pix_fmt,
@@ -2570,6 +2571,7 @@ int img_convert(AVPicture *dst, int dst_pix_fmt,
     avpicture_free(tmp);
     return ret;
 }
+#endif
 
 /* NOTE: we scan all the pixels to have an exact information */
 static int get_alpha_info_pal8(const AVPicture *src, int width, int height)
diff --git a/libavcodec/imgresample.c b/libavcodec/imgresample.c
index 814faa8..c481e9d 100644
--- a/libavcodec/imgresample.c
+++ b/libavcodec/imgresample.c
@@ -512,7 +512,6 @@ void img_resample_close(ImgReSampleContext *s)
     av_free(s);
 }
 
-#ifndef CONFIG_SWSCALER
 struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat,
                                   int dstW, int dstH, int dstFormat,
                                   int flags, SwsFilter *srcFilter,
@@ -690,7 +689,6 @@ the_end:
     return res;
 }
 
-#endif // #ifndef CONFIG_SWSCALER
 
 #ifdef TEST
 #include <stdio.h>
diff --git a/libavformat/raw.c b/libavformat/raw.c
index c8ac655..d4b1389 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -236,23 +236,6 @@ static int ac3_read_header(AVFormatContext *s,
     return 0;
 }
 
-/* drc read */
-static int dirac_read_header(AVFormatContext *s,
-                             AVFormatParameters *ap)
-{
-    AVStream *st;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR_NOMEM;
-
-    st->codec->codec_type = CODEC_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_DIRAC;
-    st->need_parsing = 1;
-    /* the parameters will be extracted from the compressed bitstream */
-    return 0;
-}
-
 static int shorten_read_header(AVFormatContext *s,
                                AVFormatParameters *ap)
 {
@@ -778,31 +761,6 @@ AVInputFormat vc1_demuxer = {
     .value = CODEC_ID_VC1,
 };
 
-AVInputFormat dirac_iformat = {
-    "dirac",
-    "raw dirac",
-    0,
-    NULL,
-    dirac_read_header,
-    raw_read_partial_packet,
-    raw_read_close,
-    .extensions = "drc",
-};
-
-#ifdef CONFIG_MUXERS
-AVOutputFormat dirac_oformat = {
-    "dirac",
-    "raw dirac",
-    "dirac", 
-    "drc",
-    0,
-    CODEC_ID_DIRAC,
-    0,
-    NULL,
-    raw_write_packet,
-};
-#endif //CONFIG_MUXERS
-
 /* pcm formats */
 
 #define PCMINPUTDEF(name, long_name, ext, codec) \
diff --git a/libavformat/riff.c b/libavformat/riff.c
index f5092bf..7e87e19 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -173,7 +173,6 @@ const AVCodecTag codec_bmp_tags[] = {
     { CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') },
     { CODEC_ID_VMNC, MKTAG('V', 'M', 'n', 'c') },
     { CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') },
-    { CODEC_ID_DIRAC, MKTAG('d', 'r', 'a', 'c') },
     { CODEC_ID_NONE, 0 },
 };
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 7da09b6..04a33a0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1958,7 +1958,6 @@ int av_find_stream_info(AVFormatContext *ic)
              st->codec->codec_id == CODEC_ID_PBM ||
              st->codec->codec_id == CODEC_ID_PPM ||
              st->codec->codec_id == CODEC_ID_SHORTEN ||
-	     st->codec->codec_id == CODEC_ID_DIRAC ||
              (st->codec->codec_id == CODEC_ID_MPEG4 && !st->need_parsing))*/)
             try_decode_frame(st, pkt->data, pkt->size);
 
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009