Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    9
  • comment
    1
  • views
    1609

liboggvorbis as a single-file

Sign in to follow this  
piecuch.p

1063 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 G-Dot
      Hello everyone! I've decided to implement a destructible enemies system.
       
      Description:
      When bullet hit enemy in specific part of his body(arm fo example) armour, which covers that part of body, will fall off. Enemies in my game are robots so this means that when shooting them certain plates of their armour will fall off. All enemies will have a different amount of armour plates
       
      My solution: 
      The only solution I came up with is to make an actor with a static mesh and attach it to the bones of enemy's skeletal mesh. When bullet hit that actor it detaches and fly away with add impulse node.

       
      Question: 
      Maybe there is a better solution, which I'm missing and it's more efficient. 
    • By JeremyAlessi
      In the 5th PixelCast, Jeremy shares some fond memories of Castlevania IV now that it's October and Halloween gaming is on. Jeremy also dives into the news and covers an issue that's been on his heart and mind lately; the increasing number of game developers who seem to be passing away in their 40's and 50's.
       
       

      View full story
    • By JeremyAlessi
      In the 5th PixelCast, Jeremy shares some fond memories of Castlevania IV now that it's October and Halloween gaming is on. Jeremy also dives into the news and covers an issue that's been on his heart and mind lately; the increasing number of game developers who seem to be passing away in their 40's and 50's.
       
       
    • By JeremyAlessi
      In episode #2, Jeremy adds some formatting by covering the news, reflecting on the inspiration for PixelFest, and delving into an important developer lesson; that period of time everyone faces when they have to decide whether to play a game or make a game with their time.
      https://youtu.be/fvaG_pIIUYM
       

      View full story
    • By JeremyAlessi
      In episode #2, Jeremy adds some formatting by covering the news, reflecting on the inspiration for PixelFest, and delving into an important developer lesson; that period of time everyone faces when they have to decide whether to play a game or make a game with their time.
      https://youtu.be/fvaG_pIIUYM
       
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!