]> git.sesse.net Git - vlc/blob - test/native/profiles.c
Use var_InheritString for --decklink-video-connection.
[vlc] / test / native / profiles.c
1 /*****************************************************************************
2  * profiles.c: Test streaming profiles
3  *****************************************************************************
4  * Copyright (C) 2006 The VideoLAN project
5  * $Id$
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20  *****************************************************************************/
21
22 #include "../pyunit.h"
23 #ifdef HAVE_CONFIG_H
24 # include "config.h"
25 #endif
26
27 #include <vlc/vlc.h>
28 #include <vlc_streaming.h>
29
30 #define STDCHAIN1 "#std{access=udp,url=12.42.12.42,mux=ts}"
31 //#define GUICHAIN1
32 static void BuildStdChain1( sout_chain_t *p_chain )
33 {
34     streaming_ChainAddStd( p_chain, "udp", "ts", "12.42.12.42" );
35 }
36
37 #define TRACHAIN1 "#transcode{vcodec=mpgv,vb=1024,scale=1.0,acodec=mp3,ab=128,channels=2}:std{mux=mp4,access=file,url=/dev/null}"
38 static void BuildTranscodeChain1( sout_chain_t *p_chain )
39 {
40     streaming_ChainAddTranscode( p_chain, "mpgv", "mp3", NULL, 1024, 1.0,
41                                  128, 2, NULL );
42     streaming_ChainAddStd( p_chain, "file", "mp4", "/dev/null" );
43 }
44
45 static void BuildInvalid1( sout_chain_t *p_chain )
46 {
47     streaming_ChainAddStd( p_chain, "file", "mp4", "/dev/null" );
48     streaming_ChainAddStd( p_chain, "file", "mp4", "/dev/null" );
49 }
50
51 PyObject *chains_test( PyObject *self, PyObject *args )
52 {
53     sout_chain_t *p_chain = streaming_ChainNew();
54     sout_duplicate_t *p_dup;
55     ASSERT( p_chain->i_modules == 0, "unclean chain" );
56     ASSERT( p_chain->i_options == 0, "unclean chain" );
57     ASSERT( p_chain->pp_modules == NULL, "unclean chain" );
58     ASSERT( p_chain->ppsz_options == NULL, "unclean chain" );
59
60     /* Check duplicate */
61     p_dup = streaming_ChainAddDup( p_chain );
62     ASSERT( p_chain->i_modules == 1, "not 1 module" );
63     ASSERT( p_dup->i_children == 0, "dup has children" );
64     streaming_DupAddChild( p_dup );
65     ASSERT( p_dup->i_children == 1, "not 1 child" );
66     ASSERT( p_dup->pp_children[0]->i_modules == 0, "unclean child chain");
67     streaming_DupAddChild( p_dup );
68     ASSERT( p_dup->i_children == 2, "not 2 children" );
69
70     Py_INCREF( Py_None );
71     return Py_None;
72 }
73
74 PyObject *gui_chains_test( PyObject *self, PyObject *args )
75 {
76     Py_INCREF( Py_None);
77     return Py_None;
78 }
79
80 PyObject *psz_chains_test( PyObject *self, PyObject *args )
81 {
82     sout_chain_t *p_chain = streaming_ChainNew();
83     sout_module_t *p_module;
84     char *psz_output;
85     printf( "\n" );
86
87     BuildStdChain1( p_chain );
88     psz_output = streaming_ChainToPsz( p_chain );
89     printf( "STD1: %s\n", psz_output );
90     ASSERT( !strcmp( psz_output, STDCHAIN1 ), "wrong output for STD1" )
91     ASSERT( p_chain->i_modules == 1, "wrong number of modules" );
92     p_module = p_chain->pp_modules[0];
93     ASSERT( p_module->i_type ==  SOUT_MOD_STD, "wrong type of module" );
94
95
96     Py_INCREF( Py_None);
97     return Py_None;
98 }