mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
e040bb2dbe
Original commit message from CVS: 2005-09-02 Andy Wingo <wingo@pobox.com> * gst/gstelement.h (GstState): Renamed from GstElementState, changed to be a normal enum instead of flags. (GstStateChangeReturn): Renamed from GstElementStateReturn, names munged to be GST_STATE_CHANGE_*. (GST_STATE_CHANGE): Renamed from GST_STATE_TRANSITION, updated to work with the new state representation. (GstStateChange): New enumeration of possible state transitions. Replaces GST_STATE_FOO_TO_BAR with GST_STATE_CHANGE_FOO_TO_BAR. (GstElementClass::change_state): Pass the GstStateChange along as an argument. Helps language bindings, so they don't have to use tricky lock-needing macros like GST_STATE_CHANGE (). * scripts/update-states (file): New script. Run it on a file to update it for state naming and API changes. Updates files in place. * All files updated for the new API.
66 lines
2.7 KiB
Bash
Executable file
66 lines
2.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
if test -z "$1" -o -n "$2"; then
|
|
echo "Usage: $0 FILE" >&2
|
|
exit 1
|
|
fi
|
|
|
|
file=$1
|
|
|
|
if grep -q GstElementState $file; then
|
|
echo "$file: GstElementState->GstState"
|
|
perl -i -p -e 's/GstElementState/GstState/g' $file
|
|
fi
|
|
|
|
if grep -q GstStateReturn $file; then
|
|
echo "$file: GstStateReturn->GstStateChangeReturn"
|
|
perl -i -p -e 's/GstStateReturn/GstStateChangeReturn/g' $file
|
|
fi
|
|
|
|
if egrep 'GST_STATE_(ASYNC|SUCCESS|FAILURE|NO_PREROLL)' $file | grep -q -v 'NO_PREROLL ('; then
|
|
echo "$file: GST_STATE_SUCCESS -> GST_STATE_CHANGE_SUCCESS"
|
|
perl -i -p -e 's/GST_STATE_SUCCESS/GST_STATE_CHANGE_SUCCESS/g' $file
|
|
perl -i -p -e 's/GST_STATE_ASYNC/GST_STATE_CHANGE_ASYNC/g' $file
|
|
perl -i -p -e 's/GST_STATE_FAILURE/GST_STATE_CHANGE_FAILURE/g' $file
|
|
perl -i -p -e 's/GST_STATE_NO_PREROLL/GST_STATE_CHANGE_NO_PREROLL/g' $file
|
|
# hack around the overloaded macro in 0.9
|
|
perl -i -p -e 's/GST_STATE_CHANGE_NO_PREROLL \(/GST_STATE_NO_PREROLL (/g' $file
|
|
fi
|
|
|
|
if grep 'change_state (' $file | grep -q 'element)'; then
|
|
echo "$file: change_state (GstElement) -> change_state (GstElement, GstStateChange)"
|
|
perl -i -p -e 's/^(static.*)change_state \(GstElement \* element\);/$1change_state (GstElement * element,\n GstStateChange transition);/g' $file
|
|
perl -i -p -e 's/change_state \(GstElement \* element\)/change_state (GstElement * element, GstStateChange transition)/g' $file
|
|
perl -i -p -e 's/change_state \(element\)/change_state (element, transition)/g' $file
|
|
egrep -v '^[[:space:]]+GstState transition;' < $file > $file.tmp
|
|
mv $file.tmp $file
|
|
grep -v 'transition = ' < $file > $file.tmp
|
|
mv $file.tmp $file
|
|
fi
|
|
|
|
if grep -q GST_STATE_TRANSITION $file; then
|
|
echo "$file: CHECK ME: GST_STATE_TRANSITION (element) -> transition"
|
|
perl -i -p -e 's/GST_STATE_TRANSITION \(element\)/transition/g' $file
|
|
fi
|
|
|
|
if grep 'transition' $file | grep -q int; then
|
|
echo "$file: Removing ghetto int transitions"
|
|
egrep -v '^[[:space:]]+g?u?int.* transition;' < $file > $file.tmp
|
|
mv $file.tmp $file
|
|
fi
|
|
|
|
if egrep -q 'GST_STATE_[A-Z]+_TO_[A-Z]+' $file; then
|
|
echo "$file: GST_STATE_NULL_TO_READY -> GST_STATE_CHANGE_NULL_TO_READY"
|
|
perl -i -p -e 's/GST_STATE_([A-Z]+)_TO_([A-Z]+)/GST_STATE_CHANGE_$1_TO_$2/g' $file
|
|
fi
|
|
|
|
if grep -q GstStateReturn $file; then
|
|
echo "$file: GST_STATE_SUCCESS -> GST_STATE_CHANGE_SUCCESS"
|
|
perl -i -p -e 's/GstStateReturn/GstStateChangeReturn/g' $file
|
|
perl -i -p -e 's/GST_STATE_SUCCESS/GST_STATE_CHANGE_SUCCESS/g' $file
|
|
perl -i -p -e 's/GST_STATE_ASYNC/GST_STATE_CHANGE_ASYNC/g' $file
|
|
perl -i -p -e 's/GST_STATE_FAILURE/GST_STATE_CHANGE_FAILURE/g' $file
|
|
perl -i -p -e 's/GST_STATE_NO_PREROLL/GST_STATE_CHANGE_NO_PREROLL/g' $file
|
|
fi
|