]> git.sesse.net Git - vlc/blob - test/native/profiles.c
svn ids and stuff
[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 #include <vlc/vlc.h>
24 #include <vlc_streaming.h>
25
26 #define STDCHAIN1 "#std{access=udp,url=12.42.12.42,mux=ts}"
27 //#define GUICHAIN1
28 static void BuildStdChain1( sout_chain_t *p_chain )
29 {
30     streaming_ChainAddStd( p_chain, "udp", "ts", "12.42.12.42" );
31 }
32
33 #define TRACHAIN1 "#transcode{vcodec=mpgv,vb=1024,scale=1.0,acodec=mp3,ab=128,channels=2}:std{mux=mp4,access=file,url=/dev/null}"
34 static void BuildTranscodeChain1( sout_chain_t *p_chain )
35 {
36     streaming_ChainAddTranscode( p_chain, "mpgv", "mp3", NULL, 1024, 1.0,
37                                  128, 2, NULL );
38     streaming_ChainAddStd( p_chain, "file", "mp4", "/dev/null" );
39 }
40
41 static void BuildInvalid1( sout_chain_t *p_chain )
42 {
43     streaming_ChainAddStd( p_chain, "file", "mp4", "/dev/null" );
44     streaming_ChainAddStd( p_chain, "file", "mp4", "/dev/null" );
45 }
46
47 PyObject *chains_test( PyObject *self, PyObject *args )
48 {
49     sout_chain_t *p_chain = streaming_ChainNew();
50     sout_duplicate_t *p_dup;
51     ASSERT( p_chain->i_modules == 0, "unclean chain" );
52     ASSERT( p_chain->i_options == 0, "unclean chain" );
53     ASSERT( p_chain->pp_modules == NULL, "unclean chain" );
54     ASSERT( p_chain->ppsz_options == NULL, "unclean chain" );
55
56     /* Check duplicate */
57     p_dup = streaming_ChainAddDup( p_chain );
58     ASSERT( p_chain->i_modules == 1, "not 1 module" );
59     ASSERT( p_dup->i_children == 0, "dup has children" );
60     streaming_DupAddChild( p_dup );
61     ASSERT( p_dup->i_children == 1, "not 1 child" );
62     ASSERT( p_dup->pp_children[0]->i_modules == 0, "unclean child chain");
63     streaming_DupAddChild( p_dup );
64     ASSERT( p_dup->i_children == 2, "not 2 children" );
65
66     Py_INCREF( Py_None );
67     return Py_None;
68 }
69
70 PyObject *gui_chains_test( PyObject *self, PyObject *args )
71 {
72     Py_INCREF( Py_None);
73     return Py_None;
74 }
75
76 PyObject *psz_chains_test( PyObject *self, PyObject *args )
77 {
78     sout_chain_t *p_chain = streaming_ChainNew();
79     sout_module_t *p_module;
80     char *psz_output;
81     printf( "\n" );
82
83     BuildStdChain1( p_chain );
84     psz_output = streaming_ChainToPsz( p_chain );
85     printf( "STD1: %s\n", psz_output );
86     ASSERT( !strcmp( psz_output, STDCHAIN1 ), "wrong output for STD1" )
87     ASSERT( p_chain->i_modules == 1, "wrong number of modules" );
88     p_module = p_chain->pp_modules[0];
89     ASSERT( p_module->i_type ==  SOUT_MOD_STD, "wrong type of module" );
90
91
92     Py_INCREF( Py_None);
93     return Py_None;
94 }