[Ffmpeg-devel] [PATCH] compile with demux only
Loic
lll+ffmpeg
Tue Nov 7 18:02:37 CET 2006
Hi,
I'm trying to compile libavformat and libavcodec with demuxers only (I
have a test program which only dumps the raw streams inside any
container). I'm using the configure line:
./configure --enable-gpl --disable-encoders --disable-muxers --disable-decoders
And I observe the following errors when trying to link libavformat and
libavcodec in my program:
libavformat/libavformat.a(rtp.o): In function `rtp_check_and_send_back_rr':
libavformat/rtp.c:387: undefined reference to `url_open_dyn_buf'
libavformat/rtp.c:443: undefined reference to `url_close_dyn_buf'
libavcodec/libavcodec.a(parser.o): In function `cavsvideo_parse':
libavcodec/parser.c:376: undefined reference to `ff_cavs_find_frame_end'
I have a patch (see attached) which correct this.
url_open_dyn_buf and url_close_dyn_buf which are protected by ifdef
CONFIG_MUXERS are now protected by
#if defined(CONFIG_MUXERS) || defined(CONFIG_NETWORK)
because CONFIG_NETWORK is the condition for rtp.c compilation.
ff_cavs_find_frame_end function which is in cavs.c has been moved to
parser.c in the same block where it is used. As this function is only
used here, it can be removed for parser.h and declared static.
Note that some defines from cavsdata.h are needed by
ff_cavs_find_frame_end so I put them in a separate cavs.h file and
include it from cavs.c and parser.c (I don't include cavsdata.h directly
in parser.c because it contains many static const variable declaration
which use memory but wont be used).
Hope this patch can be included.
--
Lo?c
"heaven is not a place, it's a feeling"
-------------- next part --------------
Index: libavcodec/cavsdata.h
===================================================================
--- libavcodec/cavsdata.h (r?vision 6934)
+++ libavcodec/cavsdata.h (copie de travail)
@@ -19,14 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define SLICE_MIN_START_CODE 0x00000101
-#define SLICE_MAX_START_CODE 0x000001af
-#define EXT_START_CODE 0x000001b5
-#define USER_START_CODE 0x000001b2
-#define SEQ_START_CODE 0x000001b0
-#define PIC_I_START_CODE 0x000001b3
-#define PIC_PB_START_CODE 0x000001b6
-
#define A_AVAIL 1
#define B_AVAIL 2
#define C_AVAIL 4
Index: libavcodec/cavs.c
===================================================================
--- libavcodec/cavs.c (r?vision 6934)
+++ libavcodec/cavs.c (copie de travail)
@@ -29,6 +29,7 @@
#include "bitstream.h"
#include "golomb.h"
#include "mpegvideo.h"
+#include "cavs.h"
#include "cavsdata.h"
typedef struct {
@@ -1318,49 +1319,6 @@
return 0;
}
-/**
- * finds the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-int ff_cavs_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) {
- int pic_found, i;
- uint32_t state;
-
- pic_found= pc->frame_start_found;
- state= pc->state;
-
- i=0;
- if(!pic_found){
- for(i=0; i<buf_size; i++){
- state= (state<<8) | buf[i];
- if(state == PIC_I_START_CODE || state == PIC_PB_START_CODE){
- i++;
- pic_found=1;
- break;
- }
- }
- }
-
- if(pic_found){
- /* EOF considered as end of frame */
- if (buf_size == 0)
- return 0;
- for(; i<buf_size; i++){
- state= (state<<8) | buf[i];
- if((state&0xFFFFFF00) == 0x100){
- if(state < SLICE_MIN_START_CODE || state > SLICE_MAX_START_CODE){
- pc->frame_start_found=0;
- pc->state=-1;
- return i-3;
- }
- }
- }
- }
- pc->frame_start_found= pic_found;
- pc->state= state;
- return END_NOT_FOUND;
-}
-
void ff_cavs_flush(AVCodecContext * avctx) {
AVSContext *h = avctx->priv_data;
h->got_keyframe = 0;
Index: libavcodec/cavs.h
===================================================================
--- libavcodec/cavs.h (r?vision 0)
+++ libavcodec/cavs.h (r?vision 0)
@@ -0,0 +1,28 @@
+/*
+ * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
+ * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer at gmx.de>
+ *
+ * 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define SLICE_MIN_START_CODE 0x00000101
+#define SLICE_MAX_START_CODE 0x000001af
+#define EXT_START_CODE 0x000001b5
+#define USER_START_CODE 0x000001b2
+#define SEQ_START_CODE 0x000001b0
+#define PIC_I_START_CODE 0x000001b3
+#define PIC_PB_START_CODE 0x000001b6
Index: libavcodec/parser.c
===================================================================
--- libavcodec/parser.c (r?vision 6934)
+++ libavcodec/parser.c (copie de travail)
@@ -362,6 +362,50 @@
#endif
#ifdef CONFIG_CAVSVIDEO_PARSER
+#include "cavs.h"
+/**
+ * finds the end of the current frame in the bitstream.
+ * @return the position of the first byte of the next frame, or -1
+ */
+static int ff_cavs_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) {
+ int pic_found, i;
+ uint32_t state;
+
+ pic_found= pc->frame_start_found;
+ state= pc->state;
+
+ i=0;
+ if(!pic_found){
+ for(i=0; i<buf_size; i++){
+ state= (state<<8) | buf[i];
+ if(state == PIC_I_START_CODE || state == PIC_PB_START_CODE){
+ i++;
+ pic_found=1;
+ break;
+ }
+ }
+ }
+
+ if(pic_found){
+ /* EOF considered as end of frame */
+ if (buf_size == 0)
+ return 0;
+ for(; i<buf_size; i++){
+ state= (state<<8) | buf[i];
+ if((state&0xFFFFFF00) == 0x100){
+ if(state < SLICE_MIN_START_CODE || state > SLICE_MAX_START_CODE){
+ pc->frame_start_found=0;
+ pc->state=-1;
+ return i-3;
+ }
+ }
+ }
+ }
+ pc->frame_start_found= pic_found;
+ pc->state= state;
+ return END_NOT_FOUND;
+}
+
static int cavsvideo_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
Index: libavcodec/parser.h
===================================================================
--- libavcodec/parser.h (r?vision 6934)
+++ libavcodec/parser.h (copie de travail)
@@ -58,7 +58,4 @@
/* h263dec.c */
int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size);
-/* cavs.c */
-int ff_cavs_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size);
-
#endif /* !FFMPEG_PARSER_H */
Index: libavformat/aviobuf.c
===================================================================
--- libavformat/aviobuf.c (r?vision 6934)
+++ libavformat/aviobuf.c (copie de travail)
@@ -136,12 +136,12 @@
fill_buffer(s);
s->buf_ptr = s->buf_end + offset - s->pos;
} else {
-#ifdef CONFIG_MUXERS
+#if defined(CONFIG_MUXERS) || defined(CONFIG_NETWORK)
if (s->write_flag) {
flush_buffer(s);
s->must_flush = 1;
} else
-#endif //CONFIG_MUXERS
+#endif // defined(CONFIG_MUXERS) || defined(CONFIG_NETWORK)
{
s->buf_end = s->buffer;
}
@@ -622,7 +622,9 @@
return s->max_packet_size;
}
-#ifdef CONFIG_MUXERS
+// url_open_dyn_buf and url_close_dyn_buf are used in rtp.c to send response back
+// to server even if CONFIG_MUXERS is not set.
+#if defined(CONFIG_MUXERS) || defined(CONFIG_NETWORK)
/* buffer handling */
int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags)
{
@@ -785,4 +787,4 @@
av_free(d);
return size;
}
-#endif //CONFIG_MUXERS
+#endif // CONFIG_MUXERS || CONFIG_NETWORK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061107/2accf744/attachment.pgp>
More information about the ffmpeg-devel
mailing list