add new top level examples/ directory with one example for now (example_c_decode_file)
This commit is contained in:
parent
546ba794ca
commit
44937a7652
36
FLAC.dsw
36
FLAC.dsw
@ -29,6 +29,9 @@ Package=<5>
|
|||||||
|
|
||||||
Package=<4>
|
Package=<4>
|
||||||
{{{
|
{{{
|
||||||
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name examples
|
||||||
|
End Project Dependency
|
||||||
Begin Project Dependency
|
Begin Project Dependency
|
||||||
Project_Dep_Name flac
|
Project_Dep_Name flac
|
||||||
End Project Dependency
|
End Project Dependency
|
||||||
@ -116,6 +119,9 @@ Package=<5>
|
|||||||
|
|
||||||
Package=<4>
|
Package=<4>
|
||||||
{{{
|
{{{
|
||||||
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name examples
|
||||||
|
End Project Dependency
|
||||||
Begin Project Dependency
|
Begin Project Dependency
|
||||||
Project_Dep_Name flac
|
Project_Dep_Name flac
|
||||||
End Project Dependency
|
End Project Dependency
|
||||||
@ -189,6 +195,36 @@ Package=<4>
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "examples"=.\examples\examples.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name example_c_decode_file
|
||||||
|
End Project Dependency
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "example_c_decode_file"=.\examples\c\decode\file\example_c_decode_file.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name libFLAC_static
|
||||||
|
End Project Dependency
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
Project: "flac"=.\src\flac\flac.dsp - Package Owner=<4>
|
Project: "flac"=.\src\flac\flac.dsp - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
|
9
FLAC.sln
9
FLAC.sln
@ -1,6 +1,11 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
# Visual C++ Express 2005
|
# Visual C++ Express 2005
|
||||||
|
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "example_c_decode_file", "example\c\decode\file\example_c_decode_file.vcproj", "{4cefbd00-c215-11db-8314-0800200c9a66}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "flac", "src\flac\flac.vcproj", "{4cefbc7d-c215-11db-8314-0800200c9a66}"
|
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "flac", "src\flac\flac.vcproj", "{4cefbc7d-c215-11db-8314-0800200c9a66}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{4cefbc81-c215-11db-8314-0800200c9a66} = {4cefbc81-c215-11db-8314-0800200c9a66}
|
{4cefbc81-c215-11db-8314-0800200c9a66} = {4cefbc81-c215-11db-8314-0800200c9a66}
|
||||||
@ -220,6 +225,10 @@ Global
|
|||||||
{4cefbc95-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
|
{4cefbc95-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{4cefbc95-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
|
{4cefbc95-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{4cefbc95-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
|
{4cefbc95-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{4cefbd00-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{4cefbd00-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{4cefbd00-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{4cefbd00-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -30,8 +30,8 @@
|
|||||||
|
|
||||||
topdir = .
|
topdir = .
|
||||||
|
|
||||||
.PHONY: all doc src libFLAC libFLAC++ share plugin_common plugin_xmms flac metaflac test_grabbag test_libFLAC test_libFLAC++ test_seeking test_streams
|
.PHONY: all doc src examples libFLAC libFLAC++ share plugin_common plugin_xmms flac metaflac test_grabbag test_libFLAC test_libFLAC++ test_seeking test_streams
|
||||||
all: doc src
|
all: doc src examples
|
||||||
|
|
||||||
DEFAULT_CONFIG = release
|
DEFAULT_CONFIG = release
|
||||||
|
|
||||||
@ -46,57 +46,61 @@ valgrind: all
|
|||||||
release : all
|
release : all
|
||||||
|
|
||||||
doc:
|
doc:
|
||||||
(cd $@ ; $(MAKE) -f Makefile.lite)
|
(cd $@ && $(MAKE) -f Makefile.lite)
|
||||||
|
|
||||||
src:
|
src:
|
||||||
(cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd $@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
|
examples: src
|
||||||
|
(cd $@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
libFLAC:
|
libFLAC:
|
||||||
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
libFLAC++: libFLAC
|
libFLAC++: libFLAC
|
||||||
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
share: libFLAC
|
share: libFLAC
|
||||||
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
flac: libFLAC share
|
flac: libFLAC share
|
||||||
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
metaflac: libFLAC share
|
metaflac: libFLAC share
|
||||||
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
plugin_common: libFLAC
|
plugin_common: libFLAC
|
||||||
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
plugin_xmms: libFLAC plugin_common
|
plugin_xmms: libFLAC plugin_common
|
||||||
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
test_seeking: libFLAC
|
test_seeking: libFLAC
|
||||||
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
test_streams: libFLAC
|
test_streams: libFLAC
|
||||||
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
test_grabbag: share
|
test_grabbag: share
|
||||||
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
test_libFLAC: libFLAC
|
test_libFLAC: libFLAC
|
||||||
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
test_libFLAC++: libFLAC libFLAC++
|
test_libFLAC++: libFLAC libFLAC++
|
||||||
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
test: debug
|
test: debug
|
||||||
(cd test ; $(MAKE) -f Makefile.lite debug)
|
(cd test && $(MAKE) -f Makefile.lite debug)
|
||||||
|
|
||||||
testv: valgrind
|
testv: valgrind
|
||||||
(cd test ; $(MAKE) -f Makefile.lite valgrind)
|
(cd test && $(MAKE) -f Makefile.lite valgrind)
|
||||||
|
|
||||||
testr: release
|
testr: release
|
||||||
(cd test ; $(MAKE) -f Makefile.lite release)
|
(cd test && $(MAKE) -f Makefile.lite release)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-(cd doc ; $(MAKE) -f Makefile.lite clean)
|
-(cd doc && $(MAKE) -f Makefile.lite clean)
|
||||||
-(cd src ; $(MAKE) -f Makefile.lite clean)
|
-(cd src && $(MAKE) -f Makefile.lite clean)
|
||||||
-(cd test ; $(MAKE) -f Makefile.lite clean)
|
-(cd examples && $(MAKE) -f Makefile.lite clean)
|
||||||
|
-(cd test && $(MAKE) -f Makefile.lite clean)
|
||||||
|
27
examples/Makefile.am
Normal file
27
examples/Makefile.am
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# FLAC - Free Lossless Audio Codec
|
||||||
|
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
#
|
||||||
|
# This file is part the FLAC project. FLAC is comprised of several
|
||||||
|
# components distributed under difference licenses. The codec libraries
|
||||||
|
# are distributed under Xiph.Org's BSD-like license (see the file
|
||||||
|
# COPYING.Xiph in this distribution). All other programs, libraries, and
|
||||||
|
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
|
||||||
|
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
|
||||||
|
# FLAC distribution contains at the top the terms under which it may be
|
||||||
|
# distributed.
|
||||||
|
#
|
||||||
|
# Since this particular file is relevant to all components of FLAC,
|
||||||
|
# it may be distributed under the Xiph.Org license, which is the least
|
||||||
|
# restrictive of those mentioned above. See the file COPYING.Xiph in this
|
||||||
|
# distribution.
|
||||||
|
|
||||||
|
if FLaC__WITH_CPPLIBS
|
||||||
|
CPPLIBS_DIRS = cpp
|
||||||
|
endif
|
||||||
|
|
||||||
|
SUBDIRS = c $(CPPLIBS_DIRS)
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
examples.dsp \
|
||||||
|
Makefile.lite \
|
||||||
|
README
|
37
examples/Makefile.lite
Normal file
37
examples/Makefile.lite
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# FLAC - Free Lossless Audio Codec
|
||||||
|
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
#
|
||||||
|
# This file is part the FLAC project. FLAC is comprised of several
|
||||||
|
# components distributed under difference licenses. The codec libraries
|
||||||
|
# are distributed under Xiph.Org's BSD-like license (see the file
|
||||||
|
# COPYING.Xiph in this distribution). All other programs, libraries, and
|
||||||
|
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
|
||||||
|
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
|
||||||
|
# FLAC distribution contains at the top the terms under which it may be
|
||||||
|
# distributed.
|
||||||
|
#
|
||||||
|
# Since this particular file is relevant to all components of FLAC,
|
||||||
|
# it may be distributed under the Xiph.Org license, which is the least
|
||||||
|
# restrictive of those mentioned above. See the file COPYING.Xiph in this
|
||||||
|
# distribution.
|
||||||
|
|
||||||
|
.PHONY: all example_c_decode_file
|
||||||
|
all: example_c_decode_file
|
||||||
|
|
||||||
|
DEFAULT_CONFIG = release
|
||||||
|
|
||||||
|
CONFIG = $(DEFAULT_CONFIG)
|
||||||
|
|
||||||
|
debug : CONFIG = debug
|
||||||
|
valgrind: CONFIG = valgrind
|
||||||
|
release : CONFIG = release
|
||||||
|
|
||||||
|
debug : all
|
||||||
|
valgrind: all
|
||||||
|
release : all
|
||||||
|
|
||||||
|
example_c_decode_file:
|
||||||
|
(cd c/decode/file && $(MAKE) -f Makefile.lite $(CONFIG))
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-(cd c/decode/file && $(MAKE) -f Makefile.lite clean)
|
9
examples/README
Normal file
9
examples/README
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Here are several small example programs that use the libraries in different
|
||||||
|
ways.
|
||||||
|
|
||||||
|
The "c" directory has programs that are all in C and use libFLAC.
|
||||||
|
|
||||||
|
The "cpp" directory has analogous programs that are all in C++ and use libFLAC++.
|
||||||
|
|
||||||
|
The programs are:
|
||||||
|
c/decode/file/ - example_c_decode_file - Simple FLAC file decoder using libFLAC
|
18
examples/c/Makefile.am
Normal file
18
examples/c/Makefile.am
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# FLAC - Free Lossless Audio Codec
|
||||||
|
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
#
|
||||||
|
# This file is part the FLAC project. FLAC is comprised of several
|
||||||
|
# components distributed under difference licenses. The codec libraries
|
||||||
|
# are distributed under Xiph.Org's BSD-like license (see the file
|
||||||
|
# COPYING.Xiph in this distribution). All other programs, libraries, and
|
||||||
|
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
|
||||||
|
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
|
||||||
|
# FLAC distribution contains at the top the terms under which it may be
|
||||||
|
# distributed.
|
||||||
|
#
|
||||||
|
# Since this particular file is relevant to all components of FLAC,
|
||||||
|
# it may be distributed under the Xiph.Org license, which is the least
|
||||||
|
# restrictive of those mentioned above. See the file COPYING.Xiph in this
|
||||||
|
# distribution.
|
||||||
|
|
||||||
|
SUBDIRS = decode
|
18
examples/c/decode/Makefile.am
Normal file
18
examples/c/decode/Makefile.am
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# FLAC - Free Lossless Audio Codec
|
||||||
|
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
#
|
||||||
|
# This file is part the FLAC project. FLAC is comprised of several
|
||||||
|
# components distributed under difference licenses. The codec libraries
|
||||||
|
# are distributed under Xiph.Org's BSD-like license (see the file
|
||||||
|
# COPYING.Xiph in this distribution). All other programs, libraries, and
|
||||||
|
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
|
||||||
|
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
|
||||||
|
# FLAC distribution contains at the top the terms under which it may be
|
||||||
|
# distributed.
|
||||||
|
#
|
||||||
|
# Since this particular file is relevant to all components of FLAC,
|
||||||
|
# it may be distributed under the Xiph.Org license, which is the least
|
||||||
|
# restrictive of those mentioned above. See the file COPYING.Xiph in this
|
||||||
|
# distribution.
|
||||||
|
|
||||||
|
SUBDIRS = file
|
30
examples/c/decode/file/Makefile.am
Normal file
30
examples/c/decode/file/Makefile.am
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# example_c_decode_file - Simple FLAC file decoder using libFLAC
|
||||||
|
# Copyright (C) 2007 Josh Coalson
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program 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 General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
Makefile.lite \
|
||||||
|
example_c_decode_file.dsp \
|
||||||
|
example_c_decode_file.vcproj \
|
||||||
|
|
||||||
|
INCLUDES = -I$(top_srcdir)/src/libFLAC/include
|
||||||
|
|
||||||
|
noinst_PROGRAMS = example_c_decode_file
|
||||||
|
example_c_decode_file_LDADD = \
|
||||||
|
@OGG_LIBS@ \
|
||||||
|
@MINGW_WINSOCK_LIBS@ \
|
||||||
|
-lm
|
||||||
|
example_c_decode_file_SOURCES = main.c
|
39
examples/c/decode/file/Makefile.lite
Normal file
39
examples/c/decode/file/Makefile.lite
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# example_c_decode_file - Simple FLAC file decoder using libFLAC
|
||||||
|
# Copyright (C) 2007 Josh Coalson
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program 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 General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
#
|
||||||
|
# GNU makefile
|
||||||
|
#
|
||||||
|
|
||||||
|
topdir = ../../../..
|
||||||
|
libdir = $(topdir)/obj/$(BUILD)/lib
|
||||||
|
|
||||||
|
PROGRAM_NAME = example_c_decode_file
|
||||||
|
|
||||||
|
INCLUDES = -I../libFLAC/include -I$(topdir)/include
|
||||||
|
|
||||||
|
ifeq ($(DARWIN_BUILD),yes)
|
||||||
|
EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
|
||||||
|
else
|
||||||
|
LIBS = -lFLAC -L$(OGG_LIB_DIR) -logg -lm
|
||||||
|
endif
|
||||||
|
|
||||||
|
SRCS_C = main.c
|
||||||
|
|
||||||
|
include $(topdir)/build/exe.mk
|
||||||
|
|
||||||
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
100
examples/c/decode/file/example_c_decode_file.dsp
Normal file
100
examples/c/decode/file/example_c_decode_file.dsp
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="example_c_decode_file" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=example_c_decode_file - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "example_c_decode_file.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "example_c_decode_file.mak" CFG="example_c_decode_file - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "example_c_decode_file - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "example_c_decode_file - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "example_c_decode_file - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "..\..\..\..\obj\release\bin"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||||
|
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c
|
||||||
|
# SUBTRACT CPP /YX /Yc /Yu
|
||||||
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 ..\..\..\..\obj\release\lib\libFLAC_static.lib ..\..\..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "example_c_decode_file - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "..\..\..\..\obj\debug\bin"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
|
||||||
|
# SUBTRACT CPP /YX /Yc /Yu
|
||||||
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 ..\..\..\..\obj\debug\lib\libFLAC_static.lib ..\..\..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "example_c_decode_file - Win32 Release"
|
||||||
|
# Name "example_c_decode_file - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\main.c
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
204
examples/c/decode/file/example_c_decode_file.vcproj
Normal file
204
examples/c/decode/file/example_c_decode_file.vcproj
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="example_c_decode_file"
|
||||||
|
ProjectGUID="{4cefbd00-c215-11db-8314-0800200c9a66}"
|
||||||
|
RootNamespace="example_c_decode_file"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="..\..\..\..\obj\debug\bin"
|
||||||
|
IntermediateDirectory="Debug"
|
||||||
|
ConfigurationType="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\..\..\..\include"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
CompileAs="0"
|
||||||
|
DisableSpecificWarnings="4267;4996"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="..\..\..\..\obj\release\lib\ogg_static.lib"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="uuid.lib"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="..\..\..\..\obj\release\bin"
|
||||||
|
IntermediateDirectory="Release"
|
||||||
|
ConfigurationType="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
FavorSizeOrSpeed="1"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
|
AdditionalIncludeDirectories="..\..\..\..\include"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
BufferSecurityCheck="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
CompileAs="0"
|
||||||
|
DisableSpecificWarnings="4267;4996"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="..\..\..\..\obj\release\lib\ogg_static.lib"
|
||||||
|
LinkIncremental="1"
|
||||||
|
IgnoreDefaultLibraryNames="uuid.lib"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
LinkTimeCodeGeneration="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
|
UniqueIdentifier="{39992580-89DB-4b41-8E8B-625F9E28BEBF}"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC727F1-C7A5-1376-A061-2AF2D742A2F0}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\main.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
186
examples/c/decode/file/main.c
Normal file
186
examples/c/decode/file/main.c
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
/* example_c_decode_file - Simple FLAC file decoder using libFLAC
|
||||||
|
* Copyright (C) 2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This example shows how to use libFLAC to decode a FLAC file to a WAVE
|
||||||
|
* file. It only supports 16-bit stereo files.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "FLAC/stream_decoder.h"
|
||||||
|
|
||||||
|
static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
|
||||||
|
static void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
|
||||||
|
static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
||||||
|
|
||||||
|
FLAC__uint64 total_samples = 0;
|
||||||
|
unsigned sample_rate = 0;
|
||||||
|
unsigned channels = 0;
|
||||||
|
unsigned bps = 0;
|
||||||
|
|
||||||
|
static FLAC__bool write_little_endian_uint16(FILE *f, FLAC__uint16 x)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
fputc(x, f) != EOF &&
|
||||||
|
fputc(x >> 8, f) != EOF
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static FLAC__bool write_little_endian_int16(FILE *f, FLAC__int16 x)
|
||||||
|
{
|
||||||
|
return write_little_endian_uint16(f, (FLAC__uint16)x);
|
||||||
|
}
|
||||||
|
|
||||||
|
static FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 x)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
fputc(x, f) != EOF &&
|
||||||
|
fputc(x >> 8, f) != EOF &&
|
||||||
|
fputc(x >> 16, f) != EOF &&
|
||||||
|
fputc(x >> 24, f) != EOF
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
FLAC__bool ok = true;
|
||||||
|
FLAC__StreamDecoder *decoder = 0;
|
||||||
|
FLAC__StreamDecoderInitStatus init_status;
|
||||||
|
FILE *fout;
|
||||||
|
|
||||||
|
if(argc != 3) {
|
||||||
|
fprintf(stderr, "usage: %s infile.flac outfile.wav\n", argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((decoder = FLAC__stream_decoder_new()) == NULL) {
|
||||||
|
fprintf(stderr, "ERROR: allocation decoder\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((fout = fopen(argv[2], "wb")) == NULL) {
|
||||||
|
fprintf(stderr, "ERROR: opening %s for output\n", argv[2]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
(void)FLAC__stream_decoder_set_md5_checking(decoder, true);
|
||||||
|
|
||||||
|
init_status = FLAC__stream_decoder_init_file(decoder, argv[1], write_callback, metadata_callback, error_callback, /*client_data=*/fout);
|
||||||
|
if(init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
|
||||||
|
fprintf(stderr, "ERROR: initializing decoder: %s\n", FLAC__StreamDecoderInitStatusString[init_status]);
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ok) {
|
||||||
|
ok = FLAC__stream_decoder_process_until_end_of_stream(decoder);
|
||||||
|
fprintf(stderr, "decoding: %s\n", ok? "succeeded" : "FAILED");
|
||||||
|
fprintf(stderr, " state: %s\n", FLAC__StreamDecoderStateString[FLAC__stream_decoder_get_state(decoder)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
FLAC__stream_decoder_delete(decoder);
|
||||||
|
fclose(fout);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
|
||||||
|
{
|
||||||
|
FILE *f = (FILE*)client_data;
|
||||||
|
const FLAC__uint32 total_size = (FLAC__uint32)(total_samples * channels * (bps/8));
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
(void)decoder;
|
||||||
|
|
||||||
|
if(total_samples == 0) {
|
||||||
|
fprintf(stderr, "ERROR: this example only works for FLAC files that have a total_samples count in STREAMINFO\n");
|
||||||
|
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
|
||||||
|
}
|
||||||
|
if(channels != 2 || bps != 16) {
|
||||||
|
fprintf(stderr, "ERROR: this example only supports 16bit stereo streams\n");
|
||||||
|
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write WAVE header before we write the first frame */
|
||||||
|
if(frame->header.number.sample_number == 0) {
|
||||||
|
if(
|
||||||
|
fwrite("RIFF", 1, 4, f) < 4 ||
|
||||||
|
!write_little_endian_uint32(f, total_size + 36) ||
|
||||||
|
fwrite("WAVEfmt ", 1, 8, f) < 8 ||
|
||||||
|
!write_little_endian_uint32(f, 16) ||
|
||||||
|
!write_little_endian_uint16(f, 1) ||
|
||||||
|
!write_little_endian_uint16(f, channels) ||
|
||||||
|
!write_little_endian_uint32(f, sample_rate) ||
|
||||||
|
!write_little_endian_uint32(f, sample_rate * channels * (bps/8)) ||
|
||||||
|
!write_little_endian_uint16(f, channels * (bps/8)) || /* block align */
|
||||||
|
!write_little_endian_uint16(f, bps) ||
|
||||||
|
fwrite("data", 1, 4, f) < 4 ||
|
||||||
|
!write_little_endian_uint32(f, total_size)
|
||||||
|
) {
|
||||||
|
fprintf(stderr, "ERROR: write error\n");
|
||||||
|
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write decoded PCM samples */
|
||||||
|
for(i = 0; i < frame->header.blocksize; i++) {
|
||||||
|
if(
|
||||||
|
!write_little_endian_int16(f, buffer[0][i]) || /* left channel */
|
||||||
|
!write_little_endian_int16(f, buffer[1][i]) /* right channel */
|
||||||
|
) {
|
||||||
|
fprintf(stderr, "ERROR: write error\n");
|
||||||
|
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
|
||||||
|
{
|
||||||
|
(void)decoder, (void)client_data;
|
||||||
|
|
||||||
|
/* print some stats */
|
||||||
|
if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
|
||||||
|
/* save for later */
|
||||||
|
total_samples = metadata->data.stream_info.total_samples;
|
||||||
|
sample_rate = metadata->data.stream_info.sample_rate;
|
||||||
|
channels = metadata->data.stream_info.channels;
|
||||||
|
bps = metadata->data.stream_info.bits_per_sample;
|
||||||
|
|
||||||
|
fprintf(stderr, "sample rate : %u Hz\n", sample_rate);
|
||||||
|
fprintf(stderr, "channels : %u\n", channels);
|
||||||
|
fprintf(stderr, "bits per sample: %u\n", bps);
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
fprintf(stderr, "total samples : %I64u\n", total_samples);
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "total samples : %llu\n", total_samples);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
|
||||||
|
{
|
||||||
|
(void)decoder, (void)client_data;
|
||||||
|
|
||||||
|
fprintf(stderr, "Got error callback: %s\n", FLAC__StreamDecoderErrorStatusString[status]);
|
||||||
|
}
|
67
examples/examples.dsp
Normal file
67
examples/examples.dsp
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="examples" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Generic Project" 0x010a
|
||||||
|
|
||||||
|
CFG=examples - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "examples.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "examples.mak" CFG="examples - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "examples - Win32 Release" (based on "Win32 (x86) Generic Project")
|
||||||
|
!MESSAGE "examples - Win32 Debug" (based on "Win32 (x86) Generic Project")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName "all"
|
||||||
|
# PROP Scc_LocalPath "."
|
||||||
|
MTL=midl.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "examples - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "..\obj\release"
|
||||||
|
# PROP Intermediate_Dir "..\obj\release"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "examples - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "..\obj\debug"
|
||||||
|
# PROP Intermediate_Dir "..\obj\debug"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "examples - Win32 Release"
|
||||||
|
# Name "examples - Win32 Debug"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\README
|
||||||
|
# End Source File
|
||||||
|
# End Target
|
||||||
|
# End Project
|
Loading…
Reference in New Issue
Block a user