1 /*****************************************************************************
2 * dynamicoverlay_commands.c : dynamic overlay plugin commands
3 *****************************************************************************
4 * Copyright (C) 2008 the VideoLAN team
7 * Author: Soren Bog <avacore@videolan.org>
8 * Jean-Paul Saman <jpsaman@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
29 #include <vlc_common.h>
30 #include <vlc_arrays.h>
32 #include <vlc_filter.h>
38 #if defined(HAVE_SYS_SHM_H)
42 #include "dynamicoverlay.h"
45 /*****************************************************************************
46 * overlay_t: Overlay descriptor
47 *****************************************************************************/
49 overlay_t *OverlayCreate( void )
51 overlay_t *p_ovl = malloc( sizeof( overlay_t ) );
54 memset( p_ovl, 0, sizeof( overlay_t ) );
56 p_ovl->i_x = p_ovl->i_y = 0;
57 p_ovl->i_alpha = 0xFF;
58 p_ovl->b_active = false;
59 vout_InitFormat( &p_ovl->format, VLC_FOURCC( '\0','\0','\0','\0') , 0, 0,
61 p_ovl->p_fontstyle = text_style_New();
62 p_ovl->data.p_text = NULL;
67 int OverlayDestroy( overlay_t *p_ovl )
69 if( p_ovl->data.p_text != NULL )
70 free( p_ovl->data.p_text );
71 text_style_Delete( p_ovl->p_fontstyle );
76 /*****************************************************************************
78 *****************************************************************************/
79 static int skip_space( char **psz_command )
81 char *psz_temp = *psz_command;
83 while( isspace( *psz_temp ) )
87 if( psz_temp == *psz_command )
91 *psz_command = psz_temp;
95 static int parse_digit( char **psz_command, int32_t *value )
98 *value = strtol( *psz_command, &psz_temp, 10 );
99 if( psz_temp == *psz_command )
103 *psz_command = psz_temp;
107 static int parse_char( char **psz_command, char **psz_end,
108 int count, char *psz_value )
110 if( *psz_end - *psz_command < count )
114 memcpy( psz_value, *psz_command, count );
115 *psz_command += count;
119 static int parser_DataSharedMem( char *psz_command,
121 commandparams_t *p_params )
123 /* Parse: 0 128 128 RGBA 9404459 */
124 skip_space( &psz_command );
125 if( isdigit( *psz_command ) )
127 if( parse_digit( &psz_command, &p_params->i_id ) == VLC_EGENERIC )
130 skip_space( &psz_command );
131 if( isdigit( *psz_command ) )
133 if( parse_digit( &psz_command, &p_params->i_width ) == VLC_EGENERIC )
136 skip_space( &psz_command );
137 if( isdigit( *psz_command ) )
139 if( parse_digit( &psz_command, &p_params->i_height ) == VLC_EGENERIC )
142 skip_space( &psz_command );
143 if( isascii( *psz_command ) )
145 if( parse_char( &psz_command, &psz_end, 4, (char*)&p_params->fourcc )
149 skip_space( &psz_command );
150 if( isdigit( *psz_command ) )
152 if( parse_digit( &psz_command, &p_params->i_shmid ) == VLC_EGENERIC )
158 static int parser_Id( char *psz_command, char *psz_end,
159 commandparams_t *p_params )
162 skip_space( &psz_command );
163 if( isdigit( *psz_command ) )
165 if( parse_digit( &psz_command, &p_params->i_id ) == VLC_EGENERIC )
171 static int parser_None( char *psz_command, char *psz_end,
172 commandparams_t *p_params )
174 VLC_UNUSED(psz_command);
176 VLC_UNUSED(p_params);
180 static int parser_SetAlpha( char *psz_command, char *psz_end,
181 commandparams_t *p_params )
184 skip_space( &psz_command );
185 if( isdigit( *psz_command ) )
187 if( parse_digit( &psz_command, &p_params->i_id ) == VLC_EGENERIC )
190 skip_space( &psz_command );
191 if( isdigit( *psz_command ) )
193 if( parse_digit( &psz_command, &p_params->i_alpha ) == VLC_EGENERIC )
199 static int parser_SetPosition( char *psz_command, char *psz_end,
200 commandparams_t *p_params )
203 skip_space( &psz_command );
204 if( isdigit( *psz_command ) )
206 if( parse_digit( &psz_command, &p_params->i_id ) == VLC_EGENERIC )
209 skip_space( &psz_command );
210 if( isdigit( *psz_command ) )
212 if( parse_digit( &psz_command, &p_params->i_x ) == VLC_EGENERIC )
215 skip_space( &psz_command );
216 if( isdigit( *psz_command ) )
218 if( parse_digit( &psz_command, &p_params->i_y ) == VLC_EGENERIC )
224 static int parser_SetTextAlpha( char *psz_command, char *psz_end,
225 commandparams_t *p_params )
228 skip_space( &psz_command );
229 if( isdigit( *psz_command ) )
231 if( parse_digit( &psz_command, &p_params->i_id ) == VLC_EGENERIC )
234 skip_space( &psz_command );
235 if( isdigit( *psz_command ) )
237 if( parse_digit( &psz_command, &p_params->fontstyle.i_font_alpha ) == VLC_EGENERIC )
243 static int parser_SetTextColor( char *psz_command, char *psz_end,
244 commandparams_t *p_params )
246 int r = 0, g = 0, b = 0;
249 skip_space( &psz_command );
250 if( isdigit( *psz_command ) )
252 if( parse_digit( &psz_command, &p_params->i_id ) == VLC_EGENERIC )
255 skip_space( &psz_command );
256 if( isdigit( *psz_command ) )
258 if( parse_digit( &psz_command, &r ) == VLC_EGENERIC )
261 skip_space( &psz_command );
262 if( isdigit( *psz_command ) )
264 if( parse_digit( &psz_command, &g ) == VLC_EGENERIC )
267 skip_space( &psz_command );
268 if( isdigit( *psz_command ) )
270 if( parse_digit( &psz_command, &b ) == VLC_EGENERIC )
273 p_params->fontstyle.i_font_color = (r<<16) | (g<<8) | (b<<0);
277 static int parser_SetTextSize( char *psz_command, char *psz_end,
278 commandparams_t *p_params )
281 skip_space( &psz_command );
282 if( isdigit( *psz_command ) )
284 if( parse_digit( &psz_command, &p_params->i_id ) == VLC_EGENERIC )
287 skip_space( &psz_command );
288 if( isdigit( *psz_command ) )
290 if( parse_digit( &psz_command, &p_params->fontstyle.i_font_size ) == VLC_EGENERIC )
296 static int parser_SetVisibility( char *psz_command, char *psz_end,
297 commandparams_t *p_params )
300 skip_space( &psz_command );
301 if( isdigit( *psz_command ) )
303 if( parse_digit( &psz_command, &p_params->i_id ) == VLC_EGENERIC )
306 skip_space( &psz_command );
307 if( isdigit( *psz_command ) )
310 if( parse_digit( &psz_command, &i_vis ) == VLC_EGENERIC )
312 p_params->b_visible = (i_vis == 1) ? true : false;
317 /*****************************************************************************
318 * Command unparser functions
319 *****************************************************************************/
321 static int unparse_default( const commandparams_t *p_results,
324 VLC_UNUSED(p_results);
325 VLC_UNUSED(p_output);
329 static int unparse_GenImage( const commandparams_t *p_results,
332 int ret = BufferPrintf( p_output, " %d", p_results->i_id );
333 if( ret != VLC_SUCCESS )
339 static int unparse_GetAlpha( const commandparams_t *p_results,
342 int ret = BufferPrintf( p_output, " %d", p_results->i_alpha );
343 if( ret != VLC_SUCCESS )
349 static int unparse_GetPosition( const commandparams_t *p_results,
352 int ret = BufferPrintf( p_output, " %d", p_results->i_x );
353 if( ret != VLC_SUCCESS )
356 ret = BufferPrintf( p_output, " %d", p_results->i_y );
357 if( ret != VLC_SUCCESS )
363 static int unparse_GetTextAlpha( const commandparams_t *p_results,
366 int ret = BufferPrintf( p_output, " %d", p_results->fontstyle.i_font_alpha );
367 if( ret != VLC_SUCCESS )
373 static int unparse_GetTextColor( const commandparams_t *p_results,
376 int ret = BufferPrintf( p_output, " %d", (p_results->fontstyle.i_font_color & 0xff0000)>>16 );
377 if( ret != VLC_SUCCESS )
380 ret = BufferPrintf( p_output, " %d", (p_results->fontstyle.i_font_color & 0x00ff00)>>8 );
381 if( ret != VLC_SUCCESS )
384 ret = BufferPrintf( p_output, " %d", (p_results->fontstyle.i_font_color & 0x0000ff) );
385 if( ret != VLC_SUCCESS )
391 static int unparse_GetTextSize( const commandparams_t *p_results,
394 int ret = BufferPrintf( p_output, " %d", p_results->fontstyle.i_font_size );
395 if( ret != VLC_SUCCESS )
401 static int unparse_GetVisibility( const commandparams_t *p_results,
404 int ret = BufferPrintf( p_output, " %d", (p_results->b_visible ? 1 : 0) );
405 if( ret != VLC_SUCCESS ) {
411 /*****************************************************************************
413 *****************************************************************************/
414 static int exec_DataSharedMem( filter_t *p_filter,
415 const commandparams_t *p_params,
416 commandparams_t *p_results )
418 #if defined(HAVE_SYS_SHM_H)
419 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
420 struct shmid_ds shminfo;
424 VLC_UNUSED(p_results);
426 p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
429 msg_Err( p_filter, "Invalid overlay: %d", p_params->i_id );
433 if( shmctl( p_params->i_shmid, IPC_STAT, &shminfo ) == -1 )
435 msg_Err( p_filter, "Unable to access shared memory" );
438 i_size = shminfo.shm_segsz;
440 if( p_params->fourcc == VLC_CODEC_TEXT )
444 if( (p_params->i_height != 1) || (p_params->i_width < 1) )
447 "Invalid width and/or height. when specifing text height "
448 "must be 1 and width the number of bytes in the string, "
449 "including the null terminator" );
453 if( (size_t)p_params->i_width > i_size )
456 "Insufficient data in shared memory. need %d, got %zu",
457 p_params->i_width, i_size );
461 p_ovl->data.p_text = malloc( p_params->i_width );
462 if( p_ovl->data.p_text == NULL )
464 msg_Err( p_filter, "Unable to allocate string storage" );
468 vout_InitFormat( &p_ovl->format, VLC_CODEC_TEXT,
471 p_data = shmat( p_params->i_shmid, NULL, SHM_RDONLY );
474 msg_Err( p_filter, "Unable to attach to shared memory" );
475 free( p_ovl->data.p_text );
476 p_ovl->data.p_text = NULL;
479 memcpy( p_ovl->data.p_text, p_data, p_params->i_width );
485 uint8_t *p_data, *p_in;
486 size_t i_neededsize = 0;
488 p_ovl->data.p_pic = malloc( sizeof( picture_t ) );
489 if( p_ovl->data.p_pic == NULL )
492 vout_InitFormat( &p_ovl->format, p_params->fourcc,
493 p_params->i_width, p_params->i_height,
494 VOUT_ASPECT_FACTOR );
495 if( vout_AllocatePicture( p_filter, p_ovl->data.p_pic,
496 p_ovl->format.i_chroma, p_params->i_width,
497 p_params->i_height, p_ovl->format.i_aspect ) )
499 msg_Err( p_filter, "Unable to allocate picture" );
500 free( p_ovl->data.p_pic );
501 p_ovl->data.p_pic = NULL;
505 for( size_t i_plane = 0; i_plane < (size_t)p_ovl->data.p_pic->i_planes;
508 i_neededsize += p_ovl->data.p_pic->p[i_plane].i_visible_lines *
509 p_ovl->data.p_pic->p[i_plane].i_visible_pitch;
512 if( i_neededsize > i_size )
515 "Insufficient data in shared memory. need %zu, got %zu",
516 i_neededsize, i_size );
517 picture_Release( p_ovl->data.p_pic );
518 free( p_ovl->data.p_pic );
519 p_ovl->data.p_pic = NULL;
523 p_data = shmat( p_params->i_shmid, NULL, SHM_RDONLY );
526 msg_Err( p_filter, "Unable to attach to shared memory" );
527 picture_Release( p_ovl->data.p_pic );
528 free( p_ovl->data.p_pic );
529 p_ovl->data.p_pic = NULL;
534 for( size_t i_plane = 0; i_plane < (size_t)p_ovl->data.p_pic->i_planes;
537 uint8_t *p_out = p_ovl->data.p_pic->p[i_plane].p_pixels;
538 for( size_t i_line = 0;
539 i_line < (size_t)p_ovl->data.p_pic->p[i_plane].i_visible_lines;
542 vlc_memcpy( p_out, p_in,
543 p_ovl->data.p_pic->p[i_plane].i_visible_pitch );
544 p_out += p_ovl->data.p_pic->p[i_plane].i_pitch;
545 p_in += p_ovl->data.p_pic->p[i_plane].i_visible_pitch;
550 p_sys->b_updated = p_ovl->b_active;
554 VLC_UNUSED(p_params);
555 VLC_UNUSED(p_results);
557 msg_Err( p_filter, "system doesn't support shared memory" );
562 static int exec_DeleteImage( filter_t *p_filter,
563 const commandparams_t *p_params,
564 commandparams_t *p_results )
566 VLC_UNUSED(p_results);
567 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
568 p_sys->b_updated = true;
570 return ListRemove( &p_sys->overlays, p_params->i_id );
573 static int exec_EndAtomic( filter_t *p_filter,
574 const commandparams_t *p_params,
575 commandparams_t *p_results )
577 VLC_UNUSED(p_params);
578 VLC_UNUSED(p_results);
579 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
580 QueueTransfer( &p_sys->pending, &p_sys->atomic );
581 p_sys->b_atomic = false;
585 static int exec_GenImage( filter_t *p_filter,
586 const commandparams_t *p_params,
587 commandparams_t *p_results )
589 VLC_UNUSED(p_params);
590 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
592 overlay_t *p_ovl = OverlayCreate();
596 ssize_t i_idx = ListAdd( &p_sys->overlays, p_ovl );
600 p_results->i_id = i_idx;
604 static int exec_GetAlpha( filter_t *p_filter,
605 const commandparams_t *p_params,
606 commandparams_t *p_results )
608 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
609 overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
613 p_results->i_alpha = p_ovl->i_alpha;
617 static int exec_GetPosition( filter_t *p_filter,
618 const commandparams_t *p_params,
619 commandparams_t *p_results )
621 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
622 overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
626 p_results->i_x = p_ovl->i_x;
627 p_results->i_y = p_ovl->i_y;
631 static int exec_GetTextAlpha( filter_t *p_filter,
632 const commandparams_t *p_params,
633 commandparams_t *p_results )
635 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
636 overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
640 p_results->fontstyle.i_font_alpha = p_ovl->p_fontstyle->i_font_alpha;
644 static int exec_GetTextColor( filter_t *p_filter,
645 const commandparams_t *p_params,
646 commandparams_t *p_results )
648 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
649 overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
653 p_results->fontstyle.i_font_color = p_ovl->p_fontstyle->i_font_color;
657 static int exec_GetTextSize( filter_t *p_filter,
658 const commandparams_t *p_params,
659 commandparams_t *p_results )
661 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
662 overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
666 p_results->fontstyle.i_font_size = p_ovl->p_fontstyle->i_font_size;
670 static int exec_GetVisibility( filter_t *p_filter,
671 const commandparams_t *p_params,
672 commandparams_t *p_results )
674 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
676 overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
680 p_results->b_visible = ( p_ovl->b_active == true ) ? 1 : 0;
684 static int exec_SetAlpha( filter_t *p_filter,
685 const commandparams_t *p_params,
686 commandparams_t *p_results )
688 VLC_UNUSED(p_results);
689 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
691 overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
695 p_ovl->i_alpha = p_params->i_alpha;
696 p_sys->b_updated = p_ovl->b_active;
700 static int exec_SetPosition( filter_t *p_filter,
701 const commandparams_t *p_params,
702 commandparams_t *p_results )
704 VLC_UNUSED(p_results);
705 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
707 overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
711 p_ovl->i_x = p_params->i_x;
712 p_ovl->i_y = p_params->i_y;
714 p_sys->b_updated = p_ovl->b_active;
718 static int exec_SetTextAlpha( filter_t *p_filter,
719 const commandparams_t *p_params,
720 commandparams_t *p_results )
722 VLC_UNUSED(p_results);
723 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
725 overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
729 p_ovl->p_fontstyle->i_font_alpha = p_params->fontstyle.i_font_alpha;
730 p_sys->b_updated = p_ovl->b_active;
734 static int exec_SetTextColor( filter_t *p_filter,
735 const commandparams_t *p_params,
736 commandparams_t *p_results )
738 VLC_UNUSED(p_results);
739 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
741 overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
745 p_ovl->p_fontstyle->i_font_color = p_params->fontstyle.i_font_color;
746 p_sys->b_updated = p_ovl->b_active;
750 static int exec_SetTextSize( filter_t *p_filter,
751 const commandparams_t *p_params,
752 commandparams_t *p_results )
754 VLC_UNUSED(p_results);
755 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
757 overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
761 p_ovl->p_fontstyle->i_font_size = p_params->fontstyle.i_font_size;
762 p_sys->b_updated = p_ovl->b_active;
766 static int exec_SetVisibility( filter_t *p_filter,
767 const commandparams_t *p_params,
768 commandparams_t *p_results )
770 VLC_UNUSED(p_results);
771 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
773 overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
777 p_ovl->b_active = p_params->b_visible;// ? false : true;
778 p_sys->b_updated = true;
782 static int exec_StartAtomic( filter_t *p_filter,
783 const commandparams_t *p_params,
784 commandparams_t *p_results )
786 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
787 VLC_UNUSED(p_params);
788 VLC_UNUSED(p_results);
790 p_sys->b_atomic = true;
794 /*****************************************************************************
796 *****************************************************************************/
797 static const commanddesc_t p_commands[] =
799 { .psz_command = "DataSharedMem",
801 .pf_parser = parser_DataSharedMem,
802 .pf_execute = exec_DataSharedMem,
803 .pf_unparse = unparse_default,
805 { .psz_command = "DeleteImage",
807 .pf_parser = parser_Id,
808 .pf_execute = exec_DeleteImage,
809 .pf_unparse = unparse_default,
811 { .psz_command = "EndAtomic",
813 .pf_parser = parser_None,
814 .pf_execute = exec_EndAtomic,
815 .pf_unparse = unparse_default,
817 { .psz_command = "GenImage",
819 .pf_parser = parser_None,
820 .pf_execute = exec_GenImage,
821 .pf_unparse = unparse_GenImage,
823 { .psz_command = "GetAlpha",
825 .pf_parser = parser_Id,
826 .pf_execute = exec_GetAlpha,
827 .pf_unparse = unparse_GetAlpha,
829 { .psz_command = "GetPosition",
831 .pf_parser = parser_Id,
832 .pf_execute = exec_GetPosition,
833 .pf_unparse = unparse_GetPosition,
835 { .psz_command = "GetTextAlpha",
837 .pf_parser = parser_Id,
838 .pf_execute = exec_GetTextAlpha,
839 .pf_unparse = unparse_GetTextAlpha,
841 { .psz_command = "GetTextColor",
843 .pf_parser = parser_Id,
844 .pf_execute = exec_GetTextColor,
845 .pf_unparse = unparse_GetTextColor,
847 { .psz_command = "GetTextSize",
849 .pf_parser = parser_Id,
850 .pf_execute = exec_GetTextSize,
851 .pf_unparse = unparse_GetTextSize,
853 { .psz_command = "GetVisibility",
855 .pf_parser = parser_Id,
856 .pf_execute = exec_GetVisibility,
857 .pf_unparse = unparse_GetVisibility,
859 { .psz_command = "SetAlpha",
861 .pf_parser = parser_SetAlpha,
862 .pf_execute = exec_SetAlpha,
863 .pf_unparse = unparse_default,
865 { .psz_command = "SetPosition",
867 .pf_parser = parser_SetPosition,
868 .pf_execute = exec_SetPosition,
869 .pf_unparse = unparse_default,
871 { .psz_command = "SetTextAlpha",
873 .pf_parser = parser_SetTextAlpha,
874 .pf_execute = exec_SetTextAlpha,
875 .pf_unparse = unparse_default,
877 { .psz_command = "SetTextColor",
879 .pf_parser = parser_SetTextColor,
880 .pf_execute = exec_SetTextColor,
881 .pf_unparse = unparse_default,
883 { .psz_command = "SetTextSize",
885 .pf_parser = parser_SetTextSize,
886 .pf_execute = exec_SetTextSize,
887 .pf_unparse = unparse_default,
889 { .psz_command = "SetVisibility",
891 .pf_parser = parser_SetVisibility,
892 .pf_execute = exec_SetVisibility,
893 .pf_unparse = unparse_default,
895 { .psz_command = "StartAtomic",
897 .pf_parser = parser_None,
898 .pf_execute = exec_StartAtomic,
899 .pf_unparse = unparse_default,
903 void RegisterCommand( filter_t *p_filter )
905 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
908 p_sys->i_commands = ARRAY_SIZE(p_commands);
909 p_sys->pp_commands = (commanddesc_t **) calloc( p_sys->i_commands, sizeof(commanddesc_t*) );
910 if( !p_sys->pp_commands ) return;
911 for( i_index = 0; i_index < p_sys->i_commands; i_index ++ )
913 p_sys->pp_commands[i_index] = (commanddesc_t *) malloc( sizeof(commanddesc_t) );
914 if( !p_sys->pp_commands[i_index] ) return;
915 p_sys->pp_commands[i_index]->psz_command = strdup( p_commands[i_index].psz_command );
916 p_sys->pp_commands[i_index]->b_atomic = p_commands[i_index].b_atomic;
917 p_sys->pp_commands[i_index]->pf_parser = p_commands[i_index].pf_parser;
918 p_sys->pp_commands[i_index]->pf_execute = p_commands[i_index].pf_execute;
919 p_sys->pp_commands[i_index]->pf_unparse = p_commands[i_index].pf_unparse;
922 msg_Dbg( p_filter, "%zu commands are available", p_sys->i_commands );
923 for( size_t i_index = 0; i_index < p_sys->i_commands; i_index++ )
924 msg_Dbg( p_filter, " %s", p_sys->pp_commands[i_index]->psz_command );
927 void UnregisterCommand( filter_t *p_filter )
929 filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
932 for( i_index = 0; i_index < p_sys->i_commands; i_index++ )
934 free( p_sys->pp_commands[i_index]->psz_command );
935 free( p_sys->pp_commands[i_index] );
937 free( p_sys->pp_commands );
938 p_sys->pp_commands = NULL;
939 p_sys->i_commands = 0;