mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 02:30:35 +00:00
04424d07ef
Original commit message from CVS: * gst/realmedia/.cvsignore: Add test to ignore. * gst/realmedia/Makefile.am: * gst/realmedia/asmrules.c: (gst_asm_node_new), (gst_asm_node_free), (gst_asm_operator_eval), (gst_asm_node_evaluate), (gst_asm_scan_new), (gst_asm_scan_free), (gst_asm_scan_string), (gst_asm_scan_number), (gst_asm_scan_identifier), (gst_asm_scan_print_token), (gst_asm_scan_next_token), (gst_asm_rule_new), (gst_asm_rule_free), (gst_asm_rule_add_property), (gst_asm_scan_parse_operand), (gst_asm_scan_parse_expression), (gst_asm_scan_parse_condition), (gst_asm_scan_parse_property), (gst_asm_scan_parse_rule), (gst_asm_rule_evaluate), (gst_asm_rule_book_new), (gst_asm_rule_book_n_rules), (gst_asm_rule_book_free), (gst_asm_rule_book_match), (main): * gst/realmedia/asmrules.h: Added asembler rule book parser and evaluator. * gst/realmedia/rtspreal.c: (rtsp_ext_real_parse_sdp), (rtsp_ext_real_stream_select), (gst_rtsp_real_plugin_init): * gst/realmedia/rtspreal.h: Keep per stream config info. Parse and evaluate asm rule books for stream selection.
115 lines
2.8 KiB
C
115 lines
2.8 KiB
C
/* GStreamer
|
|
* Copyright (C) <2007> Wim Taymans <wim.taymans@gmail.com>
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Library General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Library General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Library General Public
|
|
* License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
* Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#ifndef __GST_ASM_RULES_H__
|
|
#define __GST_ASM_RULES_H__
|
|
|
|
#include <gst/gst.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define MAX_RULEMATCHES 16
|
|
|
|
typedef struct _GstASMNode GstASMNode;
|
|
typedef struct _GstASMRule GstASMRule;
|
|
typedef struct _GstASMRuleBook GstASMRuleBook;
|
|
|
|
typedef enum {
|
|
GST_ASM_TOKEN_NONE,
|
|
GST_ASM_TOKEN_EOF,
|
|
|
|
GST_ASM_TOKEN_INT,
|
|
GST_ASM_TOKEN_FLOAT,
|
|
GST_ASM_TOKEN_IDENTIFIER,
|
|
GST_ASM_TOKEN_STRING,
|
|
|
|
GST_ASM_TOKEN_HASH,
|
|
GST_ASM_TOKEN_SEMICOLON,
|
|
GST_ASM_TOKEN_COMMA,
|
|
GST_ASM_TOKEN_DOLLAR,
|
|
|
|
GST_ASM_TOKEN_LPAREN,
|
|
GST_ASM_TOKEN_RPAREN,
|
|
|
|
GST_ASM_TOKEN_GREATER,
|
|
GST_ASM_TOKEN_LESS,
|
|
GST_ASM_TOKEN_GREATEREQUAL,
|
|
GST_ASM_TOKEN_LESSEQUAL,
|
|
GST_ASM_TOKEN_EQUAL,
|
|
GST_ASM_TOKEN_NOTEQUAL,
|
|
|
|
GST_ASM_TOKEN_AND,
|
|
GST_ASM_TOKEN_OR
|
|
} GstASMToken;
|
|
|
|
typedef enum {
|
|
GST_ASM_NODE_UNKNOWN,
|
|
GST_ASM_NODE_VARIABLE,
|
|
GST_ASM_NODE_INTEGER,
|
|
GST_ASM_NODE_FLOAT,
|
|
GST_ASM_NODE_OPERATOR
|
|
} GstASMNodeType;
|
|
|
|
typedef enum {
|
|
GST_ASM_OP_GREATER = GST_ASM_TOKEN_GREATER,
|
|
GST_ASM_OP_LESS = GST_ASM_TOKEN_LESS,
|
|
GST_ASM_OP_GREATEREQUAL = GST_ASM_TOKEN_GREATEREQUAL,
|
|
GST_ASM_OP_LESSEQUAL = GST_ASM_TOKEN_LESSEQUAL,
|
|
GST_ASM_OP_EQUAL = GST_ASM_TOKEN_EQUAL,
|
|
GST_ASM_OP_NOTEQUAL = GST_ASM_TOKEN_NOTEQUAL,
|
|
|
|
GST_ASM_OP_AND = GST_ASM_TOKEN_AND,
|
|
GST_ASM_OP_OR = GST_ASM_TOKEN_OR
|
|
} GstASMOp;
|
|
|
|
struct _GstASMNode {
|
|
GstASMNodeType type;
|
|
|
|
union {
|
|
gchar *varname;
|
|
gint intval;
|
|
gfloat floatval;
|
|
GstASMOp optype;
|
|
} data;
|
|
|
|
GstASMNode *left;
|
|
GstASMNode *right;
|
|
};
|
|
|
|
struct _GstASMRule {
|
|
GstASMNode *root;
|
|
GHashTable *props;
|
|
};
|
|
|
|
struct _GstASMRuleBook {
|
|
const gchar *rulebook;
|
|
|
|
guint n_rules;
|
|
GList *rules;
|
|
};
|
|
|
|
G_END_DECLS
|
|
|
|
GstASMRuleBook* gst_asm_rule_book_new (const gchar *rulebook);
|
|
void gst_asm_rule_book_free (GstASMRuleBook *book);
|
|
|
|
gint gst_asm_rule_book_match (GstASMRuleBook *book, GHashTable *vars,
|
|
gint *rulematches);
|
|
|
|
#endif /* __GST_ASM_RULES_H__ */
|