| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
Codec API. More...

Go to the source code of this file.
| Data Structures | |
| struct | ast_codec | 
| Represents a media codec within Asterisk.  More... | |
| Macros | |
| #define | ast_codec_register(codec) __ast_codec_register(codec, AST_MODULE_SELF) | 
| This function is used to register a codec with the Asterisk core. Registering allows it to be passed through in frames and configured in channel drivers. | |
| Enumerations | |
| enum | ast_media_type { AST_MEDIA_TYPE_UNKNOWN = 0 , AST_MEDIA_TYPE_AUDIO , AST_MEDIA_TYPE_VIDEO , AST_MEDIA_TYPE_IMAGE , AST_MEDIA_TYPE_TEXT , AST_MEDIA_TYPE_END } | 
| Types of media.  More... | |
| Functions | |
| int | __ast_codec_register (struct ast_codec *codec, struct ast_module *mod) | 
| This function is used to register a codec with the Asterisk core. Registering allows it to be passed through in frames and configured in channel drivers. | |
| int | ast_codec_builtin_init (void) | 
| Initialize built-in codecs within the core. | |
| unsigned int | ast_codec_determine_length (const struct ast_codec *codec, unsigned int samples) | 
| Get the length of media (in milliseconds) given a number of samples. | |
| struct ast_codec * | ast_codec_get (const char *name, enum ast_media_type type, unsigned int sample_rate) | 
| Retrieve a codec given a name, type, and sample rate. | |
| struct ast_codec * | ast_codec_get_by_id (int id) | 
| Retrieve a codec given the unique identifier. | |
| int | ast_codec_get_max (void) | 
| Retrieve the current maximum identifier for codec iteration. | |
| int | ast_codec_init (void) | 
| Initialize codec support within the core. | |
| const char * | ast_codec_media_type2str (enum ast_media_type type) | 
| Conversion function to take a media type and turn it into a string. | |
| unsigned int | ast_codec_samples_count (struct ast_frame *frame) | 
| Get the number of samples contained within a frame. | |
| enum ast_media_type | ast_media_type_from_str (const char *media_type_str) | 
| Conversion function to take a media string and convert it to a media type. | |
Codec API.
Definition in file codec.h.
| #define ast_codec_register | ( | codec | ) | __ast_codec_register(codec, AST_MODULE_SELF) | 
| enum ast_media_type | 
Types of media.
| Enumerator | |
|---|---|
| AST_MEDIA_TYPE_UNKNOWN | |
| AST_MEDIA_TYPE_AUDIO | |
| AST_MEDIA_TYPE_VIDEO | |
| AST_MEDIA_TYPE_IMAGE | |
| AST_MEDIA_TYPE_TEXT | |
| AST_MEDIA_TYPE_END | |
| int __ast_codec_register | ( | struct ast_codec * | codec, | 
| struct ast_module * | mod | ||
| ) | 
This function is used to register a codec with the Asterisk core. Registering allows it to be passed through in frames and configured in channel drivers.
| codec | to register | 
| mod | the module this codec is provided by | 
| 0 | success | 
| -1 | failure | 
Definition at line 273 of file codec.c.
References __ast_codec_register_with_format(), ast_codec::mod, and NULL.
| int ast_codec_builtin_init | ( | void | ) | 
Initialize built-in codecs within the core.
| 0 | success | 
| -1 | failure | 
Definition at line 956 of file codec_builtin.c.
References adpcm, alaw, codec2, CODEC_REGISTER_AND_CACHE, CODEC_REGISTER_AND_CACHE_NAMED, g719, g722, g723, g726aal2, g726rfc3551, g729a, h261, h263, h263p, h264, h265, ilbc, jpeg, lpc10, mpeg4, none, opus, png, silk12, silk16, silk24, silk8, siren14, siren7, slin12, slin16, slin192, slin24, slin32, slin44, slin48, slin8, slin96, speex16, speex32, speex8, t140, t140red, t38, ulaw, vp8, and vp9.
Referenced by asterisk_daemon().
| unsigned int ast_codec_determine_length | ( | const struct ast_codec * | codec, | 
| unsigned int | samples | ||
| ) | 
Get the length of media (in milliseconds) given a number of samples.
| codec | The codec itself | 
| samples | The number of samples | 
| length | of media (in milliseconds) | 
Definition at line 408 of file codec.c.
References ast_codec::get_length.
Referenced by ast_format_determine_length().
| struct ast_codec * ast_codec_get | ( | const char * | name, | 
| enum ast_media_type | type, | ||
| unsigned int | sample_rate | ||
| ) | 
Retrieve a codec given a name, type, and sample rate.
| name | The name of the codec | 
| type | The type of the codec | 
| sample_rate | Optional sample rate, may not be applicable for some types | 
| non-NULL | success | 
| NULL | failure | 
Definition at line 327 of file codec.c.
References ao2_find, codecs, name, ast_codec::name, OBJ_SEARCH_OBJECT, ast_codec::sample_rate, and type.
Referenced by __ast_register_translator(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), handle_show_translation_path(), and newpvt().
| struct ast_codec * ast_codec_get_by_id | ( | int | id | ) | 
Retrieve a codec given the unique identifier.
| id | The unique identifier | 
| non-NULL | success | 
| NULL | failure | 
Definition at line 338 of file codec.c.
References ao2_callback, codec_id_cmp(), and codecs.
Referenced by ast_format_cap_append_by_type(), AST_TEST_DEFINE(), complete_trans_path_choice(), handle_show_translation_path(), handle_show_translation_table(), and index2codec().
| int ast_codec_get_max | ( | void | ) | 
Retrieve the current maximum identifier for codec iteration.
Definition at line 343 of file codec.c.
References codec_id.
Referenced by ast_format_cap_append_by_type(), and AST_TEST_DEFINE().
| int ast_codec_init | ( | void | ) | 
Initialize codec support within the core.
| 0 | success | 
| -1 | failure | 
Definition at line 250 of file codec.c.
References AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_container_alloc_hash, ARRAY_LEN, ast_cli_register_multiple, ast_register_cleanup(), CODEC_BUCKETS, codec_cli, codec_cmp(), codec_shutdown(), codecs, and NULL.
Referenced by asterisk_daemon().
| const char * ast_codec_media_type2str | ( | enum ast_media_type | type | ) | 
Conversion function to take a media type and turn it into a string.
| type | The media type | 
| string | representation of the media type | 
Definition at line 348 of file codec.c.
References AST_MEDIA_TYPE_AUDIO, AST_MEDIA_TYPE_IMAGE, AST_MEDIA_TYPE_TEXT, AST_MEDIA_TYPE_VIDEO, and type.
Referenced by __ast_codec_register_with_format(), add_msid_to_stream(), add_sdp_streams(), ast_rtp_engine_load_format(), ast_rtp_interpret(), ast_rtp_read(), ast_sip_create_joint_call_cap(), ast_sip_session_media_state_add(), ast_stream_create_resolved(), ast_stream_to_str(), ast_stream_topology_append_stream(), ast_stream_topology_create_from_format_cap(), ast_stream_topology_set_stream(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), chan_pjsip_write_stream(), check_stream_positions(), create_outgoing_sdp_stream(), create_outgoing_sdp_stream(), handle_incoming_sdp(), handle_negotiated_sdp_session_media(), handle_showchan(), is_media_state_valid(), log_caps(), negotiate_incoming_sdp_stream(), rtp_check_timeout(), sdp_requires_deferral(), set_caps(), set_incoming_call_offer_cap(), show_codecs(), stream_echo_exec(), and stream_echo_write_error().
| unsigned int ast_codec_samples_count | ( | struct ast_frame * | frame | ) | 
Get the number of samples contained within a frame.
| frame | The frame itself | 
| number | of samples in the frame | 
Definition at line 379 of file codec.c.
References ao2_ref, ast_format_get_codec(), ast_format_get_name(), AST_FRAME_IMAGE, AST_FRAME_VIDEO, AST_FRAME_VOICE, ast_log, ast_frame_subclass::format, ast_frame::frametype, LOG_WARNING, ast_codec::samples_count, and ast_frame::subclass.
Referenced by ast_rtp_interpret(), dahdi_encoder_frameout(), isAnsweringMachine(), moh_generate(), ogg_speex_read(), schedule_delivery(), socket_process_helper(), and socket_process_meta().
| enum ast_media_type ast_media_type_from_str | ( | const char * | media_type_str | ) | 
Conversion function to take a media string and convert it to a media type.
| media_type_str | The media type string | 
| The | ast_media_type that corresponds to the string | 
Definition at line 364 of file codec.c.
References AST_MEDIA_TYPE_AUDIO, AST_MEDIA_TYPE_IMAGE, AST_MEDIA_TYPE_TEXT, AST_MEDIA_TYPE_UNKNOWN, and AST_MEDIA_TYPE_VIDEO.
Referenced by handle_incoming_sdp(), sdp_requires_deferral(), and stream_echo_exec().