[MPlayer-dev-eng] [PATCH] some muxer_lavf mess cleanup
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Fri Jan 5 16:55:16 CET 2007
Hello,
On Fri, Jan 05, 2007 at 04:22:24PM +0100, Michael Niedermayer wrote:
> On Fri, Jan 05, 2007 at 11:31:33AM +0100, Reimar Döffinger wrote:
> > attached patch does:
> > 1) include the proper header (riff.h) instead of adding our own function
> > prototypes for all those functions
>
> ok of course
>
>
> > 2) add missing prototype for codec_get_id and CodecTag typedef
>
> ok of course
>
>
> > 3) remove useless extern for function prototypes
>
> ok of course
>
>
> > 4) mp_wav_tags is of type CodecTag[] not int[]!!! Lazyness is not an
> > excuse for that kind of hacks
>
> oops, thats a little embarassing but it was not exactly lazyness but rather
> limitless stupidity ... when the compiler didnt like CodecTag i thought it was
> just a typdef int with fourcc in it (of course thats not possible and i should
> have remembered my own code ...) and as its used for example in
That's what you get for not providing all the proper function prototypes
;-)
> libmpcodecs/ae_lavc.c which shouldnt depend on headers from lavf i thought
> cheating and using int would do ...
well, it was under a libavformat ifdef anyway though.
> that brings us to the point that you have to fix ae_lavc.c too
"have"? Give a finger and see the whole hand go... ;-)
I have a new patch that fixes both muxer_lavf and ae_lavc. But I have to
say that I really do not dynamic lib handling.
Since MPlayer checkout always includes the libavf dirs I am tempted to
just always #include "libavformat/riff.h", even if this increases the
risks of incompatibilities even further...
What do you think?
Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/muxer_lavf.c
===================================================================
--- libmpdemux/muxer_lavf.c (revision 21828)
+++ libmpdemux/muxer_lavf.c (working copy)
@@ -19,14 +19,21 @@
#include "m_option.h"
#ifdef USE_LIBAVFORMAT_SO
#include <ffmpeg/avformat.h>
+typedef struct CodecTag {
+ int id;
+ unsigned int tag;
+ unsigned int invalid_asf : 1;
+} CodecTag;
+unsigned int codec_get_wav_tag(int id);
+enum CodecID codec_get_bmp_id(unsigned int tag);
+enum CodecID codec_get_wav_id(unsigned int tag);
+enum CodecID codec_get_id(const CodecTag *tags, unsigned int tag);
#else
#include "avformat.h"
+#include "libavformat/riff.h"
#endif
-extern unsigned int codec_get_wav_tag(int id);
-extern enum CodecID codec_get_bmp_id(unsigned int tag);
-extern enum CodecID codec_get_wav_id(unsigned int tag);
-extern const int mp_wav_tags[];
+extern const CodecTag mp_wav_tags[];
extern char *info_name;
extern char *info_artist;
Index: libmpcodecs/ae_lavc.c
===================================================================
--- libmpcodecs/ae_lavc.c (revision 21828)
+++ libmpcodecs/ae_lavc.c (working copy)
@@ -29,9 +29,21 @@
extern int avcodec_inited;
static int compressed_frame_size = 0;
#if defined(USE_LIBAVFORMAT) || defined(USE_LIBAVFORMAT_SO)
-extern unsigned int codec_get_wav_tag(int id);
-extern const int mp_wav_tags[];
+#ifdef USE_LIBAVFORMAT_SO
+#include <ffmpeg/avformat.h>
+typedef struct CodecTag {
+ int id;
+ unsigned int tag;
+ unsigned int invalid_asf : 1;
+} CodecTag;
+unsigned int codec_get_wav_tag(int id);
+unsigned int codec_get_tag(const CodecTag *tags, int id);
+#else
+#include "libavformat/avformat.h"
+#include "libavformat/riff.h"
#endif
+extern const CodecTag mp_wav_tags[];
+#endif
static int bind_lavc(audio_encoder_t *encoder, muxer_stream_t *mux_a)
{
More information about the MPlayer-dev-eng
mailing list