diff options
Diffstat (limited to 'src/combined')
-rw-r--r-- | src/combined/Makefile.am | 1 | ||||
-rw-r--r-- | src/combined/demux_flac.c | 10 | ||||
-rw-r--r-- | src/combined/ffmpeg/Makefile.am | 38 | ||||
-rw-r--r-- | src/combined/ffmpeg/ff_audio_decoder.c | 158 | ||||
-rw-r--r-- | src/combined/ffmpeg/ff_video_decoder.c | 560 | ||||
-rwxr-xr-x | src/combined/ffmpeg/mkcodeclist.pl | 95 | ||||
-rw-r--r-- | src/combined/ffmpeg/xine_audio.list | 55 | ||||
-rw-r--r-- | src/combined/ffmpeg/xine_video.list | 109 |
8 files changed, 546 insertions, 480 deletions
diff --git a/src/combined/Makefile.am b/src/combined/Makefile.am index 03250ef67..6a43fed47 100644 --- a/src/combined/Makefile.am +++ b/src/combined/Makefile.am @@ -1,3 +1,4 @@ +include $(top_builddir)/misc/Makefile.plugins include $(top_srcdir)/misc/Makefile.common SUBDIRS = ffmpeg diff --git a/src/combined/demux_flac.c b/src/combined/demux_flac.c index ebba63701..fc638fe35 100644 --- a/src/combined/demux_flac.c +++ b/src/combined/demux_flac.c @@ -583,7 +583,7 @@ open_plugin (demux_class_t *class_gen, } break; case METHOD_BY_EXTENSION: { - char *ending, *mrl; + const char *ending, *mrl; mrl = input->get_mrl (input); @@ -715,22 +715,22 @@ open_plugin (demux_class_t *class_gen, /* FLAC Demuxer class */ -static char * +static const char * get_description (demux_class_t *this_gen) { return "FLAC demux plugin"; } -static char * +static const char * get_identifier (demux_class_t *this_gen) { return "FLAC"; } -static char * +static const char * get_extensions (demux_class_t *this_gen) { return "flac"; } -static char * +static const char * get_mimetypes (demux_class_t *this_gen) { return "audio/x-flac: flac: FLAC Audio;" "audio/flac: flac: FLAC Audio;"; diff --git a/src/combined/ffmpeg/Makefile.am b/src/combined/ffmpeg/Makefile.am index 4d7e70423..24cab7577 100644 --- a/src/combined/ffmpeg/Makefile.am +++ b/src/combined/ffmpeg/Makefile.am @@ -1,3 +1,4 @@ +include $(top_builddir)/misc/Makefile.plugins include $(top_srcdir)/misc/Makefile.common DEFAULT_INCLUDES = -I. @@ -13,11 +14,18 @@ link_ffmpeg = \ $(top_builddir)/src/libffmpeg/libavcodec/libpostproc/libpostprocess.la endif +ff_generated = \ + avcodec_video.list avcodec_audio.list \ + ff_video_list.h ff_audio_list.h + +BUILT_SOURCES = $(ff_generated) + # ffmpeg_config.h is generated by configure -DISTCLEANFILES = ffmpeg_config.h +DISTCLEANFILES = ffmpeg_config.h $(ff_generated) # this must always be included, even if the current machine has no DXR3... -EXTRA_DIST = ffmpeg_encoder.c +EXTRA_DIST = ffmpeg_encoder.c \ + xine_video.list xine_audio.list mkcodeclist.pl xineplug_LTLIBRARIES = xineplug_decode_ff.la xineplug_decode_dvaudio.la @@ -45,3 +53,29 @@ xineplug_decode_dvaudio_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(top_srcdir)/src/libffmpeg/libavcodec/libavcodec.la: make -C $(top_srcdir)/src/libffmpeg + +# Generation of ffmpeg->xine codec mapping lists (see xine_*.list). + +AV_CPP = $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) + +# Extract some CODEC_ID_* from avcodec.h. Requires some sed mangling. +avcodec_audio.list: AV_CODECS:=/CODEC_ID_PCM_S16LE/,/CODEC_ID_DVD_SUBTITLE/ +avcodec_video.list: AV_CODECS:=/CODEC_ID_MPEG1VIDEO/,/CODEC_ID_PCM_S16LE/ + +avcodec_audio.list avcodec_video.list: + echo '#include "$(srcdir)/ffmpeg_decoder.h"' | $(AV_CPP) - |\ + sed -e $(AV_CODECS)'! d; s/^[ \t]*//; s/[=,].*//; /^$$/ d' >$@ + +# Generate the mappings. These are #included where needed. +ff_%_list.h: $(srcdir)/mkcodeclist.pl avcodec_%.list $(srcdir)/xine_%.list + $(PERL) $^ $@ + +ff_audio_decoder.c: ff_audio_list.h +ff_video_decoder.c: ff_video_list.h + +# 'make report' prints tokens corresponding to any unhandled codecs. +report: avcodec_audio.list avcodec_video.list + @$(top_srcdir)/src/combined/ffmpeg/mkcodeclist.pl avcodec_audio.list xine_audio.list - audio + @$(top_srcdir)/src/combined/ffmpeg/mkcodeclist.pl avcodec_video.list xine_video.list - video + +.PHONY: report diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c index e0d294113..24c193b44 100644 --- a/src/combined/ffmpeg/ff_audio_decoder.c +++ b/src/combined/ffmpeg/ff_audio_decoder.c @@ -73,45 +73,7 @@ typedef struct ff_audio_decoder_s { } ff_audio_decoder_t; -static const ff_codec_t ff_audio_lookup[] = { - {BUF_AUDIO_WMAV1, CODEC_ID_WMAV1, "MS Windows Media Audio 1 (ffmpeg)"}, - {BUF_AUDIO_WMAV2, CODEC_ID_WMAV2, "MS Windows Media Audio 2 (ffmpeg)"}, - {BUF_AUDIO_14_4, CODEC_ID_RA_144, "Real 14.4 (ffmpeg)"}, - {BUF_AUDIO_28_8, CODEC_ID_RA_288, "Real 28.8 (ffmpeg)"}, - {BUF_AUDIO_MPEG, CODEC_ID_MP3, "MP3 (ffmpeg)"}, - {BUF_AUDIO_MP3ADU, CODEC_ID_MP3ADU, "MPEG-3 adu (ffmpeg)"}, - {BUF_AUDIO_MSADPCM, CODEC_ID_ADPCM_MS, "MS ADPCM (ffmpeg)"}, - {BUF_AUDIO_QTIMAADPCM, CODEC_ID_ADPCM_IMA_QT, "QT IMA ADPCM (ffmpeg)"}, - {BUF_AUDIO_MSIMAADPCM, CODEC_ID_ADPCM_IMA_WAV, "MS IMA ADPCM (ffmpeg)"}, - {BUF_AUDIO_DK3ADPCM, CODEC_ID_ADPCM_IMA_DK3, "Duck DK3 ADPCM (ffmpeg)"}, - {BUF_AUDIO_DK4ADPCM, CODEC_ID_ADPCM_IMA_DK4, "Duck DK4 ADPCM (ffmpeg)"}, - {BUF_AUDIO_VQA_IMA, CODEC_ID_ADPCM_IMA_WS, "Westwood Studios IMA (ffmpeg)"}, - {BUF_AUDIO_SMJPEG_IMA, CODEC_ID_ADPCM_IMA_SMJPEG, "SMJPEG IMA (ffmpeg)"}, - {BUF_AUDIO_XA_ADPCM, CODEC_ID_ADPCM_XA, "CD-ROM/XA ADPCM (ffmpeg)"}, - {BUF_AUDIO_4X_ADPCM, CODEC_ID_ADPCM_4XM, "4X ADPCM (ffmpeg)"}, - {BUF_AUDIO_EA_ADPCM, CODEC_ID_ADPCM_EA, "Electronic Arts ADPCM (ffmpeg)"}, - {BUF_AUDIO_MULAW, CODEC_ID_PCM_MULAW, "mu-law logarithmic PCM (ffmpeg)"}, - {BUF_AUDIO_ALAW, CODEC_ID_PCM_ALAW, "A-law logarithmic PCM (ffmpeg)"}, - {BUF_AUDIO_ROQ, CODEC_ID_ROQ_DPCM, "RoQ DPCM (ffmpeg)"}, - {BUF_AUDIO_INTERPLAY, CODEC_ID_INTERPLAY_DPCM, "Interplay DPCM (ffmpeg)"}, - {BUF_AUDIO_MAC3, CODEC_ID_MACE3, "MACE 3:1 (ffmpeg)"}, - {BUF_AUDIO_MAC6, CODEC_ID_MACE6, "MACE 6:1 (ffmpeg)"}, - {BUF_AUDIO_XAN_DPCM, CODEC_ID_XAN_DPCM, "Origin Xan DPCM (ffmpeg)"}, - {BUF_AUDIO_VMD, CODEC_ID_VMDAUDIO, "Sierra VMD Audio (ffmpeg)"}, - {BUF_AUDIO_FLAC, CODEC_ID_FLAC, "FLAC (ffmpeg)"}, - {BUF_AUDIO_SHORTEN, CODEC_ID_SHORTEN, "Shorten (ffmpeg)"}, - {BUF_AUDIO_ALAC, CODEC_ID_ALAC, "ALAC (ffmpeg)"}, - {BUF_AUDIO_QDESIGN2, CODEC_ID_QDM2, "QDesign (ffmpeg)"}, - {BUF_AUDIO_COOK, CODEC_ID_COOK, "RealAudio Cooker (ffmpeg)"}, - {BUF_AUDIO_TRUESPEECH, CODEC_ID_TRUESPEECH, "TrueSpeech (ffmpeg)"}, - {BUF_AUDIO_TTA, CODEC_ID_TTA, "True Audio Lossless (ffmpeg)"}, - {BUF_AUDIO_SMACKER, CODEC_ID_SMACKAUDIO, "Smacker (ffmpeg)"}, - {BUF_AUDIO_FLVADPCM, CODEC_ID_ADPCM_SWF, "Flash ADPCM (ffmpeg)"}, - {BUF_AUDIO_WAVPACK, CODEC_ID_WAVPACK, "WavPack (ffmpeg)"}, - {BUF_AUDIO_AMR_NB, CODEC_ID_AMR_NB, "AMR narrow band (ffmpeg)"}, - {BUF_AUDIO_AMR_WB, CODEC_ID_AMR_WB, "AMR wide band (ffmpeg)"}, -}; - +#include "ff_audio_list.h" static void ff_audio_ensure_buffer_size(ff_audio_decoder_t *this, int size) { if (size > this->bufsize) { @@ -249,6 +211,8 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) if (extradata + data_len > this->size) break; /* abort early - extradata length is bad */ + if (extradata > INT_MAX - data_len) + break;/*integer overflow*/ this->context->extradata_size = data_len; this->context->extradata = malloc(this->context->extradata_size + @@ -367,6 +331,13 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) /* dispatch the decoded audio */ out = 0; while (out < decode_buffer_size) { + int stream_status = xine_get_status(this->stream); + + if (stream_status == XINE_STATUS_QUIT || stream_status == XINE_STATUS_STOP) { + this->size = 0; + return; + } + audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { @@ -500,115 +471,6 @@ void *init_audio_plugin (xine_t *xine, void *data) { return this; } -static uint32_t supported_audio_types[] = { - #ifdef CONFIG_WMAV1_DECODER - BUF_AUDIO_WMAV1, - #endif - #ifdef CONFIG_WMAV2_DECODER - BUF_AUDIO_WMAV2, - #endif - #ifdef CONFIG_RA_144_DECODER - BUF_AUDIO_14_4, - #endif - #ifdef CONFIG_RA_288_DECODER - BUF_AUDIO_28_8, - #endif - #ifdef CONFIG_MP3_DECODER - BUF_AUDIO_MPEG, - #endif - #ifdef CONFIG_ADPCM_MS_DECODER - BUF_AUDIO_MSADPCM, - #endif - #ifdef CONFIG_ADPCM_IMA_QT_DECODER - BUF_AUDIO_QTIMAADPCM, - #endif - #ifdef CONFIG_ADPCM_IMA_WAV_DECODER - BUF_AUDIO_MSIMAADPCM, - #endif - #ifdef CONFIG_ADPCM_IMA_DK3_DECODER - BUF_AUDIO_DK3ADPCM, - #endif - #ifdef CONFIG_ADPCM_IMA_DK4_DECODER - BUF_AUDIO_DK4ADPCM, - #endif - #ifdef CONFIG_ADPCM_IMA_WS_DECODER - BUF_AUDIO_VQA_IMA, - #endif - #ifdef CONFIG_ADPCM_IMA_SMJPEG_DECODER - BUF_AUDIO_SMJPEG_IMA, - #endif - #ifdef CONFIG_ADPCM_XA_DECODER - BUF_AUDIO_XA_ADPCM, - #endif - #ifdef CONFIG_ADPCM_4XM_DECODER - BUF_AUDIO_4X_ADPCM, - #endif - #ifdef CONFIG_ADPCM_EA_DECODER - BUF_AUDIO_EA_ADPCM, - #endif - #ifdef CONFIG_PCM_MULAW_DECODER - BUF_AUDIO_MULAW, - #endif - #ifdef CONFIG_PCM_ALAW_DECODER - BUF_AUDIO_ALAW, - #endif - #ifdef CONFIG_ROQ_DPCM_DECODER - BUF_AUDIO_ROQ, - #endif - #ifdef CONFIG_INTERPLAY_DPCM_DECODER - BUF_AUDIO_INTERPLAY, - #endif - #ifdef CONFIG_MACE3_DECODER - BUF_AUDIO_MAC3, - #endif - #ifdef CONFIG_MACE6_DECODER - BUF_AUDIO_MAC6, - #endif - #ifdef CONFIG_XAN_DPCM_DECODER - BUF_AUDIO_XAN_DPCM, - #endif - #ifdef CONFIG_VMDAUDIO_DECODER - BUF_AUDIO_VMD, - #endif - #ifdef CONFIG_FLAC_DECODER - BUF_AUDIO_FLAC, - #endif - #ifdef CONFIG_SHORTEN_DECODER - BUF_AUDIO_SHORTEN, - #endif - #ifdef CONFIG_ALAC_DECODER - BUF_AUDIO_ALAC, - #endif - #ifdef CONFIG_QDM2_DECODER - BUF_AUDIO_QDESIGN2, - #endif - #ifdef CONFIG_COOK_DECODER - BUF_AUDIO_COOK, - #endif - #ifdef CONFIG_TRUESPEECH_DECODER - BUF_AUDIO_TRUESPEECH, - #endif - #ifdef CONFIG_TTA_DECODER - BUF_AUDIO_TTA, - #endif - #ifdef CONFIG_SMACKAUDIO_DECODER - BUF_AUDIO_SMACKER, - #endif - #ifdef CONFIG_ADPCM_SWF_DECODER - BUF_AUDIO_FLVADPCM, - #endif - #ifdef CONFIG_WAVPACK_DECODER - BUF_AUDIO_WAVPACK, - #endif - #ifdef CONFIG_AMR_NB_DECODER - BUF_AUDIO_AMR_NB, - #endif - #ifdef CONFIG_AMR_WB_DECODER - BUF_AUDIO_AMR_WB, - #endif - 0 -}; - decoder_info_t dec_info_ffmpeg_audio = { supported_audio_types, /* supported types */ 7 /* priority */ diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index a04d2feb6..98caac269 100644 --- a/src/combined/ffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -58,6 +58,12 @@ #define ENABLE_DIRECT_RENDERING +/* reordered_opaque appeared in libavcodec 51.68.0 */ +#define AVCODEC_HAS_REORDERED_OPAQUE +#if LIBAVCODEC_VERSION_INT < 0x334400 +# undef AVCODEC_HAS_REORDERED_OPAQUE +#endif + typedef struct ff_video_decoder_s ff_video_decoder_t; typedef struct ff_video_class_s { @@ -78,7 +84,14 @@ struct ff_video_decoder_s { xine_stream_t *stream; int64_t pts; +#ifdef AVCODEC_HAS_REORDERED_OPAQUE + uint64_t pts_tag_mask; + uint64_t pts_tag; + int pts_tag_counter; + int pts_tag_stable_counter; +#endif /* AVCODEC_HAS_REORDERED_OPAQUE */ int video_step; + int reported_video_step; uint8_t decoder_ok:1; uint8_t decoder_init_mode:1; @@ -212,6 +225,11 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ av_frame->type= FF_BUFFER_TYPE_USER; +#ifdef AVCODEC_HAS_REORDERED_OPAQUE + /* take over pts for this frame to have it reordered */ + av_frame->reordered_opaque = context->reordered_opaque; +#endif + xine_list_push_back(this->dr1_frames, av_frame); return 0; @@ -244,85 +262,7 @@ static void release_buffer(struct AVCodecContext *context, AVFrame *av_frame){ } #endif -static const ff_codec_t ff_video_lookup[] = { - {BUF_VIDEO_MSMPEG4_V1, CODEC_ID_MSMPEG4V1, "Microsoft MPEG-4 v1 (ffmpeg)"}, - {BUF_VIDEO_MSMPEG4_V2, CODEC_ID_MSMPEG4V2, "Microsoft MPEG-4 v2 (ffmpeg)"}, - {BUF_VIDEO_MSMPEG4_V3, CODEC_ID_MSMPEG4V3, "Microsoft MPEG-4 v3 (ffmpeg)"}, - {BUF_VIDEO_WMV7, CODEC_ID_WMV1, "MS Windows Media Video 7 (ffmpeg)"}, - {BUF_VIDEO_WMV8, CODEC_ID_WMV2, "MS Windows Media Video 8 (ffmpeg)"}, - {BUF_VIDEO_WMV9, CODEC_ID_WMV3, "MS Windows Media Video 9 (ffmpeg)"}, - {BUF_VIDEO_VC1, CODEC_ID_VC1, "MS Windows Media Video VC-1 (ffmpeg)"}, - {BUF_VIDEO_MPEG4, CODEC_ID_MPEG4, "ISO MPEG-4 (ffmpeg)"}, - {BUF_VIDEO_XVID, CODEC_ID_MPEG4, "ISO MPEG-4 (XviD, ffmpeg)"}, - {BUF_VIDEO_DIVX5, CODEC_ID_MPEG4, "ISO MPEG-4 (DivX5, ffmpeg)"}, - {BUF_VIDEO_3IVX, CODEC_ID_MPEG4, "ISO MPEG-4 (3ivx, ffmpeg)"}, - {BUF_VIDEO_JPEG, CODEC_ID_MJPEG, "Motion JPEG (ffmpeg)"}, - {BUF_VIDEO_MJPEG, CODEC_ID_MJPEG, "Motion JPEG (ffmpeg)"}, - {BUF_VIDEO_MJPEG_B, CODEC_ID_MJPEGB, "Motion JPEG B (ffmpeg)"}, - {BUF_VIDEO_I263, CODEC_ID_H263I, "ITU H.263 (ffmpeg)"}, - {BUF_VIDEO_H263, CODEC_ID_H263, "H.263 (ffmpeg)"}, - {BUF_VIDEO_RV10, CODEC_ID_RV10, "Real Video 1.0 (ffmpeg)"}, - {BUF_VIDEO_RV20, CODEC_ID_RV20, "Real Video 2.0 (ffmpeg)"}, - {BUF_VIDEO_IV31, CODEC_ID_INDEO3, "Indeo Video 3.1 (ffmpeg)"}, - {BUF_VIDEO_IV32, CODEC_ID_INDEO3, "Indeo Video 3.2 (ffmpeg)"}, - {BUF_VIDEO_SORENSON_V1, CODEC_ID_SVQ1, "Sorenson Video 1 (ffmpeg)"}, - {BUF_VIDEO_SORENSON_V3, CODEC_ID_SVQ3, "Sorenson Video 3 (ffmpeg)"}, - {BUF_VIDEO_DV, CODEC_ID_DVVIDEO, "DV (ffmpeg)"}, - {BUF_VIDEO_HUFFYUV, CODEC_ID_HUFFYUV, "HuffYUV (ffmpeg)"}, - {BUF_VIDEO_VP31, CODEC_ID_VP3, "On2 VP3.1 (ffmpeg)"}, - {BUF_VIDEO_VP5, CODEC_ID_VP5, "On2 VP5 (ffmpeg)"}, - {BUF_VIDEO_VP6, CODEC_ID_VP6, "On2 VP6 (ffmpeg)"}, - {BUF_VIDEO_VP6F, CODEC_ID_VP6F, "On2 VP6 (ffmpeg)"}, - {BUF_VIDEO_4XM, CODEC_ID_4XM, "4X Video (ffmpeg)"}, - {BUF_VIDEO_CINEPAK, CODEC_ID_CINEPAK, "Cinepak (ffmpeg)"}, - {BUF_VIDEO_MSVC, CODEC_ID_MSVIDEO1, "Microsoft Video 1 (ffmpeg)"}, - {BUF_VIDEO_MSRLE, CODEC_ID_MSRLE, "Microsoft RLE (ffmpeg)"}, - {BUF_VIDEO_RPZA, CODEC_ID_RPZA, "Apple Quicktime Video/RPZA (ffmpeg)"}, - {BUF_VIDEO_CYUV, CODEC_ID_CYUV, "Creative YUV (ffmpeg)"}, - {BUF_VIDEO_ROQ, CODEC_ID_ROQ, "Id Software RoQ (ffmpeg)"}, - {BUF_VIDEO_IDCIN, CODEC_ID_IDCIN, "Id Software CIN (ffmpeg)"}, - {BUF_VIDEO_WC3, CODEC_ID_XAN_WC3, "Xan (ffmpeg)"}, - {BUF_VIDEO_VQA, CODEC_ID_WS_VQA, "Westwood Studios VQA (ffmpeg)"}, - {BUF_VIDEO_INTERPLAY, CODEC_ID_INTERPLAY_VIDEO, "Interplay MVE (ffmpeg)"}, - {BUF_VIDEO_FLI, CODEC_ID_FLIC, "FLIC Video (ffmpeg)"}, - {BUF_VIDEO_8BPS, CODEC_ID_8BPS, "Planar RGB (ffmpeg)"}, - {BUF_VIDEO_SMC, CODEC_ID_SMC, "Apple Quicktime Graphics/SMC (ffmpeg)"}, - {BUF_VIDEO_DUCKTM1, CODEC_ID_TRUEMOTION1,"Duck TrueMotion v1 (ffmpeg)"}, - {BUF_VIDEO_DUCKTM2, CODEC_ID_TRUEMOTION2,"Duck TrueMotion v2 (ffmpeg)"}, - {BUF_VIDEO_VMD, CODEC_ID_VMDVIDEO, "Sierra VMD Video (ffmpeg)"}, - {BUF_VIDEO_ZLIB, CODEC_ID_ZLIB, "ZLIB Video (ffmpeg)"}, - {BUF_VIDEO_MSZH, CODEC_ID_MSZH, "MSZH Video (ffmpeg)"}, - {BUF_VIDEO_ASV1, CODEC_ID_ASV1, "ASV v1 Video (ffmpeg)"}, - {BUF_VIDEO_ASV2, CODEC_ID_ASV2, "ASV v2 Video (ffmpeg)"}, - {BUF_VIDEO_ATIVCR1, CODEC_ID_VCR1, "ATI VCR-1 (ffmpeg)"}, - {BUF_VIDEO_FLV1, CODEC_ID_FLV1, "Flash Video (ffmpeg)"}, - {BUF_VIDEO_QTRLE, CODEC_ID_QTRLE, "Apple Quicktime Animation/RLE (ffmpeg)"}, - {BUF_VIDEO_H264, CODEC_ID_H264, "H.264/AVC (ffmpeg)"}, - {BUF_VIDEO_H261, CODEC_ID_H261, "H.261 (ffmpeg)"}, - {BUF_VIDEO_AASC, CODEC_ID_AASC, "Autodesk Video (ffmpeg)"}, - {BUF_VIDEO_LOCO, CODEC_ID_LOCO, "LOCO (ffmpeg)"}, - {BUF_VIDEO_QDRW, CODEC_ID_QDRAW, "QuickDraw (ffmpeg)"}, - {BUF_VIDEO_QPEG, CODEC_ID_QPEG, "Q-Team QPEG (ffmpeg)"}, - {BUF_VIDEO_TSCC, CODEC_ID_TSCC, "TechSmith Video (ffmpeg)"}, - {BUF_VIDEO_ULTI, CODEC_ID_ULTI, "IBM UltiMotion (ffmpeg)"}, - {BUF_VIDEO_WNV1, CODEC_ID_WNV1, "Winnow Video (ffmpeg)"}, - {BUF_VIDEO_XL, CODEC_ID_VIXL, "Miro/Pinnacle VideoXL (ffmpeg)"}, - {BUF_VIDEO_RT21, CODEC_ID_INDEO2, "Indeo/RealTime 2 (ffmpeg)"}, - {BUF_VIDEO_FPS1, CODEC_ID_FRAPS, "Fraps (ffmpeg)"}, - {BUF_VIDEO_MPEG, CODEC_ID_MPEG1VIDEO, "MPEG 1/2 (ffmpeg)"}, - {BUF_VIDEO_CSCD, CODEC_ID_CSCD, "CamStudio (ffmpeg)"}, - {BUF_VIDEO_AVS, CODEC_ID_AVS, "AVS (ffmpeg)"}, - {BUF_VIDEO_ALGMM, CODEC_ID_MMVIDEO, "American Laser Games MM (ffmpeg)"}, - {BUF_VIDEO_ZMBV, CODEC_ID_ZMBV, "Zip Motion Blocks Video (ffmpeg)"}, - {BUF_VIDEO_SMACKER, CODEC_ID_SMACKVIDEO, "Smacker (ffmpeg)"}, - {BUF_VIDEO_NUV, CODEC_ID_NUV, "NuppelVideo (ffmpeg)"}, - {BUF_VIDEO_KMVC, CODEC_ID_KMVC, "Karl Morton's Video Codec (ffmpeg)"}, - {BUF_VIDEO_FLASHSV, CODEC_ID_FLASHSV, "Flash Screen Video (ffmpeg)"}, - {BUF_VIDEO_CAVS, CODEC_ID_CAVS, "Chinese AVS (ffmpeg)"}, - {BUF_VIDEO_VMNC, CODEC_ID_VMNC, "VMware Screen Codec (ffmpeg)"}, - {BUF_VIDEO_THEORA_RAW, CODEC_ID_THEORA, "Theora (ffmpeg)"}, - {BUF_VIDEO_SNOW, CODEC_ID_SNOW, "Snow (ffmpeg)"}, -}; +#include "ff_video_list.h" static const char *const skip_loop_filter_enum_names[] = { "default", /* AVDISCARD_DEFAULT */ @@ -400,6 +340,22 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) return; } + if (this->codec->id == CODEC_ID_VC1 && + (!this->bih.biWidth || !this->bih.biHeight)) { + /* VC1 codec must be re-opened with correct width and height. */ + avcodec_close(this->context); + + if (avcodec_open (this->context, this->codec) < 0) { + pthread_mutex_unlock(&ffmpeg_lock); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + _("ffmpeg_video_dec: couldn't open decoder (pass 2)\n")); + free(this->context); + this->context = NULL; + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HANDLED, 0); + return; + } + } + if (this->class->thread_count > 1) { avcodec_thread_init(this->context, this->class->thread_count); this->context->thread_count = this->class->thread_count; @@ -606,6 +562,10 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { su = this->av_frame->data[1]; sv = this->av_frame->data[2]; + /* Some segfaults & heap corruption have been observed with img->height, + * so we use this->bih.biHeight instead (which is the displayed height) + */ + if (this->context->pix_fmt == PIX_FMT_YUV410P) { yuv9_to_yv12( @@ -626,7 +586,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { img->pitches[2], /* width x height */ img->width, - img->height); + this->bih.biHeight); } else if (this->context->pix_fmt == PIX_FMT_YUV411P) { @@ -648,15 +608,15 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { img->pitches[2], /* width x height */ img->width, - img->height); + this->bih.biHeight); - } else if (this->context->pix_fmt == PIX_FMT_RGBA32) { + } else if (this->context->pix_fmt == PIX_FMT_RGB32) { int x, plane_ptr = 0; uint32_t *argb_pixels; uint32_t argb; - for(y = 0; y < img->height; y++) { + for(y = 0; y < this->bih.biHeight; y++) { argb_pixels = (uint32_t *)sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; @@ -684,7 +644,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { uint8_t *src; uint16_t pixel16; - for(y = 0; y < img->height; y++) { + for(y = 0; y < this->bih.biHeight; y++) { src = sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; @@ -713,7 +673,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { uint8_t *src; uint16_t pixel16; - for(y = 0; y < img->height; y++) { + for(y = 0; y < this->bih.biHeight; y++) { src = sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; @@ -741,7 +701,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { int x, plane_ptr = 0; uint8_t *src; - for(y = 0; y < img->height; y++) { + for(y = 0; y < this->bih.biHeight; y++) { src = sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; @@ -765,7 +725,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { int x, plane_ptr = 0; uint8_t *src; - for(y = 0; y < img->height; y++) { + for(y = 0; y < this->bih.biHeight; y++) { src = sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; @@ -808,7 +768,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { v_palette[x] = COMPUTE_V(r, g, b); } - for(y = 0; y < img->height; y++) { + for(y = 0; y < this->bih.biHeight; y++) { src = sy; for(x = 0; x < img->width; x++) { pixel = *src++; @@ -825,7 +785,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } else { - for (y=0; y<img->height; y++) { + for (y = 0; y < this->bih.biHeight; y++) { xine_fast_memcpy (dy, sy, img->width); dy += img->pitches[0]; @@ -833,7 +793,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { sy += this->av_frame->linesize[0]; } - for (y=0; y<(img->height/2); y++) { + for (y = 0; y < this->bih.biHeight / 2; y++) { if (this->context->pix_fmt != PIX_FMT_YUV444P) { @@ -1174,6 +1134,97 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu } } +#ifdef AVCODEC_HAS_REORDERED_OPAQUE +static uint64_t ff_tag_pts(ff_video_decoder_t *this, uint64_t pts) +{ + return pts | this->pts_tag; +} + +static uint64_t ff_untag_pts(ff_video_decoder_t *this, uint64_t pts) +{ + if (this->pts_tag_mask == 0) + return pts; /* pts tagging inactive */ + + if (this->pts_tag != 0 && (pts & this->pts_tag_mask) != this->pts_tag) + return 0; /* reset pts if outdated while waiting for first pass (see below) */ + + return pts & ~this->pts_tag_mask; +} + +static void ff_check_pts_tagging(ff_video_decoder_t *this, uint64_t pts) +{ + if (this->pts_tag_mask == 0) + return; /* pts tagging inactive */ + if ((pts & this->pts_tag_mask) != this->pts_tag) { + this->pts_tag_stable_counter = 0; + return; /* pts still outdated */ + } + + /* the tag should be stable for 100 frames */ + this->pts_tag_stable_counter++; + + if (this->pts_tag != 0) { + if (this->pts_tag_stable_counter >= 100) { + /* first pass: reset pts_tag */ + this->pts_tag = 0; + this->pts_tag_stable_counter = 0; + } + } else if (pts == 0) + return; /* cannot detect second pass */ + else { + if (this->pts_tag_stable_counter >= 100) { + /* second pass: reset pts_tag_mask and pts_tag_counter */ + this->pts_tag_mask = 0; + this->pts_tag_counter = 0; + this->pts_tag_stable_counter = 0; + } + } +} + +static int ff_vc1_find_header(ff_video_decoder_t *this, buf_element_t *buf) +{ + uint8_t *p = buf->content; + + if (!p[0] && !p[1] && p[2] == 1 && p[3] == 0x0f) { + int i; + + this->context->extradata = calloc(1, buf->size); + this->context->extradata_size = 0; + + for (i = 0; i < buf->size && i < 128; i++) { + if (!p[i] && !p[i+1] && p[i+2]) { + lprintf("00 00 01 %02x at %d\n", p[i+3], i); + if (p[i+3] != 0x0e && p[i+3] != 0x0f) + break; + } + this->context->extradata[i] = p[i]; + this->context->extradata_size++; + } + + lprintf("ff_video_decoder: found VC1 sequence header\n"); + return 1; + } + + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "ffmpeg_video_dec: VC1 extradata missing !\n"); + return 0; +} + +static int ff_check_extradata(ff_video_decoder_t *this, unsigned int codec_type, buf_element_t *buf) +{ + if (this->context && this->context->extradata) + return 1; + + switch (codec_type) { + case BUF_VIDEO_VC1: + return ff_vc1_find_header(this, buf); + default:; + } + + return 1; +} + +#endif /* AVCODEC_HAS_REORDERED_OPAQUE */ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { uint8_t *chunk_buf = this->buf; AVRational avr00 = {0, 1}; @@ -1184,6 +1235,9 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { if (this->decoder_init_mode) { int codec_type = buf->type & 0xFFFF0000; + if (!ff_check_extradata(this, codec_type, buf)) + return; + /* init ffmpeg decoder */ init_video_codec(this, codec_type); init_postprocess(this); @@ -1198,6 +1252,16 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { this->size = 0; } +#ifdef AVCODEC_HAS_REORDERED_OPAQUE + if (this->size == 0) { + /* take over pts when we are about to buffer a frame */ + this->av_frame->reordered_opaque = ff_tag_pts(this, this->pts); + if (this->context) /* shouldn't be NULL */ + this->context->reordered_opaque = ff_tag_pts(this, this->pts); + this->pts = 0; + } +#endif /* AVCODEC_HAS_REORDERED_OPAQUE */ + /* data accumulation */ if (buf->size > 0) { if ((this->size == 0) && @@ -1250,6 +1314,12 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { len = avcodec_decode_video (this->context, this->av_frame, &got_picture, &chunk_buf[offset], this->size); + +#ifdef AVCODEC_HAS_REORDERED_OPAQUE + /* reset consumed pts value */ + this->context->reordered_opaque = ff_tag_pts(this, 0); +#endif /* AVCODEC_HAS_REORDERED_OPAQUE */ + lprintf("consumed size: %d, got_picture: %d\n", len, got_picture); if ((len <= 0) || (len > this->size)) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, @@ -1265,12 +1335,27 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { ff_check_bufsize(this, this->size); memmove (this->buf, &chunk_buf[offset], this->size); chunk_buf = this->buf; + +#ifdef AVCODEC_HAS_REORDERED_OPAQUE + /* take over pts for next access unit */ + this->av_frame->reordered_opaque = ff_tag_pts(this, this->pts); + this->context->reordered_opaque = ff_tag_pts(this, this->pts); + this->pts = 0; +#endif /* AVCODEC_HAS_REORDERED_OPAQUE */ } } } /* use externally provided video_step or fall back to stream's time_base otherwise */ - video_step_to_use = (this->video_step || !this->context->time_base.den) ? this->video_step : (int)(90000ll * this->context->time_base.num / this->context->time_base.den); + video_step_to_use = (this->video_step || !this->context->time_base.den) + ? this->video_step + : (int)(90000ll +#if LIBAVCODEC_VERSION_INT >= 0x341400 + * this->context->ticks_per_frame +#elif LIBAVCODEC_VERSION_INT >= 0x340000 +# warning Building without avcodec ticks_per_frame support; you should upgrade your libavcodec and recompile +#endif + * this->context->time_base.num / this->context->time_base.den); /* aspect ratio provided by ffmpeg, override previous setting */ if ((this->aspect_ratio_prio < 2) && @@ -1296,7 +1381,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { /* initialize the colorspace converter */ if (!this->cs_convert_init) { - if ((this->context->pix_fmt == PIX_FMT_RGBA32) || + if ((this->context->pix_fmt == PIX_FMT_RGB32) || (this->context->pix_fmt == PIX_FMT_RGB565) || (this->context->pix_fmt == PIX_FMT_RGB555) || (this->context->pix_fmt == PIX_FMT_BGR24) || @@ -1359,15 +1444,24 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { ff_convert_frame(this, img); } +#ifndef AVCODEC_HAS_REORDERED_OPAQUE img->pts = this->pts; this->pts = 0; +#else /* AVCODEC_HAS_REORDERED_OPAQUE */ + img->pts = ff_untag_pts(this, this->av_frame->reordered_opaque); + ff_check_pts_tagging(this, this->av_frame->reordered_opaque); /* only check for valid frames */ + this->av_frame->reordered_opaque = 0; +#endif /* AVCODEC_HAS_REORDERED_OPAQUE */ /* workaround for weird 120fps streams */ if( video_step_to_use == 750 ) { /* fallback to the VIDEO_PTS_MODE */ video_step_to_use = 0; } - + + if (video_step_to_use && video_step_to_use != this->reported_video_step) + _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, (this->reported_video_step = video_step_to_use)); + if (this->av_frame->repeat_pict) img->duration = video_step_to_use * 3 / 2; else @@ -1400,8 +1494,13 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { this->output_format, VO_BOTH_FIELDS|this->frame_flags); /* set PTS to allow early syncing */ +#ifndef AVCODEC_HAS_REORDERED_OPAQUE img->pts = this->pts; this->pts = 0; +#else /* AVCODEC_HAS_REORDERED_OPAQUE */ + img->pts = ff_untag_pts(this, this->av_frame->reordered_opaque); + this->av_frame->reordered_opaque = 0; +#endif /* AVCODEC_HAS_REORDERED_OPAQUE */ img->duration = video_step_to_use; @@ -1426,7 +1525,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (buf->decoder_flags & BUF_FLAG_FRAMERATE) { this->video_step = buf->decoder_info[0]; - _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->video_step); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, (this->reported_video_step = this->video_step)); } if (buf->decoder_flags & BUF_FLAG_PREVIEW) { @@ -1486,6 +1585,13 @@ static void ff_reset (video_decoder_t *this_gen) { if (this->is_mpeg12) mpeg_parser_reset(this->mpeg_parser); + +#ifdef AVCODEC_HAS_REORDERED_OPAQUE + this->pts_tag_mask = 0; + this->pts_tag = 0; + this->pts_tag_counter = 0; + this->pts_tag_stable_counter = 0; +#endif /* AVCODEC_HAS_REORDERED_OPAQUE */ } static void ff_discontinuity (video_decoder_t *this_gen) { @@ -1493,6 +1599,41 @@ static void ff_discontinuity (video_decoder_t *this_gen) { lprintf ("ff_discontinuity\n"); this->pts = 0; + +#ifdef AVCODEC_HAS_REORDERED_OPAQUE + /* + * there is currently no way to reset all the pts which are stored in the decoder. + * therefore, we add a unique tag (generated from pts_tag_counter) to pts (see + * ff_tag_pts()) and wait for it to appear on returned frames. + * until then, any retrieved pts value will be reset to 0 (see ff_untag_pts()). + * when we see the tag returned, pts_tag will be reset to 0. from now on, any + * untagged pts value is valid already. + * when tag 0 appears too, there are no tags left in the decoder so pts_tag_mask + * and pts_tag_counter will be reset to 0 too (see ff_check_pts_tagging()). + */ + this->pts_tag_counter++; + this->pts_tag_mask = 0; + this->pts_tag = 0; + this->pts_tag_stable_counter = 0; + { + /* pts values typically don't use the uppermost bits. therefore we put the tag there */ + int counter_mask = 1; + int counter = 2 * this->pts_tag_counter + 1; /* always set the uppermost bit in tag_mask */ + uint64_t tag_mask = 0x8000000000000000ull; + while (this->pts_tag_counter >= counter_mask) + { + /* + * mirror the counter into the uppermost bits. this allows us to enlarge mask as + * necessary and while previous taggings can still be detected to be outdated. + */ + if (counter & counter_mask) + this->pts_tag |= tag_mask; + this->pts_tag_mask |= tag_mask; + tag_mask >>= 1; + counter_mask <<= 1; + } + } +#endif /* AVCODEC_HAS_REORDERED_OPAQUE */ } static void ff_dispose (video_decoder_t *this_gen) { @@ -1669,237 +1810,6 @@ void *init_video_plugin (xine_t *xine, void *data) { return this; } -static uint32_t supported_video_types[] = { - #ifdef CONFIG_MSMPEG4V1_DECODER - BUF_VIDEO_MSMPEG4_V1, - #endif - #ifdef CONFIG_MSMPEG4V2_DECODER - BUF_VIDEO_MSMPEG4_V2, - #endif - #ifdef CONFIG_MSMPEG4V3_DECODER - BUF_VIDEO_MSMPEG4_V3, - #endif - #ifdef CONFIG_WMV1_DECODER - BUF_VIDEO_WMV7, - #endif - #ifdef CONFIG_WMV2_DECODER - BUF_VIDEO_WMV8, - #endif - #ifdef CONFIG_WMV3_DECODER - BUF_VIDEO_WMV9, - #endif - #ifdef CONFIG_VC1_DECODER - BUF_VIDEO_VC1, - #endif - #ifdef CONFIG_MPEG4_DECODER - BUF_VIDEO_MPEG4, - #endif - #ifdef CONFIG_MPEG4_DECODER - BUF_VIDEO_XVID, - #endif - #ifdef CONFIG_MPEG4_DECODER - BUF_VIDEO_DIVX5, - #endif - #ifdef CONFIG_MPEG4_DECODER - BUF_VIDEO_3IVX, - #endif - #ifdef CONFIG_MJPEG_DECODER - BUF_VIDEO_JPEG, - #endif - #ifdef CONFIG_MJPEG_DECODER - BUF_VIDEO_MJPEG, - #endif - #ifdef CONFIG_MJPEGB_DECODER - BUF_VIDEO_MJPEG_B, - #endif - #ifdef CONFIG_H263I_DECODER - BUF_VIDEO_I263, - #endif - #ifdef CONFIG_H263_DECODER - BUF_VIDEO_H263, - #endif - #ifdef CONFIG_RV10_DECODER - BUF_VIDEO_RV10, - #endif - #ifdef CONFIG_RV20_DECODER - BUF_VIDEO_RV20, - #endif - #ifdef CONFIG_INDEO3_DECODER - BUF_VIDEO_IV31, - #endif - #ifdef CONFIG_INDEO3_DECODER - BUF_VIDEO_IV32, - #endif - #ifdef CONFIG_SVQ1_DECODER - BUF_VIDEO_SORENSON_V1, - #endif - #ifdef CONFIG_SVQ3_DECODER - BUF_VIDEO_SORENSON_V3, - #endif - #ifdef CONFIG_DVVIDEO_DECODER - BUF_VIDEO_DV, - #endif - #ifdef CONFIG_HUFFYUV_DECODER - BUF_VIDEO_HUFFYUV, - #endif - #ifdef CONFIG_VP3_DECODER - BUF_VIDEO_VP31, - #endif - #ifdef CONFIG_VP5_DECODER - BUF_VIDEO_VP5, - #endif - #ifdef CONFIG_VP6_DECODER - BUF_VIDEO_VP6, - BUF_VIDEO_VP6F, - #endif - #ifdef CONFIG_4XM_DECODER - BUF_VIDEO_4XM, - #endif - #ifdef CONFIG_CINEPAK_DECODER - BUF_VIDEO_CINEPAK, - #endif - #ifdef CONFIG_MSVIDEO1_DECODER - BUF_VIDEO_MSVC, - #endif - #ifdef CONFIG_MSRLE_DECODER - BUF_VIDEO_MSRLE, - #endif - #ifdef CONFIG_RPZA_DECODER - BUF_VIDEO_RPZA, - #endif - #ifdef CONFIG_CYUV_DECODER - BUF_VIDEO_CYUV, - #endif - #ifdef CONFIG_ROQ_DECODER - BUF_VIDEO_ROQ, - #endif - #ifdef CONFIG_IDCIN_DECODER - BUF_VIDEO_IDCIN, - #endif - #ifdef CONFIG_XAN_WC3_DECODER - BUF_VIDEO_WC3, - #endif - #ifdef CONFIG_WS_VQA_DECODER - BUF_VIDEO_VQA, - #endif - #ifdef CONFIG_INTERPLAY_VIDEO_DECODER - BUF_VIDEO_INTERPLAY, - #endif - #ifdef CONFIG_FLIC_DECODER - BUF_VIDEO_FLI, - #endif - #ifdef CONFIG_8BPS_DECODER - BUF_VIDEO_8BPS, - #endif - #ifdef CONFIG_SMC_DECODER - BUF_VIDEO_SMC, - #endif - #ifdef CONFIG_TRUEMOTION1_DECODER - BUF_VIDEO_DUCKTM1, - #endif - #ifdef CONFIG_TRUEMOTION2_DECODER - BUF_VIDEO_DUCKTM2, - #endif - #ifdef CONFIG_VMDVIDEO_DECODER - BUF_VIDEO_VMD, - #endif - #ifdef CONFIG_ZLIB_DECODER - BUF_VIDEO_ZLIB, - #endif - #ifdef CONFIG_MSZH_DECODER - BUF_VIDEO_MSZH, - #endif - #ifdef CONFIG_ASV1_DECODER - BUF_VIDEO_ASV1, - #endif - #ifdef CONFIG_ASV2_DECODER - BUF_VIDEO_ASV2, - #endif - #ifdef CONFIG_VCR1_DECODER - BUF_VIDEO_ATIVCR1, - #endif - #ifdef CONFIG_FLV_DECODER - BUF_VIDEO_FLV1, - #endif - #ifdef CONFIG_QTRLE_DECODER - BUF_VIDEO_QTRLE, - #endif - #ifdef CONFIG_H264_DECODER - BUF_VIDEO_H264, - #endif - #ifdef CONFIG_H261_DECODER - BUF_VIDEO_H261, - #endif - #ifdef CONFIG_AASC_DECODER - BUF_VIDEO_AASC, - #endif - #ifdef CONFIG_LOCO_DECODER - BUF_VIDEO_LOCO, - #endif - #ifdef CONFIG_QDRAW_DECODER - BUF_VIDEO_QDRW, - #endif - #ifdef CONFIG_QPEG_DECODER - BUF_VIDEO_QPEG, - #endif - #ifdef CONFIG_TSCC_DECODER - BUF_VIDEO_TSCC, - #endif - #ifdef CONFIG_ULTI_DECODER - BUF_VIDEO_ULTI, - #endif - #ifdef CONFIG_WNV1_DECODER - BUF_VIDEO_WNV1, - #endif - #ifdef CONFIG_VIXL_DECODER - BUF_VIDEO_XL, - #endif - #ifdef CONFIG_INDEO2_DECODER - BUF_VIDEO_RT21, - #endif - #ifdef CONFIG_FRAPS_DECODER - BUF_VIDEO_FPS1, - #endif - #ifdef CONFIG_MPEG1VIDEO_DECODER - BUF_VIDEO_MPEG, - #endif - #ifdef CONFIG_CSCD_DECODER - BUF_VIDEO_CSCD, - #endif - #ifdef CONFIG_AVS_DECODER - BUF_VIDEO_AVS, - #endif - #ifdef CONFIG_MMVIDEO_DECODER - BUF_VIDEO_ALGMM, - #endif - #ifdef CONFIG_ZMBV_DECODER - BUF_VIDEO_ZMBV, - #endif - #ifdef CONFIG_SMACKVIDEO_DECODER - BUF_VIDEO_SMACKER, - #endif - #ifdef CONFIG_NUV_DECODER - BUF_VIDEO_NUV, - #endif - #ifdef CONFIG_KMVC_DECODER - BUF_VIDEO_KMVC, - #endif - #ifdef CONFIG_FLASHSV_DECODER - BUF_VIDEO_FLASHSV, - #endif - #ifdef CONFIG_CAVS_DECODER - BUF_VIDEO_CAVS, - #endif - #ifdef CONFIG_VMNC_DECODER - BUF_VIDEO_VMNC, - #endif - #ifdef CONFIG_SNOW_DECODER - BUF_VIDEO_SNOW, - #endif - BUF_VIDEO_THEORA_RAW, - 0 -}; - static uint32_t wmv8_video_types[] = { BUF_VIDEO_WMV8, 0 diff --git a/src/combined/ffmpeg/mkcodeclist.pl b/src/combined/ffmpeg/mkcodeclist.pl new file mode 100755 index 000000000..b4a10921a --- /dev/null +++ b/src/combined/ffmpeg/mkcodeclist.pl @@ -0,0 +1,95 @@ +#! /usr/bin/perl -w + +# Make codec lists for #inclusion by ff_*_decoder.c. +# Parameters: +# list of ffmpeg CODEC_ID_* (pre-processed, one per line) +# list of codecs recognised by xine-lib (see list for details) +# output file name, or "-" to generate a report on unhandled codecs + +my ($ffmpeg, $xine, $out) = @ARGV; +my $line; + +# Read in the ffmpeg codec IDs +my %codecs; +open LIST, "< $ffmpeg" or die $!; +$line = <LIST>; +while (defined $line) { + chomp $line; + $line =~ s/^CODEC_ID_//o; + $codecs{$line} = 0; + $line = <LIST>; +} +close LIST or die $!; + +# Read in the xine-lib codec IDs +my %config; +my @known; +my $type = 'audio'; # default type +my $Type = 'AUDIO'; +my ($a, $f, $t); +open LIST, "< $xine" or die $!; +while (defined ($line = <LIST>)) { + next if substr ($line, 0, 1) eq '#' or $line =~ /^\s*$/o; + chomp $line; + if (substr ($line, 0, 5) eq 'type=') { + # codec type; "FOO" in "BUF_FOO_BAR" + $type = substr ($line, 5); + $type =~ tr/A-Z/a-z/; + $Type = $type; + $Type =~ tr/a-z/A-Z/; + } elsif (substr ($line, 0, 7) eq 'config=') { + # "#ifdef CONFIG_FOO_DECODER" mappings + ($a, $f, $t) = split (/=/, $line, 3); + $config{$f} = $t; + } else { + # codec details + push @known, [split (/\s+/, $line, 3)]; + } +} +close LIST or die $!; + +# Look through the mappings. +# Mark what we can handle and report on what the installed ffmpeg can't +foreach $line (@known) { + if (defined $codecs{$line->[1]}) { + ++$codecs{$line->[1]}; + } else { + print "Ignored $line->[0] = $line->[1]\n"; + } +} + +my $w = ($out ne '-'); + +if ($w) { + # Write the C source code for the codec lists + open LIST, "> $out" or die $!; + print LIST "static const ff_codec_t ff_${type}_lookup[] = {\n" or die $!; + foreach $line (@known) { + next if $line->[0] eq '!'; + next unless defined $codecs{$line->[1]}; + print LIST " { BUF_${Type}_$line->[0], CODEC_ID_$line->[1], \"$line->[2] (ffmpeg)\" },\n" or die $!; + } + print LIST "};\n\nstatic uint32_t supported_${type}_types[] = {\n" or die $!; + foreach $line (@known) { + next if $line->[0] eq '!'; + next unless defined $codecs{$line->[1]}; + $a = $line->[1]; + $a = $config{$a} if defined $config{$a}; + if ($a eq '') { + print LIST " BUF_${Type}_$line->[0],\n" or die $!; + } else { + print LIST " #ifdef CONFIG_${a}_DECODER\n BUF_${Type}_$line->[0],\n #endif\n" or die $!; + } + } + print LIST " 0,\n};\n" or die $!; + close LIST or die $!; +} +else { + # Report on ffmpeg codecs which we don't handle + print "Unhandled $type codecs:\n"; + foreach $line (sort keys %codecs) { + print " $line\n" if $codecs{$line} == 0; + } +} + +exit 0; diff --git a/src/combined/ffmpeg/xine_audio.list b/src/combined/ffmpeg/xine_audio.list new file mode 100644 index 000000000..4b6932474 --- /dev/null +++ b/src/combined/ffmpeg/xine_audio.list @@ -0,0 +1,55 @@ +type=audio +config=MP3ADU= + +# xine-lib BUF_AUDIO_ ffmpeg CODEC_ID_ description or comment +# ("!"=ignore) (quote any "s) + +WMAV1 WMAV1 MS Windows Media Audio 1 +WMAV2 WMAV2 MS Windows Media Audio 2 +14_4 RA_144 Real 14.4 +28_8 RA_288 Real 28.8 +MPEG MP3 MP3 +MP3ADU MP3ADU MPEG-3 adu +MSADPCM ADPCM_MS MS ADPCM +QTIMAADPCM ADPCM_IMA_QT QT IMA ADPCM +MSIMAADPCM ADPCM_IMA_WAV MS IMA ADPCM +DK3ADPCM ADPCM_IMA_DK3 Duck DK3 ADPCM +DK4ADPCM ADPCM_IMA_DK4 Duck DK4 ADPCM +VQA_IMA ADPCM_IMA_WS Westwood Studios IMA +SMJPEG_IMA ADPCM_IMA_SMJPEG SMJPEG IMA +XA_ADPCM ADPCM_XA CD-ROM/XA ADPCM +4X_ADPCM ADPCM_4XM 4X ADPCM +EA_ADPCM ADPCM_EA Electronic Arts ADPCM +MULAW PCM_MULAW mu-law logarithmic PCM +ALAW PCM_ALAW A-law logarithmic PCM +ROQ ROQ_DPCM RoQ DPCM +INTERPLAY INTERPLAY_DPCM Interplay DPCM +MAC3 MACE3 MACE 3:1 +MAC6 MACE6 MACE 6:1 +XAN_DPCM XAN_DPCM Origin Xan DPCM +VMD VMDAUDIO Sierra VMD Audio +FLAC FLAC FLAC +SHORTEN SHORTEN Shorten +ALAC ALAC ALAC +QDESIGN2 QDM2 QDesign +COOK COOK RealAudio Cooker +TRUESPEECH TRUESPEECH TrueSpeech +TTA TTA True Audio Lossless +SMACKER SMACKAUDIO Smacker +FLVADPCM ADPCM_SWF Flash ADPCM +WAVPACK WAVPACK WavPack +AMR_NB AMR_NB AMR narrow band +AMR_WB AMR_WB AMR wide band + +# disabled codecs (ref. configure.ac) +! AAC +! AC3 +! ADPCM_ADX +! ADPCM_G726 +! DSICINAUDIO +! DVAUDIO +! IMC +! MP3ON4 +! SONIC +! SONIC_LS +! VORBIS diff --git a/src/combined/ffmpeg/xine_video.list b/src/combined/ffmpeg/xine_video.list new file mode 100644 index 000000000..a3c961d13 --- /dev/null +++ b/src/combined/ffmpeg/xine_video.list @@ -0,0 +1,109 @@ +type=video +config=VP6F=VP6 +config=FLV1=FLV +config=THEORA= + +# xine-lib BUF_VIDEO_ ffmpeg CODEC_ID_ description or comment +# ("!"=ignore) (quote any "s) + +MSMPEG4_V1 MSMPEG4V1 Microsoft MPEG-4 v1 +MSMPEG4_V2 MSMPEG4V2 Microsoft MPEG-4 v2 +MSMPEG4_V3 MSMPEG4V3 Microsoft MPEG-4 v3 +WMV7 WMV1 MS Windows Media Video 7 +WMV8 WMV2 MS Windows Media Video 8 +WMV9 WMV3 MS Windows Media Video 9 +VC1 VC1 MS Windows Media Video VC-1 +MPEG4 MPEG4 ISO MPEG-4 +XVID MPEG4 ISO MPEG-4 (XviD) +DIVX5 MPEG4 ISO MPEG-4 (DivX5) +3IVX MPEG4 ISO MPEG-4 (3ivx) +JPEG MJPEG Motion JPEG +MJPEG MJPEG Motion JPEG +MJPEG_B MJPEGB Motion JPEG B +I263 H263I ITU H.263 +H263 H263 H.263 +RV10 RV10 Real Video 1.0 +RV20 RV20 Real Video 2.0 +IV31 INDEO3 Indeo Video 3.1 +IV32 INDEO3 Indeo Video 3.2 +SORENSON_V1 SVQ1 Sorenson Video 1 +SORENSON_V3 SVQ3 Sorenson Video 3 +DV DVVIDEO DV +HUFFYUV HUFFYUV HuffYUV +VP31 VP3 On2 VP3.1 +VP5 VP5 On2 VP5 +VP6 VP6 On2 VP6 +VP6F VP6F On2 VP6 +4XM 4XM 4X Video +CINEPAK CINEPAK Cinepak +MSVC MSVIDEO1 Microsoft Video 1 +MSRLE MSRLE Microsoft RLE +RPZA RPZA Apple Quicktime Video/RPZA +CYUV CYUV Creative YUV +ROQ ROQ Id Software RoQ +IDCIN IDCIN Id Software CIN +WC3 XAN_WC3 Xan +VQA WS_VQA Westwood Studios VQA +INTERPLAY INTERPLAY_VIDEO Interplay MVE +FLI FLIC FLIC Video +8BPS 8BPS Planar RGB +SMC SMC Apple Quicktime Graphics/SMC +DUCKTM1 TRUEMOTION1 Duck TrueMotion v1 +DUCKTM2 TRUEMOTION2 Duck TrueMotion v2 +VMD VMDVIDEO Sierra VMD Video +ZLIB ZLIB ZLIB Video +MSZH MSZH MSZH Video +ASV1 ASV1 ASV v1 Video +ASV2 ASV2 ASV v2 Video +ATIVCR1 VCR1 ATI VCR-1 +FLV1 FLV1 Flash Video +QTRLE QTRLE Apple Quicktime Animation/RLE +H264 H264 H.264/AVC +H261 H261 H.261 +AASC AASC Autodesk Video +LOCO LOCO LOCO +QDRW QDRAW QuickDraw +QPEG QPEG Q-Team QPEG +TSCC TSCC TechSmith Video +ULTI ULTI IBM UltiMotion +WNV1 WNV1 Winnow Video +XL VIXL Miro/Pinnacle VideoXL +RT21 INDEO2 Indeo/RealTime 2 +FPS1 FRAPS Fraps +MPEG MPEG1VIDEO MPEG 1/2 +CSCD CSCD CamStudio +AVS AVS AVS +ALGMM MMVIDEO American Laser Games MM +ZMBV ZMBV Zip Motion Blocks Video +SMACKER SMACKVIDEO Smacker +NUV NUV NuppelVideo +KMVC KMVC Karl Morton's Video Codec +FLASHSV FLASHSV Flash Screen Video +CAVS CAVS Chinese AVS +VMNC VMNC VMware Screen Codec +THEORA_RAW THEORA Theora +SNOW SNOW Snow + +# disabled codecs (ref. configure.ac) +! BMP +! CLJR +! DSICINVIDEO +! FFV1 +! FFVHUFF +! GIF +! H263P +! JPEGLS +! LJPEG +! MDEC +! PAM +! PBM +! PGM +! PGMYUV +! PNG +! PPM +! RAWVIDEO +! SP5X +! TARGA +! TIERTEXSEQVIDEO +! TIFF +! XVID ⇒ MPEG4 |