Line data Source code
1 : /*
2 : * GPAC - Multimedia Framework C SDK
3 : *
4 : * Authors: Deniz Ugur, Romain Bouqueau, Sohaib Larbi
5 : * Copyright (c) Motion Spell
6 : * All rights reserved
7 : *
8 : * This file is part of the GPAC/GStreamer wrapper
9 : *
10 : * This GPAC/GStreamer wrapper is free software; you can redistribute it
11 : * and/or modify it under the terms of the GNU Affero General Public License
12 : * as published by the Free Software Foundation; either version 3, or (at
13 : * your option) any later version.
14 : *
15 : * This GPAC/GStreamer wrapper is distributed in the hope that it will be
16 : * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
17 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 : * GNU Affero General Public License for more details.
19 : *
20 : * You should have received a copy of the GNU Affero General Public
21 : * License along with this library; see the file LICENSE. If not, write to
22 : * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 : *
24 : */
25 :
26 : #include "common.h"
27 : #include "gpacmessages.h"
28 : #include "lib/pid.h"
29 :
30 : #define DEFAULT_HANDLER_SIGNATURE(prop_nickname) \
31 : gboolean prop_nickname##_default_handler(GPAC_PID_PROP_IMPL_ARGS_NO_ELEMENT)
32 :
33 : // Optional if not explicitly marked as mandatory
34 : #define DEFAULT_HANDLER(prop_nickname) \
35 : gboolean prop_nickname##_default_handler(GPAC_PID_PROP_IMPL_ARGS_NO_ELEMENT) \
36 : { \
37 : return TRUE; \
38 : }
39 :
40 : #define DEFAULT_HANDLER_MANDATORY(prop_nickname, prop_4cc) \
41 : gboolean prop_nickname##_default_handler(GPAC_PID_PROP_IMPL_ARGS_NO_ELEMENT) \
42 : { \
43 : SKIP_IF_SET(prop_4cc) \
44 : GST_WARNING("Could not determine the value for %s", #prop_nickname); \
45 : return FALSE; \
46 : }
47 :
48 : //
49 : // Default Default handlers
50 : //
51 0 : DEFAULT_HANDLER_MANDATORY(stream_type, GF_PROP_PID_STREAM_TYPE)
52 0 : DEFAULT_HANDLER_MANDATORY(codec_id, GF_PROP_PID_CODECID)
53 0 : DEFAULT_HANDLER_MANDATORY(unframed, GF_PROP_PID_UNFRAMED)
54 :
55 : // Following are optional
56 0 : DEFAULT_HANDLER(width)
57 0 : DEFAULT_HANDLER(height)
58 2 : DEFAULT_HANDLER(bitrate)
59 5 : DEFAULT_HANDLER(max_bitrate)
60 0 : DEFAULT_HANDLER(decoder_config)
61 0 : DEFAULT_HANDLER(duration)
62 0 : DEFAULT_HANDLER(fps)
63 0 : DEFAULT_HANDLER(timescale)
64 0 : DEFAULT_HANDLER(sample_rate)
65 0 : DEFAULT_HANDLER(num_channels)
66 21 : DEFAULT_HANDLER(language)
67 21 : DEFAULT_HANDLER(dbsize)
68 :
69 : //
70 : // Default handlers
71 : //
72 21 : DEFAULT_HANDLER_SIGNATURE(id)
73 : {
74 : // Check if we have already set the id
75 21 : SKIP_IF_SET(GF_PROP_PID_ID);
76 :
77 : // Set a new monotonic id
78 21 : SET_PROP(GF_PROP_PID_ID, PROP_UINT(priv->id));
79 21 : return TRUE;
80 : }
|