diff --git a/Makefile b/Makefile index 7b6e76d8f9..00a4ba6e16 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,13 @@ PRG_CFG = codec-cfg #prefix = /usr/local BINDIR = ${prefix}/bin # BINDIR = /usr/local/bin -SRCS = cpudetect.c postproc/swscale.c postproc/postprocess.c mp_msg.c open.c parse_es.c ac3-iec958.c find_sub.c aviprint.c dec_audio.c dec_video.c aviwrite.c aviheader.c asfheader.c demux_avi.c demux_asf.c demux_mpg.c demux_mov.c demuxer.c stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c xa/rle8.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c $(STREAM_SRCS) +SRCS = cpudetect.c postproc/swscale.c postproc/postprocess.c mp_msg.c ac3-iec958.c find_sub.c dec_audio.c dec_video.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c xa/rle8.c lirc_mp.c cfgparser.c mixer.c spudec.c OBJS = $(SRCS:.c=.o) -CFLAGS = $(OPTFLAGS) -Iloader -Ilibvo $(CSS_INC) $(EXTRA_INC) # -Wall +CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(CSS_INC) $(EXTRA_INC) # -Wall A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3 $(ALSA_LIB) $(ESD_LIB) VO_LIBS = -Llibvo -lvo $(MLIB_LIB) $(X_LIBS) -PARTS = mp3lib libac3 libmpeg2 opendivx libavcodec encore libvo libao2 drivers drivers/syncfb +PARTS = libmpdemux mp3lib libac3 libmpeg2 opendivx libavcodec encore libvo libao2 drivers drivers/syncfb ifeq ($(GUI),yes) PARTS += Gui endif @@ -50,11 +50,14 @@ all: $(ALL_PRG) .c.o: $(CC) -c $(CFLAGS) -o $@ $< -COMMONLIBS = libvo/libvo.a libao2/libao2.a libac3/libac3.a mp3lib/libMP3.a libmpeg2/libmpeg2.a opendivx/libdecore.a encore/libencore.a +COMMONLIBS = libmpdemux/libmpdemux.a libvo/libvo.a libao2/libao2.a libac3/libac3.a mp3lib/libMP3.a libmpeg2/libmpeg2.a opendivx/libdecore.a encore/libencore.a loader/libloader.a: $(MAKE) -C loader +libmpdemux/libmpdemux.a: + $(MAKE) -C libmpdemux + loader/DirectShow/libDS_Filter.a: $(MAKE) -C loader/DirectShow @@ -93,7 +96,7 @@ mplayerwithoutlink: $(MPLAYER_DEP) @for a in $(PARTS); do $(MAKE) -C $$a all ; done $(PRG): $(MPLAYER_DEP) - $(CC) $(CFLAGS) -o $(PRG) mplayer.o $(OBJS) $(XMM_LIBS) $(LIRC_LIBS) $(A_LIBS) -lm $(TERMCAP_LIB) $(LIB_LOADER) $(AV_LIB) -Llibmpeg2 -lmpeg2 -Llibao2 -lao2 $(VO_LIBS) $(CSS_LIB) -Lencore -lencore $(DECORE_LIBS) $(GUI_LIBS) $(ARCH_LIBS) + $(CC) $(CFLAGS) -o $(PRG) mplayer.o -Llibmpdemux -lmpdemux $(OBJS) $(XMM_LIBS) $(LIRC_LIBS) $(A_LIBS) -lm $(TERMCAP_LIB) $(LIB_LOADER) $(AV_LIB) -Llibmpeg2 -lmpeg2 -Llibao2 -lao2 $(VO_LIBS) $(CSS_LIB) -Lencore -lencore $(DECORE_LIBS) $(GUI_LIBS) $(ARCH_LIBS) $(PRG_FIBMAP): fibmap_mplayer.o $(CC) -o $(PRG_FIBMAP) fibmap_mplayer.o diff --git a/codec-cfg.h b/codec-cfg.h index a97868cfd2..1086b23ed5 100644 --- a/codec-cfg.h +++ b/codec-cfg.h @@ -51,7 +51,7 @@ typedef struct { #endif -typedef struct { +typedef struct codecs_st { unsigned int fourcc[CODECS_MAX_FOURCC]; unsigned int fourccmap[CODECS_MAX_FOURCC]; unsigned int outfmt[CODECS_MAX_OUTFMT]; diff --git a/configure b/configure index 510b49ba19..16b042b6b1 100755 --- a/configure +++ b/configure @@ -1734,7 +1734,7 @@ fi _streamingdef='#undef STREAMING' if test "$_streaming" = yes ; then - _streamingsrcs='asf_streaming.c network.c url.c http.c' +# _streamingsrcs='asf_streaming.c network.c url.c http.c' _streamingdef='#define STREAMING' fi @@ -2271,7 +2271,7 @@ AV_LIB = $_lavclib ALSA_LIB = $_alsalib ESD_LIB = $_esdlib ARCH_LIBS = $_archlibs $_iconvlib -STREAM_SRCS = $_streamingsrcs +STREAMING=$_streaming DECORE_LIBS = $_decorelibs DIVX4LINUX=$_divx4linux MLIB_INC = $_mlibinc diff --git a/asf.h b/libmpdemux/asf.h similarity index 100% rename from asf.h rename to libmpdemux/asf.h diff --git a/asf_streaming.c b/libmpdemux/asf_streaming.c similarity index 100% rename from asf_streaming.c rename to libmpdemux/asf_streaming.c diff --git a/asfheader.c b/libmpdemux/asfheader.c similarity index 100% rename from asfheader.c rename to libmpdemux/asfheader.c diff --git a/aviheader.c b/libmpdemux/aviheader.c similarity index 100% rename from aviheader.c rename to libmpdemux/aviheader.c diff --git a/aviheader.h b/libmpdemux/aviheader.h similarity index 100% rename from aviheader.h rename to libmpdemux/aviheader.h diff --git a/aviprint.c b/libmpdemux/aviprint.c similarity index 100% rename from aviprint.c rename to libmpdemux/aviprint.c diff --git a/aviwrite.c b/libmpdemux/aviwrite.c similarity index 100% rename from aviwrite.c rename to libmpdemux/aviwrite.c diff --git a/libmpdemux/bswap.h b/libmpdemux/bswap.h new file mode 100644 index 0000000000..21072f676a --- /dev/null +++ b/libmpdemux/bswap.h @@ -0,0 +1,2 @@ +/* Let it be for now*/ +#include "../bswap.h" diff --git a/libmpdemux/codec-cfg.h b/libmpdemux/codec-cfg.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libmpdemux/config.h b/libmpdemux/config.h new file mode 100644 index 0000000000..319abb0131 --- /dev/null +++ b/libmpdemux/config.h @@ -0,0 +1,2 @@ +/* Let it be for now*/ +#include "../config.h" diff --git a/demux_asf.c b/libmpdemux/demux_asf.c similarity index 100% rename from demux_asf.c rename to libmpdemux/demux_asf.c diff --git a/demux_avi.c b/libmpdemux/demux_avi.c similarity index 100% rename from demux_avi.c rename to libmpdemux/demux_avi.c diff --git a/demux_mov.c b/libmpdemux/demux_mov.c similarity index 100% rename from demux_mov.c rename to libmpdemux/demux_mov.c diff --git a/demux_mpg.c b/libmpdemux/demux_mpg.c similarity index 100% rename from demux_mpg.c rename to libmpdemux/demux_mpg.c diff --git a/demuxer.c b/libmpdemux/demuxer.c similarity index 100% rename from demuxer.c rename to libmpdemux/demuxer.c diff --git a/demuxer.h b/libmpdemux/demuxer.h similarity index 100% rename from demuxer.h rename to libmpdemux/demuxer.h diff --git a/dvdauth.c b/libmpdemux/dvdauth.c similarity index 100% rename from dvdauth.c rename to libmpdemux/dvdauth.c diff --git a/dvdauth.h b/libmpdemux/dvdauth.h similarity index 100% rename from dvdauth.h rename to libmpdemux/dvdauth.h diff --git a/libmpdemux/help_mp.h b/libmpdemux/help_mp.h new file mode 100644 index 0000000000..c714314853 --- /dev/null +++ b/libmpdemux/help_mp.h @@ -0,0 +1 @@ +#include "../help_mp.h" diff --git a/http.c b/libmpdemux/http.c similarity index 100% rename from http.c rename to libmpdemux/http.c diff --git a/http.h b/libmpdemux/http.h similarity index 100% rename from http.h rename to libmpdemux/http.h diff --git a/libmpdemux/mp_msg.h b/libmpdemux/mp_msg.h new file mode 100644 index 0000000000..0f8ceae361 --- /dev/null +++ b/libmpdemux/mp_msg.h @@ -0,0 +1,2 @@ +/* Let it be for now*/ +#include "../mp_msg.h" diff --git a/network.c b/libmpdemux/network.c similarity index 100% rename from network.c rename to libmpdemux/network.c diff --git a/network.h b/libmpdemux/network.h similarity index 100% rename from network.h rename to libmpdemux/network.h diff --git a/open.c b/libmpdemux/open.c similarity index 100% rename from open.c rename to libmpdemux/open.c diff --git a/parse_es.c b/libmpdemux/parse_es.c similarity index 100% rename from parse_es.c rename to libmpdemux/parse_es.c diff --git a/parse_es.h b/libmpdemux/parse_es.h similarity index 100% rename from parse_es.h rename to libmpdemux/parse_es.h diff --git a/stheader.h b/libmpdemux/stheader.h similarity index 97% rename from stheader.h rename to libmpdemux/stheader.h index 891331b032..0e83c53d84 100644 --- a/stheader.h +++ b/libmpdemux/stheader.h @@ -28,7 +28,7 @@ typedef struct { typedef struct { demux_stream_t *ds; unsigned int format; - codecs_t *codec; + struct codecs_st *codec; int inited; // output format: float timer; // value of old a_frame @@ -66,7 +66,7 @@ typedef struct { typedef struct { demux_stream_t *ds; unsigned int format; - codecs_t *codec; + struct codecs_st *codec; int inited; // output format: float timer; // value of old v_frame diff --git a/stream.c b/libmpdemux/stream.c similarity index 98% rename from stream.c rename to libmpdemux/stream.c index 34cc42bf9c..de138cef02 100644 --- a/stream.c +++ b/libmpdemux/stream.c @@ -17,9 +17,9 @@ extern int verbose; // defined in mplayer.c #ifdef __FreeBSD__ -#include "vcd_read_fbsd.c" +#include "vcd_read_fbsd.h" #else -#include "vcd_read.c" +#include "vcd_read.h" #endif #ifdef USE_DVDREAD diff --git a/stream.h b/libmpdemux/stream.h similarity index 100% rename from stream.h rename to libmpdemux/stream.h diff --git a/libmpdemux/test.c b/libmpdemux/test.c new file mode 100644 index 0000000000..ce59b19228 --- /dev/null +++ b/libmpdemux/test.c @@ -0,0 +1,66 @@ + +#include +#include +#include + +#include "mp_msg.h" + +#include "stream.h" +#include "demuxer.h" + +#include "wine/mmreg.h" +#include "wine/avifmt.h" +#include "wine/vfw.h" +#include "codec-cfg.h" +#include "stheader.h" + +//-------------------------- + +// audio stream skip/resync functions requires only for seeking. +// (they should be implemented in the audio codec layer) +void skip_audio_frame(sh_audio_t *sh_audio){ +} +void resync_audio_stream(sh_audio_t *sh_audio){ +} + +// some globals: +int verbose=1; + +// AVI demuxer parameters: +int index_mode=-1; // -1=untouched 0=don't use index 1=use (geneate) index +int force_ni=0; // force non-interleaved AVI parsing +int pts_from_bps=1; // PTS: 0=interleaved 1=BPS-based + +//--------------- + +extern stream_t* open_stream(char* filename,int vcd_track,int* file_format); + +int main(int argc,char* argv[]){ + +stream_t* stream=NULL; +demuxer_t* demuxer=NULL; +int file_format=DEMUXER_TYPE_UNKNOWN; + + mp_msg_init(verbose+MSGL_STATUS); + + if(argc>1) + stream=open_stream(argv[1],0,&file_format); + else +// stream=open_stream("/3d/divx/405divx_sm_v2[1].avi",0,&file_format); + stream=open_stream("/dev/cdrom",2,&file_format); // VCD track 2 + + if(!stream){ + printf("Cannot open file/device\n"); + exit(1); + } + + printf("success: format: %d data: 0x%X - 0x%X\n",file_format, (int)(stream->start_pos),(int)(stream->end_pos)); + + demuxer=demux_open(stream,file_format,-1,-1,-1); + if(!demuxer){ + printf("Cannot open demuxer\n"); + exit(1); + } + + +} diff --git a/url.c b/libmpdemux/url.c similarity index 100% rename from url.c rename to libmpdemux/url.c diff --git a/url.h b/libmpdemux/url.h similarity index 100% rename from url.h rename to libmpdemux/url.h diff --git a/vcd_read.h b/libmpdemux/vcd_read.h similarity index 100% rename from vcd_read.h rename to libmpdemux/vcd_read.h diff --git a/vcd_read_fbsd.h b/libmpdemux/vcd_read_fbsd.h similarity index 100% rename from vcd_read_fbsd.h rename to libmpdemux/vcd_read_fbsd.h