[FFmpeg-cvslog] r22652 - in trunk/libavformat: Makefile flacenc.h flacenc_header.c

jbr subversion
Wed Mar 24 00:58:46 CET 2010


Author: jbr
Date: Wed Mar 24 00:58:45 2010
New Revision: 22652

Log:
Put ff_flac_write_header() in a separate C file to allow it to be shared without 
duplicating code or adding a dependency on vorbiscomment.o.

Added:
   trunk/libavformat/flacenc_header.c
      - copied, changed from r22650, trunk/libavformat/flacenc.h
Modified:
   trunk/libavformat/Makefile
   trunk/libavformat/flacenc.h

Modified: trunk/libavformat/Makefile
==============================================================================
--- trunk/libavformat/Makefile	Wed Mar 24 00:35:36 2010	(r22651)
+++ trunk/libavformat/Makefile	Wed Mar 24 00:58:45 2010	(r22652)
@@ -71,7 +71,8 @@ OBJS-$(CONFIG_FILMSTRIP_MUXER)          
 OBJS-$(CONFIG_FLAC_DEMUXER)              += flacdec.o raw.o id3v1.o \
                                             id3v2.o oggparsevorbis.o \
                                             vorbiscomment.o
-OBJS-$(CONFIG_FLAC_MUXER)                += flacenc.o vorbiscomment.o
+OBJS-$(CONFIG_FLAC_MUXER)                += flacenc.o flacenc_header.o \
+                                            vorbiscomment.o
 OBJS-$(CONFIG_FLIC_DEMUXER)              += flic.o
 OBJS-$(CONFIG_FLV_DEMUXER)               += flvdec.o
 OBJS-$(CONFIG_FLV_MUXER)                 += flvenc.o avc.o
@@ -103,7 +104,8 @@ OBJS-$(CONFIG_M4V_MUXER)                
 OBJS-$(CONFIG_MATROSKA_DEMUXER)          += matroskadec.o matroska.o \
                                             riff.o isom.o rmdec.o rm.o
 OBJS-$(CONFIG_MATROSKA_MUXER)            += matroskaenc.o matroska.o \
-                                            riff.o isom.o avc.o
+                                            riff.o isom.o avc.o \
+                                            flacenc_header.o
 OBJS-$(CONFIG_MJPEG_DEMUXER)             += raw.o
 OBJS-$(CONFIG_MJPEG_MUXER)               += raw.o
 OBJS-$(CONFIG_MLP_DEMUXER)               += raw.o id3v2.o

Modified: trunk/libavformat/flacenc.h
==============================================================================
--- trunk/libavformat/flacenc.h	Wed Mar 24 00:35:36 2010	(r22651)
+++ trunk/libavformat/flacenc.h	Wed Mar 24 00:58:45 2010	(r22652)
@@ -26,28 +26,7 @@
 #include "libavcodec/bytestream.h"
 #include "avformat.h"
 
-static int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec,
-                                int last_block)
-{
-    uint8_t header[8] = {
-        0x66, 0x4C, 0x61, 0x43, 0x00, 0x00, 0x00, 0x22
-    };
-    uint8_t *streaminfo;
-    enum FLACExtradataFormat format;
-
-    header[4] = last_block ? 0x80 : 0x00;
-    if (!ff_flac_is_extradata_valid(codec, &format, &streaminfo))
-        return -1;
-
-    /* write "fLaC" stream marker and first metadata block header if needed */
-    if (format == FLAC_EXTRADATA_FORMAT_STREAMINFO) {
-        put_buffer(pb, header, 8);
-    }
-
-    /* write STREAMINFO or full header */
-    put_buffer(pb, codec->extradata, codec->extradata_size);
-
-    return 0;
-}
+int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec,
+                         int last_block);
 
 #endif /* AVFORMAT_FLACENC_H */

Copied and modified: trunk/libavformat/flacenc_header.c (from r22650, trunk/libavformat/flacenc.h)
==============================================================================
--- trunk/libavformat/flacenc.h	Tue Mar 23 21:03:20 2010	(r22650, copy source)
+++ trunk/libavformat/flacenc_header.c	Wed Mar 24 00:58:45 2010	(r22652)
@@ -19,15 +19,13 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef AVFORMAT_FLACENC_H
-#define AVFORMAT_FLACENC_H
-
 #include "libavcodec/flac.h"
 #include "libavcodec/bytestream.h"
 #include "avformat.h"
+#include "flacenc.h"
 
-static int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec,
-                                int last_block)
+int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec,
+                         int last_block)
 {
     uint8_t header[8] = {
         0x66, 0x4C, 0x61, 0x43, 0x00, 0x00, 0x00, 0x22
@@ -49,5 +47,3 @@ static int ff_flac_write_header(ByteIOCo
 
     return 0;
 }
-
-#endif /* AVFORMAT_FLACENC_H */



More information about the ffmpeg-cvslog mailing list