[svn-commits] file: branch group/media_formats-reviewed r411016 - in /team/group/media_form...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Mar 23 06:50:17 CDT 2014


Author: file
Date: Sun Mar 23 06:50:10 2014
New Revision: 411016

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=411016
Log:
Merge in some additional core changes.

Review: https://reviewboard.asterisk.org/r/3319/

Modified:
    team/group/media_formats-reviewed/include/asterisk/callerid.h
    team/group/media_formats-reviewed/include/asterisk/codec.h
    team/group/media_formats-reviewed/include/asterisk/format.h
    team/group/media_formats-reviewed/include/asterisk/format_cache.h
    team/group/media_formats-reviewed/include/asterisk/format_cap.h
    team/group/media_formats-reviewed/include/asterisk/frame.h
    team/group/media_formats-reviewed/main/codec.c
    team/group/media_formats-reviewed/main/format.c
    team/group/media_formats-reviewed/main/format_cap.c

Modified: team/group/media_formats-reviewed/include/asterisk/callerid.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/include/asterisk/callerid.h?view=diff&rev=411016&r1=411015&r2=411016
==============================================================================
--- team/group/media_formats-reviewed/include/asterisk/callerid.h (original)
+++ team/group/media_formats-reviewed/include/asterisk/callerid.h Sun Mar 23 06:50:10 2014
@@ -75,8 +75,8 @@
 /*! MWI MDMF format -- generate name, callerid, date and MWI fields */
 #define CID_MWI_TYPE_MDMF_FULL	0x02
 
-#define AST_LIN2X(a) ((codec->id == AST_FORMAT_ALAW) ? (AST_LIN2A(a)) : (AST_LIN2MU(a)))
-#define AST_XLAW(a) ((codec->id == AST_FORMAT_ALAW) ? (AST_ALAW(a)) : (AST_MULAW(a)))
+#define AST_LIN2X(a) ((ast_format_cmp(codec, ast_format_alaw) == AST_FORMAT_CMP_EQUAL) ? (AST_LIN2A(a)) : (AST_LIN2MU(a)))
+#define AST_XLAW(a) ((ast_format_cmp(codec, ast_format_alaw) == AST_FORMAT_CMP_EQUAL) ? (AST_ALAW(a)) : (AST_MULAW(a)))
 
 
 struct callerid_state;

Modified: team/group/media_formats-reviewed/include/asterisk/codec.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/include/asterisk/codec.h?view=diff&rev=411016&r1=411015&r2=411016
==============================================================================
--- team/group/media_formats-reviewed/include/asterisk/codec.h (original)
+++ team/group/media_formats-reviewed/include/asterisk/codec.h Sun Mar 23 06:50:10 2014
@@ -169,4 +169,14 @@
  */
 unsigned int ast_codec_samples_count(struct ast_frame *frame);
 
+/*!
+ * \brief Get the length of media (in milliseconds) given a number of samples
+ *
+ * \param codec The codec itself
+ * \param samples The number of samples
+ *
+ * \retval length of media (in milliseconds)
+ */
+unsigned int ast_codec_determine_length(const struct ast_codec *codec, unsigned int samples);
+
 #endif /* _AST_CODEC_H */

Modified: team/group/media_formats-reviewed/include/asterisk/format.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/include/asterisk/format.h?view=diff&rev=411016&r1=411015&r2=411016
==============================================================================
--- team/group/media_formats-reviewed/include/asterisk/format.h (original)
+++ team/group/media_formats-reviewed/include/asterisk/format.h Sun Mar 23 06:50:10 2014
@@ -275,4 +275,14 @@
  */
 unsigned int ast_format_get_sample_rate(const struct ast_format *format);
 
+/*!
+ * \brief Get the length (in milliseconds) for the format with a given number of samples
+ *
+ * \param format The media format
+ * \param samples The number of samples
+ *
+ * \return length of media (in milliseconds)
+ */
+unsigned int ast_format_determine_length(const struct ast_format *format, unsigned int samples);
+
 #endif /* _AST_FORMAT_H */

Modified: team/group/media_formats-reviewed/include/asterisk/format_cache.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/include/asterisk/format_cache.h?view=diff&rev=411016&r1=411015&r2=411016
==============================================================================
--- team/group/media_formats-reviewed/include/asterisk/format_cache.h (original)
+++ team/group/media_formats-reviewed/include/asterisk/format_cache.h Sun Mar 23 06:50:10 2014
@@ -134,6 +134,36 @@
 extern struct ast_format *ast_format_g729;
 
 /*!
+ * \brief Built-in cached g719 format.
+ */
+extern struct ast_format *ast_format_g719;
+
+/*!
+ * \brief Built-in cached h263 format.
+ */
+extern struct ast_format *ast_format_h263;
+
+/*!
+ * \brief Built-in cached h264 format.
+ */
+extern struct ast_format *ast_format_h264;
+
+/*!
+ * \brief Built-in cached jpeg format.
+ */
+extern struct ast_format *ast_format_jpeg;
+
+/*!
+ * \brief Built-in cached siren14 format.
+ */
+extern struct ast_format *ast_format_siren14;
+
+/*!
+ * \brief Built-in cached siren7 format.
+ */
+extern struct ast_format *ast_format_siren7;
+
+/*!
  * \brief Initialize format cache support within the core.
  *
  * \retval 0 success

Modified: team/group/media_formats-reviewed/include/asterisk/format_cap.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/include/asterisk/format_cap.h?view=diff&rev=411016&r1=411015&r2=411016
==============================================================================
--- team/group/media_formats-reviewed/include/asterisk/format_cap.h (original)
+++ team/group/media_formats-reviewed/include/asterisk/format_cap.h Sun Mar 23 06:50:10 2014
@@ -93,17 +93,18 @@
 int ast_format_cap_add_all_by_type(struct ast_format_cap *cap, enum ast_media_type type);
 
 /*!
- * \brief Copy all formats in src to dst
+ * \brief Append the formats of provided type in src to dst
  *
  * \param dst The destination capabilities structure
  * \param src The source capabilities structure
- *
- * \retval 0 success
- * \retval -1 failure
- *
- * \note The source capabilities structure is left alone and remains valid afterwards.
- */
-int ast_format_cap_append(struct ast_format_cap *dst, const struct ast_format_cap *src);
+ * \param type The type of formats to append.
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ *
+ * \note If AST_MEDIA_TYPE_UNKNOWN is passed as the type all known codecs will be added.
+ */
+int ast_format_cap_append_by_type(struct ast_format_cap *dst, const struct ast_format_cap *src, enum ast_media_type type);
 
 /*!
  * \brief Get the number of formats present within the capabilities structure

Modified: team/group/media_formats-reviewed/include/asterisk/frame.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/include/asterisk/frame.h?view=diff&rev=411016&r1=411015&r2=411016
==============================================================================
--- team/group/media_formats-reviewed/include/asterisk/frame.h (original)
+++ team/group/media_formats-reviewed/include/asterisk/frame.h Sun Mar 23 06:50:10 2014
@@ -129,9 +129,15 @@
 	AST_FRFLAG_HAS_TIMING_INFO = (1 << 0),
 };
 
+struct ast_frame_video {
+	struct ast_format *format;
+	unsigned int frame_ending;
+};
+
 union ast_frame_subclass {
 	int integer;
 	struct ast_format *format;
+	struct ast_frame_video video;
 };
 
 /*! \brief Data structure associated with a single frame of data

Modified: team/group/media_formats-reviewed/main/codec.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/main/codec.c?view=diff&rev=411016&r1=411015&r2=411016
==============================================================================
--- team/group/media_formats-reviewed/main/codec.c (original)
+++ team/group/media_formats-reviewed/main/codec.c Sun Mar 23 06:50:10 2014
@@ -341,4 +341,13 @@
 	}
 
 	return frame->subclass.format->codec->get_samples(frame);
+}
+
+unsigned int ast_codec_determine_length(const struct ast_codec *codec, unsigned int samples)
+{
+	if (!codec->get_length) {
+		return 0;
+	}
+
+	return codec->get_length(samples);
 }

Modified: team/group/media_formats-reviewed/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/main/format.c?view=diff&rev=411016&r1=411015&r2=411016
==============================================================================
--- team/group/media_formats-reviewed/main/format.c (original)
+++ team/group/media_formats-reviewed/main/format.c Sun Mar 23 06:50:10 2014
@@ -288,4 +288,9 @@
 unsigned int ast_format_get_sample_rate(const struct ast_format *format)
 {
 	return format->codec->sample_rate;
+}
+
+unsigned int ast_format_determine_length(const struct ast_format *format, unsigned int samples)
+{
+	return ast_codec_determine_length(format->codec, samples);
 }

Modified: team/group/media_formats-reviewed/main/format_cap.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/main/format_cap.c?view=diff&rev=411016&r1=411015&r2=411016
==============================================================================
--- team/group/media_formats-reviewed/main/format_cap.c (original)
+++ team/group/media_formats-reviewed/main/format_cap.c Sun Mar 23 06:50:10 2014
@@ -189,14 +189,17 @@
 	return 0;
 }
 
-int ast_format_cap_append(struct ast_format_cap *dst, const struct ast_format_cap *src)
+int ast_format_cap_append_by_type(struct ast_format_cap *dst, const struct ast_format_cap *src,
+	enum ast_media_type type)
 {
 	int idx, res = 0;
 
 	for (idx = 0; (idx < AST_VECTOR_SIZE(&src->preference_order)) && !res; ++idx) {
 		struct format_cap_framed *framed = AST_VECTOR_GET(&src->preference_order, idx);
 
-		res = ast_format_cap_add(dst, framed->format, framed->framing);
+		if (type == AST_MEDIA_TYPE_UNKNOWN || framed->format->codec->type == type) {
+			res = ast_format_cap_add(dst, framed->format, framed->framing);
+		}
 	}
 
 	return res;




More information about the svn-commits mailing list