[vlc-devel] [PATCH] Preserve block_t properties when running audio filters
Rafaël Carré
funman at videolan.org
Tue Dec 25 14:51:10 CET 2012
---
Ugly patch to illustrate my proposal.
Only tested to work playing back a few samples.
src/audio_output/filters.c | 11 +++++++++++
src/misc/filter_chain.c | 13 +++++++++++++
2 files changed, 24 insertions(+)
diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index b46fc2d..5b1a827 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -266,10 +266,21 @@ static block_t *aout_FiltersPipelinePlay(filter_t *const *filters,
for (unsigned i = 0; (i < count) && (block != NULL); i++)
{
filter_t *filter = filters[i];
+ uint32_t i_flags = block->i_flags;
+ unsigned i_nb_samples = block->i_nb_samples;
+ mtime_t i_pts = block->i_pts;
+ mtime_t i_dts = block->i_dts;
+ mtime_t i_length = block->i_length;
/* Please note that p_block->i_nb_samples & i_buffer
* shall be set by the filter plug-in. */
block = filter->pf_audio_filter (filter, block);
+
+ block->i_flags = i_flags;
+ block->i_nb_samples = i_nb_samples;
+ block->i_pts = i_pts;
+ block->i_dts = i_dts;
+ block->i_length = i_length;
}
return block;
}
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index e58551b..81abcf4 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -26,6 +26,7 @@
#endif
#include <vlc_filter.h>
+#include <vlc_block.h>
#include <vlc_osd.h>
#include <vlc_modules.h>
#include <libvlc.h>
@@ -286,9 +287,21 @@ block_t *filter_chain_AudioFilter( filter_chain_t *p_chain, block_t *p_block )
{
filter_t *p_filter = &f->filter;
+ uint32_t i_flags = p_block->i_flags;
+ unsigned i_nb_samples = p_block->i_nb_samples;
+ mtime_t i_pts = p_block->i_pts;
+ mtime_t i_dts = p_block->i_dts;
+ mtime_t i_length = p_block->i_length;
+
p_block = p_filter->pf_audio_filter( p_filter, p_block );
if( !p_block )
break;
+
+ p_block->i_flags = i_flags;
+ p_block->i_nb_samples = i_nb_samples;
+ p_block->i_pts = i_pts;
+ p_block->i_dts = i_dts;
+ p_block->i_length = i_length;
}
return p_block;
}
--
1.7.10.4
More information about the vlc-devel
mailing list