[Mplayer-cvslog] CVS: main/libaf af.c,1.11,1.12 af.h,1.6,1.7
Anders Johansson
anders at mplayerhq.hu
Mon Oct 7 12:46:16 CEST 2002
Update of /cvsroot/mplayer/main/libaf
In directory mail:/var/tmp.root/cvs-serv10142
Modified Files:
af.c af.h
Log Message:
Adding functionality for adding filters during execution
Index: af.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- af.c 6 Oct 2002 11:45:49 -0000 1.11
+++ af.c 7 Oct 2002 10:46:01 -0000 1.12
@@ -156,7 +156,9 @@
free(af);
}
-/* Reinitializes all filters downstream from the filter given in the argument */
+/* Reinitializes all filters downstream from the filter given in the
+ argument the return value is AF_OK if success and AF_ERROR if
+ failure */
int af_reinit(af_stream_t* s, af_instance_t* af)
{
if(!af)
@@ -364,6 +366,31 @@
return 0;
}
+/* Add filter during execution. This function adds the filter "name"
+ to the stream s. The filter will be inserted somewhere nice in the
+ list of filters. The return value is a pointer to the new filter,
+ If the filter couldn't be added the return value is NULL. */
+af_instance_t* af_add(af_stream_t* s, char* name){
+ af_instance_t* new;
+ // Sanity check
+ if(!s || !s->first || !name)
+ return NULL;
+ // Insert the filter somwhere nice
+ if(!strcmp(s->first->info->name,"format"))
+ new = af_append(s, s->first, name);
+ else
+ new = af_prepend(s, s->first, name);
+ if(!new)
+ return NULL;
+
+ // Reinitalize the filter list
+ if(AF_OK != af_reinit(s, s->first)){
+ free(new);
+ return NULL;
+ }
+ return new;
+}
+
// Filter data chunk through the filters in the list
af_data_t* af_play(af_stream_t* s, af_data_t* data)
{
@@ -450,9 +477,6 @@
if( (t * (((in/t)*mul.n))/mul.d) >= len) return in;
in+=t;
}
-
-// printf("Could no meet constraint nr 3. in=%d out=%d len=%d max_in=%d max_out=%d",
-// in,out,len,max_insize,max_outsize);
// Could no meet constraint nr 3.
while(out > max_outsize || in > max_insize){
Index: af.h
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- af.h 6 Oct 2002 11:26:14 -0000 1.6
+++ af.h 7 Oct 2002 10:46:01 -0000 1.7
@@ -138,19 +138,37 @@
stream will be reinitialized. The return value is 0 if sucess and
-1 if failure */
int af_init(af_stream_t* s);
+
// Uninit and remove all filters
void af_uninit(af_stream_t* s);
+
+/* Add filter during execution. This function adds the filter "name"
+ to the stream s. The filter will be inserted somewhere nice in the
+ list of filters. The return value is a pointer to the new filter,
+ If the filter couldn't be added the return value is NULL. */
+af_instance_t* af_add(af_stream_t* s, char* name);
+
+// Uninit and remove the filter "af"
+void af_remove(af_stream_t* s, af_instance_t* af);
+
+/* Find filter in the dynamic filter list using it's name This
+ function is used for finding already initialized filters */
+af_instance_t* af_get(af_stream_t* s, char* name);
+
// Filter data chunk through the filters in the list
af_data_t* af_play(af_stream_t* s, af_data_t* data);
+
/* Calculate how long the output from the filters will be given the
input length "len". The calculated length is >= the actual
length */
int af_outputlen(af_stream_t* s, int len);
+
/* Calculate how long the input to the filters should be to produce a
certain output length, i.e. the return value of this function is
the input length required to produce the output length "len". The
calculated length is <= the actual length */
int af_inputlen(af_stream_t* s, int len);
+
/* Calculate how long the input IN to the filters should be to produce
a certain output length OUT but with the following three constraints:
1. IN <= max_insize, where max_insize is the maximum possible input
More information about the MPlayer-cvslog
mailing list