[svn-commits] file: branch group/media_formats-reviewed r410664 - /team/group/media_formats...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 17 06:29:02 CDT 2014


Author: file
Date: Mon Mar 17 06:28:54 2014
New Revision: 410664

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=410664
Log:
Move dialplan functions over to media formats.

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

Modified:
    team/group/media_formats-reviewed/funcs/func_channel.c
    team/group/media_formats-reviewed/funcs/func_frame_trace.c
    team/group/media_formats-reviewed/funcs/func_pitchshift.c
    team/group/media_formats-reviewed/funcs/func_speex.c

Modified: team/group/media_formats-reviewed/funcs/func_channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/funcs/func_channel.c?view=diff&rev=410664&r1=410663&r2=410664
==============================================================================
--- team/group/media_formats-reviewed/funcs/func_channel.c (original)
+++ team/group/media_formats-reviewed/funcs/func_channel.c Mon Mar 17 06:28:54 2014
@@ -424,21 +424,25 @@
 	if (!strcasecmp(data, "audionativeformat")) {
 		char tmp[512];
 
-		if ((tmpcap = ast_format_cap_get_type(ast_channel_nativeformats(chan), AST_FORMAT_TYPE_AUDIO))) {
+		tmpcap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+		if (tmpcap) {
+			ast_format_cap_append_by_type(tmpcap, ast_channel_nativeformats(chan), AST_MEDIA_TYPE_AUDIO);
 			ast_copy_string(buf, ast_getformatname_multiple(tmp, sizeof(tmp), tmpcap), len);
-			tmpcap = ast_format_cap_destroy(tmpcap);
+			ao2_ref(tmpcap, -1);
 		}
 	} else if (!strcasecmp(data, "videonativeformat")) {
 		char tmp[512];
 
-		if ((tmpcap = ast_format_cap_get_type(ast_channel_nativeformats(chan), AST_FORMAT_TYPE_VIDEO))) {
+		tmpcap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+		if (tmpcap) {
+			ast_format_cap_append_by_type(tmpcap, ast_channel_nativeformats(chan), AST_MEDIA_TYPE_VIDEO);
 			ast_copy_string(buf, ast_getformatname_multiple(tmp, sizeof(tmp), tmpcap), len);
-			tmpcap = ast_format_cap_destroy(tmpcap);
+			ao2_ref(tmpcap, -1);
 		}
 	} else if (!strcasecmp(data, "audioreadformat")) {
-		ast_copy_string(buf, ast_getformatname(ast_channel_readformat(chan)), len);
+		ast_copy_string(buf, ast_format_get_name(ast_channel_readformat(chan)), len);
 	} else if (!strcasecmp(data, "audiowriteformat")) {
-		ast_copy_string(buf, ast_getformatname(ast_channel_writeformat(chan)), len);
+		ast_copy_string(buf, ast_format_get_name(ast_channel_writeformat(chan)), len);
 #ifdef CHANNEL_TRACE
 	} else if (!strcasecmp(data, "trace")) {
 		ast_channel_lock(chan);

Modified: team/group/media_formats-reviewed/funcs/func_frame_trace.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/funcs/func_frame_trace.c?view=diff&rev=410664&r1=410663&r2=410664
==============================================================================
--- team/group/media_formats-reviewed/funcs/func_frame_trace.c (original)
+++ team/group/media_formats-reviewed/funcs/func_frame_trace.c Mon Mar 17 06:28:54 2014
@@ -214,14 +214,14 @@
 		break;
 	case AST_FRAME_VOICE:
 		ast_verbose("FrameType: VOICE\n");
-		ast_verbose("Codec: %s\n", ast_getformatname(&frame->subclass.format));
+		ast_verbose("Codec: %s\n", ast_format_get_name(frame->subclass.format));
 		ast_verbose("MS: %ld\n", frame->len);
 		ast_verbose("Samples: %d\n", frame->samples);
 		ast_verbose("Bytes: %d\n", frame->datalen);
 		break;
 	case AST_FRAME_VIDEO:
 		ast_verbose("FrameType: VIDEO\n");
-		ast_verbose("Codec: %s\n", ast_getformatname(&frame->subclass.format));
+		ast_verbose("Codec: %s\n", ast_format_get_name(frame->subclass.format));
 		ast_verbose("MS: %ld\n", frame->len);
 		ast_verbose("Samples: %d\n", frame->samples);
 		ast_verbose("Bytes: %d\n", frame->datalen);

Modified: team/group/media_formats-reviewed/funcs/func_pitchshift.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/funcs/func_pitchshift.c?view=diff&rev=410664&r1=410663&r2=410664
==============================================================================
--- team/group/media_formats-reviewed/funcs/func_pitchshift.c (original)
+++ team/group/media_formats-reviewed/funcs/func_pitchshift.c Mon Mar 17 06:28:54 2014
@@ -172,9 +172,7 @@
 	if (!f) {
 		return 0;
 	}
-	if ((audiohook->status == AST_AUDIOHOOK_STATUS_DONE) ||
-		(f->frametype != AST_FRAME_VOICE) ||
-		!(ast_format_is_slinear(&f->subclass.format))) {
+	if (audiohook->status == AST_AUDIOHOOK_STATUS_DONE) {
 		return -1;
 	}
 
@@ -484,7 +482,7 @@
 		return 0;
 	}
 	for (samples = 0; samples < f->samples; samples += 32) {
-		smb_pitch_shift(amount, 32, MAX_FRAME_LENGTH, 32, ast_format_rate(&f->subclass.format), fun+samples, fun+samples, fft);
+		smb_pitch_shift(amount, 32, MAX_FRAME_LENGTH, 32, ast_format_get_sample_rate(f->subclass.format), fun+samples, fun+samples, fft);
 	}
 
 	return 0;

Modified: team/group/media_formats-reviewed/funcs/func_speex.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed/funcs/func_speex.c?view=diff&rev=410664&r1=410663&r2=410664
==============================================================================
--- team/group/media_formats-reviewed/funcs/func_speex.c (original)
+++ team/group/media_formats-reviewed/funcs/func_speex.c Mon Mar 17 06:28:54 2014
@@ -165,8 +165,8 @@
 		return -1;
 	}
 
-	if ((sdi->samples != frame->samples) || (ast_format_rate(&frame->subclass.format) != si->lastrate)) {
-		si->lastrate = ast_format_rate(&frame->subclass.format);
+	if ((sdi->samples != frame->samples) || (ast_format_get_sample_rate(frame->subclass.format) != si->lastrate)) {
+		si->lastrate = ast_format_get_sample_rate(frame->subclass.format);
 		if (sdi->state) {
 			speex_preprocess_state_destroy(sdi->state);
 		}




More information about the svn-commits mailing list