Index: configure =================================================================== --- configure (リビジョン 8451) +++ configure (作業コピー) @@ -96,6 +96,7 @@ echo " --enable-libtheora enable Theora encoding via libtheora [default=no]" echo " --enable-libvorbis enable Vorbis en/decoding via libvorbis," echo " native implementations exist [default=no]" + echo " --enable-spc enable SPC demuxing via libopenspc [default=no]" echo " --enable-x264 enable H.264 encoding via x264 [default=no]" echo " --enable-xvid enable Xvid encoding via xvidcore," echo " native MPEG-4/Xvid encoder exists [default=no]" @@ -566,6 +567,7 @@ powerpc_perf pp protocols + spc swscaler vhook v4l @@ -650,6 +652,7 @@ mpeg_xvmc_decoder_deps="xvmc" png_decoder_deps="zlib" png_encoder_deps="zlib" +spc_encoder_deps="spc" x264_encoder_deps="x264" xvid_encoder_deps="xvid" zmbv_decoder_deps="zlib" @@ -783,6 +786,7 @@ libtheora="no" libvorbis="no" mlib="no" +spc="no" x11grab="no" x264="no" xvid="no" @@ -1230,6 +1234,7 @@ die_gpl_disabled "The Postprocessing code" pp die_gpl_disabled "liba52" liba52 die_gpl_disabled "libxvidcore" xvid + die_gpl_disabled "spc" spc die_gpl_disabled "x264" x264 die_gpl_disabled "libdts" libdts die_gpl_disabled "FAAD2" libfaad2 @@ -1558,6 +1563,7 @@ enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg enabled libnut && require libnut libnut.h nut_demuxer_init -lnut +enabled spc && require libopenspc openspc.h OSPC_Init -lopenspc enabled xvid && require XviD xvid.h xvid_global -lxvidcore enabled x264 && require x264 x264.h x264_encoder_open -lx264 enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 @@ -1820,6 +1826,7 @@ echo "libogg enabled $libogg" echo "libtheora enabled $libtheora" echo "libvorbis enabled $libvorbis" +echo "spc enabled $spc" echo "x264 enabled $x264" echo "XviD enabled $xvid" echo "zlib enabled $zlib" Index: libavformat/Makefile =================================================================== --- libavformat/Makefile (リビジョン 8451) +++ libavformat/Makefile (作業コピー) @@ -118,6 +119,7 @@ OBJS-$(CONFIG_VMD_DEMUXER) += sierravmd.o OBJS-$(CONFIG_SMACKER_DEMUXER) += smacker.o OBJS-$(CONFIG_SOL_DEMUXER) += sol.o +OBJS-$(CONFIG_SPC_DEMUXER) += spc.o OBJS-$(CONFIG_SWF_DEMUXER) += swf.o OBJS-$(CONFIG_SWF_MUXER) += swf.o OBJS-$(CONFIG_TIERTEXSEQ_DEMUXER) += tiertexseq.o Index: libavformat/spc.c =================================================================== --- libavformat/spc.c (リビジョン 0) +++ libavformat/spc.c (リビジョン 0) @@ -0,0 +1,85 @@ +/* + * SPC(SPC700 Sound Format) demuxer + * Copyright (c) 2007 Nazo + * + * This file is part of FFmpeg. + * + * FFmpeg is av_free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the av_free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the av_free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "avformat.h" +#include + +static int spc_probe(AVProbeData *p) +{ + if(p->buf_size < 27) + return 0; + if(!memcmp(p->buf, "SNES-SPC700 Sound File Data", 27)) { + return AVPROBE_SCORE_MAX; + } + return 0; +} + + +static int spc_read_header(AVFormatContext *s, + AVFormatParameters *ap) +{ + AVStream *st; + AVCodecContext *codec; + int size, i = 0; + char *buf; + size = url_fsize(&s->pb); + buf = (char *)av_malloc(size); + for(;ipb); + if(OSPC_Init(buf, size)){ + return -1; + } + av_free(buf); + + st = av_new_stream(s, 0); + codec = st->codec; + codec->codec_type = CODEC_TYPE_AUDIO; + codec->codec_id = CODEC_ID_PCM_S16LE; + codec->sample_rate = 32768; + codec->channels = 2; + return 0; +} + +static int spc_read_packet(AVFormatContext *s, AVPacket *pkt) +{ + int size; + char buf[100]; + size = OSPC_Run(-1, (short *)buf, sizeof(buf)); + if(av_new_packet(pkt, size) < 0) + return AVERROR_IO; + memcpy(pkt->data, buf, size); + return 0; +} + +static int spc_read_close(AVFormatContext *s) +{ + return 0; +} + +AVInputFormat spc_demuxer = { + "spc", + "spc format", + 0, + spc_probe, + spc_read_header, + spc_read_packet, + spc_read_close, + .extensions = "spc", +}; Index: libavformat/allformats.c =================================================================== --- libavformat/allformats.c (リビジョン 8451) +++ libavformat/allformats.c (作業コピー) @@ -138,6 +139,7 @@ REGISTER_DEMUXER (SHORTEN, shorten); REGISTER_DEMUXER (SMACKER, smacker); REGISTER_DEMUXER (SOL, sol); + REGISTER_DEMUXER (SPC, spc); REGISTER_DEMUXER (STR, str); REGISTER_MUXDEMUX(SWF, swf); REGISTER_MUXER (TG2, tg2); Index: libavformat/allformats.h =================================================================== --- libavformat/allformats.h (リビジョン 8451) +++ libavformat/allformats.h (作業コピー) @@ -151,6 +152,7 @@ extern AVInputFormat vmd_demuxer; extern AVInputFormat smacker_demuxer; extern AVInputFormat sol_demuxer; +extern AVInputFormat spc_demuxer; extern AVInputFormat swf_demuxer; extern AVOutputFormat swf_muxer; extern AVInputFormat tta_demuxer;