mirror of
https://github.com/mpv-player/mpv
synced 2024-12-31 11:42:14 +00:00
Added Matroska demuxing support.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10025 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
fa728ab453
commit
004d3a060c
2
Makefile
2
Makefile
@ -35,7 +35,7 @@ OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o)
|
||||
|
||||
VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB)
|
||||
AO_LIBS = $(ARTS_LIB) $(ESD_LIB) $(NAS_LIB) $(SGIAUDIO_LIB)
|
||||
CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(DECORE_LIB) $(XVID_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB)
|
||||
CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(DECORE_LIB) $(XVID_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB) $(MATROSKA_LIB)
|
||||
COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a postproc/libswscale.a osdep/libosdep.a $(CSS_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(STREAMING_LIB) $(WIN32_LIB) $(GIF_LIB) $(MACOSX_FRAMEWORKS) $(SMBSUPPORT_LIB) $(FRIBIDI_LIB)
|
||||
|
||||
CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(FREETYPE_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(SDL_INC) $(FRIBIDI_INC) # -Wall
|
||||
|
46
configure
vendored
46
configure
vendored
@ -189,6 +189,7 @@ Codecs:
|
||||
--enable-libfame enable libfame realtime encoder [autodetect]
|
||||
--enable-vorbis build with OggVorbis support [autodetect]
|
||||
--enable-tremor build with integer-only OggVorbis support [disabled]
|
||||
--enable-matroska build with Matroska support [autodetect]
|
||||
--enable-faad build with FAAD2 (MP4/AAC) support [autodetect]
|
||||
--disable-libdv disable libdv 0.9.5 en/decoding support [autodetect]
|
||||
--disable-mad disable libmad (mpeg audio) support [autodetect]
|
||||
@ -1025,6 +1026,7 @@ _esd=auto
|
||||
_liblzo=auto
|
||||
_mad=auto
|
||||
_vorbis=auto
|
||||
_matroska=auto
|
||||
_tremor=no
|
||||
_faad=auto
|
||||
_xmms=no
|
||||
@ -1178,6 +1180,8 @@ for ac_option do
|
||||
--disable-vorbis) _vorbis=no ;;
|
||||
--enable-tremor) _tremor=yes ;;
|
||||
--disable-tremor) _tremor=no ;;
|
||||
--enable-matroska) _matroska=yes ;;
|
||||
--disable-matroska) _matroska=no ;;
|
||||
--enable-faad) _faad=yes ;;
|
||||
--disable-faad) _faad=no ;;
|
||||
--enable-xmms) _xmms=yes ;;
|
||||
@ -4025,6 +4029,42 @@ fi
|
||||
echores "$_vorbis"
|
||||
|
||||
|
||||
echocheck "Matroska support"
|
||||
if test "$_matroska" = auto ; then
|
||||
_matroska=no
|
||||
cat > $TMPC << EOF
|
||||
#include <EbmlConfig.h>
|
||||
int main(void) { return 0; }
|
||||
EOF
|
||||
cc_check -lmatroska -lebml && _matroska=yes
|
||||
if test "$_matroska" = no ; then
|
||||
_saved_inc_extra=$_inc_extra
|
||||
_inc_extra="$_inc_extra -I/usr/include/ebml -I/usr/include/matroska"
|
||||
cc_check -lmatroska -lebml && _matroska=yes
|
||||
if test "$_matroska" = no ; then
|
||||
_inc_extra="$_saved_inc_extra -I/usr/local/include/ebml -I/usr/local/include/matroska"
|
||||
cc_check -lmatroska -lebml && _matroska=yes
|
||||
if test "$_matroska" = no ; then
|
||||
_inc_extra=$_saved_inc_extra
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "$_matroska" = yes ; then
|
||||
_def_matroska='#define HAVE_MATROSKA 1'
|
||||
_inputmodules="matroska $_inputmodules"
|
||||
_ld_matroska="-lmatroska -lebml -lstdc++"
|
||||
case $cc_version in
|
||||
2.*) _def_matroska_gcc2="#define LIBEBML_GCC2" ;;
|
||||
*) _def_matroska_gcc2="/*#define LIBEBML_GCC2*/" ;;
|
||||
esac
|
||||
else
|
||||
_def_matroska='#undef HAVE_MATROSKA'
|
||||
_noinputmodules="matroska $_noinputmodules"
|
||||
fi
|
||||
echores "$_matroska"
|
||||
|
||||
|
||||
echocheck "faad2 (AAC) support"
|
||||
if test "$_faad" = auto ; then
|
||||
_faad=no
|
||||
@ -5150,6 +5190,8 @@ CONFIG_PP = yes
|
||||
CONFIG_RISKY = yes
|
||||
LIBMENU = $_menu
|
||||
I18NLIBS = $_i18n_libs
|
||||
MATROSKA = $_matroska
|
||||
MATROSKA_LIB = $_ld_matroska
|
||||
|
||||
OPENDIVX = $_opendivx
|
||||
|
||||
@ -5645,6 +5687,10 @@ $_def_vorbis
|
||||
/* enable Tremor as vorbis decoder */
|
||||
$_def_tremor
|
||||
|
||||
/* enable Matroska support */
|
||||
$_def_matroska
|
||||
$_def_matroska_gcc2
|
||||
|
||||
/* enable FAAD (AAC) support */
|
||||
$_def_faad
|
||||
$_def_faad_version
|
||||
|
@ -26,7 +26,9 @@ SRCS += dvbin.c
|
||||
SRCS += dvb_tune.c
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(MATROSKA),yes)
|
||||
CPLUSPLUSSRCS += demux_mkv.cpp
|
||||
endif
|
||||
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
1945
libmpdemux/demux_mkv.cpp
Normal file
1945
libmpdemux/demux_mkv.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -135,6 +135,7 @@ extern void demux_close_smjpeg(demuxer_t* demuxer);
|
||||
extern void demux_close_xmms(demuxer_t* demuxer);
|
||||
extern void demux_close_gif(demuxer_t* demuxer);
|
||||
extern void demux_close_ts(demuxer_t* demuxer);
|
||||
extern void demux_close_mkv(demuxer_t* demuxer);
|
||||
|
||||
#ifdef USE_TV
|
||||
#include "tv.h"
|
||||
@ -185,6 +186,10 @@ void free_demuxer(demuxer_t *demuxer){
|
||||
case DEMUXER_TYPE_OGG:
|
||||
demux_close_ogg(demuxer); break;
|
||||
#endif
|
||||
#ifdef HAVE_MATROSKA
|
||||
case DEMUXER_TYPE_MATROSKA:
|
||||
demux_close_mkv(demuxer); break;
|
||||
#endif
|
||||
#ifdef STREAMING_LIVE_DOT_COM
|
||||
case DEMUXER_TYPE_RTP:
|
||||
demux_close_rtp(demuxer); break;
|
||||
@ -292,6 +297,7 @@ extern int demux_ogg_fill_buffer(demuxer_t *d);
|
||||
extern int demux_rawaudio_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds);
|
||||
extern int demux_rawvideo_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds);
|
||||
extern int demux_smjpeg_fill_buffer(demuxer_t* demux);
|
||||
extern int demux_mkv_fill_buffer(demuxer_t *d);
|
||||
|
||||
int demux_fill_buffer(demuxer_t *demux,demux_stream_t *ds){
|
||||
// Note: parameter 'ds' can be NULL!
|
||||
@ -329,6 +335,9 @@ int demux_fill_buffer(demuxer_t *demux,demux_stream_t *ds){
|
||||
case DEMUXER_TYPE_DEMUXERS: return demux_demuxers_fill_buffer(demux,ds);
|
||||
#ifdef HAVE_OGGVORBIS
|
||||
case DEMUXER_TYPE_OGG: return demux_ogg_fill_buffer(demux);
|
||||
#endif
|
||||
#ifdef HAVE_MATROSKA
|
||||
case DEMUXER_TYPE_MATROSKA: return demux_mkv_fill_buffer(demux);
|
||||
#endif
|
||||
case DEMUXER_TYPE_RAWAUDIO: return demux_rawaudio_fill_buffer(demux,ds);
|
||||
case DEMUXER_TYPE_RAWVIDEO: return demux_rawvideo_fill_buffer(demux,ds);
|
||||
@ -574,6 +583,7 @@ extern int demux_xmms_open(demuxer_t* demuxer);
|
||||
extern int gif_check_file(demuxer_t *demuxer);
|
||||
extern int demux_open_gif(demuxer_t* demuxer);
|
||||
extern int ts_check_file(demuxer_t * demuxer);
|
||||
extern int demux_open_mkv(demuxer_t *demuxer);
|
||||
|
||||
extern demuxer_t* init_avi_with_ogg(demuxer_t* demuxer);
|
||||
|
||||
@ -700,6 +710,19 @@ if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_SMJPEG){
|
||||
demuxer = NULL;
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_MATROSKA
|
||||
//=============== Try to open as Matroska file: =================
|
||||
if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_MATROSKA){
|
||||
demuxer=new_demuxer(stream,DEMUXER_TYPE_MATROSKA,audio_id,video_id,dvdsub_id);
|
||||
if(demux_mkv_open(demuxer)){
|
||||
mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"Matroska");
|
||||
file_format=DEMUXER_TYPE_MATROSKA;
|
||||
} else {
|
||||
free_demuxer(demuxer);
|
||||
demuxer = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//=============== Try based on filename EXTENSION: =================
|
||||
// Ok. We're over the stable detectable fileformats, the next ones are a bit
|
||||
@ -1277,6 +1300,7 @@ extern void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,int flags);
|
||||
extern void demux_rawaudio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags);
|
||||
extern void demux_rawvideo_seek(demuxer_t *demuxer,float rel_seek_secs,int flags);
|
||||
extern void demux_xmms_seek(demuxer_t *demuxer,float rel_seek_secs,int flags);
|
||||
extern void demux_mkv_seek(demuxer_t *demuxer,float rel_seek_secs,int flags);
|
||||
|
||||
int demux_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
|
||||
demux_stream_t *d_audio=demuxer->audio;
|
||||
@ -1365,6 +1389,10 @@ switch(demuxer->file_format){
|
||||
#ifdef HAVE_XMMS
|
||||
case DEMUXER_TYPE_XMMS:
|
||||
demux_xmms_seek(demuxer,rel_seek_secs,flags); break;
|
||||
#endif
|
||||
#ifdef HAVE_MATROSKA
|
||||
case DEMUXER_TYPE_MATROSKA:
|
||||
demux_mkv_seek(demuxer,rel_seek_secs,flags); break;
|
||||
#endif
|
||||
case DEMUXER_TYPE_MPEG_TS:
|
||||
demux_seek_ts(demuxer,rel_seek_secs,flags); break;
|
||||
@ -1428,6 +1456,7 @@ extern int demux_mpg_control(demuxer_t *demuxer, int cmd, void *arg);
|
||||
extern int demux_asf_control(demuxer_t *demuxer, int cmd, void *arg);
|
||||
extern int demux_avi_control(demuxer_t *demuxer, int cmd, void *arg);
|
||||
extern int demux_xmms_control(demuxer_t *demuxer, int cmd, void *arg);
|
||||
extern int demux_mkv_control(demuxer_t *demuxer, int cmd, void *arg);
|
||||
|
||||
int demux_control(demuxer_t *demuxer, int cmd, void *arg) {
|
||||
switch(demuxer->type) {
|
||||
@ -1444,6 +1473,10 @@ int demux_control(demuxer_t *demuxer, int cmd, void *arg) {
|
||||
#ifdef HAVE_XMMS
|
||||
case DEMUXER_TYPE_XMMS:
|
||||
return demux_xmms_control(demuxer,cmd,arg);
|
||||
#endif
|
||||
#ifdef HAVE_MATROSKA
|
||||
case DEMUXER_TYPE_MATROSKA:
|
||||
return demux_mkv_control(demuxer,cmd,arg);
|
||||
#endif
|
||||
default:
|
||||
return DEMUXER_CTRL_NOTIMPL;
|
||||
|
@ -39,11 +39,12 @@
|
||||
#define DEMUXER_TYPE_GIF 28
|
||||
#define DEMUXER_TYPE_MPEG_TS 29
|
||||
#define DEMUXER_TYPE_H264_ES 30
|
||||
#define DEMUXER_TYPE_MATROSKA 31
|
||||
|
||||
// This should always match the higest demuxer type number.
|
||||
// Unless you want to disallow users to force the demuxer to some types
|
||||
#define DEMUXER_TYPE_MIN 0
|
||||
#define DEMUXER_TYPE_MAX 30
|
||||
#define DEMUXER_TYPE_MAX 31
|
||||
|
||||
#define DEMUXER_TYPE_DEMUXERS (1<<16)
|
||||
// A virtual demuxer type for the network code
|
||||
|
21
libmpdemux/matroska.h
Normal file
21
libmpdemux/matroska.h
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* CodecID definitions for Matroska files
|
||||
*
|
||||
* see http://cvs.corecodec.org/cgi-bin/cvsweb.cgi/~checkout~/matroska/doc/website/specs/codex.html?rev=HEAD&content-type=text/html
|
||||
*/
|
||||
|
||||
#ifndef __MATROSKA_H
|
||||
#define __MATROSKA_H
|
||||
|
||||
#define MKV_A_MP3 "A_MPEG/L3"
|
||||
#define MKV_A_AC3 "A_AC3"
|
||||
#define MKV_A_PCM "A_PCM/INT/LIT"
|
||||
#define MKV_A_VORBIS "A_VORBIS"
|
||||
#define MKV_A_ACM "A_MS/ACM"
|
||||
|
||||
#define MKV_V_MSCOMP "V_MS/VFW/FOURCC"
|
||||
|
||||
#define MKV_S_TEXTASCII "S_TEXT/ASCII"
|
||||
#define MKV_S_TEXTUTF8 "S_TEXT/UTF8"
|
||||
|
||||
#endif /* __MATROSKA_H */
|
Loading…
Reference in New Issue
Block a user