2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef __GST_FFMPEG_CODECMAP_H__
21 #define __GST_FFMPEG_CODECMAP_H__
23 #include <libavcodec/avcodec.h>
25 #include <gst/audio/audio.h>
26 #include <gst/video/video.h>
29 * GstFFMpegCompliance:
30 * @GST_FFMPEG_VERY_STRICT: Strictly conform to an older
31 * more strict version of the spec or reference software
32 * @GST_FFMPEG_STRICT: Strictly conform to all the things
33 * in the spec no matter what consequences.
35 * @GST_FFMPEG_UNOFFICIAL: Allow unofficial extensions
36 * @GST_FFMPEG_EXPERIMENTAL: Allow nonstandardized
37 * experimental things.
39 * This setting instructs libav on how strictly it should follow the
40 * associated standard.
43 * Setting this to STRICT or higher means the encoder and decoder will
44 * generally do stupid things, whereas setting it to unofficial or lower
45 * will mean the encoder might produce output that is not supported by all
46 * spec-compliant decoders. Decoders don't differentiate between normal,
47 * unofficial and experimental (that is, they always try to decode things
48 * when they can) unless they are explicitly asked to behave stupidly
49 * (=strictly conform to the specs)
52 GST_FFMPEG_VERY_STRICT = FF_COMPLIANCE_VERY_STRICT,
53 GST_FFMPEG_STRICT = FF_COMPLIANCE_STRICT,
54 GST_FFMPEG_NORMAL = FF_COMPLIANCE_NORMAL,
55 GST_FFMPEG_UNOFFICIAL = FF_COMPLIANCE_UNOFFICIAL,
56 GST_FFMPEG_EXPERIMENTAL = FF_COMPLIANCE_EXPERIMENTAL,
57 } GstFFMpegCompliance;
60 * _compliance_get_type () Returns an enum type that can be
61 * used as a property to indicate desired FFMpeg adherence to
62 * an associated specification
66 gst_ffmpeg_compliance_get_type (void);
67 #define GST_TYPE_FFMPEG_COMPLIANCE (gst_ffmpeg_compliance_get_type ())
68 #define FFMPEG_DEFAULT_COMPLIANCE GST_FFMPEG_NORMAL
71 * _codecid_is_image() returns TRUE for image formats
74 gst_ffmpeg_codecid_is_image (enum AVCodecID codec_id);
77 * _codecid_to_caps () gets the GstCaps that belongs to
78 * a certain CodecID for a pad with compressed data.
82 gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id,
83 AVCodecContext *context,
87 * _codectype_to_caps () gets the GstCaps that belongs to
88 * a certain AVMediaType for a pad with uncompressed data.
92 gst_ffmpeg_codectype_to_audio_caps (AVCodecContext *context,
93 enum AVCodecID codec_id,
97 gst_ffmpeg_codectype_to_video_caps (AVCodecContext *context,
98 enum AVCodecID codec_id,
103 * caps_to_codecid () transforms a GstCaps that belongs to
104 * a pad for compressed data to (optionally) a filled-in
105 * context and a codecID.
109 gst_ffmpeg_caps_to_codecid (const GstCaps *caps,
110 AVCodecContext *context);
113 * caps_with_codecid () transforms a GstCaps for a known codec
114 * ID into a filled-in context.
118 gst_ffmpeg_caps_with_codecid (enum AVCodecID codec_id,
119 enum AVMediaType codec_type,
121 AVCodecContext *context);
124 * caps_with_codectype () transforms a GstCaps that belongs to
125 * a pad for uncompressed data to a filled-in context.
129 gst_ffmpeg_caps_with_codectype (enum AVMediaType type,
131 AVCodecContext *context);
134 gst_ffmpeg_videoinfo_to_context (GstVideoInfo *info,
135 AVCodecContext *context);
138 gst_ffmpeg_audioinfo_to_context (GstAudioInfo *info,
139 AVCodecContext *context);
141 GstVideoFormat gst_ffmpeg_pixfmt_to_videoformat (enum AVPixelFormat pixfmt);
142 enum AVPixelFormat gst_ffmpeg_videoformat_to_pixfmt (GstVideoFormat format);
144 GstAudioFormat gst_ffmpeg_smpfmt_to_audioformat (enum AVSampleFormat sample_fmt);
147 * _formatid_to_caps () is meant for muxers/demuxers, it
148 * transforms a name (ffmpeg way of ID'ing these, why don't
149 * they have unique numerical IDs?) to the corresponding
150 * caps belonging to that mux-format
154 gst_ffmpeg_formatid_to_caps (const gchar *format_name);
157 * _formatid_get_codecids () can be used to get the codecIDs
158 * (CODEC_ID_NONE-terminated list) that fit that specific
163 gst_ffmpeg_formatid_get_codecids (const gchar *format_name,
164 enum AVCodecID ** video_codec_list,
165 enum AVCodecID ** audio_codec_list,
166 AVOutputFormat * plugin);
170 gst_ffmpeg_channel_layout_to_gst (guint64 channel_layout, gint channels,
171 GstAudioChannelPosition * pos);
173 #endif /* __GST_FFMPEG_CODECMAP_H__ */