## faad faad — Free MPEG-2/4 AAC decoder |

## Synopsis

                        GstFaad;

## Description

faad decodes AAC (MPEG-4 part 3) stream.

### Example launch lines

    1
    gst-launch filesrc location=example.mp4 ! qtdemux ! faad ! audioconvert ! audioresample ! autoaudiosink

Play aac from mp4 file.

    1
    gst-launch filesrc location=example.adts ! faad ! audioconvert ! audioresample ! autoaudiosink

Play standalone aac bitstream.

## Details

### GstFaad

    typedef struct {
      GstElement element;

      GstPad    *srcpad;
      GstPad    *sinkpad;

      guint      samplerate; /* sample rate of the last MPEG frame    */
      guint      channels;   /* number of channels of the last frame  */
      guint      bps;        /* bytes per sample                      */
      guchar    *channel_positions;

      guint8     fake_codec_data[2];

      GstAdapter *adapter;

      /* FAAD object */
      faacDecHandle handle;
      gboolean init;

      gboolean packetised; /* We must differentiate between raw and packetised streams */

      gint64  prev_ts;     /* timestamp of previous buffer                    */
      gint64  next_ts;     /* timestamp of next buffer                        */
      guint64 bytes_in;    /* bytes received                                  */
      guint64 sum_dur_out; /* sum of durations of decoded buffers we sent out */
      gint    error_count;
      gboolean discont;
      gint    sync_flush;

      /* segment handling */
      GstSegment segment;

      /* list of raw output buffers for reverse playback */
      GList *queued;
      /* gather/decode queues for reverse playback */
      GList *gather;
      GList *decode;
    } GstFaad;