Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Thank You for your continued support and contributions!

+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Adding a codec
« previous next »
  • Print
Pages: [1]

Author Topic: Adding a codec  (Read 1688 times)

Offline bharvey63

  • Member
  • *
  • Posts: 5
Adding a codec
« on: March 21, 2012, 03:02:43 PM »
I'm trying to add follow the "add new codec" process as described on the site.. I decided to start by "cloning" an existing codec to a new, imaginary format called "foo" just to make sure theprocess works. I chose the flac codec and began by copying flac.c to foo.c in both apps/codecs and apps/metadata.

I can get this working (see below) with one exception, that is to say, if I rename a .flac file to .foo it plays with the new code (proven by DEBUGF statments). The exception is that I cannot get the build prcess to pick up the foo.c file in the metadata directory, hence I cannot present a "get_foo_metadata" function to the linker. If I leave the parse fuction "get_flac_metadata" in the audio_format enum, it works.

So, my question is: How do I integrate a new file in the apps/metadata directory into the build process???

Below is my annotated results of having followed the "add new codec" procedure from the web. Like I said, I seem to be missing only one piece, how to get the build process to "pick up on" the foo.c file in the metadata directory (and hence the get_foo_metadata funtion thereof)

Thanks for any help and please ask for more info if needed.

Regards,

-B

---------------------------------------------------------------------------------------------------------------
ADDING NEW CODEC STEPS:

Adding a decoder to Rockbox

This is of course subject to change as things move around in the source.

    Put your source in apps/codecs
   
        >>yes, copied flac.c to foo.c

    apps/codecs/SOURCES
        Add the file name.
       
            >>yes, added foo.c

    apps/codecs/Makefile
        Add a rule like ${OBJDIR}/wav.elf : $(OBJDIR)/wav.o
       
        >>??? There is no Makefile in apps/codecs, what to do here?
       
        >>Is it needed? The foo codec gets built anyway.

    apps/metadata.h
        Add a value to the Audio file types enum.
       
        >>yes, AFMT_FOO

    apps/metadata.c
        Add a case to the switch in get_metadata()
       
            >>??? No switch in get_metadata()
           
        Add an entry or entries to audio_formats[]
       
            >>yes,
           
            >>[AFMT_FOO] =
            >>AFMT_ENTRY("FOO", "foo", NULL, get_foo_metadata,   "foo\0"),
           
            >>!!! This is where the problem is. "get_foo_metadata()" in apps/metadata/foo.c never gets built.
           
            >>Substututing get_flac_metadata in AFMT_FOO above works because apps/metadata/flac.c
            >>is already getting built.

        If one codec supports multiple formats, add a case to get_audio_base_codec_type().
        If the format is atomic audio (must be completely loaded onto the buffer), add a case to get_audio_base_data_type().
        If file can be resumed without loading it from the beginning, add a case to format_buffers_with_offset().
       
        >>Haven't dealt with these yet

    apps/metadata
        Add your metadata detection here.
       
        >>yes, copied flac.c to foo.c
       
        >>??? foo.c doesn't get built. WHY and HOW!?!?!?

    apps/filetypes.c
        Add an element to inbuilt_filetypes struct.
       
        >>yes,  { "gnaural", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
       
    NOT LISTED
   
        Because I'm cloning the flac codec, I need this in apps/codecs/codec.make:
   
        $(CODECDIR)/foo.codec : $(CODECDIR)/libffmpegFLAC.a


Oh yes, one more thing. One time the build did produce a foo.o file but it removed it too. I have not been able to duplicate this.
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 9156
Re: Adding a codec
« Reply #1 on: March 21, 2012, 05:21:43 PM »
Add your new metadata file the the SOURCES file right after flac.c so that the make system knows to compile it.

FWIW I think we got rid of apps/metadata a couple days ago, so if you've got an older checkout you might want to update before putting to much work into this:

http://git.rockbox.org/?p=rockbox.git;a=commit;h=b5716df4cb2837bbbc42195cf1aefcf03e21d6a6

Logged

Offline bharvey63

  • Member
  • *
  • Posts: 5
Re: Adding a codec
« Reply #2 on: March 21, 2012, 05:56:20 PM »
Ah! apps/codecs/SOURCES is mentioned but I never realized that there is also an apps/SOURCES.

Awesome!

Also, thanks for the heads up on changes to the metadata directory, in general.

-B
Logged

Offline bharvey63

  • Member
  • *
  • Posts: 5
Re: Adding a codec
« Reply #3 on: March 22, 2012, 05:20:17 PM »
re refactoring, yes apps/metadata.[ch] moved into metadata directory and that in turn has been relocated into lib/rbcodec.

-B
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Adding a codec
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.131 seconds with 22 queries.