[Ffmpeg-cvslog] r5497 - in trunk: ffmpeg.c ffplay.c ffserver.c libavcodec/alac.c libavcodec/png.c libavcodec/resample2.c libavcodec/truespeech.c libavformat/aiff.c libavformat/movenc.c libavformat/mpegts.c libavformat/mpegtsenc.c libavformat/rtsp.c libavformat/udp.c libpostproc/postprocess.c libpostproc/postprocess_internal.h vhook/watermark.c

diego subversion
Sun Jun 18 13:33:16 CEST 2006


Author: diego
Date: Sun Jun 18 13:33:14 2006
New Revision: 5497

Modified:
   trunk/ffmpeg.c
   trunk/ffplay.c
   trunk/ffserver.c
   trunk/libavcodec/alac.c
   trunk/libavcodec/png.c
   trunk/libavcodec/resample2.c
   trunk/libavcodec/truespeech.c
   trunk/libavformat/aiff.c
   trunk/libavformat/movenc.c
   trunk/libavformat/mpegts.c
   trunk/libavformat/mpegtsenc.c
   trunk/libavformat/rtsp.c
   trunk/libavformat/udp.c
   trunk/libpostproc/postprocess.c
   trunk/libpostproc/postprocess_internal.h
   trunk/vhook/watermark.c

Log:
Add const to (mostly) char* and make some functions static, which aren't used
outside their declaring source file and which have no corresponding prototype.
patch by Stefan Huehner stefan^^@^^huehner^^.^^org


Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	(original)
+++ trunk/ffmpeg.c	Sun Jun 18 13:33:14 2006
@@ -211,12 +211,12 @@
 static int rate_emu = 0;
 
 #ifdef CONFIG_BKTR
-static char *video_grab_format = "bktr";
+static const char *video_grab_format = "bktr";
 #else
 #ifdef CONFIG_VIDEO4LINUX2
-static char *video_grab_format = "video4linux2";
+static const char *video_grab_format = "video4linux2";
 #else
-static char *video_grab_format = "video4linux";
+static const char *video_grab_format = "video4linux";
 #endif
 #endif
 static char *video_device = NULL;
@@ -224,7 +224,7 @@
 static int  video_channel = 0;
 static char *video_standard = "ntsc";
 
-static char *audio_grab_format = "audio_device";
+static const char *audio_grab_format = "audio_device";
 static char *audio_device = NULL;
 static int audio_volume = 256;
 

Modified: trunk/ffplay.c
==============================================================================
--- trunk/ffplay.c	(original)
+++ trunk/ffplay.c	Sun Jun 18 13:33:14 2006
@@ -1735,7 +1735,7 @@
     }
 }
 
-void dump_stream_info(AVFormatContext *s)
+static void dump_stream_info(const AVFormatContext *s)
 {
     if (s->track != 0)
         fprintf(stderr, "Track: %d\n", s->track);
@@ -2042,7 +2042,7 @@
     SDL_DestroyMutex(is->video_decoder_mutex);
 }
 
-void stream_cycle_channel(VideoState *is, int codec_type)
+static void stream_cycle_channel(VideoState *is, int codec_type)
 {
     AVFormatContext *ic = is->ic;
     int start_index, stream_index;
@@ -2092,7 +2092,7 @@
 }
 
 
-void toggle_full_screen(void)
+static void toggle_full_screen(void)
 {
     int w, h, flags;
     is_full_screen = !is_full_screen;
@@ -2117,14 +2117,14 @@
     }
 }
 
-void toggle_pause(void)
+static void toggle_pause(void)
 {
     if (cur_stream)
         stream_pause(cur_stream);
     step = 0;
 }
 
-void step_to_next_frame(void)
+static void step_to_next_frame(void)
 {
     if (cur_stream) {
         if (cur_stream->paused)
@@ -2134,7 +2134,7 @@
     step = 1;
 }
 
-void do_exit(void)
+static void do_exit(void)
 {
     if (cur_stream) {
         stream_close(cur_stream);
@@ -2146,7 +2146,7 @@
     exit(0);
 }
 
-void toggle_audio_display(void)
+static void toggle_audio_display(void)
 {
     if (cur_stream) {
         cur_stream->show_audio = !cur_stream->show_audio;
@@ -2154,7 +2154,7 @@
 }
 
 /* handle an event sent by the GUI */
-void event_loop(void)
+static void event_loop(void)
 {
     SDL_Event event;
     double incr, pos, frac;

Modified: trunk/ffserver.c
==============================================================================
--- trunk/ffserver.c	(original)
+++ trunk/ffserver.c	Sun Jun 18 13:33:14 2006
@@ -3704,7 +3704,7 @@
 /* simplistic plugin support */
 
 #ifdef CONFIG_HAVE_DLOPEN
-void load_module(const char *filename)
+static void load_module(const char *filename)
 {
     void *dll;
     void (*init_func)(void);

Modified: trunk/libavcodec/alac.c
==============================================================================
--- trunk/libavcodec/alac.c	(original)
+++ trunk/libavcodec/alac.c	Sun Jun 18 13:33:14 2006
@@ -407,7 +407,7 @@
     }
 }
 
-void deinterlace_16(int32_t *buffer_a, int32_t *buffer_b,
+static void deinterlace_16(int32_t *buffer_a, int32_t *buffer_b,
                     int16_t *buffer_out,
                     int numchannels, int numsamples,
                     uint8_t interlacing_shift,

Modified: trunk/libavcodec/png.c
==============================================================================
--- trunk/libavcodec/png.c	(original)
+++ trunk/libavcodec/png.c	Sun Jun 18 13:33:14 2006
@@ -346,7 +346,7 @@
 
     d = dst;
     for(j = 0; j < width; j++) {
-        v = ((uint32_t *)src)[j];
+        v = ((const uint32_t *)src)[j];
         d[0] = v >> 16;
         d[1] = v >> 8;
         d[2] = v;

Modified: trunk/libavcodec/resample2.c
==============================================================================
--- trunk/libavcodec/resample2.c	(original)
+++ trunk/libavcodec/resample2.c	Sun Jun 18 13:33:14 2006
@@ -62,7 +62,7 @@
 /**
  * 0th order modified bessel function of the first kind.
  */
-double bessel(double x){
+static double bessel(double x){
     double v=1;
     double t=1;
     int i;

Modified: trunk/libavcodec/truespeech.c
==============================================================================
--- trunk/libavcodec/truespeech.c	(original)
+++ trunk/libavcodec/truespeech.c	Sun Jun 18 13:33:14 2006
@@ -188,7 +188,8 @@
 
 static void truespeech_apply_twopoint_filter(TSContext *dec, int quart)
 {
-    int16_t tmp[146 + 60], *ptr0, *ptr1, *filter;
+    int16_t tmp[146 + 60], *ptr0, *ptr1;
+    const int16_t *filter;
     int i, t, off;
 
     t = dec->offset2[quart];
@@ -201,7 +202,7 @@
     off = (t / 25) + dec->offset1[quart >> 1] + 18;
     ptr0 = tmp + 145 - off;
     ptr1 = tmp + 146;
-    filter = (int16_t*)ts_240 + (t % 25) * 2;
+    filter = (const int16_t*)ts_240 + (t % 25) * 2;
     for(i = 0; i < 60; i++){
         t = (ptr0[0] * filter[0] + ptr0[1] * filter[1] + 0x2000) >> 14;
         ptr0++;
@@ -214,7 +215,8 @@
 {
     int16_t tmp[7];
     int i, j, t;
-    int16_t *ptr1, *ptr2;
+    const int16_t *ptr1;
+    int16_t *ptr2;
     int coef;
 
     memset(out, 0, 60 * 2);
@@ -225,7 +227,7 @@
     }
 
     coef = dec->pulsepos[quart] >> 15;
-    ptr1 = (int16_t*)ts_140 + 30;
+    ptr1 = (const int16_t*)ts_140 + 30;
     ptr2 = tmp;
     for(i = 0, j = 3; (i < 30) && (j > 0); i++){
         t = *ptr1++;
@@ -238,7 +240,7 @@
         }
     }
     coef = dec->pulsepos[quart] & 0x7FFF;
-    ptr1 = (int16_t*)ts_140;
+    ptr1 = (const int16_t*)ts_140;
     for(i = 30, j = 4; (i < 60) && (j > 0); i++){
         t = *ptr1++;
         if(coef >= t)

Modified: trunk/libavformat/aiff.c
==============================================================================
--- trunk/libavformat/aiff.c	(original)
+++ trunk/libavformat/aiff.c	Sun Jun 18 13:33:14 2006
@@ -110,7 +110,7 @@
 }
 
 /* Returns the number of sound data frames or negative on error */
-unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
+static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
                              int size, unsigned version)
 {
     AVExtFloat ext;

Modified: trunk/libavformat/movenc.c
==============================================================================
--- trunk/libavformat/movenc.c	(original)
+++ trunk/libavformat/movenc.c	Sun Jun 18 13:33:14 2006
@@ -1341,7 +1341,7 @@
     return updateSize(pb, pos);
 }
 
-int mov_write_mdat_tag(ByteIOContext *pb, MOVContext* mov)
+static int mov_write_mdat_tag(ByteIOContext *pb, MOVContext* mov)
 {
     put_be32(pb, 8);    // placeholder for extended size field (64 bit)
     put_tag(pb, "wide");

Modified: trunk/libavformat/mpegts.c
==============================================================================
--- trunk/libavformat/mpegts.c	(original)
+++ trunk/libavformat/mpegts.c	Sun Jun 18 13:33:14 2006
@@ -151,7 +151,7 @@
     }
 }
 
-MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts, unsigned int pid,
+static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts, unsigned int pid,
                                          SectionCallback *section_cb, void *opaque,
                                          int check_crc)
 
@@ -183,7 +183,7 @@
     return filter;
 }
 
-MpegTSFilter *mpegts_open_pes_filter(MpegTSContext *ts, unsigned int pid,
+static MpegTSFilter *mpegts_open_pes_filter(MpegTSContext *ts, unsigned int pid,
                                      PESCallback *pes_cb,
                                      void *opaque)
 {
@@ -205,7 +205,7 @@
     return filter;
 }
 
-void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter)
+static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter)
 {
     int pid;
 
@@ -609,7 +609,7 @@
     ts->pat_filter = NULL;
 }
 
-void mpegts_set_service(MpegTSContext *ts, int sid,
+static void mpegts_set_service(MpegTSContext *ts, int sid,
                         SetServiceCallback *set_service_cb, void *opaque)
 {
     ts->set_service_cb = set_service_cb;
@@ -696,7 +696,7 @@
 }
 
 /* scan services in a transport stream by looking at the SDT */
-void mpegts_scan_sdt(MpegTSContext *ts)
+static void mpegts_scan_sdt(MpegTSContext *ts)
 {
     ts->sdt_filter = mpegts_open_section_filter(ts, SDT_PID,
                                                 sdt_cb, ts, 1);
@@ -704,7 +704,7 @@
 
 /* scan services in a transport stream by looking at the PAT (better
    than nothing !) */
-void mpegts_scan_pat(MpegTSContext *ts)
+static void mpegts_scan_pat(MpegTSContext *ts)
 {
     ts->pat_filter = mpegts_open_section_filter(ts, PAT_PID,
                                                 pat_scan_cb, ts, 1);

Modified: trunk/libavformat/mpegtsenc.c
==============================================================================
--- trunk/libavformat/mpegtsenc.c	(original)
+++ trunk/libavformat/mpegtsenc.c	Sun Jun 18 13:33:14 2006
@@ -34,7 +34,7 @@
 } MpegTSSection;
 
 /* NOTE: 4 bytes must be left at the end for the crc32 */
-void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
+static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
 {
     unsigned int crc;
     unsigned char packet[TS_PACKET_SIZE];
@@ -89,7 +89,7 @@
     *q_ptr = q;
 }
 
-int mpegts_write_section1(MpegTSSection *s, int tid, int id,
+static int mpegts_write_section1(MpegTSSection *s, int tid, int id,
                           int version, int sec_num, int last_sec_num,
                           uint8_t *buf, int len)
 {

Modified: trunk/libavformat/rtsp.c
==============================================================================
--- trunk/libavformat/rtsp.c	(original)
+++ trunk/libavformat/rtsp.c	Sun Jun 18 13:33:14 2006
@@ -145,7 +145,7 @@
     char buf[256];
     int i;
     AVCodec *c;
-    char *c_name;
+    const char *c_name;
 
     /* Loop into AVRtpDynamicPayloadTypes[] and AVRtpPayloadTypes[] and
        see if we can handle this kind of payload */
@@ -169,7 +169,7 @@
 
     c = avcodec_find_decoder(codec->codec_id);
     if (c && c->name)
-        c_name = (char *)c->name;
+        c_name = c->name;
     else
         c_name = (char *)NULL;
 
@@ -255,7 +255,7 @@
 
 typedef struct attrname_map
 {
-    char *str;
+    const char *str;
     uint16_t type;
     uint32_t offset;
 } attrname_map_t;

Modified: trunk/libavformat/udp.c
==============================================================================
--- trunk/libavformat/udp.c	(original)
+++ trunk/libavformat/udp.c	Sun Jun 18 13:33:14 2006
@@ -51,7 +51,7 @@
 
 #ifdef CONFIG_IPV6
 
-int udp_ipv6_is_multicast_address(const struct sockaddr *addr) {
+static int udp_ipv6_is_multicast_address(const struct sockaddr *addr) {
     if (addr->sa_family == AF_INET)
         return IN_MULTICAST(ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr));
     if (addr->sa_family == AF_INET6)
@@ -59,7 +59,7 @@
     return -1;
 }
 
-int udp_ipv6_set_multicast_ttl(int sockfd, int mcastTTL, struct sockaddr *addr) {
+static int udp_ipv6_set_multicast_ttl(int sockfd, int mcastTTL, struct sockaddr *addr) {
     if (addr->sa_family == AF_INET) {
         if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &mcastTTL, sizeof(mcastTTL)) < 0) {
             perror("setsockopt(IP_MULTICAST_TTL)");
@@ -75,7 +75,7 @@
     return 0;
 }
 
-int udp_ipv6_join_multicast_group(int sockfd, struct sockaddr *addr) {
+static int udp_ipv6_join_multicast_group(int sockfd, struct sockaddr *addr) {
     struct ip_mreq   mreq;
     struct ipv6_mreq mreq6;
     if (addr->sa_family == AF_INET) {
@@ -97,7 +97,7 @@
     return 0;
 }
 
-int udp_ipv6_leave_multicast_group(int sockfd, struct sockaddr *addr) {
+static int udp_ipv6_leave_multicast_group(int sockfd, struct sockaddr *addr) {
     struct ip_mreq   mreq;
     struct ipv6_mreq mreq6;
     if (addr->sa_family == AF_INET) {
@@ -119,7 +119,7 @@
     return 0;
 }
 
-struct addrinfo* udp_ipv6_resolve_host(const char *hostname, int port, int type, int family, int flags) {
+static struct addrinfo* udp_ipv6_resolve_host(const char *hostname, int port, int type, int family, int flags) {
     struct addrinfo hints, *res = 0;
     int error;
     char sport[16];
@@ -144,7 +144,7 @@
     return res;
 }
 
-int udp_ipv6_set_remote_url(URLContext *h, const char *uri) {
+static int udp_ipv6_set_remote_url(URLContext *h, const char *uri) {
     UDPContext *s = h->priv_data;
     char hostname[256];
     int port;
@@ -158,7 +158,7 @@
     return 0;
 }
 
-int udp_ipv6_set_local(URLContext *h) {
+static int udp_ipv6_set_local(URLContext *h) {
     UDPContext *s = h->priv_data;
     int udp_fd = -1;
     struct sockaddr_storage clientaddr;

Modified: trunk/libpostproc/postprocess.c
==============================================================================
--- trunk/libpostproc/postprocess.c	(original)
+++ trunk/libpostproc/postprocess.c	Sun Jun 18 13:33:14 2006
@@ -161,7 +161,7 @@
         {NULL, NULL,0,0,0,0} //End Marker
 };
 
-static char *replaceTable[]=
+static const char *replaceTable[]=
 {
         "default",      "hdeblock:a,vdeblock:a,dering:a",
         "de",           "hdeblock:a,vdeblock:a,dering:a",
@@ -766,8 +766,8 @@
 {
         char temp[GET_MODE_BUFFER_SIZE];
         char *p= temp;
-        char *filterDelimiters= ",/";
-        char *optionDelimiters= ":";
+        const char *filterDelimiters= ",/";
+        const char *optionDelimiters= ":";
         struct PPMode *ppMode;
         char *filterToken;
 

Modified: trunk/libpostproc/postprocess_internal.h
==============================================================================
--- trunk/libpostproc/postprocess_internal.h	(original)
+++ trunk/libpostproc/postprocess_internal.h	Sun Jun 18 13:33:14 2006
@@ -79,8 +79,8 @@
  * Postprocessng filter.
  */
 struct PPFilter{
-        char *shortName;
-        char *longName;
+        const char *shortName;
+        const char *longName;
         int chromDefault;       ///< is chrominance filtering on by default if this filter is manually activated
         int minLumQuality;      ///< minimum quality to turn luminance filtering on
         int minChromQuality;    ///< minimum quality to turn chrominance filtering on

Modified: trunk/vhook/watermark.c
==============================================================================
--- trunk/vhook/watermark.c	(original)
+++ trunk/vhook/watermark.c	Sun Jun 18 13:33:14 2006
@@ -164,7 +164,7 @@
 /****************************************************************************
  * For mode 0 (the original one)
  ****************************************************************************/
-void Process0(void *ctx,
+static void Process0(void *ctx,
               AVPicture *picture,
               enum PixelFormat pix_fmt,
               int src_width,
@@ -276,7 +276,7 @@
 /****************************************************************************
  * For mode 1 (the original one)
  ****************************************************************************/
-void Process1(void *ctx,
+static void Process1(void *ctx,
               AVPicture *picture,
               enum PixelFormat pix_fmt,
               int src_width,




More information about the ffmpeg-cvslog mailing list