[Ffmpeg-devel] [PATCH] portability fixes (ILP32 vs LP64)

Dieter freebsd
Sun Jan 8 21:09:53 CET 2006


Here are fixes for some of the compiler warnings I got
building the ffmpeg-0.4.9-pre1 port on FreeBSD 6.0.
They should help with portability between ILP32 and LP64.


Diffs for file: libavcodec/liba52/crc.c

===================================================================
RCS file: RCS/crc.c,v
retrieving revision 1.1
diff -u -c -r1.1 crc.c
*** crc.c	2006/01/06 05:27:31	1.1
--- crc.c	2006/01/06 06:10:21
***************
*** 61,66 ****
--- 61,69 ----
  	0x8213,0x0216,0x021c,0x8219,0x0208,0x820d,0x8207,0x0202
  };
  
+ /* prototypes */
+ uint16_t a52_crc16_block(uint8_t *, uint32_t);
+ 
  uint16_t a52_crc16_block(uint8_t *data,uint32_t num_bytes)
  {
  	uint32_t i;



Diffs for file: libavcodec/liba52/resample.c

===================================================================
RCS file: RCS/resample.c,v
retrieving revision 1.1
diff -u -c -r1.1 resample.c
*** resample.c	2006/01/06 05:29:17	1.1
--- resample.c	2006/01/06 05:30:09
***************
*** 17,22 ****
--- 17,25 ----
  #include "resample_mmx.c"
  #endif
  
+ /* prototypes */
+ void* a52_resample_init(uint32_t, int, int);
+ 
  void* a52_resample_init(uint32_t mm_accel,int flags,int chans){
  void* tmp;
  



Diffs for file: libavcodec/4xm.c

===================================================================
RCS file: RCS/4xm.c,v
retrieving revision 1.1
diff -u -c -r1.1 4xm.c
*** 4xm.c	2006/01/06 05:17:51	1.1
--- 4xm.c	2006/01/06 05:18:55
***************
*** 354,360 ****
      }
      
      if(bitstream_size != (get_bits_count(&f->gb)+31)/32*4)
!         av_log(f->avctx, AV_LOG_ERROR, " %d %d %d bytes left\n", 
              bitstream_size - (get_bits_count(&f->gb)+31)/32*4, 
              bytestream_size - (f->bytestream - (buf + 20 + bitstream_size + wordstream_size)),
              wordstream_size - (((uint8_t*)f->wordstream) - (buf + 20 + bitstream_size))
--- 354,360 ----
      }
      
      if(bitstream_size != (get_bits_count(&f->gb)+31)/32*4)
!         av_log(f->avctx, AV_LOG_ERROR, " %d %ld %ld bytes left\n", 
              bitstream_size - (get_bits_count(&f->gb)+31)/32*4, 
              bytestream_size - (f->bytestream - (buf + 20 + bitstream_size + wordstream_size)),
              wordstream_size - (((uint8_t*)f->wordstream) - (buf + 20 + bitstream_size))



Diffs for file: libavcodec/h261.c

===================================================================
RCS file: RCS/h261.c,v
retrieving revision 1.1
diff -u -c -r1.1 h261.c
*** h261.c	2006/01/06 05:24:58	1.1
--- h261.c	2006/01/06 05:26:28
***************
*** 56,61 ****
--- 56,65 ----
      int last_bits; //bits left of the following frame in the last byte in this frame
  }H261Context;
  
+ /* prototypes */
+ void ff_h261_loop_filter(H261Context *);
+ int h261_decode_picture_header(H261Context *);
+ 
  void ff_h261_loop_filter(H261Context * h){
      MpegEncContext * const s = &h->s;
      const int linesize  = s->linesize;



Diffs for file: libavcodec/h263.c

===================================================================
RCS file: RCS/h263.c,v
retrieving revision 1.1
diff -u -c -r1.1 h263.c
*** h263.c	2006/01/06 05:21:40	1.1
--- h263.c	2006/01/06 05:23:29
***************
*** 2934,2942 ****
  {
      uint8_t *start= pbBufPtr(&s->pb);
      uint8_t *end= s->pb.buf_end;
!     int size= end - start;
!     int pb_size = (((int)start + size/3)&(~3)) - (int)start;
!     int tex_size= (size - 2*pb_size)&(~3);
      
      set_put_bits_buffer_size(&s->pb, pb_size);
      init_put_bits(&s->tex_pb, start + pb_size           , tex_size);
--- 2934,2942 ----
  {
      uint8_t *start= pbBufPtr(&s->pb);
      uint8_t *end= s->pb.buf_end;
!     long size= end - start;
!     long pb_size = (((long)start + size/3)&(~3)) - (long)start;
!     long tex_size= (size - 2*pb_size)&(~3);
      
      set_put_bits_buffer_size(&s->pb, pb_size);
      init_put_bits(&s->tex_pb, start + pb_size           , tex_size);



Diffs for file: libavcodec/interplayvideo.c

===================================================================
RCS file: RCS/interplayvideo.c,v
retrieving revision 1.1
diff -u -c -r1.1 interplayvideo.c
*** interplayvideo.c	2006/01/06 05:20:09	1.1
--- interplayvideo.c	2006/01/06 05:20:34
***************
*** 846,852 ****
      }
      if ((s->stream_ptr != s->stream_end) &&
          (s->stream_ptr + 1 != s->stream_end)) {
!         av_log(s->avctx, AV_LOG_ERROR, " Interplay video: decode finished with %d bytes left over\n",
              s->stream_end - s->stream_ptr);
      }
  }
--- 846,852 ----
      }
      if ((s->stream_ptr != s->stream_end) &&
          (s->stream_ptr + 1 != s->stream_end)) {
!         av_log(s->avctx, AV_LOG_ERROR, " Interplay video: decode finished with %ld bytes left over\n",
              s->stream_end - s->stream_ptr);
      }
  }



Diffs for file: libavcodec/resample2.c

===================================================================
RCS file: RCS/resample2.c,v
retrieving revision 1.1
diff -u -c -r1.1 resample2.c
*** resample2.c	2006/01/06 05:13:34	1.1
--- resample2.c	2006/01/06 06:13:16
***************
*** 33,38 ****
--- 33,42 ----
  #define PHASE_MASK (PHASE_COUNT-1)
  #define FILTER_SHIFT 15
  
+ /* prototypes */
+ double bessel(double);
+ void av_build_filter(int16_t *, double, int, int, int, int);
+ 
  typedef struct AVResampleContext{
      short *filter_bank;
      int filter_length;



Diffs for file: vhook/drawtext.c

===================================================================
RCS file: RCS/drawtext.c,v
retrieving revision 1.1
diff -u -c -r1.1 drawtext.c
*** drawtext.c	2006/01/06 06:40:34	1.1
--- drawtext.c	2006/01/06 06:49:20
***************
*** 108,113 ****
--- 108,117 ----
    int use_kerning;
  } ContextInfo;
  
+ /* prototypes */
+ int ParseColor(char *, unsigned char [] );
+ inline void draw_glyph(AVPicture *, FT_Bitmap *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned char [], unsigned char [], int);
+ inline void draw_box(AVPicture *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned char []);
  
  void Release(void *ctx)
  {



Diffs for file: vhook/ppm.c

===================================================================
RCS file: RCS/ppm.c,v
retrieving revision 1.1
diff -u -c -r1.1 ppm.c
*** ppm.c	2006/01/06 06:37:07	1.1
--- ppm.c	2006/01/06 06:47:28
***************
*** 36,41 ****
--- 36,49 ----
  }
  rwpipe;
  
+ /* prototypes */
+ rwpipe *rwpipe_open( int, char *[]);
+ FILE *rwpipe_reader( rwpipe * );
+ FILE *rwpipe_writer( rwpipe * );
+ int rwpipe_read_number( rwpipe * );
+ int rwpipe_read_ppm_header( rwpipe *, int *, int * );
+ void rwpipe_close( rwpipe * );
+ 
  /** Create a bidirectional pipe for the given command.
  */
  



Diffs for file: ./configure

===================================================================
RCS file: RCS/configure,v
retrieving revision 1.1
diff -u -c -r1.1 configure
*** configure	2006/01/06 06:05:35	1.1
--- configure	2006/01/06 06:07:35
***************
*** 497,503 ****
  		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
  		;;
  	    *3.*)
! 		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
  		if test "$lshared" = no; then
  		   needmdynamicnopic="yes"
  		fi
--- 497,503 ----
  		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
  		;;
  	    *3.*)
! 		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith"
  		if test "$lshared" = no; then
  		   needmdynamicnopic="yes"
  		fi



Diffs for file: ./ffmpeg.c

===================================================================
RCS file: RCS/ffmpeg.c,v
retrieving revision 1.1
diff -u -c -r1.1 ffmpeg.c
*** ffmpeg.c	2006/01/06 05:57:29	1.1
--- ffmpeg.c	2006/01/06 06:14:03
***************
*** 294,299 ****
--- 294,304 ----
  /* init terminal so that we can grab keys */
  static struct termios oldtty;
  
+ /* prototypes */
+ void parse_matrix_coeffs(uint16_t *, const char *);
+ void opt_inter_matrix(const char *);
+ void opt_intra_matrix(const char *);
+ 
  static void term_exit(void)
  {
      tcsetattr (0, TCSANOW, &oldtty);



Diffs for file: ./ffserver.c

===================================================================
RCS file: RCS/ffserver.c,v
retrieving revision 1.1
diff -u -c -r1.1 ffserver.c
*** ffserver.c	2006/01/06 06:25:17	1.1
--- ffserver.c	2006/01/06 06:26:37
***************
*** 285,290 ****
--- 285,295 ----
  
  static long cur_time;           // Making this global saves on passing it around everywhere
  
+ /* prototypes */
+ #ifdef CONFIG_HAVE_DLOPEN
+ void load_module(const char *);
+ #endif
+ 
  static long gettime_ms(void)
  {
      struct timeval tv;



Diffs for file: ./output_example.c

===================================================================
RCS file: RCS/output_example.c,v
retrieving revision 1.1
diff -u -c -r1.1 output_example.c
*** output_example.c	2006/01/06 06:27:01	1.1
--- output_example.c	2006/01/06 06:32:15
***************
*** 47,52 ****
--- 47,65 ----
  int audio_outbuf_size;
  int audio_input_frame_size;
  
+ /* prototypes */
+ AVStream *add_audio_stream(AVFormatContext *, int);
+ void open_audio(AVFormatContext *, AVStream *);
+ void get_audio_frame(int16_t *, int, int);
+ void write_audio_frame(AVFormatContext *, AVStream *);
+ void close_audio(AVFormatContext *, AVStream *);
+ AVStream *add_video_stream(AVFormatContext *, int);
+ AVFrame *alloc_picture(int, int, int);
+ void open_video(AVFormatContext *, AVStream *);
+ void fill_yuv_image(AVFrame *, int, int, int);
+ void write_video_frame(AVFormatContext *, AVStream *);
+ void close_video(AVFormatContext *, AVStream *);
+ 
  /* 
   * add an audio output stream
   */







More information about the ffmpeg-devel mailing list