Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    7
  • comment
    1
  • views
    1097

liboggvorbis as a single-file

Sign in to follow this  
piecuch.p

761 views

liboggvorbis combined into one file - might be usefull if you want to simpifie dependencies of your project. 

Get it here.

-rw-r--r--  1 piecuchp  staff   2.0M Apr 26 17:55 oggvorbis.c
-rw-r--r--  1 piecuchp  staff   134K Apr 26 17:55 oggvorbis.h
-rw-r--r--  1 piecuchp  staff   3.1M Apr 26 17:55 oggvorbis.o

 

Combining script is quite complex and not well commented (also I might make some changes into source code that I don't recall right now) but maybe someone find it usefull:

#!/bin/bash

src_c="\
\
 lib/codebook.h lib/mdct.h lib/envelope.h lib/smallft.h lib/codec_internal.h lib/lookup.h lib/lookup_data.h lib/lpc.h lib/lsp.h lib/masking.h lib/misc.h lib/os.h lib/registry.h lib/scales.h lib/window.h\
 lib/books/floor/floor_books.h lib/books/coupled/res_books_stereo.h lib/books/uncoupled/res_books_uncoupled.h lib/books/coupled/res_books_51.h\
 lib/analysis.c lib/bitrate.c lib/block.c lib/codebook.c lib/envelope.c lib/floor0.c lib/floor1.c lib/info.c lib/lookup.c lib/lpc.c lib/lsp.c lib/mapping0.c lib/mdct.c lib/psy.c lib/registry.c lib/res0.c lib/sharedbook.c lib/smallft.c lib/synthesis.c lib/vorbisenc.c lib/vorbisfile.c lib/window.c\
"
src_h="\
 include/ogg/config_types.h include/ogg/os_types.h include/ogg/ogg.h\
 lib/ogg/bitwise.c lib/ogg/framing.c\
 include/vorbis/codec.h include/vorbis/vorbisenc.h include/vorbis/vorbisfile.h\
"

mkdir -p lib-portable

files=0

C="lib-portable/oggvorbis.c"
H="lib-portable/oggvorbis.h"

echo "/** $0: `date`*/" > "$C"
echo "" >> "$C"
echo "_#include \"oggvorbis.h\"" >> "$C"
echo "" >> "$C"
echo "#define _BUILD_SINGLE_SOURCE" >> "$C"
echo "#ifdef __cplusplus" >> "$C"
echo "# define restrict __restrict__" >> "$C"
echo "#endif" >> "$C"
echo "" >> "$C"

echo "/** $0: `date`*/" > "$H"
echo "" >> "$H"

line_offset=3

for c in $src_c; do
  if [ -e "$c" ]; then
    echo "/** $0: $c*/" >> "$C"
    echo "" >> "$C"
    #line=`cat "$C"|wc -l`
    echo "#line $line_offset \"$c\"" >> "$C"
    cat $c \
            | sed "s/\([^_]\)ilog/\1ilog${cnt}/g" \
            | sed "s/FLOOR1_fromdB_LOOKUP/FLOOR1_fromdB_LOOKUP${cnt}/g" \
            | sed "s/bitreverse/bitreverse${cnt}/g" \
        >> "$C"
    echo "" >> "$C"
    ((cnt++))
    echo -n "."
  else
    # use '' for space
    echo "" >> "$C"
    echo "${c//\'\'/ }" >> "$C"
    echo "" >> "$C"
    echo -n "_"
  fi
done

for h in $src_h; do
  if [ -e "$h" ]; then
    echo "/** $0: $h*/" >> "$H"
    echo "" >> "$H"
    echo "#line $line_offset \"$h\"" >> "$H"
    cat $h >> "$H"
    echo "" >> "$H"
    ((cnt++))
    echo -n "."
  else
    # use '' for space
    echo "" >> "$H"
    echo "${h//\'\'/ }" >> "$H"
    echo "" >> "$H"
    echo -n "_"
  fi
done

for i in lib/modes/*.h; do
    inl=`basename "$i"`
    sed -i "" -e "/#include \"modes\/$inl\"/r $i" -e "/#include \"modes\/$inl\"/d" "$C"
    echo -n "@"
done

echo ""

sed -i "" -e "/^#\(.*\)include \".*\.h\".*$/d" "$H"
sed -i "" -e "/^#\(.*\)include \<ogg\/.*\.h\>.*$/d" "$H" "$C"
sed -i "" -e "/#include_inline \"psy.h\"/r lib/psy.h" -e "/#include_inline \"psy.h\"/d" "$C"
sed -i "" -e "/#include_inline \"bitrate.h\"/r lib/bitrate.h" -e "/#include_inline \"bitrate.h\"/d" "$C"
sed -i "" -e "/#include_inline \"highlevel.h\"/r lib/highlevel.h" -e "/#include_inline \"highlevel.h\"/d" "$C"
sed -i "" -e "/#include_inline \"backends.h\"/r lib/backends.h" -e "/#include_inline \"backends.h\"/d" "$C"
sed -i "" -e "/#include_inline \"asm_arm.h\"/r tremor/asm_arm.h" -e "/#include_inline \"asm_arm.h\"/d" "$C"
sed -i "" -e "/# include \"collect.c\"/r theora/lib/collect.c" -e "/# include \"collect.c\"/d" "$C"
sed -i "" -e "/^#\(.*\)include \".*\.h\".*$/d" "$C"
sed -i "" -e "/^#\(.*\)include \<theora\/.*\.h\>.*$/d" "$C"

sed -i "" -e "s/^_#/#/" "$C"

echo "** Done (with $cnt files)"

 

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By Tanzan
      I was just wondering what keeps everyone motivated to finish.
      I read at many tips&tricks to at least finish what you started so thats what i do i really want to finish this game that i'm working on...and i will.
      But it is now and then so hard to stay motivated ...so i will use your comments to keep me motivated 😉
       
      Thx!
    • By Jordan Winslow
      Royalty Free Music for Game Developers
      If you found this page, you probably wondered at some point, "Why is it called Royalty Free Music when none of it is FREE?!" and maybe you already learned the definition of Royalty Free does not necessarily mean the content itself is free but rather refers to the "right to use copyrighted material without the need to pay license fees or usage fees."
      To put it simply, Royalty Free just means you don't have to pay to use the content. So why do so many people charge for it, and isn't that exactly the opposite of what Royalty Free means? Obviously artists and content makers who spend a lot of effort making something should be rewarded for their time, but in my opinion, they should not use the term "Royalty Free" to refer to their paid content.
      That is why I developed a FREE Royalty Free Music for YouTube Library for anyone and everyone who is looking for free professional music to use in their films, television shows, youtube promos, video games, you get the picture.
      How to Download
      To begin, simply choose a category of music from the list on the website linked above:

      Once you have selected your desired category of music, hover your mouse or finger over it and click the red button that appears to open up a small window with a media player in it that will look something like this:

      Click a song to listen to it, and click the down arrow to download the song, it's that easy!
      Licensing & Copyright Information
      If you like the song and you want to use it in a non-commercial project (something that does not earn you money) you can do that for free simply by attributing me in your credits somewhere! Just put "Music by Jordan Winslow on https://jordanwinslow.me/royaltyfreemusic" or simply "Music Downloaded from https://jordanwinslow.me/royaltyfreemusic"
      If you would like to use the music in a commercial project (something that earns you money) there is still no charge, but one more step: simply fill out the Royalty Free Music Commercial License Request Form.
      Downloading Free Royalty Free Music for your YouTube creations has never been so easy!

      View full story
    • By Jordan Winslow
      Royalty Free Music for Game Developers
      If you found this page, you probably wondered at some point, "Why is it called Royalty Free Music when none of it is FREE?!" and maybe you already learned the definition of Royalty Free does not necessarily mean the content itself is free but rather refers to the "right to use copyrighted material without the need to pay license fees or usage fees."
      To put it simply, Royalty Free just means you don't have to pay to use the content. So why do so many people charge for it, and isn't that exactly the opposite of what Royalty Free means? Obviously artists and content makers who spend a lot of effort making something should be rewarded for their time, but in my opinion, they should not use the term "Royalty Free" to refer to their paid content.
      That is why I developed a FREE Royalty Free Music for YouTube Library for anyone and everyone who is looking for free professional music to use in their films, television shows, youtube promos, video games, you get the picture.
      How to Download
      To begin, simply choose a category of music from the list on the website linked above:

      Once you have selected your desired category of music, hover your mouse or finger over it and click the red button that appears to open up a small window with a media player in it that will look something like this:

      Click a song to listen to it, and click the down arrow to download the song, it's that easy!
      Licensing & Copyright Information
      If you like the song and you want to use it in a non-commercial project (something that does not earn you money) you can do that for free simply by attributing me in your credits somewhere! Just put "Music by Jordan Winslow on https://jordanwinslow.me/royaltyfreemusic" or simply "Music Downloaded from https://jordanwinslow.me/royaltyfreemusic"
      If you would like to use the music in a commercial project (something that earns you money) there is still no charge, but one more step: simply fill out the Royalty Free Music Commercial License Request Form.
      Downloading Free Royalty Free Music for your YouTube creations has never been so easy!
    • By Pedro Alves
      i have a problem i can make work the verificay if user existe our not
      i using nodejs ,express,mysql
      i put my link to project in github the code its to big
      https://github.com/Kammikazy/project
      find the soluction to my problem
       
       
       
       
    • By Pedro Alves
      Hello i try retrive data from a table cidades and show in my express with jade
       
      const express = require('express') const connection = require('../../Config/database') const controllerAdmin = require('../../controllers/Administration') const router = express.Router() //router.get('/Administration', controllerLogin.FindCidades) router.get('/Administration', (req, res) => res.render('Administration/index',{username:res.locals.user.username ,nome:res.locals.cidade.Nome,coordenas:res.locals.cidade.coordenadas,continente:res.locals.cidade.continente })) module.exports = app => app.use('/', router) const authenticateUser = async (connection, req, res) => { const user = await User.findUser(connection, req.body.username) if(!user){ return res.render('login/login',{error: true}) } if(!await bcrypt.compare(req.body.password, user.password)){ return res.render('login/login', {error: true}) } else{ // user.password = undefined req.session.user = user //const nivel = await User.findnivel(connection, req.body.username) if(user.nivel==1){ const cu = await Cidade.findcidade(connection, req.body.username) // req.session.user.nivel = nivel res.locals.user= user req.session.cidade= cu res.locals.cidade= req.session.cidade // console.log(1); console.log("rewr",cu); res.redirect('/Administration'); }else if(user.nivel==2){ // req.session.nivel = nivel console.log(2); // res.redirect('/Users') }else if(user.nivel==3){ // req.session.nivel = nivel console.log(3); // res.redirect('/Administration') }else if(user.nivel==4){ // req.session.nivel = nivel console.log(4); // res.redirect('/Administration') } else if(user.nivel==5){ // req.session.nivel = nivel console.log(5); // res.redirect('/Administration') } else { console.log("banned"); } } } const findcidade = (connection,username) => { return new Promise ((resolve, reject) => { connection.query(`SELECT cidade.cod_cidade, cidade.Nome,cidade.continente,cidade.coordenadas,cidade.ouro,cidade.madeira,cidade.metal,cidade.pedra,cidade.energia, cidade.comida,cidade.petrolio FROM user INNER JOIN cidade ON user.cod_user=cidade.cod_user WHERE user.username='${username}' `, (err, result) =>{ if(err){ reject(err) }else{ if(result.length>0){ resolve(result) } else{ resolve(false) } } }) }) } give this error what i doing wrong
      i want show  for example user maria have athenas and rome

×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!