mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-10-29 05:40:27 -04:00 
			
		
		
		
	pw-cat: Check for pw_cat_ffmpeg flag instead of HAVE_ALSA_COMPRESS_OFFLOAD
FFmpeg integration in pw-cat does not strictly require Compress-Offload; for example, there could be other nodes in the graph that can handle compressed audio. Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
This commit is contained in:
		
							parent
							
								
									f07bb84348
								
							
						
					
					
						commit
						e261f2ac1c
					
				
					 2 changed files with 14 additions and 13 deletions
				
			
		|  | @ -277,6 +277,7 @@ if pw_cat_ffmpeg.allowed() or ffmpeg.allowed() | ||||||
| else | else | ||||||
|   avcodec_dep = dependency('', required: false) |   avcodec_dep = dependency('', required: false) | ||||||
| endif | endif | ||||||
|  | cdata.set('HAVE_PW_CAT_FFMPEG_INTEGRATION', pw_cat_ffmpeg.allowed()) | ||||||
| 
 | 
 | ||||||
| summary({'readline (for pw-cli)': readline_dep.found()}, bool_yn: true, section: 'Misc dependencies') | summary({'readline (for pw-cli)': readline_dep.found()}, bool_yn: true, section: 'Misc dependencies') | ||||||
| cdata.set('HAVE_READLINE', readline_dep.found()) | cdata.set('HAVE_READLINE', readline_dep.found()) | ||||||
|  |  | ||||||
|  | @ -53,7 +53,7 @@ | ||||||
| 
 | 
 | ||||||
| #include "config.h" | #include "config.h" | ||||||
| 
 | 
 | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| #include <libavformat/avformat.h> | #include <libavformat/avformat.h> | ||||||
| #include <libavcodec/avcodec.h> | #include <libavcodec/avcodec.h> | ||||||
| #endif | #endif | ||||||
|  | @ -115,7 +115,7 @@ struct data { | ||||||
| #define TYPE_PCM	0 | #define TYPE_PCM	0 | ||||||
| #define TYPE_MIDI	1 | #define TYPE_MIDI	1 | ||||||
| #define TYPE_DSD	2 | #define TYPE_DSD	2 | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| #define TYPE_ENCODED    3 | #define TYPE_ENCODED    3 | ||||||
| #endif | #endif | ||||||
| 	int data_type; | 	int data_type; | ||||||
|  | @ -162,7 +162,7 @@ struct data { | ||||||
| 		struct dsf_layout layout; | 		struct dsf_layout layout; | ||||||
| 	} dsf; | 	} dsf; | ||||||
| 
 | 
 | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| 	FILE *encoded_file; | 	FILE *encoded_file; | ||||||
| 	AVFormatContext *fmt_context; | 	AVFormatContext *fmt_context; | ||||||
| 	AVStream *astream; | 	AVStream *astream; | ||||||
|  | @ -251,7 +251,7 @@ static int sf_playback_fill_f64(struct data *d, void *dest, unsigned int n_frame | ||||||
| 	return (int)rn; | 	return (int)rn; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| static int encoded_playback_fill(struct data *d, void *dest, unsigned int n_frames) | static int encoded_playback_fill(struct data *d, void *dest, unsigned int n_frames) | ||||||
| { | { | ||||||
| 	int ret, size = 0; | 	int ret, size = 0; | ||||||
|  | @ -394,7 +394,7 @@ playback_fill_fn(uint32_t fmt) | ||||||
| 		if (sizeof(double) != 8) | 		if (sizeof(double) != 8) | ||||||
| 			return NULL; | 			return NULL; | ||||||
| 		return sf_playback_fill_f64; | 		return sf_playback_fill_f64; | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| 	case SPA_AUDIO_FORMAT_ENCODED: | 	case SPA_AUDIO_FORMAT_ENCODED: | ||||||
| 		return encoded_playback_fill; | 		return encoded_playback_fill; | ||||||
| #endif | #endif | ||||||
|  | @ -786,7 +786,7 @@ static void on_process(void *userdata) | ||||||
| 		n_frames = d->maxsize / data->stride; | 		n_frames = d->maxsize / data->stride; | ||||||
| 		n_frames = SPA_MIN(n_frames, (int)b->requested); | 		n_frames = SPA_MIN(n_frames, (int)b->requested); | ||||||
| 
 | 
 | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| 		n_fill_frames = data->fill(data, p, n_frames); | 		n_fill_frames = data->fill(data, p, n_frames); | ||||||
| 
 | 
 | ||||||
| 		if (n_fill_frames > 0 || n_frames == 0) { | 		if (n_fill_frames > 0 || n_frames == 0) { | ||||||
|  | @ -983,7 +983,7 @@ static void show_usage(const char *name, bool is_error) | ||||||
| 		     "  -r, --record                          Recording mode\n" | 		     "  -r, --record                          Recording mode\n" | ||||||
| 		     "  -m, --midi                            Midi mode\n" | 		     "  -m, --midi                            Midi mode\n" | ||||||
| 		     "  -d, --dsd                             DSD mode\n" | 		     "  -d, --dsd                             DSD mode\n" | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| 		     "  -o, --encoded			      Encoded mode\n" | 		     "  -o, --encoded			      Encoded mode\n" | ||||||
| #endif | #endif | ||||||
| 		     "\n"), fp); | 		     "\n"), fp); | ||||||
|  | @ -1273,7 +1273,7 @@ static void format_from_filename(SF_INFO *info, const char *filename) | ||||||
| 		info->format = (info->format & ~SF_FORMAT_SUBMASK) | SF_FORMAT_VORBIS; | 		info->format = (info->format & ~SF_FORMAT_SUBMASK) | SF_FORMAT_VORBIS; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| static int setup_encodedfile(struct data *data) | static int setup_encodedfile(struct data *data) | ||||||
| { | { | ||||||
| 	int ret; | 	int ret; | ||||||
|  | @ -1575,7 +1575,7 @@ int main(int argc, char *argv[]) | ||||||
| 		goto error_no_props; | 		goto error_no_props; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| 	while ((c = getopt_long(argc, argv, "hvprmdoR:q:P:", long_options, NULL)) != -1) { | 	while ((c = getopt_long(argc, argv, "hvprmdoR:q:P:", long_options, NULL)) != -1) { | ||||||
| #else | #else | ||||||
| 	while ((c = getopt_long(argc, argv, "hvprmdR:q:P:", long_options, NULL)) != -1) { | 	while ((c = getopt_long(argc, argv, "hvprmdR:q:P:", long_options, NULL)) != -1) { | ||||||
|  | @ -1616,7 +1616,7 @@ int main(int argc, char *argv[]) | ||||||
| 			data.data_type = TYPE_DSD; | 			data.data_type = TYPE_DSD; | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| 		case 'o': | 		case 'o': | ||||||
| 			data.data_type = TYPE_ENCODED; | 			data.data_type = TYPE_ENCODED; | ||||||
| 			break; | 			break; | ||||||
|  | @ -1793,7 +1793,7 @@ int main(int argc, char *argv[]) | ||||||
| 		case TYPE_DSD: | 		case TYPE_DSD: | ||||||
| 			ret = setup_dsffile(&data); | 			ret = setup_dsffile(&data); | ||||||
| 			break; | 			break; | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| 		case TYPE_ENCODED: | 		case TYPE_ENCODED: | ||||||
| 			ret = setup_encodedfile(&data); | 			ret = setup_encodedfile(&data); | ||||||
| 			break; | 			break; | ||||||
|  | @ -1816,7 +1816,7 @@ int main(int argc, char *argv[]) | ||||||
| 	ret = setup_properties(&data); | 	ret = setup_properties(&data); | ||||||
| 
 | 
 | ||||||
| 	switch (data.data_type) { | 	switch (data.data_type) { | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| 	case TYPE_ENCODED: | 	case TYPE_ENCODED: | ||||||
| 	{ | 	{ | ||||||
| 		struct spa_audio_info info; | 		struct spa_audio_info info; | ||||||
|  | @ -1924,7 +1924,7 @@ int main(int argc, char *argv[]) | ||||||
| 	/* and wait while we let things run */ | 	/* and wait while we let things run */ | ||||||
| 	pw_main_loop_run(data.loop); | 	pw_main_loop_run(data.loop); | ||||||
| 
 | 
 | ||||||
| #ifdef HAVE_ALSA_COMPRESS_OFFLOAD | #ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION | ||||||
| 	if (data.encoded_file) | 	if (data.encoded_file) | ||||||
| 		fclose(data.encoded_file); | 		fclose(data.encoded_file); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Carlos Rafael Giani
						Carlos Rafael Giani