Ejemplo n.º 1
0
int BKE_ffmpeg_start(struct Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports)
{
	int success;

	ffmpeg_autosplit_count = 0;

	success = start_ffmpeg_impl(rd, rectx, recty, reports);
#ifdef WITH_AUDASPACE
	if (audio_stream) {
		AVCodecContext *c = audio_stream->codec;
		AUD_DeviceSpecs specs;
		specs.channels = c->channels;
		if (use_float_audio_buffer(c->codec_id)) {
			specs.format = AUD_FORMAT_FLOAT32;
		}
		else {
			specs.format = AUD_FORMAT_S16;
		}
		specs.rate = rd->ffcodecdata.audio_mixrate;
		audio_mixdown_device = sound_mixdown(scene, specs, rd->sfra, rd->ffcodecdata.audio_volume);
#ifdef FFMPEG_CODEC_TIME_BASE
		c->time_base.den = specs.rate;
		c->time_base.num = 1;
#endif
	}
#endif
	return success;
}
Ejemplo n.º 2
0
int BKE_ffmpeg_start(struct Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports)
{
	int success;

	ffmpeg_autosplit_count = 0;

	success = start_ffmpeg_impl(rd, rectx, recty, reports);
#ifdef WITH_AUDASPACE
	if (audio_stream) {
		AVCodecContext *c = audio_stream->codec;
		AUD_DeviceSpecs specs;
		specs.channels = c->channels;

		switch (av_get_packed_sample_fmt(c->sample_fmt)) {
			case AV_SAMPLE_FMT_U8:
				specs.format = AUD_FORMAT_U8;
				break;
			case AV_SAMPLE_FMT_S16:
				specs.format = AUD_FORMAT_S16;
				break;
			case AV_SAMPLE_FMT_S32:
				specs.format = AUD_FORMAT_S32;
				break;
			case AV_SAMPLE_FMT_FLT:
				specs.format = AUD_FORMAT_FLOAT32;
				break;
			case AV_SAMPLE_FMT_DBL:
				specs.format = AUD_FORMAT_FLOAT64;
				break;
			default:
				return -31415;
		}

		specs.rate = rd->ffcodecdata.audio_mixrate;
		audio_mixdown_device = sound_mixdown(scene, specs, rd->sfra, rd->ffcodecdata.audio_volume);
#ifdef FFMPEG_CODEC_TIME_BASE
		c->time_base.den = specs.rate;
		c->time_base.num = 1;
#endif
	}
#endif
	return success;
}