[FFmpeg-devel] [PATCH] set flags and stuff required for XvMC instead of just checking them

Reimar Döffinger Reimar.Doeffinger
Sat Feb 14 22:57:01 CET 2009


On Sat, Feb 14, 2009 at 10:18:35PM +0100, Michael Niedermayer wrote:
> On Sat, Feb 14, 2009 at 09:20:42PM +0100, Reimar D?ffinger wrote:
> > I do not know what could be the purpose of checking these things except
> > creating useless code or general sadism.
> > The CODEC_FLAG_EMU_EDGE is from MPlayer where it comes with the great
> > comment "//do i need that??!!"
> > I am not willing to keep that crap around in MPlayer, so I am moving it
> > here...
> 
> you cant, 
> 
>    /**
>      * CODEC_FLAG_*.
>      * - encoding: Set by user.
>      * - decoding: Set by user.
>      */
>     int flags;
> 
> the dox say "set by user" lavc is not the user

Well, that can be taken care of.
-------------- next part --------------
Index: libavcodec/avcodec.h
===================================================================
--- libavcodec/avcodec.h	(revision 17246)
+++ libavcodec/avcodec.h	(working copy)
@@ -1732,7 +1732,7 @@
     /**
      * slice flags
      * - encoding: unused
-     * - decoding: Set by user.
+     * - decoding: Set by user, may be modified by libavcodec.
      */
     int slice_flags;
 #define SLICE_FLAG_CODED_ORDER    0x0001 ///< draw_horiz_band() is called in coded order instead of display
@@ -1874,7 +1874,7 @@
      * thread count
      * is used to decide how many independent tasks should be passed to execute()
      * - encoding: Set by user.
-     * - decoding: Set by user.
+     * - decoding: Set by user, may be modified by libavcodec.
      */
     int thread_count;
 
Index: libavcodec/mpeg12.c
===================================================================
--- libavcodec/mpeg12.c	(revision 17280)
+++ libavcodec/mpeg12.c	(working copy)
@@ -2487,6 +2487,7 @@
 static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx){
     Mpeg1Context *s;
 
+#if LIBAVCODEC_VERSION_MAJOR < 53
     if( avctx->thread_count > 1)
         return -1;
     if( !(avctx->slice_flags & SLICE_FLAG_CODED_ORDER) )
@@ -2494,6 +2495,10 @@
     if( !(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD) ){
         dprintf(avctx, "mpeg12.c: XvMC decoder will work better if SLICE_FLAG_ALLOW_FIELD is set\n");
     }
+#else
+    avctx->thread_count = 1;
+    avctx->slice_flags |= SLICE_FLAG_CODED_ORDER | SLICE_FLAG_ALLOW_FIELD;
+#endif
     mpeg_decode_init(avctx);
     s = avctx->priv_data;
 



More information about the ffmpeg-devel mailing list