From 69147a81b3143f95119fc99ba4e77bb5cd770cf2 Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Fri, 13 Apr 2018 09:48:12 +0200 Subject: [PATCH] Add API interface code. --- app/genericapi/configurable_factory.go | 6 + app/media/codecs/codecs.go | 3 + app/media/codecs/gen_codecs.go | 1300 ++++++++++++++++++ app/media/codecs/internal/generator/main.go | 83 ++ app/media/demux/demuxer.go | 17 + app/media/formats/formats.go | 3 + app/media/formats/gen_formats.go | 769 +++++++++++ app/media/formats/internal/generator/main.go | 84 ++ app/media/mux/muxer.go | 19 + app/media/transcode/transcoder.go | 12 + 10 files changed, 2296 insertions(+) create mode 100644 app/genericapi/configurable_factory.go create mode 100644 app/media/codecs/codecs.go create mode 100644 app/media/codecs/gen_codecs.go create mode 100644 app/media/codecs/internal/generator/main.go create mode 100644 app/media/demux/demuxer.go create mode 100644 app/media/formats/formats.go create mode 100644 app/media/formats/gen_formats.go create mode 100644 app/media/formats/internal/generator/main.go create mode 100644 app/media/mux/muxer.go create mode 100644 app/media/transcode/transcoder.go diff --git a/app/genericapi/configurable_factory.go b/app/genericapi/configurable_factory.go new file mode 100644 index 0000000..6e7d87d --- /dev/null +++ b/app/genericapi/configurable_factory.go @@ -0,0 +1,6 @@ +package genericapi + +type DynamicallyConfigurable interface { + MakeConfigurationObject() interface{} + ValidateConfiguration(config interface{}) bool +} diff --git a/app/media/codecs/codecs.go b/app/media/codecs/codecs.go new file mode 100644 index 0000000..9c1c8fd --- /dev/null +++ b/app/media/codecs/codecs.go @@ -0,0 +1,3 @@ +package codecs + +//go:generate go run ./internal/generator/main.go diff --git a/app/media/codecs/gen_codecs.go b/app/media/codecs/gen_codecs.go new file mode 100644 index 0000000..a905248 --- /dev/null +++ b/app/media/codecs/gen_codecs.go @@ -0,0 +1,1300 @@ +package codecs + +var ( + + // 4X Movie + Codec_4XM = "4xm" + + // QuickTime 8BPS video + Codec_8BPS = "8bps" + + // Multicolor charset for Commodore 64 (encoders: a64multi ) + Codec_A64_MULTI = "a64_multi" + + // Multicolor charset for Commodore 64, extended with 5th color (colram) (encoders: a64multi5 ) + Codec_A64_MULTI5 = "a64_multi5" + + // Autodesk RLE + Codec_AASC = "aasc" + + // Apple Intermediate Codec + Codec_AIC = "aic" + + // Alias/Wavefront PIX image + Codec_ALIAS_PIX = "alias_pix" + + // AMV Video + Codec_AMV = "amv" + + // Deluxe Paint Animation + Codec_ANM = "anm" + + // ASCII/ANSI art + Codec_ANSI = "ansi" + + // APNG (Animated Portable Network Graphics) image + Codec_APNG = "apng" + + // ASUS V1 + Codec_ASV1 = "asv1" + + // ASUS V2 + Codec_ASV2 = "asv2" + + // Auravision AURA + Codec_AURA = "aura" + + // Auravision Aura 2 + Codec_AURA2 = "aura2" + + // Alliance for Open Media AV1 + Codec_AV1 = "av1" + + // Avid AVI Codec + Codec_AVRN = "avrn" + + // Avid 1:1 10-bit RGB Packer + Codec_AVRP = "avrp" + + // AVS (Audio Video Standard) video + Codec_AVS = "avs" + + // Avid Meridien Uncompressed + Codec_AVUI = "avui" + + // Uncompressed packed MS 4:4:4:4 + Codec_AYUV = "ayuv" + + // Bethesda VID video + Codec_BETHSOFTVID = "bethsoftvid" + + // Brute Force & Ignorance + Codec_BFI = "bfi" + + // Bink video + Codec_BINKVIDEO = "binkvideo" + + // Binary text + Codec_BINTEXT = "bintext" + + // Bitpacked + Codec_BITPACKED = "bitpacked" + + // BMP (Windows and OS/2 bitmap) + Codec_BMP = "bmp" + + // Discworld II BMV video + Codec_BMV_VIDEO = "bmv_video" + + // BRender PIX image + Codec_BRENDER_PIX = "brender_pix" + + // Interplay C93 + Codec_C93 = "c93" + + // Chinese AVS (Audio Video Standard) (AVS1-P2, JiZhun profile) + Codec_CAVS = "cavs" + + // CD Graphics video + Codec_CDGRAPHICS = "cdgraphics" + + // Commodore CDXL video + Codec_CDXL = "cdxl" + + // Cineform HD + Codec_CFHD = "cfhd" + + // Cinepak + Codec_CINEPAK = "cinepak" + + // Iterated Systems ClearVideo + Codec_CLEARVIDEO = "clearvideo" + + // Cirrus Logic AccuPak + Codec_CLJR = "cljr" + + // Canopus Lossless Codec + Codec_CLLC = "cllc" + + // Electronic Arts CMV video (decoders: eacmv ) + Codec_CMV = "cmv" + + // CPiA video format + Codec_CPIA = "cpia" + + // CamStudio (decoders: camstudio ) + Codec_CSCD = "cscd" + + // Creative YUV (CYUV) + Codec_CYUV = "cyuv" + + // Daala + Codec_DAALA = "daala" + + // DirectDraw Surface image decoder + Codec_DDS = "dds" + + // Chronomaster DFA + Codec_DFA = "dfa" + + // Dirac (encoders: vc2 ) + Codec_DIRAC = "dirac" + + // VC3/DNxHD + Codec_DNXHD = "dnxhd" + + // DPX (Digital Picture Exchange) image + Codec_DPX = "dpx" + + // Delphine Software International CIN video + Codec_DSICINVIDEO = "dsicinvideo" + + // DV (Digital Video) + Codec_DVVIDEO = "dvvideo" + + // Feeble Files/ScummVM DXA + Codec_DXA = "dxa" + + // Dxtory + Codec_DXTORY = "dxtory" + + // Resolume DXV + Codec_DXV = "dxv" + + // Escape 124 + Codec_ESCAPE124 = "escape124" + + // Escape 130 + Codec_ESCAPE130 = "escape130" + + // OpenEXR image + Codec_EXR = "exr" + + // FFmpeg video codec #1 + Codec_FFV1 = "ffv1" + + // Huffyuv FFmpeg variant + Codec_FFVHUFF = "ffvhuff" + + // Mirillis FIC + Codec_FIC = "fic" + + // FITS (Flexible Image Transport System) + Codec_FITS = "fits" + + // Flash Screen Video v1 + Codec_FLASHSV = "flashsv" + + // Flash Screen Video v2 + Codec_FLASHSV2 = "flashsv2" + + // Autodesk Animator Flic video + Codec_FLIC = "flic" + + // FLV / Sorenson Spark / Sorenson H.263 (Flash Video) (decoders: flv ) (encoders: flv ) + Codec_FLV1 = "flv1" + + // FM Screen Capture Codec + Codec_FMVC = "fmvc" + + // Fraps + Codec_FRAPS = "fraps" + + // Forward Uncompressed + Codec_FRWU = "frwu" + + // Go2Meeting + Codec_G2M = "g2m" + + // Gremlin Digital Video + Codec_GDV = "gdv" + + // GIF (Graphics Interchange Format) + Codec_GIF = "gif" + + // H.261 + Codec_H261 = "h261" + + // H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2 + Codec_H263 = "h263" + + // Intel H.263 + Codec_H263I = "h263i" + + // H.263+ / H.263-1998 / H.263 version 2 + Codec_H263P = "h263p" + + // H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_qsv h264_cuvid ) (encoders: libx264 libx264rgb h264_amf h264_nvenc h264_qsv nvenc nvenc_h264 ) + Codec_H264 = "h264" + + // Vidvox Hap + Codec_HAP = "hap" + + // H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_qsv hevc_cuvid ) (encoders: libx265 nvenc_hevc hevc_amf hevc_nvenc hevc_qsv ) + Codec_HEVC = "hevc" + + // HNM 4 video + Codec_HNM4VIDEO = "hnm4video" + + // Canopus HQ/HQA + Codec_HQ_HQA = "hq_hqa" + + // Canopus HQX + Codec_HQX = "hqx" + + // HuffYUV + Codec_HUFFYUV = "huffyuv" + + // id Quake II CIN video (decoders: idcinvideo ) + Codec_IDCIN = "idcin" + + // iCEDraw text + Codec_IDF = "idf" + + // IFF ACBM/ANIM/DEEP/ILBM/PBM/RGB8/RGBN (decoders: iff ) + Codec_IFF_ILBM = "iff_ilbm" + + // Intel Indeo 2 + Codec_INDEO2 = "indeo2" + + // Intel Indeo 3 + Codec_INDEO3 = "indeo3" + + // Intel Indeo Video Interactive 4 + Codec_INDEO4 = "indeo4" + + // Intel Indeo Video Interactive 5 + Codec_INDEO5 = "indeo5" + + // Interplay MVE video + Codec_INTERPLAYVIDEO = "interplayvideo" + + // JPEG 2000 (decoders: jpeg2000 libopenjpeg ) (encoders: jpeg2000 libopenjpeg ) + Codec_JPEG2000 = "jpeg2000" + + // JPEG-LS + Codec_JPEGLS = "jpegls" + + // Bitmap Brothers JV video + Codec_JV = "jv" + + // Kega Game Video + Codec_KGV1 = "kgv1" + + // Karl Morton's video codec + Codec_KMVC = "kmvc" + + // Lagarith lossless + Codec_LAGARITH = "lagarith" + + // Lossless JPEG + Codec_LJPEG = "ljpeg" + + // LOCO + Codec_LOCO = "loco" + + // Matrox Uncompressed SD + Codec_M101 = "m101" + + // Electronic Arts Madcow Video (decoders: eamad ) + Codec_MAD = "mad" + + // MagicYUV video + Codec_MAGICYUV = "magicyuv" + + // Sony PlayStation MDEC (Motion DECoder) + Codec_MDEC = "mdec" + + // Mimic + Codec_MIMIC = "mimic" + + // Motion JPEG (decoders: mjpeg mjpeg_cuvid ) (encoders: mjpeg mjpeg_qsv ) + Codec_MJPEG = "mjpeg" + + // Apple MJPEG-B + Codec_MJPEGB = "mjpegb" + + // American Laser Games MM Video + Codec_MMVIDEO = "mmvideo" + + // Motion Pixels video + Codec_MOTIONPIXELS = "motionpixels" + + // MPEG-1 video (decoders: mpeg1video mpeg1_cuvid ) + Codec_MPEG1VIDEO = "mpeg1video" + + // MPEG-2 video (decoders: mpeg2video mpegvideo mpeg2_qsv mpeg2_cuvid ) (encoders: mpeg2video mpeg2_qsv ) + Codec_MPEG2VIDEO = "mpeg2video" + + // MPEG-4 part 2 (decoders: mpeg4 mpeg4_cuvid ) + Codec_MPEG4 = "mpeg4" + + // MS ATC Screen + Codec_MSA1 = "msa1" + + // Mandsoft Screen Capture Codec + Codec_MSCC = "mscc" + + // MPEG-4 part 2 Microsoft variant version 1 + Codec_MSMPEG4V1 = "msmpeg4v1" + + // MPEG-4 part 2 Microsoft variant version 2 + Codec_MSMPEG4V2 = "msmpeg4v2" + + // MPEG-4 part 2 Microsoft variant version 3 (decoders: msmpeg4 ) (encoders: msmpeg4 ) + Codec_MSMPEG4V3 = "msmpeg4v3" + + // Microsoft RLE + Codec_MSRLE = "msrle" + + // MS Screen 1 + Codec_MSS1 = "mss1" + + // MS Windows Media Video V9 Screen + Codec_MSS2 = "mss2" + + // Microsoft Video 1 + Codec_MSVIDEO1 = "msvideo1" + + // LCL (LossLess Codec Library) MSZH + Codec_MSZH = "mszh" + + // MS Expression Encoder Screen + Codec_MTS2 = "mts2" + + // Silicon Graphics Motion Video Compressor 1 + Codec_MVC1 = "mvc1" + + // Silicon Graphics Motion Video Compressor 2 + Codec_MVC2 = "mvc2" + + // Mobotix MxPEG video + Codec_MXPEG = "mxpeg" + + // NuppelVideo/RTJPEG + Codec_NUV = "nuv" + + // Amazing Studio Packed Animation File Video + Codec_PAF_VIDEO = "paf_video" + + // PAM (Portable AnyMap) image + Codec_PAM = "pam" + + // PBM (Portable BitMap) image + Codec_PBM = "pbm" + + // PC Paintbrush PCX image + Codec_PCX = "pcx" + + // PGM (Portable GrayMap) image + Codec_PGM = "pgm" + + // PGMYUV (Portable GrayMap YUV) image + Codec_PGMYUV = "pgmyuv" + + // Pictor/PC Paint + Codec_PICTOR = "pictor" + + // Apple Pixlet + Codec_PIXLET = "pixlet" + + // PNG (Portable Network Graphics) image + Codec_PNG = "png" + + // PPM (Portable PixelMap) image + Codec_PPM = "ppm" + + // Apple ProRes (iCodec Pro) (decoders: prores prores_lgpl ) (encoders: prores prores_aw prores_ks ) + Codec_PRORES = "prores" + + // Photoshop PSD file + Codec_PSD = "psd" + + // V.Flash PTX image + Codec_PTX = "ptx" + + // Apple QuickDraw + Codec_QDRAW = "qdraw" + + // Q-team QPEG + Codec_QPEG = "qpeg" + + // QuickTime Animation (RLE) video + Codec_QTRLE = "qtrle" + + // AJA Kona 10-bit RGB Codec + Codec_R10K = "r10k" + + // Uncompressed RGB 10-bit + Codec_R210 = "r210" + + // raw video + Codec_RAWVIDEO = "rawvideo" + + // RL2 video + Codec_RL2 = "rl2" + + // id RoQ video (decoders: roqvideo ) (encoders: roqvideo ) + Codec_ROQ = "roq" + + // QuickTime video (RPZA) + Codec_RPZA = "rpza" + + // innoHeim/Rsupport Screen Capture Codec + Codec_RSCC = "rscc" + + // RealVideo 1.0 + Codec_RV10 = "rv10" + + // RealVideo 2.0 + Codec_RV20 = "rv20" + + // RealVideo 3.0 + Codec_RV30 = "rv30" + + // RealVideo 4.0 + Codec_RV40 = "rv40" + + // LucasArts SANM/SMUSH video + Codec_SANM = "sanm" + + // ScreenPressor + Codec_SCPR = "scpr" + + // Screenpresso + Codec_SCREENPRESSO = "screenpresso" + + // SGI image + Codec_SGI = "sgi" + + // SGI RLE 8-bit + Codec_SGIRLE = "sgirle" + + // BitJazz SheerVideo + Codec_SHEERVIDEO = "sheervideo" + + // Smacker video (decoders: smackvid ) + Codec_SMACKVIDEO = "smackvideo" + + // QuickTime Graphics (SMC) + Codec_SMC = "smc" + + // Sigmatel Motion Video + Codec_SMVJPEG = "smvjpeg" + + // Snow + Codec_SNOW = "snow" + + // Sunplus JPEG (SP5X) + Codec_SP5X = "sp5x" + + // NewTek SpeedHQ + Codec_SPEEDHQ = "speedhq" + + // Screen Recorder Gold Codec + Codec_SRGC = "srgc" + + // Sun Rasterfile image + Codec_SUNRAST = "sunrast" + + // Scalable Vector Graphics + Codec_SVG = "svg" + + // Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1 + Codec_SVQ1 = "svq1" + + // Sorenson Vector Quantizer 3 / Sorenson Video 3 / SVQ3 + Codec_SVQ3 = "svq3" + + // Truevision Targa image + Codec_TARGA = "targa" + + // Pinnacle TARGA CineWave YUV16 + Codec_TARGA_Y216 = "targa_y216" + + // TDSC + Codec_TDSC = "tdsc" + + // Electronic Arts TGQ video (decoders: eatgq ) + Codec_TGQ = "tgq" + + // Electronic Arts TGV video (decoders: eatgv ) + Codec_TGV = "tgv" + + // Theora (encoders: libtheora ) + Codec_THEORA = "theora" + + // Nintendo Gamecube THP video + Codec_THP = "thp" + + // Tiertex Limited SEQ video + Codec_TIERTEXSEQVIDEO = "tiertexseqvideo" + + // TIFF image + Codec_TIFF = "tiff" + + // 8088flex TMV + Codec_TMV = "tmv" + + // Electronic Arts TQI video (decoders: eatqi ) + Codec_TQI = "tqi" + + // Duck TrueMotion 1.0 + Codec_TRUEMOTION1 = "truemotion1" + + // Duck TrueMotion 2.0 + Codec_TRUEMOTION2 = "truemotion2" + + // Duck TrueMotion 2.0 Real Time + Codec_TRUEMOTION2RT = "truemotion2rt" + + // TechSmith Screen Capture Codec (decoders: camtasia ) + Codec_TSCC = "tscc" + + // TechSmith Screen Codec 2 + Codec_TSCC2 = "tscc2" + + // Renderware TXD (TeXture Dictionary) image + Codec_TXD = "txd" + + // IBM UltiMotion (decoders: ultimotion ) + Codec_ULTI = "ulti" + + // Ut Video + Codec_UTVIDEO = "utvideo" + + // Uncompressed 4:2:2 10-bit + Codec_V210 = "v210" + + // Uncompressed 4:2:2 10-bit + Codec_V210X = "v210x" + + // Uncompressed packed 4:4:4 + Codec_V308 = "v308" + + // Uncompressed packed QT 4:4:4:4 + Codec_V408 = "v408" + + // Uncompressed 4:4:4 10-bit + Codec_V410 = "v410" + + // Beam Software VB + Codec_VB = "vb" + + // VBLE Lossless Codec + Codec_VBLE = "vble" + + // SMPTE VC-1 (decoders: vc1 vc1_qsv vc1_cuvid ) + Codec_VC1 = "vc1" + + // Windows Media Video 9 Image v2 + Codec_VC1IMAGE = "vc1image" + + // ATI VCR1 + Codec_VCR1 = "vcr1" + + // Miro VideoXL (decoders: xl ) + Codec_VIXL = "vixl" + + // Sierra VMD video + Codec_VMDVIDEO = "vmdvideo" + + // VMware Screen Codec / VMware Video + Codec_VMNC = "vmnc" + + // On2 VP3 + Codec_VP3 = "vp3" + + // On2 VP5 + Codec_VP5 = "vp5" + + // On2 VP6 + Codec_VP6 = "vp6" + + // On2 VP6 (Flash version, with alpha channel) + Codec_VP6A = "vp6a" + + // On2 VP6 (Flash version) + Codec_VP6F = "vp6f" + + // On2 VP7 + Codec_VP7 = "vp7" + + // On2 VP8 (decoders: vp8 libvpx vp8_cuvid vp8_qsv ) (encoders: libvpx ) + Codec_VP8 = "vp8" + + // Google VP9 (decoders: vp9 libvpx-vp9 vp9_cuvid ) (encoders: libvpx-vp9 ) + Codec_VP9 = "vp9" + + // WebP (encoders: libwebp ) + Codec_WEBP = "webp" + + // Windows Media Video 7 + Codec_WMV1 = "wmv1" + + // Windows Media Video 8 + Codec_WMV2 = "wmv2" + + // Windows Media Video 9 + Codec_WMV3 = "wmv3" + + // Windows Media Video 9 Image + Codec_WMV3IMAGE = "wmv3image" + + // Winnov WNV1 + Codec_WNV1 = "wnv1" + + // AVFrame to AVPacket passthrough + Codec_WRAPPED_AVFRAME = "wrapped_avframe" + + // Westwood Studios VQA (Vector Quantized Animation) video (decoders: vqavideo ) + Codec_WS_VQA = "ws_vqa" + + // Wing Commander III / Xan + Codec_XAN_WC3 = "xan_wc3" + + // Wing Commander IV / Xxan + Codec_XAN_WC4 = "xan_wc4" + + // eXtended BINary text + Codec_XBIN = "xbin" + + // XBM (X BitMap) image + Codec_XBM = "xbm" + + // X-face image + Codec_XFACE = "xface" + + // XPM (X PixMap) image + Codec_XPM = "xpm" + + // XWD (X Window Dump) image + Codec_XWD = "xwd" + + // Uncompressed YUV 4:1:1 12-bit + Codec_Y41P = "y41p" + + // YUY2 Lossless Codec + Codec_YLC = "ylc" + + // Psygnosis YOP Video + Codec_YOP = "yop" + + // Uncompressed packed 4:2:0 + Codec_YUV4 = "yuv4" + + // ZeroCodec Lossless Video + Codec_ZEROCODEC = "zerocodec" + + // LCL (LossLess Codec Library) ZLIB + Codec_ZLIB = "zlib" + + // Zip Motion Blocks Video + Codec_ZMBV = "zmbv" + + // 4GV (Fourth Generation Vocoder) + Codec_4GV = "4gv" + + // 8SVX exponential + Codec_8SVX_EXP = "8svx_exp" + + // 8SVX fibonacci + Codec_8SVX_FIB = "8svx_fib" + + // AAC (Advanced Audio Coding) (decoders: aac aac_fixed ) + Codec_AAC = "aac" + + // AAC LATM (Advanced Audio Coding LATM syntax) + Codec_AAC_LATM = "aac_latm" + + // ATSC A/52A (AC-3) (decoders: ac3 ac3_fixed ) (encoders: ac3 ac3_fixed ) + Codec_AC3 = "ac3" + + // ADPCM 4X Movie + Codec_ADPCM_4XM = "adpcm_4xm" + + // SEGA CRI ADX ADPCM + Codec_ADPCM_ADX = "adpcm_adx" + + // ADPCM Nintendo Gamecube AFC + Codec_ADPCM_AFC = "adpcm_afc" + + // ADPCM Yamaha AICA + Codec_ADPCM_AICA = "adpcm_aica" + + // ADPCM Creative Technology + Codec_ADPCM_CT = "adpcm_ct" + + // ADPCM Nintendo Gamecube DTK + Codec_ADPCM_DTK = "adpcm_dtk" + + // ADPCM Electronic Arts + Codec_ADPCM_EA = "adpcm_ea" + + // ADPCM Electronic Arts Maxis CDROM XA + Codec_ADPCM_EA_MAXIS_XA = "adpcm_ea_maxis_xa" + + // ADPCM Electronic Arts R1 + Codec_ADPCM_EA_R1 = "adpcm_ea_r1" + + // ADPCM Electronic Arts R2 + Codec_ADPCM_EA_R2 = "adpcm_ea_r2" + + // ADPCM Electronic Arts R3 + Codec_ADPCM_EA_R3 = "adpcm_ea_r3" + + // ADPCM Electronic Arts XAS + Codec_ADPCM_EA_XAS = "adpcm_ea_xas" + + // G.722 ADPCM (decoders: g722 ) (encoders: g722 ) + Codec_ADPCM_G722 = "adpcm_g722" + + // G.726 ADPCM (decoders: g726 ) (encoders: g726 ) + Codec_ADPCM_G726 = "adpcm_g726" + + // G.726 ADPCM little-endian (decoders: g726le ) (encoders: g726le ) + Codec_ADPCM_G726LE = "adpcm_g726le" + + // ADPCM IMA AMV + Codec_ADPCM_IMA_AMV = "adpcm_ima_amv" + + // ADPCM IMA CRYO APC + Codec_ADPCM_IMA_APC = "adpcm_ima_apc" + + // ADPCM IMA Eurocom DAT4 + Codec_ADPCM_IMA_DAT4 = "adpcm_ima_dat4" + + // ADPCM IMA Duck DK3 + Codec_ADPCM_IMA_DK3 = "adpcm_ima_dk3" + + // ADPCM IMA Duck DK4 + Codec_ADPCM_IMA_DK4 = "adpcm_ima_dk4" + + // ADPCM IMA Electronic Arts EACS + Codec_ADPCM_IMA_EA_EACS = "adpcm_ima_ea_eacs" + + // ADPCM IMA Electronic Arts SEAD + Codec_ADPCM_IMA_EA_SEAD = "adpcm_ima_ea_sead" + + // ADPCM IMA Funcom ISS + Codec_ADPCM_IMA_ISS = "adpcm_ima_iss" + + // ADPCM IMA Dialogic OKI + Codec_ADPCM_IMA_OKI = "adpcm_ima_oki" + + // ADPCM IMA QuickTime + Codec_ADPCM_IMA_QT = "adpcm_ima_qt" + + // ADPCM IMA Radical + Codec_ADPCM_IMA_RAD = "adpcm_ima_rad" + + // ADPCM IMA Loki SDL MJPEG + Codec_ADPCM_IMA_SMJPEG = "adpcm_ima_smjpeg" + + // ADPCM IMA WAV + Codec_ADPCM_IMA_WAV = "adpcm_ima_wav" + + // ADPCM IMA Westwood + Codec_ADPCM_IMA_WS = "adpcm_ima_ws" + + // ADPCM Microsoft + Codec_ADPCM_MS = "adpcm_ms" + + // ADPCM MTAF + Codec_ADPCM_MTAF = "adpcm_mtaf" + + // ADPCM Playstation + Codec_ADPCM_PSX = "adpcm_psx" + + // ADPCM Sound Blaster Pro 2-bit + Codec_ADPCM_SBPRO_2 = "adpcm_sbpro_2" + + // ADPCM Sound Blaster Pro 2.6-bit + Codec_ADPCM_SBPRO_3 = "adpcm_sbpro_3" + + // ADPCM Sound Blaster Pro 4-bit + Codec_ADPCM_SBPRO_4 = "adpcm_sbpro_4" + + // ADPCM Shockwave Flash + Codec_ADPCM_SWF = "adpcm_swf" + + // ADPCM Nintendo THP + Codec_ADPCM_THP = "adpcm_thp" + + // ADPCM Nintendo THP (Little-Endian) + Codec_ADPCM_THP_LE = "adpcm_thp_le" + + // LucasArts VIMA audio + Codec_ADPCM_VIMA = "adpcm_vima" + + // ADPCM CDROM XA + Codec_ADPCM_XA = "adpcm_xa" + + // ADPCM Yamaha + Codec_ADPCM_YAMAHA = "adpcm_yamaha" + + // ALAC (Apple Lossless Audio Codec) + Codec_ALAC = "alac" + + // AMR-NB (Adaptive Multi-Rate NarrowBand) (decoders: amrnb libopencore_amrnb ) (encoders: libopencore_amrnb ) + Codec_AMR_NB = "amr_nb" + + // AMR-WB (Adaptive Multi-Rate WideBand) (decoders: amrwb libopencore_amrwb ) (encoders: libvo_amrwbenc ) + Codec_AMR_WB = "amr_wb" + + // Monkey's Audio + Codec_APE = "ape" + + // aptX (Audio Processing Technology for Bluetooth) + Codec_APTX = "aptx" + + // ATRAC1 (Adaptive TRansform Acoustic Coding) + Codec_ATRAC1 = "atrac1" + + // ATRAC3 (Adaptive TRansform Acoustic Coding 3) + Codec_ATRAC3 = "atrac3" + + // ATRAC3 AL (Adaptive TRansform Acoustic Coding 3 Advanced Lossless) + Codec_ATRAC3AL = "atrac3al" + + // ATRAC3+ (Adaptive TRansform Acoustic Coding 3+) (decoders: atrac3plus ) + Codec_ATRAC3P = "atrac3p" + + // ATRAC3+ AL (Adaptive TRansform Acoustic Coding 3+ Advanced Lossless) (decoders: atrac3plusal ) + Codec_ATRAC3PAL = "atrac3pal" + + // On2 Audio for Video Codec (decoders: on2avc ) + Codec_AVC = "avc" + + // Bink Audio (DCT) + Codec_BINKAUDIO_DCT = "binkaudio_dct" + + // Bink Audio (RDFT) + Codec_BINKAUDIO_RDFT = "binkaudio_rdft" + + // Discworld II BMV audio + Codec_BMV_AUDIO = "bmv_audio" + + // Constrained Energy Lapped Transform (CELT) + Codec_CELT = "celt" + + // RFC 3389 Comfort Noise + Codec_COMFORTNOISE = "comfortnoise" + + // Cook / Cooker / Gecko (RealAudio G2) + Codec_COOK = "cook" + + // Dolby E + Codec_DOLBY_E = "dolby_e" + + // DSD (Direct Stream Digital), least significant bit first + Codec_DSD_LSBF = "dsd_lsbf" + + // DSD (Direct Stream Digital), least significant bit first, planar + Codec_DSD_LSBF_PLANAR = "dsd_lsbf_planar" + + // DSD (Direct Stream Digital), most significant bit first + Codec_DSD_MSBF = "dsd_msbf" + + // DSD (Direct Stream Digital), most significant bit first, planar + Codec_DSD_MSBF_PLANAR = "dsd_msbf_planar" + + // Delphine Software International CIN audio + Codec_DSICINAUDIO = "dsicinaudio" + + // Digital Speech Standard - Standard Play mode (DSS SP) + Codec_DSS_SP = "dss_sp" + + // DST (Direct Stream Transfer) + Codec_DST = "dst" + + // DCA (DTS Coherent Acoustics) (decoders: dca ) (encoders: dca ) + Codec_DTS = "dts" + + // DV audio + Codec_DVAUDIO = "dvaudio" + + // ATSC A/52B (AC-3, E-AC-3) + Codec_EAC3 = "eac3" + + // EVRC (Enhanced Variable Rate Codec) + Codec_EVRC = "evrc" + + // FLAC (Free Lossless Audio Codec) + Codec_FLAC = "flac" + + // G.723.1 + Codec_G723_1 = "g723_1" + + // G.729 + Codec_G729 = "g729" + + // DPCM Gremlin + Codec_GREMLIN_DPCM = "gremlin_dpcm" + + // GSM + Codec_GSM = "gsm" + + // GSM Microsoft variant + Codec_GSM_MS = "gsm_ms" + + // IAC (Indeo Audio Coder) + Codec_IAC = "iac" + + // iLBC (Internet Low Bitrate Codec) + Codec_ILBC = "ilbc" + + // IMC (Intel Music Coder) + Codec_IMC = "imc" + + // DPCM Interplay + Codec_INTERPLAY_DPCM = "interplay_dpcm" + + // Interplay ACM + Codec_INTERPLAYACM = "interplayacm" + + // MACE (Macintosh Audio Compression/Expansion) 3:1 + Codec_MACE3 = "mace3" + + // MACE (Macintosh Audio Compression/Expansion) 6:1 + Codec_MACE6 = "mace6" + + // Voxware MetaSound + Codec_METASOUND = "metasound" + + // MLP (Meridian Lossless Packing) + Codec_MLP = "mlp" + + // MP1 (MPEG audio layer 1) (decoders: mp1 mp1float ) + Codec_MP1 = "mp1" + + // MP2 (MPEG audio layer 2) (decoders: mp2 mp2float ) (encoders: mp2 mp2fixed libtwolame ) + Codec_MP2 = "mp2" + + // MP3 (MPEG audio layer 3) (decoders: mp3 mp3float ) (encoders: libmp3lame libshine ) + Codec_MP3 = "mp3" + + // ADU (Application Data Unit) MP3 (MPEG audio layer 3) (decoders: mp3adu mp3adufloat ) + Codec_MP3ADU = "mp3adu" + + // MP3onMP4 (decoders: mp3on4 mp3on4float ) + Codec_MP3ON4 = "mp3on4" + + // MPEG-4 Audio Lossless Coding (ALS) (decoders: als ) + Codec_MP4ALS = "mp4als" + + // Musepack SV7 (decoders: mpc7 ) + Codec_MUSEPACK7 = "musepack7" + + // Musepack SV8 (decoders: mpc8 ) + Codec_MUSEPACK8 = "musepack8" + + // Nellymoser Asao + Codec_NELLYMOSER = "nellymoser" + + // Opus (Opus Interactive Audio Codec) (decoders: opus libopus ) (encoders: opus libopus ) + Codec_OPUS = "opus" + + // Amazing Studio Packed Animation File Audio + Codec_PAF_AUDIO = "paf_audio" + + // PCM A-law / G.711 A-law + Codec_PCM_ALAW = "pcm_alaw" + + // PCM signed 16|20|24-bit big-endian for Blu-ray media + Codec_PCM_BLURAY = "pcm_bluray" + + // PCM signed 20|24-bit big-endian + Codec_PCM_DVD = "pcm_dvd" + + // PCM 16.8 floating point little-endian + Codec_PCM_F16LE = "pcm_f16le" + + // PCM 24.0 floating point little-endian + Codec_PCM_F24LE = "pcm_f24le" + + // PCM 32-bit floating point big-endian + Codec_PCM_F32BE = "pcm_f32be" + + // PCM 32-bit floating point little-endian + Codec_PCM_F32LE = "pcm_f32le" + + // PCM 64-bit floating point big-endian + Codec_PCM_F64BE = "pcm_f64be" + + // PCM 64-bit floating point little-endian + Codec_PCM_F64LE = "pcm_f64le" + + // PCM signed 20-bit little-endian planar + Codec_PCM_LXF = "pcm_lxf" + + // PCM mu-law / G.711 mu-law + Codec_PCM_MULAW = "pcm_mulaw" + + // PCM signed 16-bit big-endian + Codec_PCM_S16BE = "pcm_s16be" + + // PCM signed 16-bit big-endian planar + Codec_PCM_S16BE_PLANAR = "pcm_s16be_planar" + + // PCM signed 16-bit little-endian + Codec_PCM_S16LE = "pcm_s16le" + + // PCM signed 16-bit little-endian planar + Codec_PCM_S16LE_PLANAR = "pcm_s16le_planar" + + // PCM signed 24-bit big-endian + Codec_PCM_S24BE = "pcm_s24be" + + // PCM D-Cinema audio signed 24-bit + Codec_PCM_S24DAUD = "pcm_s24daud" + + // PCM signed 24-bit little-endian + Codec_PCM_S24LE = "pcm_s24le" + + // PCM signed 24-bit little-endian planar + Codec_PCM_S24LE_PLANAR = "pcm_s24le_planar" + + // PCM signed 32-bit big-endian + Codec_PCM_S32BE = "pcm_s32be" + + // PCM signed 32-bit little-endian + Codec_PCM_S32LE = "pcm_s32le" + + // PCM signed 32-bit little-endian planar + Codec_PCM_S32LE_PLANAR = "pcm_s32le_planar" + + // PCM signed 64-bit big-endian + Codec_PCM_S64BE = "pcm_s64be" + + // PCM signed 64-bit little-endian + Codec_PCM_S64LE = "pcm_s64le" + + // PCM signed 8-bit + Codec_PCM_S8 = "pcm_s8" + + // PCM signed 8-bit planar + Codec_PCM_S8_PLANAR = "pcm_s8_planar" + + // PCM unsigned 16-bit big-endian + Codec_PCM_U16BE = "pcm_u16be" + + // PCM unsigned 16-bit little-endian + Codec_PCM_U16LE = "pcm_u16le" + + // PCM unsigned 24-bit big-endian + Codec_PCM_U24BE = "pcm_u24be" + + // PCM unsigned 24-bit little-endian + Codec_PCM_U24LE = "pcm_u24le" + + // PCM unsigned 32-bit big-endian + Codec_PCM_U32BE = "pcm_u32be" + + // PCM unsigned 32-bit little-endian + Codec_PCM_U32LE = "pcm_u32le" + + // PCM unsigned 8-bit + Codec_PCM_U8 = "pcm_u8" + + // PCM Zork + Codec_PCM_ZORK = "pcm_zork" + + // QCELP / PureVoice + Codec_QCELP = "qcelp" + + // QDesign Music Codec 2 + Codec_QDM2 = "qdm2" + + // QDesign Music + Codec_QDMC = "qdmc" + + // RealAudio 1.0 (14.4K) (decoders: real_144 ) (encoders: real_144 ) + Codec_RA_144 = "ra_144" + + // RealAudio 2.0 (28.8K) (decoders: real_288 ) + Codec_RA_288 = "ra_288" + + // RealAudio Lossless + Codec_RALF = "ralf" + + // DPCM id RoQ + Codec_ROQ_DPCM = "roq_dpcm" + + // SMPTE 302M + Codec_S302M = "s302m" + + // DPCM Squareroot-Delta-Exact + Codec_SDX2_DPCM = "sdx2_dpcm" + + // Shorten + Codec_SHORTEN = "shorten" + + // RealAudio SIPR / ACELP.NET + Codec_SIPR = "sipr" + + // Smacker audio (decoders: smackaud ) + Codec_SMACKAUDIO = "smackaudio" + + // SMV (Selectable Mode Vocoder) + Codec_SMV = "smv" + + // DPCM Sol + Codec_SOL_DPCM = "sol_dpcm" + + // Sonic + Codec_SONIC = "sonic" + + // Sonic lossless + Codec_SONICLS = "sonicls" + + // Speex (decoders: libspeex ) (encoders: libspeex ) + Codec_SPEEX = "speex" + + // TAK (Tom's lossless Audio Kompressor) + Codec_TAK = "tak" + + // TrueHD + Codec_TRUEHD = "truehd" + + // DSP Group TrueSpeech + Codec_TRUESPEECH = "truespeech" + + // TTA (True Audio) + Codec_TTA = "tta" + + // VQF TwinVQ + Codec_TWINVQ = "twinvq" + + // Sierra VMD audio + Codec_VMDAUDIO = "vmdaudio" + + // Vorbis (decoders: vorbis libvorbis ) (encoders: vorbis libvorbis ) + Codec_VORBIS = "vorbis" + + // Wave synthesis pseudo-codec + Codec_WAVESYNTH = "wavesynth" + + // WavPack (encoders: wavpack libwavpack ) + Codec_WAVPACK = "wavpack" + + // Westwood Audio (SND1) (decoders: ws_snd1 ) + Codec_WESTWOOD_SND1 = "westwood_snd1" + + // Windows Media Audio Lossless + Codec_WMALOSSLESS = "wmalossless" + + // Windows Media Audio 9 Professional + Codec_WMAPRO = "wmapro" + + // Windows Media Audio 1 + Codec_WMAV1 = "wmav1" + + // Windows Media Audio 2 + Codec_WMAV2 = "wmav2" + + // Windows Media Audio Voice + Codec_WMAVOICE = "wmavoice" + + // DPCM Xan + Codec_XAN_DPCM = "xan_dpcm" + + // Xbox Media Audio 1 + Codec_XMA1 = "xma1" + + // Xbox Media Audio 2 + Codec_XMA2 = "xma2" + + // binary data + Codec_BIN_DATA = "bin_data" + + // DVD Nav packet + Codec_DVD_NAV_PACKET = "dvd_nav_packet" + + // SMPTE 336M Key-Length-Value (KLV) metadata + Codec_KLV = "klv" + + // OpenType font + Codec_OTF = "otf" + + // SCTE 35 Message Queue + Codec_SCTE_35 = "scte_35" + + // timed ID3 metadata + Codec_TIMED_ID3 = "timed_id3" + + // TrueType font + Codec_TTF = "ttf" + + // ASS (Advanced SSA) subtitle (decoders: ssa ass ) (encoders: ssa ass ) + Codec_ASS = "ass" + + // DVB subtitles (decoders: dvbsub ) (encoders: dvbsub ) + Codec_DVB_SUBTITLE = "dvb_subtitle" + + // DVB teletext + Codec_DVB_TELETEXT = "dvb_teletext" + + // DVD subtitles (decoders: dvdsub ) (encoders: dvdsub ) + Codec_DVD_SUBTITLE = "dvd_subtitle" + + // EIA-608 closed captions (decoders: cc_dec ) + Codec_EIA_608 = "eia_608" + + // HDMV Presentation Graphic Stream subtitles (decoders: pgssub ) + Codec_HDMV_PGS_SUBTITLE = "hdmv_pgs_subtitle" + + // HDMV Text subtitle + Codec_HDMV_TEXT_SUBTITLE = "hdmv_text_subtitle" + + // JACOsub subtitle + Codec_JACOSUB = "jacosub" + + // MicroDVD subtitle + Codec_MICRODVD = "microdvd" + + // MOV text + Codec_MOV_TEXT = "mov_text" + + // MPL2 subtitle + Codec_MPL2 = "mpl2" + + // PJS (Phoenix Japanimation Society) subtitle + Codec_PJS = "pjs" + + // RealText subtitle + Codec_REALTEXT = "realtext" + + // SAMI subtitle + Codec_SAMI = "sami" + + // SubRip subtitle with embedded timing + Codec_SRT = "srt" + + // SSA (SubStation Alpha) subtitle + Codec_SSA = "ssa" + + // Spruce subtitle format + Codec_STL = "stl" + + // SubRip subtitle (decoders: srt subrip ) (encoders: srt subrip ) + Codec_SUBRIP = "subrip" + + // SubViewer subtitle + Codec_SUBVIEWER = "subviewer" + + // SubViewer v1 subtitle + Codec_SUBVIEWER1 = "subviewer1" + + // raw UTF-8 text + Codec_TEXT = "text" + + // VPlayer subtitle + Codec_VPLAYER = "vplayer" + + // WebVTT subtitle + Codec_WEBVTT = "webvtt" + + // XSUB + Codec_XSUB = "xsub" +) diff --git a/app/media/codecs/internal/generator/main.go b/app/media/codecs/internal/generator/main.go new file mode 100644 index 0000000..d916c60 --- /dev/null +++ b/app/media/codecs/internal/generator/main.go @@ -0,0 +1,83 @@ +package main + +import ( + "bufio" + "bytes" + "fmt" + "go/format" + "log" + "os" + "os/exec" + "strings" +) + +func must(err error) { + if err == nil { + return + } + log.Fatal(err) +} + +func main() { + cmd := exec.Command("ffmpeg", "-codecs") + outputBytes, err := cmd.Output() + must(err) + + code := `package codecs + +var ( +` + + bufreader := bufio.NewScanner(bytes.NewReader(outputBytes)) + + /*Encoders: + V..... = Video + A..... = Audio + S..... = Subtitle + .F.... = Frame-level multithreading + ..S... = Slice-level multithreading + ...X.. = Codec is experimental + ....B. = Supports draw_horiz_band + .....D = Supports direct rendering method 1 + ------ + V..... a64multi Multicolor charset for Commodore 64 (codec a64_multi) + V..... a64multi5 Multicolor charset for Commodore 64, extended with 5th color (colram) (codec a64_multi5)*/ + + waitingForList := true + for bufreader.Scan() && waitingForList { + text := bufreader.Text() + if text == " -------" { + waitingForList = false + } + } + + for bufreader.Scan() { + text := bufreader.Text() + //isVideo := text[1] == 'V' + //isAudio := text[1] == 'A' + //isSubtitle := text[1] == 'S' + + text = text[8:] + cols := strings.Fields(text) + + id := cols[0] + name := strings.Join(cols[1:], " ") + code += fmt.Sprintf(` + // %s + Codec_%s = %q +`, name, strings.ToUpper(id), id) + } + + code += ` +) +` + + codeBytes, err := format.Source([]byte(code)) + must(err) + + f, err := os.Create("gen_codecs.go") + must(err) + defer f.Close() + _, err = f.Write(codeBytes) + must(err) +} diff --git a/app/media/demux/demuxer.go b/app/media/demux/demuxer.go new file mode 100644 index 0000000..340aa4c --- /dev/null +++ b/app/media/demux/demuxer.go @@ -0,0 +1,17 @@ +package demux + +import ( + "io" + + "git.icedream.tech/icedream/uplink/app/media" +) + +type Demuxer interface { + NewInstance(r io.Reader) <-DemuxerInstance +} + +type DemuxerInstance interface { + Error() error + Reader() io.Reader + ContainerInfo() *media.MediaStreamContainerInfo +} diff --git a/app/media/formats/formats.go b/app/media/formats/formats.go new file mode 100644 index 0000000..f8517d3 --- /dev/null +++ b/app/media/formats/formats.go @@ -0,0 +1,3 @@ +package formats + +//go:generate go run ./internal/generator/main.go diff --git a/app/media/formats/gen_formats.go b/app/media/formats/gen_formats.go new file mode 100644 index 0000000..cc2e60a --- /dev/null +++ b/app/media/formats/gen_formats.go @@ -0,0 +1,769 @@ +package formats + +var ( + + // 3GP (3GPP file format) + Format_3GP = "3gp" + // 3GP (3GPP file format) + Mux_Format_3GP = Format_3GP + + // a64 - video for Commodore 64 + Format_A64 = "a64" + // a64 - video for Commodore 64 + Mux_Format_A64 = Format_A64 + + // raw AC-3 + Format_AC3 = "ac3" + // raw AC-3 + Mux_Format_AC3 = Format_AC3 + + // ADTS AAC (Advanced Audio Coding) + Format_ADTS = "adts" + // ADTS AAC (Advanced Audio Coding) + Mux_Format_ADTS = Format_ADTS + + // CRI ADX + Format_ADX = "adx" + // CRI ADX + Mux_Format_ADX = Format_ADX + + // Audio IFF + Format_AIFF = "aiff" + // Audio IFF + Mux_Format_AIFF = Format_AIFF + + // PCM A-law + Format_ALAW = "alaw" + // PCM A-law + Mux_Format_ALAW = Format_ALAW + + // 3GPP AMR + Format_AMR = "amr" + // 3GPP AMR + Mux_Format_AMR = Format_AMR + + // Animated Portable Network Graphics + Format_APNG = "apng" + // Animated Portable Network Graphics + Mux_Format_APNG = Format_APNG + + // raw aptX (Audio Processing Technology for Bluetooth) + Format_APTX = "aptx" + // raw aptX (Audio Processing Technology for Bluetooth) + Mux_Format_APTX = Format_APTX + + // ASF (Advanced / Active Streaming Format) + Format_ASF = "asf" + // ASF (Advanced / Active Streaming Format) + Mux_Format_ASF = Format_ASF + + // ASF (Advanced / Active Streaming Format) + Format_ASF_STREAM = "asf_stream" + // ASF (Advanced / Active Streaming Format) + Mux_Format_ASF_STREAM = Format_ASF_STREAM + + // SSA (SubStation Alpha) subtitle + Format_ASS = "ass" + // SSA (SubStation Alpha) subtitle + Mux_Format_ASS = Format_ASS + + // AST (Audio Stream) + Format_AST = "ast" + // AST (Audio Stream) + Mux_Format_AST = Format_AST + + // Sun AU + Format_AU = "au" + // Sun AU + Mux_Format_AU = Format_AU + + // AVI (Audio Video Interleaved) + Format_AVI = "avi" + // AVI (Audio Video Interleaved) + Mux_Format_AVI = Format_AVI + + // SWF (ShockWave Flash) (AVM2) + Format_AVM2 = "avm2" + // SWF (ShockWave Flash) (AVM2) + Mux_Format_AVM2 = Format_AVM2 + + // G.729 BIT file format + Format_BIT = "bit" + // G.729 BIT file format + Mux_Format_BIT = Format_BIT + + // Apple CAF (Core Audio Format) + Format_CAF = "caf" + // Apple CAF (Core Audio Format) + Mux_Format_CAF = Format_CAF + + // raw Chinese AVS (Audio Video Standard) video + Format_CAVSVIDEO = "cavsvideo" + // raw Chinese AVS (Audio Video Standard) video + Mux_Format_CAVSVIDEO = Format_CAVSVIDEO + + // CRC testing + Format_CRC = "crc" + // CRC testing + Mux_Format_CRC = Format_CRC + + // DASH Muxer + Format_DASH = "dash" + // DASH Muxer + Mux_Format_DASH = Format_DASH + + // raw data + Format_DATA = "data" + // raw data + Mux_Format_DATA = Format_DATA + + // D-Cinema audio + Format_DAUD = "daud" + // D-Cinema audio + Mux_Format_DAUD = Format_DAUD + + // raw Dirac + Format_DIRAC = "dirac" + // raw Dirac + Mux_Format_DIRAC = Format_DIRAC + + // raw DNxHD (SMPTE VC-3) + Format_DNXHD = "dnxhd" + // raw DNxHD (SMPTE VC-3) + Mux_Format_DNXHD = Format_DNXHD + + // raw DTS + Format_DTS = "dts" + // raw DTS + Mux_Format_DTS = Format_DTS + + // DV (Digital Video) + Format_DV = "dv" + // DV (Digital Video) + Mux_Format_DV = Format_DV + + // MPEG-2 PS (DVD VOB) + Format_DVD = "dvd" + // MPEG-2 PS (DVD VOB) + Mux_Format_DVD = Format_DVD + + // raw E-AC-3 + Format_EAC3 = "eac3" + // raw E-AC-3 + Mux_Format_EAC3 = Format_EAC3 + + // PCM 32-bit floating-point big-endian + Format_F32BE = "f32be" + // PCM 32-bit floating-point big-endian + Mux_Format_F32BE = Format_F32BE + + // PCM 32-bit floating-point little-endian + Format_F32LE = "f32le" + // PCM 32-bit floating-point little-endian + Mux_Format_F32LE = Format_F32LE + + // F4V Adobe Flash Video + Format_F4V = "f4v" + // F4V Adobe Flash Video + Mux_Format_F4V = Format_F4V + + // PCM 64-bit floating-point big-endian + Format_F64BE = "f64be" + // PCM 64-bit floating-point big-endian + Mux_Format_F64BE = Format_F64BE + + // PCM 64-bit floating-point little-endian + Format_F64LE = "f64le" + // PCM 64-bit floating-point little-endian + Mux_Format_F64LE = Format_F64LE + + // FFmpeg metadata in text + Format_FFMETADATA = "ffmetadata" + // FFmpeg metadata in text + Mux_Format_FFMETADATA = Format_FFMETADATA + + // FIFO queue pseudo-muxer + Format_FIFO = "fifo" + // FIFO queue pseudo-muxer + Mux_Format_FIFO = Format_FIFO + + // Adobe Filmstrip + Format_FILMSTRIP = "filmstrip" + // Adobe Filmstrip + Mux_Format_FILMSTRIP = Format_FILMSTRIP + + // Flexible Image Transport System + Format_FITS = "fits" + // Flexible Image Transport System + Mux_Format_FITS = Format_FITS + + // raw FLAC + Format_FLAC = "flac" + // raw FLAC + Mux_Format_FLAC = Format_FLAC + + // FLV (Flash Video) + Format_FLV = "flv" + // FLV (Flash Video) + Mux_Format_FLV = Format_FLV + + // framecrc testing + Format_FRAMECRC = "framecrc" + // framecrc testing + Mux_Format_FRAMECRC = Format_FRAMECRC + + // Per-frame hash testing + Format_FRAMEHASH = "framehash" + // Per-frame hash testing + Mux_Format_FRAMEHASH = Format_FRAMEHASH + + // Per-frame MD5 testing + Format_FRAMEMD5 = "framemd5" + // Per-frame MD5 testing + Mux_Format_FRAMEMD5 = Format_FRAMEMD5 + + // raw G.722 + Format_G722 = "g722" + // raw G.722 + Mux_Format_G722 = Format_G722 + + // raw G.723.1 + Format_G723_1 = "g723_1" + // raw G.723.1 + Mux_Format_G723_1 = Format_G723_1 + + // raw big-endian G.726 ("left-justified") + Format_G726 = "g726" + // raw big-endian G.726 ("left-justified") + Mux_Format_G726 = Format_G726 + + // raw little-endian G.726 ("right-justified") + Format_G726LE = "g726le" + // raw little-endian G.726 ("right-justified") + Mux_Format_G726LE = Format_G726LE + + // GIF Animation + Format_GIF = "gif" + // GIF Animation + Mux_Format_GIF = Format_GIF + + // raw GSM + Format_GSM = "gsm" + // raw GSM + Mux_Format_GSM = Format_GSM + + // GXF (General eXchange Format) + Format_GXF = "gxf" + // GXF (General eXchange Format) + Mux_Format_GXF = Format_GXF + + // raw H.261 + Format_H261 = "h261" + // raw H.261 + Mux_Format_H261 = Format_H261 + + // raw H.263 + Format_H263 = "h263" + // raw H.263 + Mux_Format_H263 = Format_H263 + + // raw H.264 video + Format_H264 = "h264" + // raw H.264 video + Mux_Format_H264 = Format_H264 + + // Hash testing + Format_HASH = "hash" + // Hash testing + Mux_Format_HASH = Format_HASH + + // HDS Muxer + Format_HDS = "hds" + // HDS Muxer + Mux_Format_HDS = Format_HDS + + // raw HEVC video + Format_HEVC = "hevc" + // raw HEVC video + Mux_Format_HEVC = Format_HEVC + + // Apple HTTP Live Streaming + Format_HLS = "hls" + // Apple HTTP Live Streaming + Mux_Format_HLS = Format_HLS + + // Microsoft Windows ICO + Format_ICO = "ico" + // Microsoft Windows ICO + Mux_Format_ICO = Format_ICO + + // iLBC storage + Format_ILBC = "ilbc" + // iLBC storage + Mux_Format_ILBC = Format_ILBC + + // image2 sequence + Format_IMAGE2 = "image2" + // image2 sequence + Mux_Format_IMAGE2 = Format_IMAGE2 + + // piped image2 sequence + Format_IMAGE2PIPE = "image2pipe" + // piped image2 sequence + Mux_Format_IMAGE2PIPE = Format_IMAGE2PIPE + + // iPod H.264 MP4 (MPEG-4 Part 14) + Format_IPOD = "ipod" + // iPod H.264 MP4 (MPEG-4 Part 14) + Mux_Format_IPOD = Format_IPOD + + // Berkeley/IRCAM/CARL Sound Format + Format_IRCAM = "ircam" + // Berkeley/IRCAM/CARL Sound Format + Mux_Format_IRCAM = Format_IRCAM + + // ISMV/ISMA (Smooth Streaming) + Format_ISMV = "ismv" + // ISMV/ISMA (Smooth Streaming) + Mux_Format_ISMV = Format_ISMV + + // On2 IVF + Format_IVF = "ivf" + // On2 IVF + Mux_Format_IVF = Format_IVF + + // JACOsub subtitle format + Format_JACOSUB = "jacosub" + // JACOsub subtitle format + Mux_Format_JACOSUB = Format_JACOSUB + + // LOAS/LATM + Format_LATM = "latm" + // LOAS/LATM + Mux_Format_LATM = Format_LATM + + // LRC lyrics + Format_LRC = "lrc" + // LRC lyrics + Mux_Format_LRC = Format_LRC + + // raw MPEG-4 video + Format_M4V = "m4v" + // raw MPEG-4 video + Mux_Format_M4V = Format_M4V + + // Matroska + Format_MATROSKA = "matroska" + // Matroska + Mux_Format_MATROSKA = Format_MATROSKA + + // MD5 testing + Format_MD5 = "md5" + // MD5 testing + Mux_Format_MD5 = Format_MD5 + + // MicroDVD subtitle format + Format_MICRODVD = "microdvd" + // MicroDVD subtitle format + Mux_Format_MICRODVD = Format_MICRODVD + + // raw MJPEG video + Format_MJPEG = "mjpeg" + // raw MJPEG video + Mux_Format_MJPEG = Format_MJPEG + + // extract pts as timecode v2 format, as defined by mkvtoolnix + Format_MKVTIMESTAMP_V2 = "mkvtimestamp_v2" + // extract pts as timecode v2 format, as defined by mkvtoolnix + Mux_Format_MKVTIMESTAMP_V2 = Format_MKVTIMESTAMP_V2 + + // raw MLP + Format_MLP = "mlp" + // raw MLP + Mux_Format_MLP = Format_MLP + + // Yamaha SMAF + Format_MMF = "mmf" + // Yamaha SMAF + Mux_Format_MMF = Format_MMF + + // QuickTime / MOV + Format_MOV = "mov" + // QuickTime / MOV + Mux_Format_MOV = Format_MOV + + // MP2 (MPEG audio layer 2) + Format_MP2 = "mp2" + // MP2 (MPEG audio layer 2) + Mux_Format_MP2 = Format_MP2 + + // MP3 (MPEG audio layer 3) + Format_MP3 = "mp3" + // MP3 (MPEG audio layer 3) + Mux_Format_MP3 = Format_MP3 + + // MP4 (MPEG-4 Part 14) + Format_MP4 = "mp4" + // MP4 (MPEG-4 Part 14) + Mux_Format_MP4 = Format_MP4 + + // MPEG-1 Systems / MPEG program stream + Format_MPEG = "mpeg" + // MPEG-1 Systems / MPEG program stream + Mux_Format_MPEG = Format_MPEG + + // raw MPEG-1 video + Format_MPEG1VIDEO = "mpeg1video" + // raw MPEG-1 video + Mux_Format_MPEG1VIDEO = Format_MPEG1VIDEO + + // raw MPEG-2 video + Format_MPEG2VIDEO = "mpeg2video" + // raw MPEG-2 video + Mux_Format_MPEG2VIDEO = Format_MPEG2VIDEO + + // MPEG-TS (MPEG-2 Transport Stream) + Format_MPEGTS = "mpegts" + // MPEG-TS (MPEG-2 Transport Stream) + Mux_Format_MPEGTS = Format_MPEGTS + + // MIME multipart JPEG + Format_MPJPEG = "mpjpeg" + // MIME multipart JPEG + Mux_Format_MPJPEG = Format_MPJPEG + + // PCM mu-law + Format_MULAW = "mulaw" + // PCM mu-law + Mux_Format_MULAW = Format_MULAW + + // MXF (Material eXchange Format) + Format_MXF = "mxf" + // MXF (Material eXchange Format) + Mux_Format_MXF = Format_MXF + + // MXF (Material eXchange Format) D-10 Mapping + Format_MXF_D10 = "mxf_d10" + // MXF (Material eXchange Format) D-10 Mapping + Mux_Format_MXF_D10 = Format_MXF_D10 + + // MXF (Material eXchange Format) Operational Pattern Atom + Format_MXF_OPATOM = "mxf_opatom" + // MXF (Material eXchange Format) Operational Pattern Atom + Mux_Format_MXF_OPATOM = Format_MXF_OPATOM + + // raw null video + Format_NULL = "null" + // raw null video + Mux_Format_NULL = Format_NULL + + // NUT + Format_NUT = "nut" + // NUT + Mux_Format_NUT = Format_NUT + + // Ogg Audio + Format_OGA = "oga" + // Ogg Audio + Mux_Format_OGA = Format_OGA + + // Ogg + Format_OGG = "ogg" + // Ogg + Mux_Format_OGG = Format_OGG + + // Ogg Video + Format_OGV = "ogv" + // Ogg Video + Mux_Format_OGV = Format_OGV + + // Sony OpenMG audio + Format_OMA = "oma" + // Sony OpenMG audio + Mux_Format_OMA = Format_OMA + + // Ogg Opus + Format_OPUS = "opus" + // Ogg Opus + Mux_Format_OPUS = Format_OPUS + + // PSP MP4 (MPEG-4 Part 14) + Format_PSP = "psp" + // PSP MP4 (MPEG-4 Part 14) + Mux_Format_PSP = Format_PSP + + // raw video + Format_RAWVIDEO = "rawvideo" + // raw video + Mux_Format_RAWVIDEO = Format_RAWVIDEO + + // RealMedia + Format_RM = "rm" + // RealMedia + Mux_Format_RM = Format_RM + + // raw id RoQ + Format_ROQ = "roq" + // raw id RoQ + Mux_Format_ROQ = Format_ROQ + + // Lego Mindstorms RSO + Format_RSO = "rso" + // Lego Mindstorms RSO + Mux_Format_RSO = Format_RSO + + // RTP output + Format_RTP = "rtp" + // RTP output + Mux_Format_RTP = Format_RTP + + // RTP/mpegts output format + Format_RTP_MPEGTS = "rtp_mpegts" + // RTP/mpegts output format + Mux_Format_RTP_MPEGTS = Format_RTP_MPEGTS + + // RTSP output + Format_RTSP = "rtsp" + // RTSP output + Mux_Format_RTSP = Format_RTSP + + // PCM signed 16-bit big-endian + Format_S16BE = "s16be" + // PCM signed 16-bit big-endian + Mux_Format_S16BE = Format_S16BE + + // PCM signed 16-bit little-endian + Format_S16LE = "s16le" + // PCM signed 16-bit little-endian + Mux_Format_S16LE = Format_S16LE + + // PCM signed 24-bit big-endian + Format_S24BE = "s24be" + // PCM signed 24-bit big-endian + Mux_Format_S24BE = Format_S24BE + + // PCM signed 24-bit little-endian + Format_S24LE = "s24le" + // PCM signed 24-bit little-endian + Mux_Format_S24LE = Format_S24LE + + // PCM signed 32-bit big-endian + Format_S32BE = "s32be" + // PCM signed 32-bit big-endian + Mux_Format_S32BE = Format_S32BE + + // PCM signed 32-bit little-endian + Format_S32LE = "s32le" + // PCM signed 32-bit little-endian + Mux_Format_S32LE = Format_S32LE + + // PCM signed 8-bit + Format_S8 = "s8" + // PCM signed 8-bit + Mux_Format_S8 = Format_S8 + + // SAP output + Format_SAP = "sap" + // SAP output + Mux_Format_SAP = Format_SAP + + // Scenarist Closed Captions + Format_SCC = "scc" + // Scenarist Closed Captions + Mux_Format_SCC = Format_SCC + + // SDL2 output device + Format_SDL, SDL2 = "sdl,sdl2" + // SDL2 output device + Mux_Format_SDL, SDL2 = Format_SDL, SDL2 + + // segment + Format_SEGMENT = "segment" + // segment + Mux_Format_SEGMENT = Format_SEGMENT + + // JPEG single image + Format_SINGLEJPEG = "singlejpeg" + // JPEG single image + Mux_Format_SINGLEJPEG = Format_SINGLEJPEG + + // Loki SDL MJPEG + Format_SMJPEG = "smjpeg" + // Loki SDL MJPEG + Mux_Format_SMJPEG = Format_SMJPEG + + // Smooth Streaming Muxer + Format_SMOOTHSTREAMING = "smoothstreaming" + // Smooth Streaming Muxer + Mux_Format_SMOOTHSTREAMING = Format_SMOOTHSTREAMING + + // SoX native + Format_SOX = "sox" + // SoX native + Mux_Format_SOX = Format_SOX + + // IEC 61937 (used on S/PDIF - IEC958) + Format_SPDIF = "spdif" + // IEC 61937 (used on S/PDIF - IEC958) + Mux_Format_SPDIF = Format_SPDIF + + // Ogg Speex + Format_SPX = "spx" + // Ogg Speex + Mux_Format_SPX = Format_SPX + + // SubRip subtitle + Format_SRT = "srt" + // SubRip subtitle + Mux_Format_SRT = Format_SRT + + // streaming segment muxer + Format_STREAM_SEGMENT, SSEGMENT = "stream_segment,ssegment" + // streaming segment muxer + Mux_Format_STREAM_SEGMENT, SSEGMENT = Format_STREAM_SEGMENT, SSEGMENT + + // raw HDMV Presentation Graphic Stream subtitles + Format_SUP = "sup" + // raw HDMV Presentation Graphic Stream subtitles + Mux_Format_SUP = Format_SUP + + // MPEG-2 PS (SVCD) + Format_SVCD = "svcd" + // MPEG-2 PS (SVCD) + Mux_Format_SVCD = Format_SVCD + + // SWF (ShockWave Flash) + Format_SWF = "swf" + // SWF (ShockWave Flash) + Mux_Format_SWF = Format_SWF + + // Multiple muxer tee + Format_TEE = "tee" + // Multiple muxer tee + Mux_Format_TEE = Format_TEE + + // raw TrueHD + Format_TRUEHD = "truehd" + // raw TrueHD + Mux_Format_TRUEHD = Format_TRUEHD + + // TTA (True Audio) + Format_TTA = "tta" + // TTA (True Audio) + Mux_Format_TTA = Format_TTA + + // PCM unsigned 16-bit big-endian + Format_U16BE = "u16be" + // PCM unsigned 16-bit big-endian + Mux_Format_U16BE = Format_U16BE + + // PCM unsigned 16-bit little-endian + Format_U16LE = "u16le" + // PCM unsigned 16-bit little-endian + Mux_Format_U16LE = Format_U16LE + + // PCM unsigned 24-bit big-endian + Format_U24BE = "u24be" + // PCM unsigned 24-bit big-endian + Mux_Format_U24BE = Format_U24BE + + // PCM unsigned 24-bit little-endian + Format_U24LE = "u24le" + // PCM unsigned 24-bit little-endian + Mux_Format_U24LE = Format_U24LE + + // PCM unsigned 32-bit big-endian + Format_U32BE = "u32be" + // PCM unsigned 32-bit big-endian + Mux_Format_U32BE = Format_U32BE + + // PCM unsigned 32-bit little-endian + Format_U32LE = "u32le" + // PCM unsigned 32-bit little-endian + Mux_Format_U32LE = Format_U32LE + + // PCM unsigned 8-bit + Format_U8 = "u8" + // PCM unsigned 8-bit + Mux_Format_U8 = Format_U8 + + // uncoded framecrc testing + Format_UNCODEDFRAMECRC = "uncodedframecrc" + // uncoded framecrc testing + Mux_Format_UNCODEDFRAMECRC = Format_UNCODEDFRAMECRC + + // raw VC-1 video + Format_VC1 = "vc1" + // raw VC-1 video + Mux_Format_VC1 = Format_VC1 + + // VC-1 test bitstream + Format_VC1TEST = "vc1test" + // VC-1 test bitstream + Mux_Format_VC1TEST = Format_VC1TEST + + // MPEG-1 Systems / MPEG program stream (VCD) + Format_VCD = "vcd" + // MPEG-1 Systems / MPEG program stream (VCD) + Mux_Format_VCD = Format_VCD + + // MPEG-2 PS (VOB) + Format_VOB = "vob" + // MPEG-2 PS (VOB) + Mux_Format_VOB = Format_VOB + + // Creative Voice + Format_VOC = "voc" + // Creative Voice + Mux_Format_VOC = Format_VOC + + // Sony Wave64 + Format_W64 = "w64" + // Sony Wave64 + Mux_Format_W64 = Format_W64 + + // WAV / WAVE (Waveform Audio) + Format_WAV = "wav" + // WAV / WAVE (Waveform Audio) + Mux_Format_WAV = Format_WAV + + // WebM + Format_WEBM = "webm" + // WebM + Mux_Format_WEBM = Format_WEBM + + // WebM Chunk Muxer + Format_WEBM_CHUNK = "webm_chunk" + // WebM Chunk Muxer + Mux_Format_WEBM_CHUNK = Format_WEBM_CHUNK + + // WebM DASH Manifest + Format_WEBM_DASH_MANIFEST = "webm_dash_manifest" + // WebM DASH Manifest + Mux_Format_WEBM_DASH_MANIFEST = Format_WEBM_DASH_MANIFEST + + // WebP + Format_WEBP = "webp" + // WebP + Mux_Format_WEBP = Format_WEBP + + // WebVTT subtitle + Format_WEBVTT = "webvtt" + // WebVTT subtitle + Mux_Format_WEBVTT = Format_WEBVTT + + // Windows Television (WTV) + Format_WTV = "wtv" + // Windows Television (WTV) + Mux_Format_WTV = Format_WTV + + // raw WavPack + Format_WV = "wv" + // raw WavPack + Mux_Format_WV = Format_WV + + // YUV4MPEG pipe + Format_YUV4MPEGPIPE = "yuv4mpegpipe" + // YUV4MPEG pipe + Mux_Format_YUV4MPEGPIPE = Format_YUV4MPEGPIPE +) diff --git a/app/media/formats/internal/generator/main.go b/app/media/formats/internal/generator/main.go new file mode 100644 index 0000000..8c94bb4 --- /dev/null +++ b/app/media/formats/internal/generator/main.go @@ -0,0 +1,84 @@ +package main + +import ( + "bufio" + "bytes" + "fmt" + "go/format" + "log" + "os" + "os/exec" + "strings" +) + +func must(err error) { + if err == nil { + return + } + log.Fatal(err) +} + +func main() { + cmd := exec.Command("ffmpeg", "-muxers") + outputBytes, err := cmd.Output() + must(err) + + code := `package formats + +var ( +` + + bufreader := bufio.NewScanner(bytes.NewReader(outputBytes)) + + /*File formats: + D. = Demuxing supported + .E = Muxing supported + -- + E 3g2 3GP2 (3GPP2 file format) + E 3gp 3GP (3GPP file format)*/ + + waitingForList := true + for bufreader.Scan() && waitingForList { + text := bufreader.Text() + if text == " --" { + waitingForList = false + } + } + + for bufreader.Scan() { + text := bufreader.Text() + demuxingSupported := text[1] == 'D' + muxingSupported := text[2] == 'E' + text = text[4:] + cols := strings.Fields(text) + id := cols[0] + name := strings.Join(cols[1:], " ") + code += fmt.Sprintf(` + // %s + Format_%s = %q +`, name, strings.ToUpper(id), id) + if demuxingSupported { + code += fmt.Sprintf(` // %s + Demux_Format_%s = Format_%s +`, name, strings.ToUpper(id), strings.ToUpper(id)) + } + if muxingSupported { + code += fmt.Sprintf(` // %s + Mux_Format_%s = Format_%s +`, name, strings.ToUpper(id), strings.ToUpper(id)) + } + } + + code += ` +) +` + + codeBytes, err := format.Source([]byte(code)) + must(err) + + f, err := os.Create("gen_formats.go") + must(err) + defer f.Close() + _, err = f.Write(codeBytes) + must(err) +} diff --git a/app/media/mux/muxer.go b/app/media/mux/muxer.go new file mode 100644 index 0000000..4c51e6b --- /dev/null +++ b/app/media/mux/muxer.go @@ -0,0 +1,19 @@ +package mux + +import ( + "io" + + "git.icedream.tech/icedream/uplink/app/media" +) + +type Muxer interface { + AcceptsCodec(info media.MediaStreamCodecInfo) bool + GeneratesFormat(info media.MediaStreamContainerInfo) bool + + NewInstance(streams ...*media.MediaStream) <-MuxerInstance +} + +type MuxerInstance interface { + Error() error + Container() *media.MediaStreamContainerInfo +} diff --git a/app/media/transcode/transcoder.go b/app/media/transcode/transcoder.go new file mode 100644 index 0000000..58337f0 --- /dev/null +++ b/app/media/transcode/transcoder.go @@ -0,0 +1,12 @@ +package transcode + +import "git.icedream.tech/icedream/uplink/app/genericapi" + +type Transcoder interface { + genericapi.DynamicallyConfigurable + + AcceptedInputCodecs() []string + AcceptedOutputCodecs() []string + + NewInstance(config interface{}) <-TranscoderInstance +}