include $(top_srcdir)/misc/Makefile.common

if HAVE_FFMPEG
AM_CFLAGS = $(FFMPEG_CFLAGS) $(FFMPEG_POSTPROC_CFLAGS)
link_ffmpeg = $(FFMPEG_LIBS) $(FFMPEG_POSTPROC_LIBS)
else
ff_cppflags = -I$(top_srcdir)/src/libffmpeg/libavutil
link_ffmpeg = \
  $(top_builddir)/src/libffmpeg/libavcodec/libavcodec.la \
  $(top_builddir)/src/libffmpeg/libavutil/libavutil.la \
  $(top_builddir)/src/libffmpeg/libavcodec/libpostproc/libpostprocess.la
SUBDIRS = libavcodec libavutil
endif

# ffmpeg_config.h is generated by configure
DISTCLEANFILES = ffmpeg_config.h

# this must always be included, even if the current machine has no DXR3...
EXTRA_DIST = ffmpeg_encoder.c diff_to_ffmpeg_cvs.txt

INTERNAL_DOCS = diff_to_ffmpeg_cvs.txt

xineplug_LTLIBRARIES = xineplug_decode_ff.la xineplug_decode_dvaudio.la

if HAVE_DXR3
AM_CPPFLAGS = -I$(top_srcdir)/src/dxr3 $(X_CFLAGS) $(ff_cppflags) \
              $(ZLIB_CPPFLAGS)
xineplug_decode_ff_la_SOURCES = ffmpeg_decoder.c ff_audio_decoder.c ff_video_decoder.c \
                                ffmpeg_encoder.c ff_mpeg_parser.c ffmpeg_decoder.h \
				ff_mpeg_parser.h
else
AM_CPPFLAGS = $(ff_cppflags) $(ZLIB_CPPFLAGS)
xineplug_decode_ff_la_SOURCES = ffmpeg_decoder.c ff_audio_decoder.c ff_video_decoder.c \
                                ff_mpeg_parser.c ffmpeg_decoder.h ff_mpeg_parser.h
endif

xineplug_decode_ff_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS)
xineplug_decode_ff_la_LDFLAGS = $(xineplug_ldflags) $(IMPURE_TEXT_LDFLAGS)
xineplug_decode_ff_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) -lm $(ZLIB_LIBS) \
	$(link_ffmpeg) $(PTHREAD_LIBS) $(LTLIBINTL)

xineplug_decode_dvaudio_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS)
xineplug_decode_dvaudio_la_LDFLAGS = $(xineplug_ldflags)
xineplug_decode_dvaudio_la_SOURCES = ff_dvaudio_decoder.c
xineplug_decode_dvaudio_la_LIBADD  = $(XINE_LIB) $(LTLIBINTL)
