]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dvdsub.c
Fixes:
[ffmpeg] / libavcodec / dvdsub.c
index da44c947487e52b1ff80d66d95e6741cb056cf60..2ed015a99a9b779422fd5e37a11be228fbcd746a 100644 (file)
@@ -2,19 +2,21 @@
  * DVD subtitle decoding for ffmpeg
  * Copyright (c) 2005 Fabrice Bellard.
  *
- * This library is free software; you can redistribute it and/or
+ * 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 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
+ * 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 this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avcodec.h"
 
@@ -28,17 +30,17 @@ static int dvdsub_init_decoder(AVCodecContext *avctx)
     return 0;
 }
 
-uint16_t getbe16(const uint8_t *p)
+static uint16_t getbe16(const uint8_t *p)
 {
     return (p[0] << 8) | p[1];
 }
 
-int get_nibble(const uint8_t *buf, int nibble_offset)
+static int get_nibble(const uint8_t *buf, int nibble_offset)
 {
     return (buf[nibble_offset >> 1] >> ((1 - (nibble_offset & 1)) << 2)) & 0xf;
 }
 
-static int decode_rle(uint8_t *bitmap, int linesize, int w, int h, 
+static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
                       const uint8_t *buf, int nibble_offset, int buf_size)
 {
     unsigned int v;
@@ -91,7 +93,7 @@ static void guess_palette(uint32_t *rgba_palette,
 {
     uint8_t color_used[16];
     int nb_opaque_colors, i, level, j, r, g, b;
-    
+
     for(i = 0; i < 4; i++)
         rgba_palette[i] = 0;
 
@@ -103,10 +105,10 @@ static void guess_palette(uint32_t *rgba_palette,
             nb_opaque_colors++;
         }
     }
-    
+
     if (nb_opaque_colors == 0)
         return;
-    
+
     j = nb_opaque_colors;
     memset(color_used, 0, 16);
     for(i = 0; i < 4; i++) {
@@ -127,7 +129,7 @@ static void guess_palette(uint32_t *rgba_palette,
     }
 }
 
-static int decode_dvd_subtitles(AVSubtitle *sub_header, 
+static int decode_dvd_subtitles(AVSubtitle *sub_header,
                                 const uint8_t *buf, int buf_size)
 {
     int cmd_pos, pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos;
@@ -135,7 +137,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
     int date;
     int i;
     int is_menu = 0;
-    
+
     if (buf_size < 4)
         return -1;
     sub_header->rects = NULL;
@@ -148,7 +150,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
         date = getbe16(buf + cmd_pos);
         next_cmd_pos = getbe16(buf + cmd_pos + 2);
 #ifdef DEBUG
-        av_log(NULL, AV_LOG_INFO, "cmd_pos=0x%04x next=0x%04x date=%d\n", 
+        av_log(NULL, AV_LOG_INFO, "cmd_pos=0x%04x next=0x%04x date=%d\n",
                cmd_pos, next_cmd_pos, date);
 #endif
         pos = cmd_pos + 4;
@@ -228,7 +230,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
         if (offset1 >= 0) {
             int w, h;
             uint8_t *bitmap;
-            
+
             /* decode the bitmap */
             w = x2 - x1 + 1;
             if (w < 0)
@@ -275,7 +277,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
     return -1;
 }
 
-static int is_transp(const uint8_t *buf, int pitch, int n, 
+static int is_transp(const uint8_t *buf, int pitch, int n,
                      const uint8_t *transp_color)
 {
     int i;
@@ -395,7 +397,7 @@ static int dvdsub_decode(AVCodecContext *avctx,
         goto no_subtitle;
 
 #if defined(DEBUG)
-    av_log(NULL, AV_LOG_INFO, "start=%d ms end =%d ms\n", 
+    av_log(NULL, AV_LOG_INFO, "start=%d ms end =%d ms\n",
            sub->start_display_time,
            sub->end_display_time);
     ppm_save("/tmp/a.ppm", sub->rects[0].bitmap,
@@ -431,11 +433,11 @@ static int dvdsub_parse_init(AVCodecParserContext *s)
 
 static int dvdsub_parse(AVCodecParserContext *s,
                         AVCodecContext *avctx,
-                        uint8_t **poutbuf, int *poutbuf_size, 
+                        uint8_t **poutbuf, int *poutbuf_size,
                         const uint8_t *buf, int buf_size)
 {
     DVDSubParseContext *pc = s->priv_data;
-    
+
     if (pc->packet_index == 0) {
         if (buf_size < 2)
             return 0;