User Tools

Site Tools


general:source_file_notes

This is an old revision of the document!


Source file notes

This section of the documentation is designed to help outside (and inside) code writers quickly figure out where a patch or feature needs to be written for, as well as generally provide an overview of the source files and their purposes. Files in Avidemux tend to do more than just one task, so most information here will not always describe the full range of a file's functions.

General notes

Avidemux is written using the C/C++ programming language, but it does not use the STL, though this is not a very big deal in general. Avidemux is built with the GTK+ graphical libraries. Lastly Avidemux also has the SpiderMonkey ECMAScript scripting engine built into it for project handling. As of yet, this cannot be directly called by Avidemux. If you want to add code or edit code for Avidemux, you will need to understand these languages and libraries. The ECMAScript is rarely used outside of a few specific functions, so most people do not need to know it if they want to modify code. However C/C++ and GTK+ are usually necessary knowledge.

Avidemux makes heavy use of polymorphims and class derivation. This means that in most of the source files you will see calls to functions and variables that are not always present in the written file itself.

General architecture

Any processing can be seen as having 3 working parts :

  • The demuxer : All demuxers are derivated from the vidHeader class and provide information and access capabilities. Among the capabilities, there is the ability to retrieve any frame and the associated flags with no need for sequential seeking.
  • The editor : The editor's job is to associate codecs to the streams present in the demuxer's output. The editor also handles editing (append, cut, etc…) and the b-frame reordering logic. The GUI ask for a frame from the editor, and the editor manages all the logic by itself. Normally adding a new format does NOT modify the editor.
  • The output muxer : All output muxers are in directories beginning with oplug_ and each one deals with one output format.

Directory: /avidemux/

  • ADM_pp.cpp : Post processing filter code
  • ADM_pp.h : Post processing filter code headers
  • gtk_gui.cpp : Controls all of the GUI. Makes calls to various other GUI dialogs and inputs.

ADM_3gp

Contains QuickTime, MP4, 3GPP input handling

  • ADM_3gp.cpp : among other things, this handles the QuickTime, MP4, 3GPP input formats (demuxing, variants)
  • ADM_3gp.h : among other things, this handles the QuickTime, MP4, 3GPP input formats (demuxing, variants)

ADM_audiofilter

Contains audio filter files (generally not the source code for the audio codecs themselves), including the Mixer. Encoding is seen as a filter so interfaces to audio encoders are in that directory too.

  • audioencoder.cpp : Code for the general audio processing within Avidemux
  • audioencoder.h : Header code for audioencoder.cpp
  • audioencoder_faac.cpp : Faac audio codec encoder source code
  • audioencoder_faac.h : Header code for Faac encoder
  • audioencoder_lame.cpp : Lame audio codec encoder source code
  • audioencoder_lame_param.h Parameter header file for Lame audio codec encoder , #included and used in the ADM_dialog/DIA_lame.cpp
  • audioencoder_lavcodec.cpp :
  • audioencoder_lavcodec.h :
  • audioencoder_pcm.cpp : PCM audio codec encoder source code
  • audioencoder_pcm.cpp : Header code for PCM audio codec encoder source code
  • audioencoder_twolame.cpp : Twolame audio codec encoder source code
  • audioencoder_twolame.h : Header code for Twolame codec encoder
  • audioencoder_vorbis.cpp : Vorbis audio codec encoder source code
  • audioencoder_vorbis.h : Header code for Vorbis audio codec encoder source code
  • audioencoder_vorbis_param.h : Parameter header file for Vorbis audio codec encoder, probably #included and used in the ADM_dialog/DIA_vorbis.cpp
  • audiofilter_mixer.cpp : The audio filter mixer

ADM_audiocodec

Files for encoding to various (audio) codecs (decoder only, see this page's link list for encoders)

  • ADM_codecac3.cpp : AC3 audio handling, including Dolby
  • ADM_codecwma.cpp : WMA audio handling

ADM_codecs

Files for encoding to various (video) codecs

  • ADM_codecs.cpp : Store some of the FourCC code for use with encoding/decoding video via the libavcodec
  • ADM_ffmpeg.cpp : The FFmpeg codecs source codes themselves
  • ADM_x264.cpp : The x264/h264 codec source code itself
  • ADM_x264.h : The x264/h264 codec source code itself
  • ADM_xvid4.cpp : The XviD codec source code itself
  • ADM_xvid4.h : The XviD codec source code itself
  • ADM_ffmp43.cpp : The decoders related to FFmpeg's libavcodec library.

ADM_dialog

GUI dialogs and windows for filters, codec configs, preferences, etc. Mostly everyting with a GUI can be found in this directory.

  • DIA_calculator.cpp : Bitrate calculator dialog
  • DIA_crop.cpp : Crop video filter dialog
  • DIA_defaultAudio.cpp : Default user interface dialog for audio codecs
  • DIA_DVDff.cpp : FFmpeg MPEG-2 DVD dialog
  • DIA_encoding.cpp : Encoding information dialog/window (How does this different from DIA_working.cpp?)
  • DIA_jobs_save.cpp : “Save to Joblist” dialog
  • DIA_jobs.cpp : “Joblist” dialog
  • DIA_lame.cpp : Lame audio encoder dialog
  • DIA_mcdeint.cpp : mcDeinterlace video filter dialog
  • DIA_ocr.cpp : “OCR (Vobsub → srt)” subtitles dialog window
  • DIA_prefs.cpp : Menu: Edit → Preferences dialog
  • DIA_preview.cpp : Video Preview dialog
  • DIA_properties.cpp : Video Properties dialog
  • DIA_srt.cpp : Subtitle Filter dialog
  • DIA_vcodec.cpp : Appears to be the old encoding codec list pulldown menu. <FONT COLOR=“#990000”>May be obsolete</FONT>
  • DIA_vobsub.cpp : Vobsub subtitle dialog
  • DIA_vorbis.cpp : Vorbis audio codec pulldown menu
  • DIA_working.cpp : Video Encoding Status Window
  • DIA_x264.cpp : x264/h264 codec configure window
  • DIA_xvid4.cpp : XviD codec configure window

ADM_encoder

Contains source files that handle the high level video encoders. The high level encoders offer the same interface to core whatever the codec used. They also handle internally the setup for 2 pass encoding. They can be seen as an abstraction layer.

  • ADM_encCodecDesc.h : Contains default codec value settings (for GUI dialogs) that are loaded on startup
  • ADM_vidEncode.hxx : Codec dialog options (like 2-pass file size, 2-pass bitrate, quantizer). Contains codec names for use when passing as parameters to other functions
  • adm_encffmpeg1.cpp : FFmpeg MPEG-1 encoder
  • adm_encx264.cpp : C++ implementation of the X264 Encoder, contains all the internal Avidemux function calls to other functions, including encode, logging, and computing bitrate

ADM_filter

Contains the management code (loading and GUI's) for the video filters. For actual video filter files see ADM_video

  • filter_declaration.cpp : handles some of the loading and declaring of files
  • video_filter.h : handles some of the loading and declaring of video filter names, descriptions, configurations

ADM_lavcodec

Contains lots of various codecs handled by the libavcodec and associated codecs.

ADM_lavformat

It is the file format library from ffmpeg. It is only used actually to save as mp4. There is some dead code to use it to output mpeg TS also.

  • mov.c : The reading part for mov/mp4/3Gp/… Not used by avidemux but some code is shared with movenc.c which is used.
  • movenc.c : Most of the mp4 writing code is here, with very little modifications concerning the way mp3 is stored.

ADM_library

Contains a miscellanious collection of files for various small and a large tasks, include frames, images, file IO, FourCC information, riff parser

  • default.h : Contains information about AMD64 fallback typedef settings

ADM_mplex

Contains files for audio muxing and demuxing, audio stream information and handling, and various pieces of code relating to general audio management

  • ADM_mthread.cpp : Some multithreaded multiplexing * ADM_mthread.h : Header for some multithreaded multiplexing
  • interact.cpp :

ADM_script

Contains ECMA JavaScript scripting files and source code.

  • ADM_JSAvidemuxAudio.cpp : code that handles

ADM_toolkit

Contains some useful functions, mostly gtk related. There are also some code to emulate unix functions on win32.

  • ADM_threads.cpp : uncertain multithreading code
  • ADM_threads.h : uncertain multithreading code
  • eggtray_win32.c : Animated icon for Win32
  • TLK_filesel.cpp : File selection functions (read/write)

ADM_script

Controls the scripts (most specifically the ECMA .js scripts)

ADM_video

Contains most of the actual source files for video filters

Each filter is declared as a c++ class. They are all derivated from the same class. They all use one input and one output and are chained together.

They exchange their configuration with the outside world through the Couples class that does the translation between a parameter name and its value. Most of the filters are ported from mplayer or avisynth. The internals of avidemux are close to both of them. There is also some code to provide a C emulation layer to avisynth so that porting code is easier.

general/source_file_notes.1271454223.txt.gz · Last modified: 2012/11/11 08:51 (external edit)