[FFmpeg-cvslog] r15002 - in trunk/libavformat: internal.h sdp.c utils.c

rbultje subversion
Thu Aug 28 01:43:28 CEST 2008


Author: rbultje
Date: Thu Aug 28 01:43:28 2008
New Revision: 15002

Log:
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
move it from sdp.c into utils.c. Also add new header internal.h specifically
for lavf-specific internal API. See discussion in "Realmedia patch" thread
on mailinglist.



Added:
   trunk/libavformat/internal.h
Modified:
   trunk/libavformat/sdp.c
   trunk/libavformat/utils.c

Added: trunk/libavformat/internal.h
==============================================================================
--- (empty file)
+++ trunk/libavformat/internal.h	Thu Aug 28 01:43:28 2008
@@ -0,0 +1,26 @@
+/*
+ * copyright (c) 2001 Fabrice Bellard
+ *
+ * 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.1 of the License, or (at your option) any later version.
+ *
+ * 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef FFMPEG_AVFORMAT_UTILS_H
+#define FFMPEG_AVFORMAT_UTILS_H
+
+char *ff_data_to_hex(char *buf, const uint8_t *src, int size);
+
+#endif /* FFMPEG_AVFORMAT_UTILS_H */

Modified: trunk/libavformat/sdp.c
==============================================================================
--- trunk/libavformat/sdp.c	(original)
+++ trunk/libavformat/sdp.c	Thu Aug 28 01:43:28 2008
@@ -21,6 +21,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/base64.h"
 #include "avformat.h"
+#include "internal.h"
 #include "avc.h"
 #include "rtp.h"
 
@@ -135,27 +136,6 @@ static char *extradata2psets(AVCodecCont
     return psets;
 }
 
-static void digit_to_char(char *dst, uint8_t src)
-{
-    if (src < 10) {
-        *dst = '0' + src;
-    } else {
-        *dst = 'A' + src - 10;
-    }
-}
-
-static char *data_to_hex(char *buff, const uint8_t *src, int s)
-{
-    int i;
-
-    for(i = 0; i < s; i++) {
-        digit_to_char(buff + 2 * i, src[i] >> 4);
-        digit_to_char(buff + 2 * i + 1, src[i] & 0xF);
-    }
-
-    return buff;
-}
-
 static char *extradata2config(AVCodecContext *c)
 {
     char *config;
@@ -171,7 +151,7 @@ static char *extradata2config(AVCodecCon
         return NULL;
     }
     memcpy(config, "; config=", 9);
-    data_to_hex(config + 9, c->extradata, c->extradata_size);
+    ff_data_to_hex(config + 9, c->extradata, c->extradata_size);
     config[9 + c->extradata_size * 2] = 0;
 
     return config;

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	(original)
+++ trunk/libavformat/utils.c	Thu Aug 28 01:43:28 2008
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
+#include "internal.h"
 #include "libavcodec/opt.h"
 #include "libavutil/avstring.h"
 #include "riff.h"
@@ -3212,6 +3213,27 @@ void url_split(char *proto, int proto_si
     }
 }
 
+static void digit_to_char(char *dst, uint8_t src)
+{
+    if (src < 10) {
+        *dst = '0' + src;
+    } else {
+        *dst = 'A' + src - 10;
+    }
+}
+
+char *ff_data_to_hex(char *buff, const uint8_t *src, int s)
+{
+    int i;
+
+    for(i = 0; i < s; i++) {
+        digit_to_char(buff + 2 * i, src[i] >> 4);
+        digit_to_char(buff + 2 * i + 1, src[i] & 0xF);
+    }
+
+    return buff;
+}
+
 void av_set_pts_info(AVStream *s, int pts_wrap_bits,
                      int pts_num, int pts_den)
 {




More information about the ffmpeg-cvslog mailing list