5 if test -z "$1" -o -n "$2"; then
6 echo "Usage: $0 FILE" >&2
12 if grep -q GstElementState $file; then
13 echo "$file: GstElementState->GstState"
14 perl -i -p -e 's/GstElementState/GstState/g' $file
17 if grep -q GstStateReturn $file; then
18 echo "$file: GstStateReturn->GstStateChangeReturn"
19 perl -i -p -e 's/GstStateReturn/GstStateChangeReturn/g' $file
22 if egrep 'GST_STATE_(ASYNC|SUCCESS|FAILURE|NO_PREROLL)' $file | grep -q -v 'NO_PREROLL ('; then
23 echo "$file: GST_STATE_SUCCESS -> GST_STATE_CHANGE_SUCCESS"
24 perl -i -p -e 's/GST_STATE_SUCCESS/GST_STATE_CHANGE_SUCCESS/g' $file
25 perl -i -p -e 's/GST_STATE_ASYNC/GST_STATE_CHANGE_ASYNC/g' $file
26 perl -i -p -e 's/GST_STATE_FAILURE/GST_STATE_CHANGE_FAILURE/g' $file
27 perl -i -p -e 's/GST_STATE_NO_PREROLL/GST_STATE_CHANGE_NO_PREROLL/g' $file
28 # hack around the overloaded macro in 0.9
29 perl -i -p -e 's/GST_STATE_CHANGE_NO_PREROLL \(/GST_STATE_NO_PREROLL (/g' $file
32 if grep 'change_state (' $file | grep -q 'element)'; then
33 echo "$file: change_state (GstElement) -> change_state (GstElement, GstStateChange)"
34 perl -i -p -e 's/^(static.*)change_state \(GstElement \* element\);/$1change_state (GstElement * element,\n GstStateChange transition);/g' $file
35 perl -i -p -e 's/change_state \(GstElement \* element\)/change_state (GstElement * element, GstStateChange transition)/g' $file
36 perl -i -p -e 's/change_state \(element\)/change_state (element, transition)/g' $file
37 egrep -v '^[[:space:]]+GstState transition;' < $file > $file.tmp
39 grep -v 'transition = ' < $file > $file.tmp
43 if grep -q GST_STATE_TRANSITION $file; then
44 echo "$file: CHECK ME: GST_STATE_TRANSITION (element) -> transition"
45 perl -i -p -e 's/GST_STATE_TRANSITION \(element\)/transition/g' $file
48 if grep 'transition' $file | grep -q int; then
49 echo "$file: Removing ghetto int transitions"
50 egrep -v '^[[:space:]]+g?u?int.* transition;' < $file > $file.tmp
54 if egrep -q 'GST_STATE_[A-Z]+_TO_[A-Z]+' $file; then
55 echo "$file: GST_STATE_NULL_TO_READY -> GST_STATE_CHANGE_NULL_TO_READY"
56 perl -i -p -e 's/GST_STATE_([A-Z]+)_TO_([A-Z]+)/GST_STATE_CHANGE_$1_TO_$2/g' $file
59 if grep -q GstStateReturn $file; then
60 echo "$file: GST_STATE_SUCCESS -> GST_STATE_CHANGE_SUCCESS"
61 perl -i -p -e 's/GstStateReturn/GstStateChangeReturn/g' $file
62 perl -i -p -e 's/GST_STATE_SUCCESS/GST_STATE_CHANGE_SUCCESS/g' $file
63 perl -i -p -e 's/GST_STATE_ASYNC/GST_STATE_CHANGE_ASYNC/g' $file
64 perl -i -p -e 's/GST_STATE_FAILURE/GST_STATE_CHANGE_FAILURE/g' $file
65 perl -i -p -e 's/GST_STATE_NO_PREROLL/GST_STATE_CHANGE_NO_PREROLL/g' $file