File: e_ffmpeg_audio.c

package info (click to toggle)
gmerlin-encoders 1.2.0-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,196 kB
  • ctags: 1,660
  • sloc: ansic: 11,635; sh: 10,993; makefile: 203; sed: 16
file content (124 lines) | stat: -rw-r--r-- 4,170 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*****************************************************************
 * gmerlin-encoders - encoder plugins for gmerlin
 *
 * Copyright (c) 2001 - 2011 Members of the Gmerlin project
 * gmerlin-general@lists.sourceforge.net
 * http://gmerlin.sourceforge.net
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * *****************************************************************/

#include <config.h>
#include <gmerlin/translation.h>
#include "ffmpeg_common.h"

static const ffmpeg_format_info_t formats[] =
  {
    {
      .name = "SUN AU Format",
      .short_name = "au",
      .extension =  "au",
      .max_audio_streams = 1,
      .audio_codecs = (enum AVCodecID[]){  AV_CODEC_ID_PCM_MULAW,
                                       AV_CODEC_ID_PCM_S16BE,
                                       AV_CODEC_ID_PCM_ALAW,
                                       AV_CODEC_ID_NONE },
    },
    {
      .name = "Raw AC3",
      .short_name = "ac3",
      .extension =  "ac3",
      .max_audio_streams = 1,
      .audio_codecs = (enum AVCodecID[]){  AV_CODEC_ID_AC3,
                                       AV_CODEC_ID_NONE },
    },
    {
      .name =       "AIFF",
      .short_name = "aiff",
      .extension =  "aif",
      .max_audio_streams = 1,
      .audio_codecs = (enum AVCodecID[]){  AV_CODEC_ID_PCM_S16BE,
                                       AV_CODEC_ID_PCM_S8,
                                       AV_CODEC_ID_PCM_ALAW,
                                       AV_CODEC_ID_PCM_MULAW,
                                       AV_CODEC_ID_NONE },
    },
    {
      .name =       "MP2",
      .short_name = "mp2",
      .extension =  "mp2",
      .max_audio_streams = 1,
      .audio_codecs = (enum AVCodecID[]){  AV_CODEC_ID_MP2,
                                       AV_CODEC_ID_NONE },
    },
#if LIBAVCODEC_BUILD >= ((51<<16)+(32<<8)+0)
    {
      .name =       "WMA",
      .short_name = "asf",
      .extension =  "wma",
      .max_audio_streams = 1,
      .audio_codecs = (enum AVCodecID[]){  AV_CODEC_ID_WMAV2,
                                       AV_CODEC_ID_WMAV1,
                                       AV_CODEC_ID_NONE },
    },
#endif
    { /* End of formats */ }
  };

static void * create_ffmpeg()
  {
  return bg_ffmpeg_create(formats);
  }

const bg_encoder_plugin_t the_plugin =
  {
    .common =
    {
      BG_LOCALE,
      .name =           "e_ffmpeg_audio",     /* Unique short name */
      .long_name =      TRS("FFmpeg audio encoder"),
      .description =    TRS("Plugin for encoding various audio formats with ffmpeg \
(http://www.ffmpeg.org)."),
      .type =           BG_PLUGIN_ENCODER_AUDIO,
      .flags =          BG_PLUGIN_FILE,
      .priority =       5,
      .create =         create_ffmpeg,
      .destroy =        bg_ffmpeg_destroy,
      .get_parameters = bg_ffmpeg_get_parameters,
      .set_parameter =  bg_ffmpeg_set_parameter,
    },
    
    .max_audio_streams =         1,
    
    .get_audio_parameters = bg_ffmpeg_get_audio_parameters,

    .set_callbacks =        bg_ffmpeg_set_callbacks,
    
    .open =                 bg_ffmpeg_open,
    
    .add_audio_stream =     bg_ffmpeg_add_audio_stream,
    
    .set_audio_parameter =  bg_ffmpeg_set_audio_parameter,
    
    .get_audio_format =     bg_ffmpeg_get_audio_format,

    .start =                bg_ffmpeg_start,
    
    .write_audio_frame =    bg_ffmpeg_write_audio_frame,
    .close =                bg_ffmpeg_close,
  };

/* Include this into all plugin modules exactly once
   to let the plugin loader obtain the API version */
BG_GET_PLUGIN_API_VERSION;